@openclaw/whatsapp 2026.7.2-beta.3 → 2026.7.2-beta.4
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-tjy_em01.js → access-control-CRz_v6bR.js} +4 -5
- package/dist/{accounts-ejK8sXPU.js → accounts-CxPuEFi-.js} +1 -1
- package/dist/{action-runtime-p0V390gA.js → action-runtime-CHU7xb6o.js} +2 -2
- package/dist/action-runtime-api.js +1 -1
- package/dist/action-runtime.runtime.js +1 -1
- package/dist/{active-listener-BbdlXooT.js → active-listener-BEjWsCNM.js} +1 -1
- package/dist/api.js +12 -15
- package/dist/{approval-handler.runtime-BO1oJ-b8.js → approval-handler.runtime-C4ddB7Kc.js} +4 -4
- package/dist/{approval-reactions-CrZFAyf-.js → approval-reactions-P2HXjmln.js} +3 -3
- package/dist/{auth-store-BQi9pZqQ.js → auth-store-DirYMTbo.js} +4 -3
- package/dist/call-tool-api.js +4 -4
- package/dist/{channel-B2I4Opzb.js → channel-B9xjrOGG.js} +28 -19
- package/dist/channel-config-api.js +1 -1
- package/dist/channel-plugin-api.js +1 -1
- package/dist/{channel-react-action-CPRQE-s3.js → channel-react-action-CBW-PA8q.js} +10 -13
- package/dist/{channel.runtime-CjkhQzk8.js → channel.runtime-DdKuhlNu.js} +5 -5
- package/dist/{channel.setup-BMWE9LmN.js → channel.setup-DXUCPHel.js} +3 -6
- package/dist/{config-schema-BZ8h1hWA.js → config-schema-C6IeKIC0.js} +6 -0
- package/dist/{connection-controller-HGaffeFb.js → connection-controller-BVRExqrB.js} +8 -10
- package/dist/{connection-controller-runtime-context-9mEeAvu1.js → connection-controller-runtime-context-DG0tuYuw.js} +3 -3
- package/dist/contract-api.js +1 -1
- package/dist/{directory-config-BZ775eGX.js → directory-config-BTbJkV1W.js} +5 -5
- package/dist/directory-contract-api.js +1 -1
- package/dist/doctor-CwzVXKoE.js +10 -0
- package/dist/doctor-contract-api.js +35 -79
- package/dist/{group-session-key-Dh8WZun_.js → group-session-key-DJSdYfnb.js} +9 -4
- package/dist/{identity-D7L8LCuH.js → identity-BM4_wZeM.js} +2 -2
- package/dist/light-runtime-api.js +2 -2
- package/dist/{login-ifOXCBjo.js → login-BKUm7KSk.js} +6 -7
- package/dist/{login-qr-DUHzVH_Y.js → login-qr-DagJvMbg.js} +7 -8
- package/dist/login-qr-runtime.js +1 -1
- package/dist/{monitor-_jqDKBXj.js → monitor-CBVNJ2lb.js} +206 -232
- package/dist/{question-reactions-C0qJ6wGA.js → question-reactions-CaOrSYzU.js} +1 -1
- package/dist/runtime-BLlToOi6.js +21 -0
- package/dist/runtime-api.js +10 -10
- package/dist/runtime-setter-api.js +1 -1
- package/dist/{send-SB-4JrVZ.js → send-DhJVN30g.js} +38 -84
- package/dist/{send-api-BG0MgoFI.js → send-api-CpHwbor_.js} +39 -33
- package/dist/{setup-finalize-Cc-4iWGj.js → setup-finalize-9XzKdFq6.js} +3 -3
- package/dist/setup-plugin-api.js +1 -1
- package/dist/{setup-surface-DhnXEZir.js → setup-surface-Kv3mPki2.js} +3 -3
- package/dist/{setup-core-BbIgEl2M.js → shared-CuqHFnKd.js} +78 -56
- package/dist/{socket-close-jNGyZY4T.js → socket-close-BoSHhQNJ.js} +5 -6
- package/dist/{targets-runtime-Bsh0HR9y.js → targets-runtime-CKFrhoX4.js} +142 -29
- package/dist/text-runtime-CU_IlbK5.js +4 -0
- package/node_modules/@protobufjs/utf8/CHANGELOG.md +8 -0
- package/node_modules/@protobufjs/utf8/index.js +29 -18
- package/node_modules/@protobufjs/utf8/package.json +2 -2
- package/node_modules/@protobufjs/utf8/tests/index.js +5 -0
- package/node_modules/@thi.ng/bitstream/package.json +4 -4
- package/node_modules/@thi.ng/errors/package.json +4 -4
- package/node_modules/@types/node/README.md +1 -1
- package/node_modules/@types/node/fs/promises.d.ts +16 -6
- package/node_modules/@types/node/package.json +2 -2
- package/node_modules/audio-type/package.json +3 -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 +11 -4
- package/node_modules/lru-cache/dist/commonjs/browser/index.js.map +1 -1
- package/node_modules/lru-cache/dist/commonjs/browser/index.min.js +1 -1
- package/node_modules/lru-cache/dist/commonjs/browser/index.min.js.map +3 -3
- package/node_modules/lru-cache/dist/commonjs/index.d.ts.map +1 -1
- package/node_modules/lru-cache/dist/commonjs/index.js +11 -4
- package/node_modules/lru-cache/dist/commonjs/index.js.map +1 -1
- package/node_modules/lru-cache/dist/commonjs/index.min.js +1 -1
- package/node_modules/lru-cache/dist/commonjs/index.min.js.map +3 -3
- package/node_modules/lru-cache/dist/commonjs/node/index.d.ts.map +1 -1
- package/node_modules/lru-cache/dist/commonjs/node/index.js +11 -4
- package/node_modules/lru-cache/dist/commonjs/node/index.js.map +1 -1
- package/node_modules/lru-cache/dist/commonjs/node/index.min.js +1 -1
- package/node_modules/lru-cache/dist/commonjs/node/index.min.js.map +3 -3
- package/node_modules/lru-cache/dist/esm/browser/index.d.ts.map +1 -1
- package/node_modules/lru-cache/dist/esm/browser/index.js +11 -4
- package/node_modules/lru-cache/dist/esm/browser/index.js.map +1 -1
- package/node_modules/lru-cache/dist/esm/browser/index.min.js +1 -1
- package/node_modules/lru-cache/dist/esm/browser/index.min.js.map +3 -3
- package/node_modules/lru-cache/dist/esm/index.d.ts.map +1 -1
- package/node_modules/lru-cache/dist/esm/index.js +11 -4
- package/node_modules/lru-cache/dist/esm/index.js.map +1 -1
- package/node_modules/lru-cache/dist/esm/index.min.js +1 -1
- package/node_modules/lru-cache/dist/esm/index.min.js.map +3 -3
- package/node_modules/lru-cache/dist/esm/node/index.d.ts.map +1 -1
- package/node_modules/lru-cache/dist/esm/node/index.js +11 -4
- package/node_modules/lru-cache/dist/esm/node/index.js.map +1 -1
- package/node_modules/lru-cache/dist/esm/node/index.min.js +1 -1
- package/node_modules/lru-cache/dist/esm/node/index.min.js.map +3 -3
- package/node_modules/lru-cache/package.json +1 -1
- package/node_modules/music-metadata/lib/common/Util.d.ts +1 -1
- package/node_modules/music-metadata/lib/common/Util.js +7 -1
- package/node_modules/music-metadata/lib/id3v2/FrameHeader.js +23 -3
- package/node_modules/music-metadata/lib/id3v2/FrameParser.js +2 -2
- package/node_modules/music-metadata/lib/id3v2/ID3v2Token.js +1 -1
- package/node_modules/music-metadata/lib/mp4/AtomToken.js +38 -13
- package/node_modules/music-metadata/lib/mpeg/MpegParser.js +1 -1
- package/node_modules/music-metadata/package.json +6 -6
- package/node_modules/p-queue/dist/index.js +17 -6
- package/node_modules/p-queue/package.json +1 -1
- package/node_modules/protobufjs/dist/light/protobuf.js +145 -188
- package/node_modules/protobufjs/dist/light/protobuf.js.map +1 -1
- package/node_modules/protobufjs/dist/light/protobuf.min.js +3 -3
- package/node_modules/protobufjs/dist/light/protobuf.min.js.map +1 -1
- package/node_modules/protobufjs/dist/minimal/protobuf.js +33 -76
- package/node_modules/protobufjs/dist/minimal/protobuf.js.map +1 -1
- package/node_modules/protobufjs/dist/minimal/protobuf.min.js +3 -3
- package/node_modules/protobufjs/dist/minimal/protobuf.min.js.map +1 -1
- package/node_modules/protobufjs/dist/protobuf.js +168 -208
- package/node_modules/protobufjs/dist/protobuf.js.map +1 -1
- package/node_modules/protobufjs/dist/protobuf.min.js +3 -3
- package/node_modules/protobufjs/dist/protobuf.min.js.map +1 -1
- package/node_modules/protobufjs/index.d.ts +0 -8
- package/node_modules/protobufjs/package.json +2 -3
- package/node_modules/protobufjs/src/parse.js +3 -0
- package/node_modules/protobufjs/src/util/minimal.js +0 -3
- package/node_modules/typebox/build/compile/validator.d.mts +1 -4
- package/node_modules/typebox/build/guard/guard.d.mts +1 -1
- package/node_modules/typebox/build/guard/guard.mjs +5 -2
- package/node_modules/typebox/build/guard/string.mjs +16 -4
- package/node_modules/typebox/build/schema/engine/_functions.mjs +34 -15
- package/node_modules/typebox/build/type/action/readonly_object.d.mts +5 -0
- package/node_modules/typebox/build/type/action/readonly_object.mjs +8 -0
- package/node_modules/typebox/build/typebox.d.mts +1 -1
- package/node_modules/typebox/build/typebox.mjs +1 -1
- package/node_modules/typebox/package.json +1 -1
- package/node_modules/typebox/readme.md +29 -32
- package/node_modules/ws/lib/receiver.js +15 -32
- package/node_modules/ws/lib/websocket-server.js +4 -4
- package/node_modules/ws/lib/websocket.js +4 -4
- package/node_modules/ws/package.json +5 -1
- package/npm-shrinkwrap.json +41 -45
- package/openclaw.plugin.json +139 -179
- package/package.json +21 -11
- package/dist/doctor-By3SB4lm.js +0 -48
- package/dist/runtime-BfAdAEYT.js +0 -8
- package/dist/text-runtime-BTGkMN0o.js +0 -4
- package/node_modules/@protobufjs/inquire/CHANGELOG.md +0 -8
- package/node_modules/@protobufjs/inquire/LICENSE +0 -26
- package/node_modules/@protobufjs/inquire/README.md +0 -13
- package/node_modules/@protobufjs/inquire/index.d.ts +0 -10
- package/node_modules/@protobufjs/inquire/index.js +0 -38
- package/node_modules/@protobufjs/inquire/package.json +0 -21
- package/node_modules/@protobufjs/inquire/tests/data/array.js +0 -1
- package/node_modules/@protobufjs/inquire/tests/data/emptyArray.js +0 -1
- package/node_modules/@protobufjs/inquire/tests/data/emptyObject.js +0 -1
- package/node_modules/@protobufjs/inquire/tests/data/object.js +0 -1
- package/node_modules/@protobufjs/inquire/tests/index.js +0 -20
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-D7D4PA-g.js";
|
|
2
|
-
import { a as resolveWhatsAppAccount } from "./accounts-
|
|
2
|
+
import { a as resolveWhatsAppAccount } from "./accounts-CxPuEFi-.js";
|
|
3
3
|
import { questionGatewayRuntime } from "openclaw/plugin-sdk/question-gateway-runtime";
|
|
4
4
|
//#region extensions/whatsapp/src/question-reactions.ts
|
|
5
5
|
var question_reactions_exports = /* @__PURE__ */ __exportAll({
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { createPluginRuntimeStore } from "openclaw/plugin-sdk/runtime-store";
|
|
2
|
+
//#region extensions/whatsapp/src/runtime.ts
|
|
3
|
+
const runtimeStore = createPluginRuntimeStore({
|
|
4
|
+
pluginId: "whatsapp",
|
|
5
|
+
errorMessage: "WhatsApp runtime not initialized"
|
|
6
|
+
});
|
|
7
|
+
const channelRuntimeStore = createPluginRuntimeStore({
|
|
8
|
+
key: "plugin-runtime:whatsapp:channel-context-owner",
|
|
9
|
+
errorMessage: "WhatsApp channel runtime not initialized"
|
|
10
|
+
});
|
|
11
|
+
/** Injects current helpers while preserving the process-lifetime channel context owner. */
|
|
12
|
+
function setWhatsAppRuntime(next) {
|
|
13
|
+
if (!channelRuntimeStore.tryGetRuntime()) channelRuntimeStore.setRuntime(next.channel);
|
|
14
|
+
runtimeStore.setRuntime(next);
|
|
15
|
+
}
|
|
16
|
+
const getWhatsAppRuntime = runtimeStore.getRuntime;
|
|
17
|
+
const getOptionalWhatsAppRuntime = runtimeStore.tryGetRuntime;
|
|
18
|
+
const getWhatsAppChannelRuntime = channelRuntimeStore.getRuntime;
|
|
19
|
+
const getOptionalWhatsAppChannelRuntime = channelRuntimeStore.tryGetRuntime;
|
|
20
|
+
//#endregion
|
|
21
|
+
export { setWhatsAppRuntime as a, getWhatsAppRuntime as i, getOptionalWhatsAppRuntime as n, getWhatsAppChannelRuntime as r, getOptionalWhatsAppChannelRuntime as t };
|
package/dist/runtime-api.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { o as resolveWebCredsBackupPath, r as hasWebCredsSync, s as resolveWebCredsPath } from "./creds-files-B1kSWtBg.js";
|
|
2
|
-
import { n as whatsAppActionRuntime, t as handleWhatsAppAction } from "./action-runtime-
|
|
3
|
-
import { i as sendTypingWhatsApp, n as sendPollWhatsApp, r as sendReactionWhatsApp, t as sendMessageWhatsApp } from "./send-
|
|
4
|
-
import {
|
|
2
|
+
import { n as whatsAppActionRuntime, t as handleWhatsAppAction } from "./action-runtime-CHU7xb6o.js";
|
|
3
|
+
import { i as sendTypingWhatsApp, n as sendPollWhatsApp, r as sendReactionWhatsApp, t as sendMessageWhatsApp } from "./send-DhJVN30g.js";
|
|
4
|
+
import { a as setWhatsAppRuntime } from "./runtime-BLlToOi6.js";
|
|
5
5
|
import { startWebLoginWithQr, waitForWebLogin } from "./login-qr-runtime.js";
|
|
6
6
|
import { t as createWhatsAppLoginTool } from "./agent-tools-login-DfyToBpG.js";
|
|
7
|
-
import { C as waitForCredsSaveQueue, T as writeCredsJsonAtomically, _ as readWebSelfIdentity, a as formatWhatsAppWebAuthStatusState, b as restoreCredsFromBackupIfNeeded, c as logoutWeb, d as readWebAuthExistsBestEffort, f as readWebAuthExistsForDecision, g as readWebSelfId, h as readWebAuthState, l as pickWebChannel, m as readWebAuthSnapshotBestEffort, n as WHATSAPP_AUTH_UNSTABLE_CODE, o as getWebAuthAgeMs, p as readWebAuthSnapshot, r as WhatsAppAuthUnstableError, s as logWebSelfId, t as WA_WEB_AUTH_DIR, u as readCredsJsonRaw, v as readWebSelfIdentityForDecision, w as waitForCredsSaveQueueWithTimeout, x as webAuthExists, y as resolveDefaultWebAuthDir } from "./auth-store-
|
|
7
|
+
import { C as waitForCredsSaveQueue, T as writeCredsJsonAtomically, _ as readWebSelfIdentity, a as formatWhatsAppWebAuthStatusState, b as restoreCredsFromBackupIfNeeded, c as logoutWeb, d as readWebAuthExistsBestEffort, f as readWebAuthExistsForDecision, g as readWebSelfId, h as readWebAuthState, l as pickWebChannel, m as readWebAuthSnapshotBestEffort, n as WHATSAPP_AUTH_UNSTABLE_CODE, o as getWebAuthAgeMs, p as readWebAuthSnapshot, r as WhatsAppAuthUnstableError, s as logWebSelfId, t as WA_WEB_AUTH_DIR, u as readCredsJsonRaw, v as readWebSelfIdentityForDecision, w as waitForCredsSaveQueueWithTimeout, x as webAuthExists, y as resolveDefaultWebAuthDir } from "./auth-store-DirYMTbo.js";
|
|
8
8
|
import { t as DEFAULT_WEB_MEDIA_BYTES } from "./constants-HU41RHGI.js";
|
|
9
|
-
import { n as resolveWebAccountId, t as getActiveWebListener } from "./active-listener-
|
|
10
|
-
import { a as waitForWaConnection, i as newConnectionId, r as createWaSocket } from "./socket-close-
|
|
9
|
+
import { n as resolveWebAccountId, t as getActiveWebListener } from "./active-listener-BEjWsCNM.js";
|
|
10
|
+
import { a as waitForWaConnection, i as newConnectionId, r as createWaSocket } from "./socket-close-BoSHhQNJ.js";
|
|
11
11
|
import { n as getStatusCode, t as formatError } from "./session-errors-JuazczrA.js";
|
|
12
|
-
import {
|
|
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-
|
|
12
|
+
import { g as extractLocationData, p as extractContactContext, y as extractText } from "./send-api-CpHwbor_.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-CBVNJ2lb.js";
|
|
14
|
+
import { t as loginWeb } from "./login-BKUm7KSk.js";
|
|
15
15
|
import { HEARTBEAT_PROMPT, HEARTBEAT_TOKEN, SILENT_REPLY_TOKEN, stripHeartbeatToken } from "openclaw/plugin-sdk/reply-runtime";
|
|
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,
|
|
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, 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,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { a as setWhatsAppRuntime } from "./runtime-BLlToOi6.js";
|
|
2
2
|
export { setWhatsAppRuntime };
|
|
@@ -1,28 +1,27 @@
|
|
|
1
|
-
import { a as resolveWhatsAppAccount, c as resolveMergedWhatsAppAccountConfig, s as resolveWhatsAppMediaMaxBytes } from "./accounts-
|
|
1
|
+
import { a as resolveWhatsAppAccount, c as resolveMergedWhatsAppAccountConfig, s as resolveWhatsAppMediaMaxBytes } from "./accounts-CxPuEFi-.js";
|
|
2
2
|
import { r as resolveDefaultWhatsAppAccountId } from "./account-ids-CB5SOWjc.js";
|
|
3
3
|
import { n as isWhatsAppNewsletterJid } from "./normalize-target-DSZnHkKF.js";
|
|
4
|
-
import { r as getWhatsAppConnectionController } from "./connection-controller-runtime-context-
|
|
4
|
+
import { r as getWhatsAppConnectionController } from "./connection-controller-runtime-context-DG0tuYuw.js";
|
|
5
5
|
import "./normalize-C-Z16y7Q.js";
|
|
6
|
-
import {
|
|
7
|
-
import { a as
|
|
6
|
+
import { a as markdownToWhatsAppChunks, c as toWhatsappJid } from "./targets-runtime-CKFrhoX4.js";
|
|
7
|
+
import { a as stripToolCallXmlTags, i as sanitizeAssistantVisibleTextWithProfile, r as sanitizeAssistantVisibleText } from "./text-runtime-CU_IlbK5.js";
|
|
8
8
|
import path from "node:path";
|
|
9
9
|
import { normalizeUniqueStringEntries } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
10
|
-
import { writeExternalFileWithinRoot } from "openclaw/plugin-sdk/security-runtime";
|
|
11
10
|
import { resolveReactionLevel } from "openclaw/plugin-sdk/status-helpers";
|
|
12
11
|
import { formatCliCommand } from "openclaw/plugin-sdk/cli-runtime";
|
|
13
12
|
import { generateSecureUuid } from "openclaw/plugin-sdk/core";
|
|
14
13
|
import { PlatformMessageNotDispatchedError } from "openclaw/plugin-sdk/error-runtime";
|
|
15
14
|
import { redactIdentifier } from "openclaw/plugin-sdk/logging-core";
|
|
16
|
-
import {
|
|
15
|
+
import { resolveMarkdownTableMode } from "openclaw/plugin-sdk/markdown-table-runtime";
|
|
16
|
+
import { loadOutboundMediaFromUrl } from "openclaw/plugin-sdk/outbound-media";
|
|
17
17
|
import { requireRuntimeConfig } from "openclaw/plugin-sdk/plugin-config-runtime";
|
|
18
18
|
import { normalizePollInput } from "openclaw/plugin-sdk/poll-runtime";
|
|
19
|
+
import { resolveChunkMode, resolveTextChunkLimit } from "openclaw/plugin-sdk/reply-chunking";
|
|
19
20
|
import { createSubsystemLogger, getChildLogger as getChildLogger$1 } from "openclaw/plugin-sdk/runtime-env";
|
|
20
|
-
import { extensionForMime } from "openclaw/plugin-sdk/media-mime";
|
|
21
|
+
import { extensionForMime, mediaKindFromMime, normalizeMimeType } from "openclaw/plugin-sdk/media-mime";
|
|
21
22
|
import { sanitizeForPlainText } from "openclaw/plugin-sdk/channel-outbound";
|
|
22
|
-
import { MEDIA_FFMPEG_MAX_AUDIO_DURATION_SECS,
|
|
23
|
+
import { MEDIA_FFMPEG_MAX_AUDIO_DURATION_SECS, transcodeAudioBufferToOpus } from "openclaw/plugin-sdk/media-runtime";
|
|
23
24
|
import { resolveOutboundMediaUrls } from "openclaw/plugin-sdk/reply-payload";
|
|
24
|
-
import { resolvePreferredOpenClawTmpDir, withTempWorkspace } from "openclaw/plugin-sdk/temp-path";
|
|
25
|
-
import { loadWebMedia } from "openclaw/plugin-sdk/web-media";
|
|
26
25
|
//#region extensions/whatsapp/src/reaction-level.ts
|
|
27
26
|
/** Resolve the effective reaction level and its implications for WhatsApp. */
|
|
28
27
|
function resolveWhatsAppReactionLevel(params) {
|
|
@@ -95,11 +94,8 @@ function normalizeWhatsAppOutboundPayload(payload, options) {
|
|
|
95
94
|
}
|
|
96
95
|
function inferWhatsAppMediaKind(media) {
|
|
97
96
|
if (media.kind === "image" || media.kind === "audio" || media.kind === "video" || media.kind === "document") return media.kind;
|
|
98
|
-
const
|
|
99
|
-
|
|
100
|
-
if (contentType.startsWith("audio/")) return "audio";
|
|
101
|
-
if (contentType.startsWith("video/")) return "video";
|
|
102
|
-
return "document";
|
|
97
|
+
const inferredKind = mediaKindFromMime(normalizeMimeType(media.contentType));
|
|
98
|
+
return !inferredKind || inferredKind === "sticker" || inferredKind === "unknown" ? "document" : inferredKind;
|
|
103
99
|
}
|
|
104
100
|
function normalizeWhatsAppLoadedMedia(media, mediaUrl) {
|
|
105
101
|
const kind = inferWhatsAppMediaKind(media);
|
|
@@ -135,55 +131,23 @@ async function prepareWhatsAppOutboundMedia(media, mediaUrl) {
|
|
|
135
131
|
mimetype: WHATSAPP_VOICE_MIMETYPE
|
|
136
132
|
};
|
|
137
133
|
}
|
|
138
|
-
function normalizeContentType(value) {
|
|
139
|
-
return value?.split(";", 1)[0]?.trim().toLowerCase() ?? "";
|
|
140
|
-
}
|
|
141
134
|
function isWhatsAppNativeVoiceAudio(params) {
|
|
142
|
-
const contentType =
|
|
135
|
+
const contentType = normalizeMimeType(params.contentType);
|
|
143
136
|
if (contentType === "audio/ogg" || contentType === "audio/opus") return true;
|
|
144
137
|
const fileName = params.fileName ?? deriveWhatsAppDocumentFileName(params.mediaUrl) ?? "";
|
|
145
138
|
const ext = path.extname(fileName).toLowerCase();
|
|
146
139
|
return ext === ".ogg" || ext === ".opus";
|
|
147
140
|
}
|
|
148
141
|
async function transcodeToWhatsAppVoiceOpus(params) {
|
|
149
|
-
return await
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
path: WHATSAPP_VOICE_FILE_NAME,
|
|
159
|
-
write: async (outputPath) => {
|
|
160
|
-
await runFfmpeg([
|
|
161
|
-
"-hide_banner",
|
|
162
|
-
"-loglevel",
|
|
163
|
-
"error",
|
|
164
|
-
"-y",
|
|
165
|
-
"-i",
|
|
166
|
-
inputPath,
|
|
167
|
-
"-vn",
|
|
168
|
-
"-sn",
|
|
169
|
-
"-dn",
|
|
170
|
-
"-t",
|
|
171
|
-
String(MEDIA_FFMPEG_MAX_AUDIO_DURATION_SECS),
|
|
172
|
-
"-ar",
|
|
173
|
-
String(WHATSAPP_VOICE_SAMPLE_RATE_HZ),
|
|
174
|
-
"-ac",
|
|
175
|
-
"1",
|
|
176
|
-
"-c:a",
|
|
177
|
-
"libopus",
|
|
178
|
-
"-b:a",
|
|
179
|
-
WHATSAPP_VOICE_BITRATE,
|
|
180
|
-
"-f",
|
|
181
|
-
"ogg",
|
|
182
|
-
outputPath
|
|
183
|
-
]);
|
|
184
|
-
}
|
|
185
|
-
});
|
|
186
|
-
return await workspace.read(WHATSAPP_VOICE_FILE_NAME);
|
|
142
|
+
return await transcodeAudioBufferToOpus({
|
|
143
|
+
audioBuffer: params.buffer,
|
|
144
|
+
inputFileName: params.fileName,
|
|
145
|
+
tempPrefix: "whatsapp-voice-",
|
|
146
|
+
outputFileName: WHATSAPP_VOICE_FILE_NAME,
|
|
147
|
+
maxDurationSeconds: MEDIA_FFMPEG_MAX_AUDIO_DURATION_SECS,
|
|
148
|
+
sampleRateHz: WHATSAPP_VOICE_SAMPLE_RATE_HZ,
|
|
149
|
+
channels: 1,
|
|
150
|
+
bitrate: WHATSAPP_VOICE_BITRATE
|
|
187
151
|
});
|
|
188
152
|
}
|
|
189
153
|
function deriveWhatsAppDocumentFileName(mediaUrl) {
|
|
@@ -197,25 +161,6 @@ function deriveWhatsAppDocumentFileName(mediaUrl) {
|
|
|
197
161
|
}
|
|
198
162
|
}
|
|
199
163
|
//#endregion
|
|
200
|
-
//#region extensions/whatsapp/src/outbound-media.runtime.ts
|
|
201
|
-
async function loadOutboundMediaFromUrl(mediaUrl, options = {}) {
|
|
202
|
-
const readFile = options.mediaAccess?.readFile ?? options.mediaReadFile;
|
|
203
|
-
const localRoots = options.mediaAccess?.localRoots?.length && options.mediaAccess.localRoots.length > 0 ? options.mediaAccess.localRoots : options.mediaLocalRoots && options.mediaLocalRoots.length > 0 ? options.mediaLocalRoots : void 0;
|
|
204
|
-
const sharedOptions = {
|
|
205
|
-
...options.maxBytes !== void 0 ? { maxBytes: options.maxBytes } : {},
|
|
206
|
-
...options.optimizeImages !== void 0 ? { optimizeImages: options.optimizeImages } : {}
|
|
207
|
-
};
|
|
208
|
-
return await loadWebMedia(mediaUrl, readFile ? {
|
|
209
|
-
...sharedOptions,
|
|
210
|
-
localRoots: "any",
|
|
211
|
-
readFile,
|
|
212
|
-
hostReadCapability: true
|
|
213
|
-
} : {
|
|
214
|
-
...sharedOptions,
|
|
215
|
-
...localRoots ? { localRoots } : {}
|
|
216
|
-
});
|
|
217
|
-
}
|
|
218
|
-
//#endregion
|
|
219
164
|
//#region extensions/whatsapp/src/send.ts
|
|
220
165
|
const outboundLog = createSubsystemLogger("gateway/channels/whatsapp").child("outbound");
|
|
221
166
|
function supportsForcedDocumentDelivery(kind) {
|
|
@@ -295,8 +240,14 @@ async function sendMessageWhatsApp(to, body, options) {
|
|
|
295
240
|
channel: "whatsapp",
|
|
296
241
|
accountId: resolvedAccountId ?? options.accountId
|
|
297
242
|
});
|
|
298
|
-
|
|
299
|
-
|
|
243
|
+
const accountIdForFormatting = resolvedAccountId ?? options.accountId;
|
|
244
|
+
const textLimit = Math.min(resolveTextChunkLimit(cfg, "whatsapp", accountIdForFormatting, { fallbackLimit: 4e3 }), 4096);
|
|
245
|
+
const textChunks = markdownToWhatsAppChunks(text, textLimit, tableMode, resolveChunkMode(cfg, "whatsapp", accountIdForFormatting));
|
|
246
|
+
text = textChunks.shift() ?? "";
|
|
247
|
+
if (!text && !hasMedia) return {
|
|
248
|
+
messageId: "",
|
|
249
|
+
toJid: jid
|
|
250
|
+
};
|
|
300
251
|
const redactedTo = redactIdentifier(to);
|
|
301
252
|
const logger = getChildLogger$1({
|
|
302
253
|
module: "web-outbound",
|
|
@@ -352,16 +303,19 @@ async function sendMessageWhatsApp(to, body, options) {
|
|
|
352
303
|
const result = sendOptions ? await active.sendMessage(to, text, mediaBuffer, mediaType, sendOptions) : await active.sendMessage(to, text, mediaBuffer, mediaType);
|
|
353
304
|
const messageId = result?.messageId ?? "unknown";
|
|
354
305
|
const sentRemoteJid = resolveActualSentRemoteJid(result, jid);
|
|
355
|
-
|
|
306
|
+
const trailingTextChunks = [visibleTextAfterVoice, ...textChunks].filter((chunk) => Boolean(chunk));
|
|
307
|
+
if (trailingTextChunks.length > 0) {
|
|
356
308
|
await options.onDeliveryResult?.({
|
|
357
309
|
messageId,
|
|
358
310
|
toJid: sentRemoteJid
|
|
359
311
|
});
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
312
|
+
for (const trailingText of trailingTextChunks) {
|
|
313
|
+
const trailingResult = sendOptions ? await active.sendMessage(to, trailingText, void 0, void 0, sendOptions) : await active.sendMessage(to, trailingText, void 0, void 0);
|
|
314
|
+
await options.onDeliveryResult?.({
|
|
315
|
+
messageId: trailingResult?.messageId ?? "unknown",
|
|
316
|
+
toJid: resolveActualSentRemoteJid(trailingResult, jid)
|
|
317
|
+
});
|
|
318
|
+
}
|
|
365
319
|
}
|
|
366
320
|
const durationMs = Date.now() - startedAt;
|
|
367
321
|
outboundLog.info(`Sent message ${messageId} -> ${redactedJid}${hasMedia ? " (media)" : ""} (${durationMs}ms)`);
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { n as isWhatsAppNewsletterJid } from "./normalize-target-DSZnHkKF.js";
|
|
2
|
-
import { l as resolveWhatsAppDocumentFileName } from "./send-
|
|
2
|
+
import { l as resolveWhatsAppDocumentFileName } from "./send-DhJVN30g.js";
|
|
3
3
|
import "./normalize-C-Z16y7Q.js";
|
|
4
|
-
import { c as
|
|
5
|
-
import "./text-runtime-
|
|
6
|
-
import { i as buildQuotedMessageOptions } from "./group-session-key-
|
|
7
|
-
import { c as resolveComparableIdentity } from "./identity-
|
|
4
|
+
import { c as toWhatsappJid, l as toWhatsappJidWithLid, r as jidToE164 } from "./targets-runtime-CKFrhoX4.js";
|
|
5
|
+
import "./text-runtime-CU_IlbK5.js";
|
|
6
|
+
import { i as buildQuotedMessageOptions } from "./group-session-key-DJSdYfnb.js";
|
|
7
|
+
import { c as resolveComparableIdentity } from "./identity-BM4_wZeM.js";
|
|
8
8
|
import { normalizeLowercaseStringOrEmpty, normalizeStringEntries, uniqueStrings } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
9
9
|
import { logVerbose } from "openclaw/plugin-sdk/runtime-env";
|
|
10
10
|
import { createMessageReceiptFromOutboundResults, listMessageReceiptPlatformIds } from "openclaw/plugin-sdk/channel-outbound";
|
|
11
11
|
import { getImageMetadata, resizeToJpeg } from "openclaw/plugin-sdk/media-runtime";
|
|
12
|
-
import { DisconnectReason, downloadMediaMessage, extractMessageContent, getContentType, isJidGroup, normalizeMessageContent, normalizeMessageContent as normalizeMessageContent$1 } from "baileys";
|
|
13
12
|
import { formatLocationText } from "openclaw/plugin-sdk/channel-inbound";
|
|
13
|
+
import { DisconnectReason, downloadMediaMessage, extractMessageContent, getContentType, isJidGroup, normalizeMessageContent, normalizeMessageContent as normalizeMessageContent$1 } from "baileys";
|
|
14
14
|
import { recordChannelActivity } from "openclaw/plugin-sdk/channel-activity-runtime";
|
|
15
15
|
//#region extensions/whatsapp/src/vcard.ts
|
|
16
16
|
const ALLOWED_VCARD_KEYS = /* @__PURE__ */ new Set([
|
|
@@ -73,6 +73,20 @@ function normalizeVcardPhone(value) {
|
|
|
73
73
|
return trimmed;
|
|
74
74
|
}
|
|
75
75
|
//#endregion
|
|
76
|
+
//#region extensions/whatsapp/src/inbound/media-mimetype.ts
|
|
77
|
+
/**
|
|
78
|
+
* Resolve the MIME type for an inbound media message.
|
|
79
|
+
* Falls back to WhatsApp's standard formats when Baileys omits the MIME.
|
|
80
|
+
*/
|
|
81
|
+
function resolveInboundMediaMimetype(message) {
|
|
82
|
+
const explicit = message.imageMessage?.mimetype ?? message.videoMessage?.mimetype ?? message.documentMessage?.mimetype ?? message.audioMessage?.mimetype ?? message.stickerMessage?.mimetype ?? void 0;
|
|
83
|
+
if (explicit) return explicit;
|
|
84
|
+
if (message.audioMessage) return "audio/ogg; codecs=opus";
|
|
85
|
+
if (message.imageMessage) return "image/jpeg";
|
|
86
|
+
if (message.videoMessage) return "video/mp4";
|
|
87
|
+
if (message.stickerMessage) return "image/webp";
|
|
88
|
+
}
|
|
89
|
+
//#endregion
|
|
76
90
|
//#region extensions/whatsapp/src/inbound/extract.ts
|
|
77
91
|
function getFutureProofInnerMessage(message) {
|
|
78
92
|
const contentType = getContentType(message);
|
|
@@ -170,14 +184,14 @@ function extractExternalAdReplyContext(rawMessage) {
|
|
|
170
184
|
body
|
|
171
185
|
} : void 0;
|
|
172
186
|
}
|
|
173
|
-
function
|
|
187
|
+
function extractMediaKind(rawMessage) {
|
|
174
188
|
const message = unwrapMessage(rawMessage);
|
|
175
189
|
if (!message) return;
|
|
176
|
-
if (message.imageMessage) return "
|
|
177
|
-
if (message.videoMessage) return
|
|
178
|
-
if (message.audioMessage) return "
|
|
179
|
-
if (message.documentMessage) return "
|
|
180
|
-
if (message.stickerMessage) return "
|
|
190
|
+
if (message.imageMessage) return "image";
|
|
191
|
+
if (message.videoMessage) return "video";
|
|
192
|
+
if (message.audioMessage) return "audio";
|
|
193
|
+
if (message.documentMessage) return "document";
|
|
194
|
+
if (message.stickerMessage) return "sticker";
|
|
181
195
|
}
|
|
182
196
|
function extractContactPlaceholder(rawMessage) {
|
|
183
197
|
const contactContext = extractContactContext(rawMessage);
|
|
@@ -275,9 +289,13 @@ function describeReplyContext(rawMessage) {
|
|
|
275
289
|
if (!quoted) return null;
|
|
276
290
|
const location = extractLocationData(quoted);
|
|
277
291
|
const locationText = location ? formatLocationText(location) : void 0;
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
292
|
+
const body = [extractText(quoted), locationText].filter(Boolean).join("\n").trim();
|
|
293
|
+
const mediaKind = extractMediaKind(quoted);
|
|
294
|
+
const media = mediaKind ? {
|
|
295
|
+
kind: mediaKind,
|
|
296
|
+
contentType: resolveInboundMediaMimetype(quoted)
|
|
297
|
+
} : void 0;
|
|
298
|
+
if (!body && !media) {
|
|
281
299
|
const quotedType = quoted ? getContentType(quoted) : void 0;
|
|
282
300
|
logVerbose(`Quoted message missing extractable body${quotedType ? ` (type ${quotedType})` : ""}`);
|
|
283
301
|
return null;
|
|
@@ -289,7 +307,8 @@ function describeReplyContext(rawMessage) {
|
|
|
289
307
|
});
|
|
290
308
|
return {
|
|
291
309
|
id: contextInfo?.stanzaId || void 0,
|
|
292
|
-
body,
|
|
310
|
+
body: body ?? "",
|
|
311
|
+
media,
|
|
293
312
|
sender
|
|
294
313
|
};
|
|
295
314
|
}
|
|
@@ -307,26 +326,12 @@ function hasInteractiveResponseContent(message) {
|
|
|
307
326
|
function hasInboundUserContent(rawMessage) {
|
|
308
327
|
if (!rawMessage) return false;
|
|
309
328
|
if (extractText(rawMessage)) return true;
|
|
310
|
-
if (
|
|
329
|
+
if (extractMediaKind(rawMessage)) return true;
|
|
311
330
|
if (extractLocationData(rawMessage)) return true;
|
|
312
331
|
for (const candidate of buildMessageChain(rawMessage)) if (hasInteractiveResponseContent(candidate)) return true;
|
|
313
332
|
return false;
|
|
314
333
|
}
|
|
315
334
|
//#endregion
|
|
316
|
-
//#region extensions/whatsapp/src/inbound/media-mimetype.ts
|
|
317
|
-
/**
|
|
318
|
-
* Resolve the MIME type for an inbound media message.
|
|
319
|
-
* Falls back to WhatsApp's standard formats when Baileys omits the MIME.
|
|
320
|
-
*/
|
|
321
|
-
function resolveInboundMediaMimetype(message) {
|
|
322
|
-
const explicit = message.imageMessage?.mimetype ?? message.videoMessage?.mimetype ?? message.documentMessage?.mimetype ?? message.audioMessage?.mimetype ?? message.stickerMessage?.mimetype ?? void 0;
|
|
323
|
-
if (explicit) return explicit;
|
|
324
|
-
if (message.audioMessage) return "audio/ogg; codecs=opus";
|
|
325
|
-
if (message.imageMessage) return "image/jpeg";
|
|
326
|
-
if (message.videoMessage) return "video/mp4";
|
|
327
|
-
if (message.stickerMessage) return "image/webp";
|
|
328
|
-
}
|
|
329
|
-
//#endregion
|
|
330
335
|
//#region extensions/whatsapp/src/image-preview.ts
|
|
331
336
|
const WHATSAPP_IMAGE_THUMBNAIL_SIDE = 32;
|
|
332
337
|
const WHATSAPP_IMAGE_THUMBNAIL_QUALITY = 50;
|
|
@@ -673,7 +678,8 @@ function createWebSendApi(params) {
|
|
|
673
678
|
remoteJid: sendOptions?.quotedMessageKey?.remoteJid,
|
|
674
679
|
fromMe: sendOptions?.quotedMessageKey?.fromMe,
|
|
675
680
|
participant: sendOptions?.quotedMessageKey?.participant,
|
|
676
|
-
messageText: sendOptions?.quotedMessageKey?.messageText
|
|
681
|
+
messageText: sendOptions?.quotedMessageKey?.messageText,
|
|
682
|
+
media: sendOptions?.quotedMessageKey?.media
|
|
677
683
|
});
|
|
678
684
|
const results = [normalizeWhatsAppSendResult(quotedOpts ? await params.sock.sendMessage(jid, payload, quotedOpts) : await params.sock.sendMessage(jid, payload), mediaBuffer ? "media" : "text")];
|
|
679
685
|
if (shouldSendAudioText) {
|
|
@@ -735,4 +741,4 @@ function createWebSendApi(params) {
|
|
|
735
741
|
};
|
|
736
742
|
}
|
|
737
743
|
//#endregion
|
|
738
|
-
export {
|
|
744
|
+
export { extractMediaKind as _, mayContainWhatsAppOutboundMention as a, hasInboundUserContent as b, DisconnectReason as c, normalizeMessageContent$1 as d, describeReplyContext as f, extractLocationData as g, extractExternalAdReplyContext as h, addWhatsAppOutboundMentionsToContent as i, downloadMediaMessage as l, extractContextInfo as m, listWhatsAppSendResultMessageIds as n, resolveWhatsAppOutboundMentions as o, extractContactContext as p, normalizeWhatsAppSendResult as r, addWhatsAppImagePreviewFields as s, createWebSendApi as t, isJidGroup as u, extractMentionedJids as v, resolveInboundMediaMimetype as x, extractText as y };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { a as resolveWhatsAppAccount, o as resolveWhatsAppAuthDir } from "./accounts-
|
|
1
|
+
import { a as resolveWhatsAppAccount, o as resolveWhatsAppAuthDir } from "./accounts-CxPuEFi-.js";
|
|
2
2
|
import { r as resolveDefaultWhatsAppAccountId } from "./account-ids-CB5SOWjc.js";
|
|
3
3
|
import { r as hasWebCredsSync } from "./creds-files-B1kSWtBg.js";
|
|
4
4
|
import { a as normalizeWhatsAppAllowFromEntries, o as normalizeWhatsAppAllowFromEntry } from "./normalize-target-DSZnHkKF.js";
|
|
5
|
-
import {
|
|
5
|
+
import { r as whatsappSetupAdapter } from "./shared-CuqHFnKd.js";
|
|
6
6
|
import { DEFAULT_ACCOUNT_ID, createSetupTranslator, splitSetupEntries } from "openclaw/plugin-sdk/setup";
|
|
7
7
|
import { formatCliCommand, formatDocsLink } from "openclaw/plugin-sdk/setup-tools";
|
|
8
8
|
//#region extensions/whatsapp/src/setup-finalize.ts
|
|
@@ -295,7 +295,7 @@ async function finalizeWhatsAppSetup(params) {
|
|
|
295
295
|
};
|
|
296
296
|
let loginWeb;
|
|
297
297
|
try {
|
|
298
|
-
({loginWeb} = await import("./login-
|
|
298
|
+
({loginWeb} = await import("./login-BKUm7KSk.js").then((n) => n.n));
|
|
299
299
|
} catch (error) {
|
|
300
300
|
await reportLoginFailure(error);
|
|
301
301
|
}
|
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-DXUCPHel.js";
|
|
2
2
|
export { whatsappSetupPlugin };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { o as resolveWhatsAppAuthDir } from "./accounts-
|
|
1
|
+
import { o as resolveWhatsAppAuthDir } from "./accounts-CxPuEFi-.js";
|
|
2
2
|
import { t as listAccountIds } from "./account-ids-CB5SOWjc.js";
|
|
3
|
-
import { a as formatWhatsAppWebAuthStatusState, h as readWebAuthState } from "./auth-store-
|
|
3
|
+
import { a as formatWhatsAppWebAuthStatusState, h as readWebAuthState } from "./auth-store-DirYMTbo.js";
|
|
4
4
|
import { DEFAULT_ACCOUNT_ID, createSetupTranslator, setSetupChannelEnabled } from "openclaw/plugin-sdk/setup";
|
|
5
5
|
//#region extensions/whatsapp/src/setup-surface.ts
|
|
6
6
|
const t = createSetupTranslator();
|
|
@@ -36,7 +36,7 @@ const whatsappSetupWizard = {
|
|
|
36
36
|
},
|
|
37
37
|
resolveShouldPromptAccountIds: ({ shouldPromptAccountIds }) => shouldPromptAccountIds,
|
|
38
38
|
credentials: [],
|
|
39
|
-
finalize: async (params) => await (await import("./setup-finalize-
|
|
39
|
+
finalize: async (params) => await (await import("./setup-finalize-9XzKdFq6.js")).finalizeWhatsAppSetup(params),
|
|
40
40
|
disable: (cfg) => setSetupChannelEnabled(cfg, channel, false),
|
|
41
41
|
onAccountRecorded: (accountId, options) => {
|
|
42
42
|
options?.onAccountId?.(channel, accountId);
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { a as resolveWhatsAppAccount, n as hasAnyWhatsAppAuth } from "./accounts-
|
|
1
|
+
import { a as resolveWhatsAppAccount, n as hasAnyWhatsAppAuth } from "./accounts-CxPuEFi-.js";
|
|
2
2
|
import { r as resolveDefaultWhatsAppAccountId, t as listAccountIds } from "./account-ids-CB5SOWjc.js";
|
|
3
3
|
import { a as normalizeWhatsAppAllowFromEntries } from "./normalize-target-DSZnHkKF.js";
|
|
4
|
-
import { t as WhatsAppChannelConfigSchema } from "./config-schema-
|
|
5
|
-
import { n as whatsappDoctor } from "./doctor-
|
|
4
|
+
import { t as WhatsAppChannelConfigSchema } from "./config-schema-C6IeKIC0.js";
|
|
5
|
+
import { n as whatsappDoctor } from "./doctor-CwzVXKoE.js";
|
|
6
6
|
import { t as resolveWhatsAppConfigPath } from "./group-config-path-BGyzT9Lg.js";
|
|
7
7
|
import { t as resolveLegacyGroupSessionKey } from "./group-session-contract-DDnZSsJ1.js";
|
|
8
8
|
import { n as unsupportedSecretRefSurfacePatterns, t as collectUnsupportedSecretRefConfigCandidates } from "./security-contract-nAzD945y.js";
|
|
@@ -11,12 +11,24 @@ import { normalizeUniqueStringEntries } from "openclaw/plugin-sdk/string-coerce-
|
|
|
11
11
|
import { normalizeE164 } from "openclaw/plugin-sdk/account-resolution";
|
|
12
12
|
import { createChannelPluginBase } from "openclaw/plugin-sdk/core";
|
|
13
13
|
import { DEFAULT_ACCOUNT_ID } from "openclaw/plugin-sdk/account-id";
|
|
14
|
+
import { createLazyRuntimeModule } from "openclaw/plugin-sdk/lazy-runtime";
|
|
14
15
|
import { buildChannelGroupsScopeTree, collectOpenGroupPolicyRouteAllowlistWarnings, createAllowlistProviderGroupPolicyWarningCollector, resolveScopeRequireMention, resolveScopeToolsPolicy } from "openclaw/plugin-sdk/channel-policy";
|
|
16
|
+
import { defineChannelSetupContract } from "openclaw/plugin-sdk/channel-setup";
|
|
17
|
+
import { applyAccountNameToChannelSection, migrateBaseNameToDefaultAccount, normalizeAccountId as normalizeAccountId$1 } from "openclaw/plugin-sdk/setup";
|
|
15
18
|
import { describeAccountSnapshot } from "openclaw/plugin-sdk/account-helpers";
|
|
16
19
|
import { adaptScopedAccountAccessor, createScopedChannelConfigAdapter, createScopedDmSecurityResolver } from "openclaw/plugin-sdk/channel-config-helpers";
|
|
17
20
|
import { createDelegatedSetupWizardProxy } from "openclaw/plugin-sdk/setup-runtime";
|
|
18
21
|
import { readChannelAllowFromStore } from "openclaw/plugin-sdk/channel-pairing";
|
|
19
|
-
|
|
22
|
+
//#region extensions/whatsapp/src/channel-runtime-loader.ts
|
|
23
|
+
const loadWhatsAppAuthStore = createLazyRuntimeModule(() => import("./auth-store-DirYMTbo.js").then((n) => n.i));
|
|
24
|
+
async function isWhatsAppAuthConfigured(authDir) {
|
|
25
|
+
return await (await loadWhatsAppAuthStore()).readWebAuthState(authDir) === "linked";
|
|
26
|
+
}
|
|
27
|
+
const loadWhatsAppChannelRuntime = createLazyRuntimeModule(async () => {
|
|
28
|
+
await loadWhatsAppAuthStore();
|
|
29
|
+
return await import("./channel.runtime-DdKuhlNu.js");
|
|
30
|
+
});
|
|
31
|
+
//#endregion
|
|
20
32
|
//#region extensions/whatsapp/src/config-accessors.ts
|
|
21
33
|
function formatWhatsAppConfigAllowFromEntries(allowFrom) {
|
|
22
34
|
return normalizeWhatsAppAllowFromEntries(allowFrom);
|
|
@@ -41,6 +53,62 @@ function resolveWhatsAppGroupToolPolicy(params) {
|
|
|
41
53
|
});
|
|
42
54
|
}
|
|
43
55
|
//#endregion
|
|
56
|
+
//#region extensions/whatsapp/src/setup-core.ts
|
|
57
|
+
const channel = "whatsapp";
|
|
58
|
+
const whatsappSetupAdapter = {
|
|
59
|
+
singleAccountKeysToMove: ["authDir"],
|
|
60
|
+
resolveAccountId: ({ accountId }) => normalizeAccountId$1(accountId),
|
|
61
|
+
applyAccountName: ({ cfg, accountId, name }) => applyAccountNameToChannelSection({
|
|
62
|
+
cfg,
|
|
63
|
+
channelKey: channel,
|
|
64
|
+
accountId,
|
|
65
|
+
name,
|
|
66
|
+
alwaysUseAccounts: true
|
|
67
|
+
}),
|
|
68
|
+
applyAccountConfig: ({ cfg, accountId, input }) => {
|
|
69
|
+
const setupInput = input;
|
|
70
|
+
const next = migrateBaseNameToDefaultAccount({
|
|
71
|
+
cfg: applyAccountNameToChannelSection({
|
|
72
|
+
cfg,
|
|
73
|
+
channelKey: channel,
|
|
74
|
+
accountId,
|
|
75
|
+
name: setupInput.name,
|
|
76
|
+
alwaysUseAccounts: true
|
|
77
|
+
}),
|
|
78
|
+
channelKey: channel,
|
|
79
|
+
alwaysUseAccounts: true
|
|
80
|
+
});
|
|
81
|
+
const entry = {
|
|
82
|
+
...next.channels?.whatsapp?.accounts?.[accountId],
|
|
83
|
+
...setupInput.authDir ? { authDir: setupInput.authDir } : {},
|
|
84
|
+
enabled: true
|
|
85
|
+
};
|
|
86
|
+
return {
|
|
87
|
+
...next,
|
|
88
|
+
channels: {
|
|
89
|
+
...next.channels,
|
|
90
|
+
whatsapp: {
|
|
91
|
+
...next.channels?.whatsapp,
|
|
92
|
+
accounts: {
|
|
93
|
+
...next.channels?.whatsapp?.accounts,
|
|
94
|
+
[accountId]: entry
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
};
|
|
101
|
+
const whatsappSetupContract = defineChannelSetupContract({
|
|
102
|
+
fields: { authDir: {
|
|
103
|
+
kind: "string",
|
|
104
|
+
cli: {
|
|
105
|
+
flags: "--auth-dir <path>",
|
|
106
|
+
description: "WhatsApp auth directory override"
|
|
107
|
+
}
|
|
108
|
+
} },
|
|
109
|
+
legacyAdapter: whatsappSetupAdapter
|
|
110
|
+
});
|
|
111
|
+
//#endregion
|
|
44
112
|
//#region extensions/whatsapp/src/security-fix.ts
|
|
45
113
|
function applyGroupAllowFromFromStore(params) {
|
|
46
114
|
const next = structuredClone(params.cfg ?? {});
|
|
@@ -83,11 +151,8 @@ async function applyWhatsAppSecurityConfigFixes(params) {
|
|
|
83
151
|
//#endregion
|
|
84
152
|
//#region extensions/whatsapp/src/shared.ts
|
|
85
153
|
const WHATSAPP_CHANNEL = "whatsapp";
|
|
86
|
-
async function loadWhatsAppChannelRuntime() {
|
|
87
|
-
return await import("./channel.runtime-CjkhQzk8.js");
|
|
88
|
-
}
|
|
89
154
|
async function loadWhatsAppSetupSurface() {
|
|
90
|
-
return await import("./setup-surface-
|
|
155
|
+
return await import("./setup-surface-Kv3mPki2.js");
|
|
91
156
|
}
|
|
92
157
|
const whatsappSetupWizardProxy = createWhatsAppSetupWizardProxy(async () => (await loadWhatsAppSetupSurface()).whatsappSetupWizard);
|
|
93
158
|
const whatsappConfigAdapter = createScopedChannelConfigAdapter({
|
|
@@ -191,7 +256,7 @@ function createWhatsAppPluginBase(params) {
|
|
|
191
256
|
docsLabel: "whatsapp",
|
|
192
257
|
blurb: "works with your own number; recommend a separate phone + eSIM.",
|
|
193
258
|
systemImage: "message",
|
|
194
|
-
|
|
259
|
+
exposure: { configured: false },
|
|
195
260
|
quickstartAllowFrom: true,
|
|
196
261
|
forceAccountBinding: true,
|
|
197
262
|
preferSessionLookupForAnnounceTarget: true
|
|
@@ -213,7 +278,7 @@ function createWhatsAppPluginBase(params) {
|
|
|
213
278
|
},
|
|
214
279
|
reload: {
|
|
215
280
|
configPrefixes: [
|
|
216
|
-
"
|
|
281
|
+
"channels.whatsapp.enabled",
|
|
217
282
|
"channels.whatsapp.accounts",
|
|
218
283
|
"channels.whatsapp.selfChatMode"
|
|
219
284
|
],
|
|
@@ -223,7 +288,7 @@ function createWhatsAppPluginBase(params) {
|
|
|
223
288
|
configSchema: WhatsAppChannelConfigSchema,
|
|
224
289
|
config: {
|
|
225
290
|
...whatsappConfigAdapter,
|
|
226
|
-
isEnabled: (account
|
|
291
|
+
isEnabled: (account) => account.enabled,
|
|
227
292
|
disabledReason: () => "disabled",
|
|
228
293
|
isConfigured: params.isConfigured,
|
|
229
294
|
hasPersistedAuthState: ({ cfg }) => hasAnyWhatsAppAuth(cfg),
|
|
@@ -245,6 +310,7 @@ function createWhatsAppPluginBase(params) {
|
|
|
245
310
|
},
|
|
246
311
|
doctor: whatsappDoctor,
|
|
247
312
|
setup: params.setup,
|
|
313
|
+
...params.setupContract ? { setupContract: params.setupContract } : {},
|
|
248
314
|
groups: params.groups
|
|
249
315
|
});
|
|
250
316
|
return {
|
|
@@ -274,48 +340,4 @@ function createWhatsAppPluginBase(params) {
|
|
|
274
340
|
};
|
|
275
341
|
}
|
|
276
342
|
//#endregion
|
|
277
|
-
|
|
278
|
-
const channel = "whatsapp";
|
|
279
|
-
const whatsappSetupAdapter = {
|
|
280
|
-
resolveAccountId: ({ accountId }) => normalizeAccountId$1(accountId),
|
|
281
|
-
applyAccountName: ({ cfg, accountId, name }) => applyAccountNameToChannelSection({
|
|
282
|
-
cfg,
|
|
283
|
-
channelKey: channel,
|
|
284
|
-
accountId,
|
|
285
|
-
name,
|
|
286
|
-
alwaysUseAccounts: true
|
|
287
|
-
}),
|
|
288
|
-
applyAccountConfig: ({ cfg, accountId, input }) => {
|
|
289
|
-
const next = migrateBaseNameToDefaultAccount({
|
|
290
|
-
cfg: applyAccountNameToChannelSection({
|
|
291
|
-
cfg,
|
|
292
|
-
channelKey: channel,
|
|
293
|
-
accountId,
|
|
294
|
-
name: input.name,
|
|
295
|
-
alwaysUseAccounts: true
|
|
296
|
-
}),
|
|
297
|
-
channelKey: channel,
|
|
298
|
-
alwaysUseAccounts: true
|
|
299
|
-
});
|
|
300
|
-
const entry = {
|
|
301
|
-
...next.channels?.whatsapp?.accounts?.[accountId],
|
|
302
|
-
...input.authDir ? { authDir: input.authDir } : {},
|
|
303
|
-
enabled: true
|
|
304
|
-
};
|
|
305
|
-
return {
|
|
306
|
-
...next,
|
|
307
|
-
channels: {
|
|
308
|
-
...next.channels,
|
|
309
|
-
whatsapp: {
|
|
310
|
-
...next.channels?.whatsapp,
|
|
311
|
-
accounts: {
|
|
312
|
-
...next.channels?.whatsapp?.accounts,
|
|
313
|
-
[accountId]: entry
|
|
314
|
-
}
|
|
315
|
-
}
|
|
316
|
-
}
|
|
317
|
-
};
|
|
318
|
-
}
|
|
319
|
-
};
|
|
320
|
-
//#endregion
|
|
321
|
-
export { resolveWhatsAppGroupRequireMention as a, whatsappSetupWizardProxy as i, createWhatsAppPluginBase as n, resolveWhatsAppGroupToolPolicy as o, loadWhatsAppChannelRuntime as r, formatWhatsAppConfigAllowFromEntries as s, whatsappSetupAdapter as t };
|
|
343
|
+
export { resolveWhatsAppGroupRequireMention as a, isWhatsAppAuthConfigured as c, whatsappSetupContract as i, loadWhatsAppChannelRuntime as l, whatsappSetupWizardProxy as n, resolveWhatsAppGroupToolPolicy as o, whatsappSetupAdapter as r, formatWhatsAppConfigAllowFromEntries as s, createWhatsAppPluginBase as t };
|