@openclaw/whatsapp 2026.5.28 → 2026.5.31-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-Z0fYaWrx.js → access-control-C53zKYSN.js} +1 -1
- package/dist/{accounts-BMGM1RtF.js → accounts-DgViSyJx.js} +1 -0
- package/dist/{action-runtime-BdhkGtaP.js → action-runtime-Cyp5GNIT.js} +2 -2
- package/dist/action-runtime-api.js +1 -1
- package/dist/action-runtime.runtime.js +1 -1
- package/dist/api.js +9 -9
- package/dist/{approval-handler.runtime-C25wPeBf.js → approval-handler.runtime-BVmOu6x1.js} +1 -2
- package/dist/{auth-store-BrKb0mwT.js → auth-store-CZ22aNcV.js} +4 -2
- package/dist/{channel-D3y4A5Dd.js → channel-DA2BAIo5.js} +17 -64
- package/dist/channel-config-api.js +1 -1
- package/dist/channel-plugin-api.js +1 -1
- package/dist/{channel-react-action-Cd2qkLqp.js → channel-react-action-zvbaCnGe.js} +3 -3
- package/dist/{channel.runtime-C228XUjs.js → channel.runtime-Q1LZDB5s.js} +4 -4
- package/dist/{channel.setup-BJQyTUUP.js → channel.setup-DHXOo4h5.js} +2 -3
- package/dist/{config-schema-CsNDlDpL.js → config-schema-CROZuhT-.js} +16 -0
- package/dist/{connection-controller-mpPGmqGq.js → connection-controller-Bnm4INld.js} +2 -2
- package/dist/contract-api.js +1 -1
- package/dist/light-runtime-api.js +1 -1
- package/dist/{login-CE4UYnyO.js → login-2fuBM7Je.js} +4 -4
- package/dist/{login-qr-LBvhEes5.js → login-qr-B1o7GFy8.js} +10 -6
- package/dist/login-qr-runtime.js +1 -1
- package/dist/{monitor-Ccph7Y8M.js → monitor-BVRq04Dt.js} +36 -18
- package/dist/runtime-api.js +7 -7
- package/dist/{send-C4LG-Cl6.js → send-DSlVXKL_.js} +53 -41
- package/dist/{send-api-C66vkRl9.js → send-api-Bjn-h80j.js} +3 -2
- package/dist/{session-D8UW2Vbn.js → session-DyGWNClj.js} +1 -1
- package/dist/{setup-core-DpfT4K-2.js → setup-core-OvPMaAsx.js} +4 -4
- package/dist/{setup-finalize-CFnxX7la.js → setup-finalize-Dk23pfKc.js} +3 -3
- package/dist/setup-plugin-api.js +1 -1
- package/dist/{setup-surface-DRsmp0ZS.js → setup-surface-F-jVrH8u.js} +3 -3
- package/node_modules/@audio/decode-aac/LICENSE +9 -0
- package/node_modules/@audio/decode-aac/README.md +60 -0
- package/node_modules/@audio/decode-aac/decode-aac.d.ts +16 -0
- package/node_modules/@audio/decode-aac/decode-aac.js +391 -0
- package/node_modules/@audio/decode-aac/package.json +47 -0
- package/node_modules/@audio/decode-aac/src/aac.wasm.cjs +0 -0
- package/node_modules/@audio/decode-aiff/LICENSE +21 -0
- package/node_modules/@audio/decode-aiff/README.md +53 -0
- package/node_modules/@audio/decode-aiff/decode-aiff.d.ts +16 -0
- package/node_modules/@audio/decode-aiff/decode-aiff.js +583 -0
- package/node_modules/@audio/decode-aiff/package.json +42 -0
- package/node_modules/@audio/decode-amr/LICENSE +191 -0
- package/node_modules/@audio/decode-amr/README.md +65 -0
- package/node_modules/@audio/decode-amr/decode-amr.d.ts +16 -0
- package/node_modules/@audio/decode-amr/decode-amr.js +159 -0
- package/node_modules/@audio/decode-amr/package.json +48 -0
- package/node_modules/@audio/decode-amr/src/amr.wasm.cjs +0 -0
- package/node_modules/@audio/decode-caf/LICENSE +21 -0
- package/node_modules/@audio/decode-caf/README.md +55 -0
- package/node_modules/@audio/decode-caf/decode-caf.d.ts +16 -0
- package/node_modules/@audio/decode-caf/decode-caf.js +190 -0
- package/node_modules/@audio/decode-caf/package.json +43 -0
- package/node_modules/{audio-buffer → @audio/decode-flac}/LICENSE +5 -2
- package/node_modules/@audio/decode-flac/README.md +23 -0
- package/node_modules/@audio/decode-flac/decode-flac.d.ts +16 -0
- package/node_modules/@audio/decode-flac/decode-flac.js +2994 -0
- package/node_modules/@audio/decode-flac/meta.js +115 -0
- package/node_modules/@audio/decode-flac/package.json +49 -0
- package/node_modules/@audio/decode-mp3/LICENSE +25 -0
- package/node_modules/@audio/decode-mp3/README.md +23 -0
- package/node_modules/@audio/decode-mp3/decode-mp3.d.ts +16 -0
- package/node_modules/@audio/decode-mp3/decode-mp3.js +868 -0
- package/node_modules/@audio/decode-mp3/meta.js +143 -0
- package/node_modules/@audio/decode-mp3/package.json +50 -0
- package/node_modules/@audio/decode-opus/LICENSE +25 -0
- package/node_modules/@audio/decode-opus/README.md +23 -0
- package/node_modules/@audio/decode-opus/decode-opus.d.ts +16 -0
- package/node_modules/@audio/decode-opus/decode-opus.js +3179 -0
- package/node_modules/@audio/decode-opus/package.json +47 -0
- package/node_modules/@audio/decode-qoa/LICENSE +25 -0
- package/node_modules/@audio/decode-qoa/README.md +21 -0
- package/node_modules/@audio/decode-qoa/decode-qoa.d.ts +16 -0
- package/node_modules/@audio/decode-qoa/decode-qoa.js +278 -0
- package/node_modules/@audio/decode-qoa/package.json +46 -0
- package/node_modules/@audio/decode-vorbis/LICENSE +25 -0
- package/node_modules/@audio/decode-vorbis/README.md +23 -0
- package/node_modules/@audio/decode-vorbis/decode-vorbis.d.ts +16 -0
- package/node_modules/@audio/decode-vorbis/decode-vorbis.js +2984 -0
- package/node_modules/@audio/decode-vorbis/package.json +47 -0
- package/node_modules/@audio/decode-wav/decode-wav.js +104 -0
- package/node_modules/@audio/decode-wav/meta.js +114 -0
- package/node_modules/@audio/decode-wav/package.json +27 -0
- package/node_modules/@audio/decode-webm/LICENSE +21 -0
- package/node_modules/@audio/decode-webm/README.md +57 -0
- package/node_modules/@audio/decode-webm/decode-webm.d.ts +16 -0
- package/node_modules/@audio/decode-webm/decode-webm.js +3964 -0
- package/node_modules/@audio/decode-webm/package.json +51 -0
- package/node_modules/@audio/decode-wma/LICENSE +12 -0
- package/node_modules/@audio/decode-wma/README.md +76 -0
- package/node_modules/@audio/decode-wma/decode-wma.d.ts +33 -0
- package/node_modules/@audio/decode-wma/decode-wma.js +525 -0
- package/node_modules/@audio/decode-wma/package.json +47 -0
- package/node_modules/@audio/decode-wma/src/wma.wasm.cjs +0 -0
- package/node_modules/audio-decode/.claude/settings.json +204 -0
- package/node_modules/audio-decode/.github/workflows/test.js.yml +11 -20
- package/node_modules/audio-decode/.gitmodules +9 -0
- package/node_modules/audio-decode/audio-decode.d.ts +48 -10
- package/node_modules/audio-decode/audio-decode.js +193 -77
- package/node_modules/audio-decode/meta.js +11 -0
- package/node_modules/audio-decode/package.json +49 -21
- package/node_modules/audio-decode/readme.md +129 -29
- package/node_modules/audio-decode/stream.d.ts +15 -0
- package/node_modules/audio-decode/stream.js +1 -0
- package/node_modules/audio-decode/test.html +29 -10
- package/node_modules/lru-cache/dist/commonjs/browser/index.d.ts +2 -2
- package/node_modules/lru-cache/dist/commonjs/browser/index.d.ts.map +1 -1
- package/node_modules/lru-cache/dist/commonjs/browser/index.js.map +1 -1
- package/node_modules/lru-cache/dist/commonjs/browser/index.min.js.map +1 -1
- package/node_modules/lru-cache/dist/commonjs/index.d.ts +2 -2
- package/node_modules/lru-cache/dist/commonjs/index.d.ts.map +1 -1
- package/node_modules/lru-cache/dist/commonjs/index.js.map +1 -1
- package/node_modules/lru-cache/dist/commonjs/index.min.js.map +1 -1
- package/node_modules/lru-cache/dist/commonjs/node/index.d.ts +2 -2
- package/node_modules/lru-cache/dist/commonjs/node/index.d.ts.map +1 -1
- package/node_modules/lru-cache/dist/commonjs/node/index.js.map +1 -1
- package/node_modules/lru-cache/dist/commonjs/node/index.min.js.map +1 -1
- package/node_modules/lru-cache/dist/esm/browser/index.d.ts +2 -2
- package/node_modules/lru-cache/dist/esm/browser/index.d.ts.map +1 -1
- package/node_modules/lru-cache/dist/esm/browser/index.js.map +1 -1
- package/node_modules/lru-cache/dist/esm/browser/index.min.js.map +1 -1
- package/node_modules/lru-cache/dist/esm/index.d.ts +2 -2
- package/node_modules/lru-cache/dist/esm/index.d.ts.map +1 -1
- package/node_modules/lru-cache/dist/esm/index.js.map +1 -1
- package/node_modules/lru-cache/dist/esm/index.min.js.map +1 -1
- package/node_modules/lru-cache/dist/esm/node/index.d.ts +2 -2
- package/node_modules/lru-cache/dist/esm/node/index.d.ts.map +1 -1
- package/node_modules/lru-cache/dist/esm/node/index.js.map +1 -1
- package/node_modules/lru-cache/dist/esm/node/index.min.js.map +1 -1
- package/node_modules/lru-cache/package.json +1 -1
- package/node_modules/typebox/build/type/script/mapping.d.mts +5 -2
- package/node_modules/typebox/build/type/script/mapping.mjs +15 -8
- package/node_modules/typebox/build/type/script/parser.d.mts +3 -1
- package/node_modules/typebox/build/type/script/parser.mjs +2 -1
- package/node_modules/typebox/package.json +29 -29
- package/npm-shrinkwrap.json +156 -39
- package/openclaw.plugin.json +76 -0
- package/package.json +6 -6
- package/node_modules/audio-buffer/.eslintrc.json +0 -44
- package/node_modules/audio-buffer/.github/workflows/node.js.yml +0 -31
- package/node_modules/audio-buffer/.travis.yml +0 -7
- package/node_modules/audio-buffer/index.js +0 -76
- package/node_modules/audio-buffer/package.json +0 -37
- package/node_modules/audio-buffer/readme.md +0 -56
- package/node_modules/audio-decode/.eslintrc.json +0 -43
- package/node_modules/audio-decode/.travis.yml +0 -13
- package/node_modules/audio-decode/tea.yaml +0 -6
- package/node_modules/audio-decode/test-case.js +0 -11
- package/node_modules/audio-decode/test.js +0 -107
- package/node_modules/node-wav/README.md +0 -35
- package/node_modules/node-wav/file.wav +0 -0
- package/node_modules/node-wav/index.js +0 -291
- package/node_modules/node-wav/package.json +0 -29
- package/node_modules/node-wav/tests/file1.wav +0 -0
- package/node_modules/node-wav/tests/test.js +0 -66
- package/node_modules/node-wav/x.js +0 -12
- package/node_modules/node-wav/x.json +0 -86702
- package/node_modules/node-wav/x.js~ +0 -13
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as resolveWhatsAppAccount } from "./accounts-
|
|
1
|
+
import { a as resolveWhatsAppAccount } from "./accounts-DgViSyJx.js";
|
|
2
2
|
import { l as isSelfChatMode, n as normalizeE164 } from "./text-runtime-Dk37KYHj.js";
|
|
3
3
|
import { a as getSelfIdentity, o as getSenderIdentity } from "./identity-xoLLdqEv.js";
|
|
4
4
|
import { defaultRuntime } from "openclaw/plugin-sdk/runtime-env";
|
|
@@ -86,6 +86,7 @@ function resolveWhatsAppAccount(params) {
|
|
|
86
86
|
allowFrom: merged.allowFrom,
|
|
87
87
|
groupAllowFrom: merged.groupAllowFrom,
|
|
88
88
|
groupPolicy: merged.groupPolicy,
|
|
89
|
+
mentionPatterns: merged.mentionPatterns,
|
|
89
90
|
historyLimit: merged.historyLimit,
|
|
90
91
|
textChunkLimit: merged.textChunkLimit,
|
|
91
92
|
chunkMode: merged.chunkMode,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { a as resolveWhatsAppAccount } from "./accounts-
|
|
1
|
+
import { a as resolveWhatsAppAccount } from "./accounts-DgViSyJx.js";
|
|
2
2
|
import { t as resolveWhatsAppOutboundTarget } from "./resolve-outbound-target-CcdugbDf.js";
|
|
3
|
-
import { g as resolveWhatsAppReactionLevel, r as sendReactionWhatsApp } from "./send-
|
|
3
|
+
import { g as resolveWhatsAppReactionLevel, r as sendReactionWhatsApp } from "./send-DSlVXKL_.js";
|
|
4
4
|
import { ToolAuthorizationError, createActionGate, jsonResult, readReactionParams, readStringParam } from "openclaw/plugin-sdk/channel-actions";
|
|
5
5
|
//#region extensions/whatsapp/src/action-runtime-target-auth.ts
|
|
6
6
|
function resolveAuthorizedWhatsAppOutboundTarget(params) {
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as handleWhatsAppAction } from "./action-runtime-
|
|
1
|
+
import { t as handleWhatsAppAction } from "./action-runtime-Cyp5GNIT.js";
|
|
2
2
|
export { handleWhatsAppAction };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as handleWhatsAppAction } from "./action-runtime-
|
|
1
|
+
import { t as handleWhatsAppAction } from "./action-runtime-Cyp5GNIT.js";
|
|
2
2
|
export { handleWhatsAppAction };
|
package/dist/api.js
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import { r as resolveDefaultWhatsAppAccountId, t as listAccountIds } from "./account-ids-CB5SOWjc.js";
|
|
2
|
-
import { a as resolveWhatsAppAccount, i as listWhatsAppAuthDirs, n as hasAnyWhatsAppAuth, o as resolveWhatsAppAuthDir, r as listEnabledWhatsAppAccounts, s as resolveWhatsAppMediaMaxBytes, t as DEFAULT_WHATSAPP_MEDIA_MAX_MB } from "./accounts-
|
|
2
|
+
import { a as resolveWhatsAppAccount, i as listWhatsAppAuthDirs, n as hasAnyWhatsAppAuth, o as resolveWhatsAppAuthDir, r as listEnabledWhatsAppAccounts, s as resolveWhatsAppMediaMaxBytes, t as DEFAULT_WHATSAPP_MEDIA_MAX_MB } from "./accounts-DgViSyJx.js";
|
|
3
3
|
import { a as normalizeWhatsAppAllowFromEntries, c as normalizeWhatsAppTarget, i as looksLikeWhatsAppTargetId, r as isWhatsAppUserTarget, s as normalizeWhatsAppMessagingTarget, t as isWhatsAppGroupJid } from "./normalize-target-bVWjgftN.js";
|
|
4
4
|
import { t as resolveWhatsAppOutboundTarget } from "./resolve-outbound-target-CcdugbDf.js";
|
|
5
|
-
import "./send-
|
|
5
|
+
import "./send-DSlVXKL_.js";
|
|
6
6
|
import { c as assertWebChannel, d as markdownToWhatsApp, f as resolveJidToE164, l as isSelfChatMode, m as toWhatsappJidWithLid, n as normalizeE164, p as toWhatsappJid, r as resolveUserPath, u as jidToE164 } from "./text-runtime-Dk37KYHj.js";
|
|
7
|
-
import { n as WHATSAPP_LEGACY_OUTBOUND_SEND_DEP_KEYS, t as whatsappPlugin } from "./channel-
|
|
7
|
+
import { n as WHATSAPP_LEGACY_OUTBOUND_SEND_DEP_KEYS, t as whatsappPlugin } from "./channel-DA2BAIo5.js";
|
|
8
8
|
import { t as whatsappCommandPolicy } from "./command-policy-BIOSHySD.js";
|
|
9
|
-
import { a as resolveWhatsAppGroupRequireMention, o as resolveWhatsAppGroupToolPolicy, s as resolveWhatsAppGroupIntroHint } from "./setup-core-
|
|
10
|
-
import "./config-schema-
|
|
11
|
-
import { t as whatsappSetupPlugin } from "./channel.setup-
|
|
9
|
+
import { a as resolveWhatsAppGroupRequireMention, o as resolveWhatsAppGroupToolPolicy, s as resolveWhatsAppGroupIntroHint } from "./setup-core-OvPMaAsx.js";
|
|
10
|
+
import "./config-schema-CROZuhT-.js";
|
|
11
|
+
import { t as whatsappSetupPlugin } from "./channel.setup-DHXOo4h5.js";
|
|
12
12
|
import { t as DEFAULT_WEB_MEDIA_BYTES } from "./constants-HU41RHGI.js";
|
|
13
13
|
import { n as listWhatsAppDirectoryGroupsFromConfig, r as listWhatsAppDirectoryPeersFromConfig } from "./directory-config-Dijefxc3.js";
|
|
14
|
-
import { n as testing } from "./access-control-
|
|
15
|
-
import { m as extractText, t as createWebSendApi } from "./send-api-
|
|
16
|
-
import { r as waitForWaConnection, t as createWaSocket } from "./session-
|
|
14
|
+
import { n as testing } from "./access-control-C53zKYSN.js";
|
|
15
|
+
import { m as extractText, t as createWebSendApi } from "./send-api-Bjn-h80j.js";
|
|
16
|
+
import { r as waitForWaConnection, t as createWaSocket } from "./session-DyGWNClj.js";
|
|
17
17
|
import "openclaw/plugin-sdk/channel-actions";
|
|
18
18
|
import "openclaw/plugin-sdk/account-resolution";
|
|
19
19
|
import "openclaw/plugin-sdk/core";
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import { s as normalizeWhatsAppMessagingTarget } from "./normalize-target-bVWjgftN.js";
|
|
2
|
-
import { f as registerWhatsAppApprovalReactionTarget, i as sendTypingWhatsApp, p as unregisterWhatsAppApprovalReactionTarget, t as sendMessageWhatsApp } from "./send-
|
|
2
|
+
import { f as registerWhatsAppApprovalReactionTarget, i as sendTypingWhatsApp, p as unregisterWhatsAppApprovalReactionTarget, t as sendMessageWhatsApp } from "./send-DSlVXKL_.js";
|
|
3
3
|
import "./normalize-Bxwqo-bW.js";
|
|
4
4
|
import { n as getWhatsAppRuntime } from "./runtime-BfAdAEYT.js";
|
|
5
5
|
import { createSubsystemLogger } from "openclaw/plugin-sdk/runtime-env";
|
|
6
6
|
import { buildApprovalReactionPendingContent } from "openclaw/plugin-sdk/approval-reaction-runtime";
|
|
7
7
|
import { buildChannelApprovalNativeTargetKey } from "openclaw/plugin-sdk/approval-native-runtime";
|
|
8
8
|
import { buildChannelApprovalExpiredText, buildChannelApprovalResolvedText, createChannelApprovalNativeRuntimeAdapter, resolvePreparedApprovalAccountId } from "openclaw/plugin-sdk/approval-handler-runtime";
|
|
9
|
-
import "openclaw/plugin-sdk/approval-runtime";
|
|
10
9
|
//#region extensions/whatsapp/src/approval-handler.runtime.ts
|
|
11
10
|
const log = createSubsystemLogger("whatsapp/approvals");
|
|
12
11
|
function buildPendingPayload(params) {
|
|
@@ -7,8 +7,9 @@ import { resolveOAuthDir as resolveOAuthDir$1 } from "openclaw/plugin-sdk/state-
|
|
|
7
7
|
import { replaceFileAtomic } from "openclaw/plugin-sdk/security-runtime";
|
|
8
8
|
import { formatCliCommand } from "openclaw/plugin-sdk/cli-runtime";
|
|
9
9
|
import { defaultRuntime, getChildLogger, info, success } from "openclaw/plugin-sdk/runtime-env";
|
|
10
|
-
import { DEFAULT_ACCOUNT_ID } from "openclaw/plugin-sdk/routing";
|
|
11
10
|
import fs from "node:fs/promises";
|
|
11
|
+
import { DEFAULT_ACCOUNT_ID } from "openclaw/plugin-sdk/routing";
|
|
12
|
+
import { resolveTimerTimeoutMs } from "openclaw/plugin-sdk/number-runtime";
|
|
12
13
|
//#region extensions/whatsapp/src/creds-persistence.ts
|
|
13
14
|
const CREDS_FILE_MODE = 384;
|
|
14
15
|
const CREDS_SAVE_FLUSH_TIMEOUT_MS = 15e3;
|
|
@@ -52,9 +53,10 @@ function waitForCredsSaveQueue(authDir) {
|
|
|
52
53
|
return Promise.all(credsSaveQueues.values()).then(() => {});
|
|
53
54
|
}
|
|
54
55
|
async function waitForCredsSaveQueueWithTimeout(authDir, timeoutMs = CREDS_SAVE_FLUSH_TIMEOUT_MS) {
|
|
56
|
+
const boundedTimeoutMs = resolveTimerTimeoutMs(timeoutMs, CREDS_SAVE_FLUSH_TIMEOUT_MS, 0);
|
|
55
57
|
let flushTimeout;
|
|
56
58
|
return await Promise.race([waitForCredsSaveQueue(authDir).then(() => "drained"), new Promise((resolve) => {
|
|
57
|
-
flushTimeout = setTimeout(() => resolve("timed_out"),
|
|
59
|
+
flushTimeout = setTimeout(() => resolve("timed_out"), boundedTimeoutMs);
|
|
58
60
|
})]).finally(() => {
|
|
59
61
|
if (flushTimeout) clearTimeout(flushTimeout);
|
|
60
62
|
});
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { r as resolveDefaultWhatsAppAccountId, t as listAccountIds } from "./account-ids-CB5SOWjc.js";
|
|
2
|
-
import { a as resolveWhatsAppAccount } from "./accounts-
|
|
2
|
+
import { a as resolveWhatsAppAccount } from "./accounts-DgViSyJx.js";
|
|
3
3
|
import { c as normalizeWhatsAppTarget, i as looksLikeWhatsAppTargetId, n as isWhatsAppNewsletterJid, o as normalizeWhatsAppAllowFromEntry, s as normalizeWhatsAppMessagingTarget, t as isWhatsAppGroupJid } from "./normalize-target-bVWjgftN.js";
|
|
4
4
|
import { t as resolveWhatsAppOutboundTarget } from "./resolve-outbound-target-CcdugbDf.js";
|
|
5
|
-
import { a as normalizeWhatsAppOutboundPayload, g as resolveWhatsAppReactionLevel, h as whatsappApprovalAuth, i as sendTypingWhatsApp, m as getWhatsAppApprovalApprovers, n as sendPollWhatsApp, o as normalizeWhatsAppPayloadText, s as normalizeWhatsAppPayloadTextPreservingIndentation, t as sendMessageWhatsApp } from "./send-
|
|
5
|
+
import { a as normalizeWhatsAppOutboundPayload, g as resolveWhatsAppReactionLevel, h as whatsappApprovalAuth, i as sendTypingWhatsApp, m as getWhatsAppApprovalApprovers, n as sendPollWhatsApp, o as normalizeWhatsAppPayloadText, s as normalizeWhatsAppPayloadTextPreservingIndentation, t as sendMessageWhatsApp } from "./send-DSlVXKL_.js";
|
|
6
6
|
import "./normalize-Bxwqo-bW.js";
|
|
7
7
|
import { n as getWhatsAppRuntime } from "./runtime-BfAdAEYT.js";
|
|
8
8
|
import { p as toWhatsappJid } from "./text-runtime-Dk37KYHj.js";
|
|
9
9
|
import { t as createWhatsAppLoginTool } from "./agent-tools-login-BX7eHgDm.js";
|
|
10
10
|
import { i as lookupInboundMessageMetaForTarget } from "./quoted-message-CveINB35.js";
|
|
11
11
|
import { t as whatsappCommandPolicy } from "./command-policy-BIOSHySD.js";
|
|
12
|
-
import { a as resolveWhatsAppGroupRequireMention, c as resolveWhatsAppMentionStripRegexes, i as whatsappSetupWizardProxy, l as formatWhatsAppConfigAllowFromEntries, n as createWhatsAppPluginBase, o as resolveWhatsAppGroupToolPolicy, r as loadWhatsAppChannelRuntime, s as resolveWhatsAppGroupIntroHint, t as whatsappSetupAdapter } from "./setup-core-
|
|
13
|
-
import { f as readWebAuthExistsForDecision, n as WHATSAPP_AUTH_UNSTABLE_CODE } from "./auth-store-
|
|
12
|
+
import { a as resolveWhatsAppGroupRequireMention, c as resolveWhatsAppMentionStripRegexes, i as whatsappSetupWizardProxy, l as formatWhatsAppConfigAllowFromEntries, n as createWhatsAppPluginBase, o as resolveWhatsAppGroupToolPolicy, r as loadWhatsAppChannelRuntime, s as resolveWhatsAppGroupIntroHint, t as whatsappSetupAdapter } from "./setup-core-OvPMaAsx.js";
|
|
13
|
+
import { f as readWebAuthExistsForDecision, n as WHATSAPP_AUTH_UNSTABLE_CODE } from "./auth-store-CZ22aNcV.js";
|
|
14
14
|
import { t as detectWhatsAppLegacyStateMigrations } from "./state-migrations-D_BmQUR9.js";
|
|
15
15
|
import { createActionGate as createActionGate$1 } from "openclaw/plugin-sdk/channel-actions";
|
|
16
16
|
import { DEFAULT_ACCOUNT_ID, listCombinedAccountIds, normalizeOptionalAccountId, resolveListedDefaultAccountId } from "openclaw/plugin-sdk/account-core";
|
|
@@ -26,31 +26,18 @@ import { createChatChannelPlugin } from "openclaw/plugin-sdk/channel-core";
|
|
|
26
26
|
import { createLazyRuntimeModule } from "openclaw/plugin-sdk/lazy-runtime";
|
|
27
27
|
import { createChannelApprovalCapability, splitChannelApprovalCapability } from "openclaw/plugin-sdk/approval-delivery-runtime";
|
|
28
28
|
import { createLazyChannelApprovalNativeRuntimeAdapter } from "openclaw/plugin-sdk/approval-handler-adapter-runtime";
|
|
29
|
-
import {
|
|
30
|
-
import { normalizeAccountId as normalizeAccountId$2 } from "openclaw/plugin-sdk/routing";
|
|
29
|
+
import { createChannelApproverDmTargetResolver, createChannelNativeOriginTargetResolver, createNativeApprovalChannelRouteGates, createNativeApprovalForwardingFallbackSuppressor } from "openclaw/plugin-sdk/approval-native-runtime";
|
|
31
30
|
import { chunkText } from "openclaw/plugin-sdk/reply-chunking";
|
|
32
31
|
import { createAttachedChannelResultAdapter } from "openclaw/plugin-sdk/channel-send-result";
|
|
33
32
|
import { sendTextMediaPayload } from "openclaw/plugin-sdk/reply-payload";
|
|
34
33
|
//#region extensions/whatsapp/src/approval-native.ts
|
|
34
|
+
const DEFAULT_APPROVAL_FORWARDING_MODE = "session";
|
|
35
35
|
function isWhatsAppApprovalTransportEnabled(params) {
|
|
36
36
|
return resolveWhatsAppAccount({
|
|
37
37
|
cfg: params.cfg,
|
|
38
38
|
accountId: params.accountId
|
|
39
39
|
}).enabled;
|
|
40
40
|
}
|
|
41
|
-
function targetAccountMatchesWhatsAppAccount(params) {
|
|
42
|
-
const targetAccountId = normalizeOptionalString(params.targetAccountId);
|
|
43
|
-
const accountId = normalizeOptionalString(params.accountId);
|
|
44
|
-
if (targetAccountId) return !accountId || normalizeAccountId$2(targetAccountId) === normalizeAccountId$2(accountId);
|
|
45
|
-
if (!accountId) return true;
|
|
46
|
-
const normalizedAccountId = normalizeAccountId$2(accountId);
|
|
47
|
-
if (normalizedAccountId === normalizeAccountId$2(resolveDefaultWhatsAppAccountId(params.cfg))) return true;
|
|
48
|
-
const enabledAccountIds = listAccountIds(params.cfg).filter((candidateAccountId) => isWhatsAppApprovalTransportEnabled({
|
|
49
|
-
cfg: params.cfg,
|
|
50
|
-
accountId: candidateAccountId
|
|
51
|
-
})).map((candidateAccountId) => normalizeAccountId$2(candidateAccountId));
|
|
52
|
-
return enabledAccountIds.length === 1 && enabledAccountIds[0] === normalizedAccountId;
|
|
53
|
-
}
|
|
54
41
|
function normalizeWhatsAppForwardTarget(target) {
|
|
55
42
|
if (normalizeLowercaseStringOrEmpty(target.channel) !== "whatsapp") return null;
|
|
56
43
|
const to = normalizeWhatsAppMessagingTarget(target.to);
|
|
@@ -61,46 +48,6 @@ function normalizeWhatsAppForwardTarget(target) {
|
|
|
61
48
|
threadId: target.threadId ?? null
|
|
62
49
|
};
|
|
63
50
|
}
|
|
64
|
-
function hasMatchingWhatsAppTarget(params) {
|
|
65
|
-
const candidateTarget = params.target ? normalizeWhatsAppForwardTarget(params.target) : null;
|
|
66
|
-
return (params.config.targets ?? []).some((target) => {
|
|
67
|
-
const configuredTarget = normalizeWhatsAppForwardTarget(target);
|
|
68
|
-
if (!configuredTarget) return false;
|
|
69
|
-
if (!targetAccountMatchesWhatsAppAccount({
|
|
70
|
-
cfg: params.cfg,
|
|
71
|
-
targetAccountId: configuredTarget.accountId,
|
|
72
|
-
accountId: params.accountId
|
|
73
|
-
})) return false;
|
|
74
|
-
if (!candidateTarget) return true;
|
|
75
|
-
return nativeApprovalTargetsMatch({
|
|
76
|
-
channel: "whatsapp",
|
|
77
|
-
left: configuredTarget,
|
|
78
|
-
right: candidateTarget
|
|
79
|
-
});
|
|
80
|
-
});
|
|
81
|
-
}
|
|
82
|
-
function hasWhatsAppOriginOrSessionTarget(params) {
|
|
83
|
-
if (resolveTurnSourceWhatsAppOriginTarget(params.request)) return true;
|
|
84
|
-
const sessionTarget = resolveApprovalRequestSessionTarget({
|
|
85
|
-
cfg: params.cfg,
|
|
86
|
-
request: params.request
|
|
87
|
-
});
|
|
88
|
-
return normalizeLowercaseStringOrEmpty(sessionTarget?.channel) === "whatsapp" && targetAccountMatchesWhatsAppAccount({
|
|
89
|
-
cfg: params.cfg,
|
|
90
|
-
targetAccountId: sessionTarget?.accountId,
|
|
91
|
-
accountId: params.accountId
|
|
92
|
-
});
|
|
93
|
-
}
|
|
94
|
-
const whatsappApprovalForwarding = createChannelApprovalForwardingEvaluator({
|
|
95
|
-
channel: "whatsapp",
|
|
96
|
-
isTransportEnabled: isWhatsAppApprovalTransportEnabled,
|
|
97
|
-
hasMatchingTarget: hasMatchingWhatsAppTarget,
|
|
98
|
-
hasOriginOrSessionTarget: hasWhatsAppOriginOrSessionTarget
|
|
99
|
-
});
|
|
100
|
-
const canApprovalPotentiallyRouteToWhatsApp = whatsappApprovalForwarding.isPotentialRoute;
|
|
101
|
-
const canAnyApprovalPotentiallyRouteToWhatsApp = whatsappApprovalForwarding.canAnyPotentiallyRoute;
|
|
102
|
-
const isWhatsAppSessionApprovalEligible = whatsappApprovalForwarding.isSessionEligible;
|
|
103
|
-
const isWhatsAppExplicitTargetEligible = whatsappApprovalForwarding.isExplicitTargetEligible;
|
|
104
51
|
function resolveTurnSourceWhatsAppOriginTarget(request) {
|
|
105
52
|
if (normalizeLowercaseStringOrEmpty(request.request.turnSourceChannel) !== "whatsapp") return null;
|
|
106
53
|
const to = normalizeWhatsAppMessagingTarget(request.request.turnSourceTo ?? "");
|
|
@@ -117,9 +64,15 @@ function resolveSessionWhatsAppOriginTarget(sessionTarget) {
|
|
|
117
64
|
accountId: normalizeOptionalString(sessionTarget.accountId)
|
|
118
65
|
} : null;
|
|
119
66
|
}
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
67
|
+
const { canApprovalPotentiallyRouteToChannel: canApprovalPotentiallyRouteToWhatsApp, canAnyApprovalPotentiallyRouteToChannel: canAnyApprovalPotentiallyRouteToWhatsApp, isSessionApprovalEligible: isWhatsAppSessionApprovalEligible, isExplicitTargetEligible: isWhatsAppExplicitTargetEligible, shouldHandleApprovalRequest: shouldHandleWhatsAppApprovalRequest } = createNativeApprovalChannelRouteGates({
|
|
68
|
+
channel: "whatsapp",
|
|
69
|
+
defaultForwardingMode: DEFAULT_APPROVAL_FORWARDING_MODE,
|
|
70
|
+
isTransportEnabled: isWhatsAppApprovalTransportEnabled,
|
|
71
|
+
listAccountIds,
|
|
72
|
+
resolveDefaultAccountId: resolveDefaultWhatsAppAccountId,
|
|
73
|
+
normalizeForwardTarget: normalizeWhatsAppForwardTarget,
|
|
74
|
+
resolveTurnSourceTarget: resolveTurnSourceWhatsAppOriginTarget
|
|
75
|
+
});
|
|
123
76
|
const resolveWhatsAppOriginTargetBase = createChannelNativeOriginTargetResolver({
|
|
124
77
|
channel: "whatsapp",
|
|
125
78
|
shouldHandleRequest: shouldHandleWhatsAppApprovalRequest,
|
|
@@ -252,7 +205,7 @@ const whatsappApprovalCapability = createChannelApprovalCapability({
|
|
|
252
205
|
accountId,
|
|
253
206
|
request
|
|
254
207
|
}),
|
|
255
|
-
load: async () => (await import("./approval-handler.runtime-
|
|
208
|
+
load: async () => (await import("./approval-handler.runtime-BVmOu6x1.js")).whatsappApprovalNativeRuntime
|
|
256
209
|
})
|
|
257
210
|
});
|
|
258
211
|
splitChannelApprovalCapability(whatsappApprovalCapability);
|
|
@@ -651,7 +604,7 @@ function collectWhatsAppStatusIssues(accounts) {
|
|
|
651
604
|
//#endregion
|
|
652
605
|
//#region extensions/whatsapp/src/channel.ts
|
|
653
606
|
const loadWhatsAppDirectoryConfig = createLazyRuntimeModule(() => import("./directory-config-Dijefxc3.js").then((n) => n.t));
|
|
654
|
-
const loadWhatsAppChannelReactAction = createLazyRuntimeModule(() => import("./channel-react-action-
|
|
607
|
+
const loadWhatsAppChannelReactAction = createLazyRuntimeModule(() => import("./channel-react-action-zvbaCnGe.js"));
|
|
655
608
|
function resolveWhatsAppTargetInfo(raw) {
|
|
656
609
|
const normalized = normalizeWhatsAppTarget(raw);
|
|
657
610
|
if (!normalized) return null;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as WhatsAppChannelConfigSchema } from "./config-schema-
|
|
1
|
+
import { t as WhatsAppChannelConfigSchema } from "./config-schema-CROZuhT-.js";
|
|
2
2
|
export { WhatsAppChannelConfigSchema };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as whatsappPlugin } from "./channel-
|
|
1
|
+
import { t as whatsappPlugin } from "./channel-DA2BAIo5.js";
|
|
2
2
|
export { whatsappPlugin };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { a as resolveWhatsAppAccount, s as resolveWhatsAppMediaMaxBytes } from "./accounts-
|
|
1
|
+
import { a as resolveWhatsAppAccount, s as resolveWhatsAppMediaMaxBytes } from "./accounts-DgViSyJx.js";
|
|
2
2
|
import { c as normalizeWhatsAppTarget, t as isWhatsAppGroupJid } from "./normalize-target-bVWjgftN.js";
|
|
3
|
-
import { r as resolveAuthorizedWhatsAppOutboundTarget, t as handleWhatsAppAction } from "./action-runtime-
|
|
4
|
-
import { t as sendMessageWhatsApp } from "./send-
|
|
3
|
+
import { r as resolveAuthorizedWhatsAppOutboundTarget, t as handleWhatsAppAction } from "./action-runtime-Cyp5GNIT.js";
|
|
4
|
+
import { t as sendMessageWhatsApp } from "./send-DSlVXKL_.js";
|
|
5
5
|
import "./normalize-Bxwqo-bW.js";
|
|
6
6
|
import { jsonResult, readStringOrNumberParam, readStringParam as readStringParam$1, resolveReactionMessageId } from "openclaw/plugin-sdk/channel-actions";
|
|
7
7
|
//#region extensions/whatsapp/src/channel-react-action.ts
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { startWebLoginWithQr as startWebLoginWithQr$1, waitForWebLogin as waitForWebLogin$1 } from "./login-qr-runtime.js";
|
|
2
|
-
import { c as logoutWeb$1, d as readWebAuthExistsBestEffort$1, f as readWebAuthExistsForDecision$1, g as readWebSelfId$1, h as readWebAuthState$1, m as readWebAuthSnapshotBestEffort$1, o as getWebAuthAgeMs$1, p as readWebAuthSnapshot$1, s as logWebSelfId$1, x as webAuthExists$1 } from "./auth-store-
|
|
2
|
+
import { c as logoutWeb$1, d as readWebAuthExistsBestEffort$1, f as readWebAuthExistsForDecision$1, g as readWebSelfId$1, h as readWebAuthState$1, m as readWebAuthSnapshotBestEffort$1, o as getWebAuthAgeMs$1, p as readWebAuthSnapshot$1, s as logWebSelfId$1, x as webAuthExists$1 } from "./auth-store-CZ22aNcV.js";
|
|
3
3
|
import { t as getActiveWebListener$1 } from "./active-listener-CFwkn3ho.js";
|
|
4
|
-
import { t as monitorWebChannel$1 } from "./monitor-
|
|
5
|
-
import { t as loginWeb$1 } from "./login-
|
|
6
|
-
import { whatsappSetupWizard as whatsappSetupWizard$1 } from "./setup-surface-
|
|
4
|
+
import { t as monitorWebChannel$1 } from "./monitor-BVRq04Dt.js";
|
|
5
|
+
import { t as loginWeb$1 } from "./login-2fuBM7Je.js";
|
|
6
|
+
import { whatsappSetupWizard as whatsappSetupWizard$1 } from "./setup-surface-F-jVrH8u.js";
|
|
7
7
|
//#region extensions/whatsapp/src/channel.runtime.ts
|
|
8
8
|
function getActiveWebListener(...args) {
|
|
9
9
|
return getActiveWebListener$1(...args);
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import "./
|
|
2
|
-
import { a as resolveWhatsAppGroupRequireMention, i as whatsappSetupWizardProxy, n as createWhatsAppPluginBase, o as resolveWhatsAppGroupToolPolicy, s as resolveWhatsAppGroupIntroHint, t as whatsappSetupAdapter } from "./setup-core-DpfT4K-2.js";
|
|
1
|
+
import { a as resolveWhatsAppGroupRequireMention, i as whatsappSetupWizardProxy, n as createWhatsAppPluginBase, o as resolveWhatsAppGroupToolPolicy, s as resolveWhatsAppGroupIntroHint, t as whatsappSetupAdapter } from "./setup-core-OvPMaAsx.js";
|
|
3
2
|
import { t as detectWhatsAppLegacyStateMigrations } from "./state-migrations-D_BmQUR9.js";
|
|
4
3
|
//#region extensions/whatsapp/src/channel.setup.ts
|
|
5
4
|
async function isWhatsAppAuthConfigured(account) {
|
|
6
|
-
const { readWebAuthState } = await import("./auth-store-
|
|
5
|
+
const { readWebAuthState } = await import("./auth-store-CZ22aNcV.js").then((n) => n.i);
|
|
7
6
|
return await readWebAuthState(account.authDir) === "linked";
|
|
8
7
|
}
|
|
9
8
|
const whatsappSetupPlugin = {
|
|
@@ -21,6 +21,22 @@ const WhatsAppChannelConfigSchema = buildChannelConfigSchema(WhatsAppConfigSchem
|
|
|
21
21
|
configWrites: {
|
|
22
22
|
label: "WhatsApp Config Writes",
|
|
23
23
|
help: "Allow WhatsApp to write config in response to channel events/commands (default: true)."
|
|
24
|
+
},
|
|
25
|
+
mentionPatterns: {
|
|
26
|
+
label: "WhatsApp Mention Pattern Policy",
|
|
27
|
+
help: "Scopes configured groupChat mentionPatterns to selected WhatsApp conversation IDs such as 123@g.us."
|
|
28
|
+
},
|
|
29
|
+
"mentionPatterns.mode": {
|
|
30
|
+
label: "WhatsApp Mention Pattern Mode",
|
|
31
|
+
help: "\"allow\" enables configured regex mention patterns unless denyIn matches; \"deny\" disables them unless allowIn matches."
|
|
32
|
+
},
|
|
33
|
+
"mentionPatterns.allowIn": {
|
|
34
|
+
label: "WhatsApp Mention Pattern Allowlist",
|
|
35
|
+
help: "WhatsApp conversation IDs where configured regex mention patterns are enabled when mode is deny."
|
|
36
|
+
},
|
|
37
|
+
"mentionPatterns.denyIn": {
|
|
38
|
+
label: "WhatsApp Mention Pattern Denylist",
|
|
39
|
+
help: "WhatsApp conversation IDs where configured regex mention patterns are disabled."
|
|
24
40
|
}
|
|
25
41
|
} });
|
|
26
42
|
//#endregion
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { a as unregisterWhatsAppConnectionController, i as registerWhatsAppConnectionController, n as getStatusCode, t as formatError } from "./session-errors-CbsoQqoy.js";
|
|
2
|
-
import { c as logoutWeb } from "./auth-store-
|
|
3
|
-
import { r as waitForWaConnection, t as createWaSocket } from "./session-
|
|
2
|
+
import { c as logoutWeb } from "./auth-store-CZ22aNcV.js";
|
|
3
|
+
import { r as waitForWaConnection, t as createWaSocket } from "./session-DyGWNClj.js";
|
|
4
4
|
import { computeBackoff, info, sleepWithAbort } from "openclaw/plugin-sdk/runtime-env";
|
|
5
5
|
import { clamp } from "openclaw/plugin-sdk/text-utility-runtime";
|
|
6
6
|
import { DisconnectReason } from "baileys";
|
package/dist/contract-api.js
CHANGED
|
@@ -4,7 +4,7 @@ import { t as resolveLegacyGroupSessionKey$1 } from "./group-session-contract-DD
|
|
|
4
4
|
import { n as unsupportedSecretRefSurfacePatterns, t as collectUnsupportedSecretRefConfigCandidates } from "./security-contract-nAzD945y.js";
|
|
5
5
|
import { r as isLegacyGroupSessionKey$1, t as canonicalizeLegacySessionKey$1 } from "./session-contract-DMTm6Q_L.js";
|
|
6
6
|
import { n as listWhatsAppDirectoryGroupsFromConfig, r as listWhatsAppDirectoryPeersFromConfig } from "./directory-config-Dijefxc3.js";
|
|
7
|
-
import { a as resolveWhatsAppRuntimeGroupPolicy$1, n as testing } from "./access-control-
|
|
7
|
+
import { a as resolveWhatsAppRuntimeGroupPolicy$1, n as testing } from "./access-control-C53zKYSN.js";
|
|
8
8
|
//#region extensions/whatsapp/contract-api.ts
|
|
9
9
|
const canonicalizeLegacySessionKey = canonicalizeLegacySessionKey$1;
|
|
10
10
|
const isLegacyGroupSessionKey = isLegacyGroupSessionKey$1;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { n as getStatusCode, t as formatError } from "./session-errors-CbsoQqoy.js";
|
|
2
2
|
import { t as createWhatsAppLoginTool } from "./agent-tools-login-BX7eHgDm.js";
|
|
3
|
-
import { c as logoutWeb, g as readWebSelfId, l as pickWebChannel, o as getWebAuthAgeMs, s as logWebSelfId, t as WA_WEB_AUTH_DIR, x as webAuthExists, y as resolveDefaultWebAuthDir } from "./auth-store-
|
|
3
|
+
import { c as logoutWeb, g as readWebSelfId, l as pickWebChannel, o as getWebAuthAgeMs, s as logWebSelfId, t as WA_WEB_AUTH_DIR, x as webAuthExists, y as resolveDefaultWebAuthDir } from "./auth-store-CZ22aNcV.js";
|
|
4
4
|
import { t as getActiveWebListener } from "./active-listener-CFwkn3ho.js";
|
|
5
5
|
export { WA_WEB_AUTH_DIR, createWhatsAppLoginTool, formatError, getActiveWebListener, getStatusCode, getWebAuthAgeMs, logWebSelfId, logoutWeb, pickWebChannel, readWebSelfId, resolveDefaultWebAuthDir, webAuthExists };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-D7D4PA-g.js";
|
|
2
|
-
import { a as resolveWhatsAppAccount } from "./accounts-
|
|
3
|
-
import { b as restoreCredsFromBackupIfNeeded } from "./auth-store-
|
|
4
|
-
import { a as renderQrTerminal, i as resolveWhatsAppSocketTiming, t as createWaSocket } from "./session-
|
|
5
|
-
import { a as closeWaSocketSoon, o as waitForWhatsAppLoginResult } from "./connection-controller-
|
|
2
|
+
import { a as resolveWhatsAppAccount } from "./accounts-DgViSyJx.js";
|
|
3
|
+
import { b as restoreCredsFromBackupIfNeeded } from "./auth-store-CZ22aNcV.js";
|
|
4
|
+
import { a as renderQrTerminal, i as resolveWhatsAppSocketTiming, t as createWaSocket } from "./session-DyGWNClj.js";
|
|
5
|
+
import { a as closeWaSocketSoon, o as waitForWhatsAppLoginResult } from "./connection-controller-Bnm4INld.js";
|
|
6
6
|
import { formatCliCommand } from "openclaw/plugin-sdk/cli-runtime";
|
|
7
7
|
import { logInfo } from "openclaw/plugin-sdk/logging-core";
|
|
8
8
|
import { danger, defaultRuntime, success } from "openclaw/plugin-sdk/runtime-env";
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import { a as resolveWhatsAppAccount } from "./accounts-
|
|
2
|
-
import { f as readWebAuthExistsForDecision, g as readWebSelfId, n as WHATSAPP_AUTH_UNSTABLE_CODE } from "./auth-store-
|
|
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-
|
|
1
|
+
import { a as resolveWhatsAppAccount } from "./accounts-DgViSyJx.js";
|
|
2
|
+
import { f as readWebAuthExistsForDecision, g as readWebSelfId, n as WHATSAPP_AUTH_UNSTABLE_CODE } from "./auth-store-CZ22aNcV.js";
|
|
3
|
+
import { i as resolveWhatsAppSocketTiming, t as createWaSocket } from "./session-DyGWNClj.js";
|
|
4
|
+
import { i as closeWaSocket, o as waitForWhatsAppLoginResult, t as WHATSAPP_LOGGED_OUT_QR_MESSAGE } from "./connection-controller-Bnm4INld.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";
|
|
8
|
+
import { resolveTimerTimeoutMs } from "openclaw/plugin-sdk/number-runtime";
|
|
8
9
|
import { randomUUID } from "node:crypto";
|
|
9
10
|
import { getRuntimeConfig } from "openclaw/plugin-sdk/runtime-config-snapshot";
|
|
10
11
|
//#region extensions/whatsapp/src/login-qr.ts
|
|
@@ -14,6 +15,9 @@ function waitForNextTask() {
|
|
|
14
15
|
const ACTIVE_LOGIN_TTL_MS = 3 * 6e4;
|
|
15
16
|
const MAX_QR_RENDER_CHASES = 10;
|
|
16
17
|
const activeLogins = /* @__PURE__ */ new Map();
|
|
18
|
+
function resolveWhatsAppLoginTimeoutMs(value, fallbackMs, minMs) {
|
|
19
|
+
return resolveTimerTimeoutMs(value, fallbackMs, minMs);
|
|
20
|
+
}
|
|
17
21
|
function closeSocket(sock) {
|
|
18
22
|
closeWaSocket(sock);
|
|
19
23
|
}
|
|
@@ -206,7 +210,7 @@ async function startWebLoginWithQr(opts = {}) {
|
|
|
206
210
|
});
|
|
207
211
|
const qrTimer = setTimeout(() => {
|
|
208
212
|
rejectQr?.(/* @__PURE__ */ new Error("Timed out waiting for WhatsApp QR"));
|
|
209
|
-
},
|
|
213
|
+
}, resolveWhatsAppLoginTimeoutMs(opts.timeoutMs, 3e4, 5e3));
|
|
210
214
|
let sock;
|
|
211
215
|
let pendingQr = null;
|
|
212
216
|
const loginId = randomUUID();
|
|
@@ -331,7 +335,7 @@ async function waitForWebLogin(opts = {}) {
|
|
|
331
335
|
message: "The login QR expired. Ask me to generate a new one."
|
|
332
336
|
};
|
|
333
337
|
}
|
|
334
|
-
const timeoutMs =
|
|
338
|
+
const timeoutMs = resolveWhatsAppLoginTimeoutMs(opts.timeoutMs, 12e4, 1e3);
|
|
335
339
|
const deadline = Date.now() + timeoutMs;
|
|
336
340
|
const currentQrDataUrl = opts.currentQrDataUrl;
|
|
337
341
|
while (true) {
|
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-B1o7GFy8.js");
|
|
5
5
|
return loginQrModulePromise;
|
|
6
6
|
}
|
|
7
7
|
async function startWebLoginWithQr(...args) {
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import { a as resolveWhatsAppAccount, s as resolveWhatsAppMediaMaxBytes } from "./accounts-
|
|
1
|
+
import { a as resolveWhatsAppAccount, s as resolveWhatsAppMediaMaxBytes } from "./accounts-DgViSyJx.js";
|
|
2
2
|
import { t as isWhatsAppGroupJid } from "./normalize-target-bVWjgftN.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-
|
|
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-DSlVXKL_.js";
|
|
4
4
|
import { n as getWhatsAppRuntime } from "./runtime-BfAdAEYT.js";
|
|
5
5
|
import { n as getStatusCode, t as formatError } from "./session-errors-CbsoQqoy.js";
|
|
6
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";
|
|
7
7
|
import { n as cacheInboundMessageMeta, r as lookupInboundMessageMeta, t as buildQuotedMessageOptions } from "./quoted-message-CveINB35.js";
|
|
8
|
-
import { c as logoutWeb, g as readWebSelfId, o as getWebAuthAgeMs, r as WhatsAppAuthUnstableError, v as readWebSelfIdentityForDecision } from "./auth-store-
|
|
8
|
+
import { c as logoutWeb, g as readWebSelfId, o as getWebAuthAgeMs, r as WhatsAppAuthUnstableError, v as readWebSelfIdentityForDecision } from "./auth-store-CZ22aNcV.js";
|
|
9
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";
|
|
10
10
|
import { n as resolveWhatsAppGroupsConfigPath } from "./group-config-path-BGyzT9Lg.js";
|
|
11
|
-
import { i as resolveWhatsAppInboundPolicy, r as resolveWhatsAppCommandAuthorized, t as checkInboundAccessControl } from "./access-control-
|
|
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-
|
|
13
|
-
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-C53zKYSN.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-Bjn-h80j.js";
|
|
13
|
+
import { i as resolveWhatsAppSocketTiming, r as waitForWaConnection, t as createWaSocket } from "./session-DyGWNClj.js";
|
|
14
14
|
import { t as BufferJSON } from "./session.runtime-LZFdq3yb.js";
|
|
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-
|
|
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-Bnm4INld.js";
|
|
16
16
|
import { resolveAccountEntry } from "openclaw/plugin-sdk/account-core";
|
|
17
17
|
import { normalizeLowercaseStringOrEmpty, normalizeStringEntries, uniqueStrings } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
18
18
|
import { createChannelMessageReplyPipeline, createDurableInboundReceiveJournal, createMessageReceiptFromOutboundResults, deliverInboundReplyWithMessageSendContext, resolveChannelMessageSourceReplyDeliveryMode } from "openclaw/plugin-sdk/channel-outbound";
|
|
@@ -24,9 +24,10 @@ import { resolveMarkdownTableMode as resolveMarkdownTableMode$1 } from "openclaw
|
|
|
24
24
|
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";
|
|
25
25
|
import { getAgentScopedMediaLocalRoots } from "openclaw/plugin-sdk/media-runtime";
|
|
26
26
|
import { LocalMediaAccessError, getDefaultLocalRoots, loadWebMedia as loadWebMedia$1, loadWebMediaRaw, optimizeImageToJpeg, optimizeImageToPng } from "openclaw/plugin-sdk/web-media";
|
|
27
|
-
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
27
|
import { chunkMarkdownTextWithMode } from "openclaw/plugin-sdk/reply-chunking";
|
|
29
28
|
import { isReasoningReplyPayload, resolveSendableOutboundReplyParts, sendMediaWithLeadingCaption } from "openclaw/plugin-sdk/reply-payload";
|
|
29
|
+
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";
|
|
30
|
+
import { asDateTimestampMs, parseStrictFiniteNumber, resolveExpiresAtMsFromDurationMs } from "openclaw/plugin-sdk/number-runtime";
|
|
30
31
|
import { recordInboundSession } from "openclaw/plugin-sdk/conversation-runtime";
|
|
31
32
|
import { loadSessionStore, resolveStorePath, updateLastRoute, updateSessionStore } from "openclaw/plugin-sdk/session-store-runtime";
|
|
32
33
|
import { DisconnectReason as DisconnectReason$1, downloadMediaMessage, isJidGroup, normalizeMessageContent as normalizeMessageContent$1 } from "baileys";
|
|
@@ -41,7 +42,6 @@ import { hasControlCommand, isControlCommandMessage, isControlCommandMessage as
|
|
|
41
42
|
import { drainPendingDeliveries } from "openclaw/plugin-sdk/delivery-queue-runtime";
|
|
42
43
|
import { DEFAULT_GROUP_HISTORY_LIMIT, buildHistoryContextFromEntries, buildInboundHistoryFromEntries, createChannelHistoryWindow } from "openclaw/plugin-sdk/reply-history";
|
|
43
44
|
import { enqueueSystemEvent } from "openclaw/plugin-sdk/system-event-runtime";
|
|
44
|
-
import { parseStrictFiniteNumber } from "openclaw/plugin-sdk/number-runtime";
|
|
45
45
|
import { createClaimableDedupe } from "openclaw/plugin-sdk/persistent-dedupe";
|
|
46
46
|
import { saveMediaStream } from "openclaw/plugin-sdk/media-store";
|
|
47
47
|
import { getRuntimeConfig as getRuntimeConfig$1, getRuntimeConfigSourceSnapshot } from "openclaw/plugin-sdk/runtime-config-snapshot";
|
|
@@ -263,6 +263,10 @@ const LOGGED_OUT_STATUS = DisconnectReason$1?.loggedOut ?? 401;
|
|
|
263
263
|
const RECONNECT_IN_PROGRESS_ERROR = "no active socket - reconnection in progress";
|
|
264
264
|
const GROUP_META_TTL_MS = 300 * 1e3;
|
|
265
265
|
const INBOUND_CLOSE_DRAIN_TIMEOUT_MS = 5e3;
|
|
266
|
+
function resolveGroupMetadataExpiresAt(nowRaw = Date.now()) {
|
|
267
|
+
const now = asDateTimestampMs(nowRaw);
|
|
268
|
+
return now === void 0 ? void 0 : resolveExpiresAtMsFromDurationMs(GROUP_META_TTL_MS, { nowMs: now });
|
|
269
|
+
}
|
|
266
270
|
function parseWhatsAppTimestampSeconds(value) {
|
|
267
271
|
if (value == null) return;
|
|
268
272
|
if (typeof value === "string") return parseStrictFiniteNumber(value);
|
|
@@ -270,6 +274,10 @@ function parseWhatsAppTimestampSeconds(value) {
|
|
|
270
274
|
return Number.isFinite(parsed) ? parsed : void 0;
|
|
271
275
|
}
|
|
272
276
|
function rememberGroupMetadataCacheEntry(cache, jid, entry) {
|
|
277
|
+
if (asDateTimestampMs(entry.expires) === void 0) {
|
|
278
|
+
cache.delete(jid);
|
|
279
|
+
return;
|
|
280
|
+
}
|
|
273
281
|
if (cache.has(jid)) cache.delete(jid);
|
|
274
282
|
cache.set(jid, entry);
|
|
275
283
|
while (cache.size > 500) {
|
|
@@ -281,7 +289,9 @@ function rememberGroupMetadataCacheEntry(cache, jid, entry) {
|
|
|
281
289
|
function readGroupMetadataCacheEntry(cache, jid) {
|
|
282
290
|
const entry = cache.get(jid);
|
|
283
291
|
if (!entry) return null;
|
|
284
|
-
|
|
292
|
+
const now = asDateTimestampMs(Date.now());
|
|
293
|
+
const expires = asDateTimestampMs(entry.expires);
|
|
294
|
+
if (now === void 0 || expires === void 0 || expires <= now) {
|
|
285
295
|
cache.delete(jid);
|
|
286
296
|
return null;
|
|
287
297
|
}
|
|
@@ -435,7 +445,7 @@ async function attachWebInboxToSocket(options) {
|
|
|
435
445
|
});
|
|
436
446
|
};
|
|
437
447
|
const sendTrackedMessage = async (jid, content, sendOptions) => {
|
|
438
|
-
let lastErr = new Error(RECONNECT_IN_PROGRESS_ERROR);
|
|
448
|
+
let lastErr = /* @__PURE__ */ new Error(RECONNECT_IN_PROGRESS_ERROR);
|
|
439
449
|
for (let attempt = 1;; attempt++) {
|
|
440
450
|
const currentSock = getCurrentSock();
|
|
441
451
|
if (currentSock) try {
|
|
@@ -477,12 +487,12 @@ async function attachWebInboxToSocket(options) {
|
|
|
477
487
|
subject: meta.subject,
|
|
478
488
|
participants,
|
|
479
489
|
mentionParticipants,
|
|
480
|
-
expires:
|
|
490
|
+
expires: resolveGroupMetadataExpiresAt() ?? 0
|
|
481
491
|
};
|
|
482
492
|
};
|
|
483
493
|
const summarizeGroupMetaForReconnectCache = (meta) => ({
|
|
484
494
|
subject: meta.subject,
|
|
485
|
-
expires:
|
|
495
|
+
expires: resolveGroupMetadataExpiresAt() ?? NaN
|
|
486
496
|
});
|
|
487
497
|
const getGroupMeta = async (jid) => {
|
|
488
498
|
const cached = readGroupMetadataCacheEntry(groupMetaCache, jid);
|
|
@@ -503,7 +513,7 @@ async function attachWebInboxToSocket(options) {
|
|
|
503
513
|
return hydrated;
|
|
504
514
|
}
|
|
505
515
|
logWhatsAppVerbose(options.verbose, `Failed to fetch group metadata for ${jid}: ${String(err)}`);
|
|
506
|
-
return { expires:
|
|
516
|
+
return { expires: resolveGroupMetadataExpiresAt() ?? 0 };
|
|
507
517
|
}
|
|
508
518
|
};
|
|
509
519
|
const resolveOutboundMentionsForGroup = async (jid, text) => {
|
|
@@ -1005,9 +1015,9 @@ const whatsappOutboundLog = whatsappLog.child("outbound");
|
|
|
1005
1015
|
const whatsappHeartbeatLog = whatsappLog.child("heartbeat");
|
|
1006
1016
|
//#endregion
|
|
1007
1017
|
//#region extensions/whatsapp/src/auto-reply/mentions.ts
|
|
1008
|
-
function buildMentionConfig(cfg, agentId) {
|
|
1018
|
+
function buildMentionConfig(cfg, agentId, options) {
|
|
1009
1019
|
return {
|
|
1010
|
-
mentionRegexes: buildMentionRegexes(cfg, agentId),
|
|
1020
|
+
mentionRegexes: buildMentionRegexes(cfg, agentId, options),
|
|
1011
1021
|
allowFrom: cfg.channels?.whatsapp?.allowFrom
|
|
1012
1022
|
};
|
|
1013
1023
|
}
|
|
@@ -1520,7 +1530,11 @@ async function applyGroupGating(params) {
|
|
|
1520
1530
|
allowFrom: inboundPolicy.configuredAllowFrom
|
|
1521
1531
|
};
|
|
1522
1532
|
const mentionConfig = {
|
|
1523
|
-
...buildMentionConfig(params.cfg, params.agentId
|
|
1533
|
+
...buildMentionConfig(params.cfg, params.agentId, {
|
|
1534
|
+
provider: "whatsapp",
|
|
1535
|
+
conversationId: params.conversationId,
|
|
1536
|
+
providerPolicy: params.providerMentionPatterns
|
|
1537
|
+
}),
|
|
1524
1538
|
allowFrom: inboundPolicy.configuredAllowFrom
|
|
1525
1539
|
};
|
|
1526
1540
|
const mentionMsg = params.mentionText !== void 0 ? {
|
|
@@ -2174,7 +2188,8 @@ async function dispatchWhatsAppBufferedReply(params) {
|
|
|
2174
2188
|
CommandAuthorized: sourceReplyCommandAuthorized
|
|
2175
2189
|
}
|
|
2176
2190
|
}) : void 0;
|
|
2177
|
-
const
|
|
2191
|
+
const sourceRepliesAreToolOnly = sourceReplyDeliveryMode === "message_tool_only";
|
|
2192
|
+
const disableBlockStreaming = sourceRepliesAreToolOnly ? true : resolveWhatsAppDisableBlockStreaming(params.cfg);
|
|
2178
2193
|
let didSendReply = false;
|
|
2179
2194
|
let didLogHeartbeatStrip = false;
|
|
2180
2195
|
const deliverNormalizedPayload = async (normalizedDeliveryPayload, info) => {
|
|
@@ -2330,6 +2345,7 @@ async function dispatchWhatsAppBufferedReply(params) {
|
|
|
2330
2345
|
}
|
|
2331
2346
|
},
|
|
2332
2347
|
replyOptions: {
|
|
2348
|
+
suppressTyping: sourceRepliesAreToolOnly && params.msg.chatType === "group" && !params.msg.wasMentioned,
|
|
2333
2349
|
disableBlockStreaming,
|
|
2334
2350
|
...sourceReplyDeliveryMode ? { sourceReplyDeliveryMode } : {},
|
|
2335
2351
|
onModelSelected: params.onModelSelected,
|
|
@@ -2983,6 +2999,7 @@ function createWebOnMessageHandler(params) {
|
|
|
2983
2999
|
agentId: route.agentId,
|
|
2984
3000
|
sessionKey: route.sessionKey,
|
|
2985
3001
|
baseMentionConfig,
|
|
3002
|
+
providerMentionPatterns: account.mentionPatterns,
|
|
2986
3003
|
authDir: account.authDir,
|
|
2987
3004
|
selfChatMode: account.selfChatMode,
|
|
2988
3005
|
groupHistories: params.groupHistories,
|
|
@@ -3002,6 +3019,7 @@ function createWebOnMessageHandler(params) {
|
|
|
3002
3019
|
agentId: route.agentId,
|
|
3003
3020
|
sessionKey: route.sessionKey,
|
|
3004
3021
|
baseMentionConfig,
|
|
3022
|
+
providerMentionPatterns: account.mentionPatterns,
|
|
3005
3023
|
authDir: account.authDir,
|
|
3006
3024
|
selfChatMode: account.selfChatMode,
|
|
3007
3025
|
groupHistories: params.groupHistories,
|