@openclaw/whatsapp 2026.10.2 → 2026.10.5-beta.2
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/.setup/{action-runtime-CE3zGstN.mjs → action-runtime-DUSkWTiZ.mjs} +2 -2
- package/dist/.setup/{agent-tools-login-B7VEvJO7.mjs → agent-tools-login-CB7OQbli.mjs} +5 -15
- package/dist/.setup/{approval-handler.runtime-CKposl6w.mjs → approval-handler.runtime-BEaAKSoU.mjs} +3 -3
- package/dist/.setup/{approval-reactions-CD6CDF9k.mjs → approval-reactions-CWkZ_ham.mjs} +7 -16
- package/dist/.setup/audio-preflight.runtime-Dg8oZgre.mjs +2 -0
- package/dist/.setup/{auth-store-D2rN-hP5.mjs → auth-store-DOBi5BPe.mjs} +10 -11
- package/dist/.setup/{channel-DNgKHMCz.mjs → channel-DcHw3Up2.mjs} +136 -135
- package/dist/.setup/{channel-react-action-BaBV9X6M.mjs → channel-react-action-C5E8_iDk.mjs} +3 -3
- package/dist/.setup/{channel.runtime-BniF8Swm.mjs → channel.runtime-DTj-wkEP.mjs} +5 -11
- package/dist/.setup/channel.setup-BJWEyQlF.mjs +5 -0
- package/dist/.setup/{connection-controller-COkcq48K.mjs → connection-controller-CejM7bhn.mjs} +50 -84
- package/dist/.setup/{directory-config-RYQomHyB.mjs → directory-config-DPLTUAqy.mjs} +22 -29
- package/dist/.setup/{group-session-key-BV8Le9r8.mjs → group-session-key-BbTPosdy.mjs} +12 -18
- package/dist/.setup/{login-CV_4V021.mjs → login-DUx5JYuW.mjs} +3 -3
- package/dist/.setup/{login-qr-DFhGc5yH.mjs → login-qr-BAWbPonj.mjs} +24 -45
- package/dist/.setup/{monitor-B5DS4PDV.mjs → monitor-CmXEQad9.mjs} +218 -367
- package/dist/.setup/{normalize-target-BGra1ZnM.mjs → normalize-target-D67Kc3g6.mjs} +5 -8
- package/dist/.setup/{question-reactions-LMeijbaq.mjs → question-reactions-DywNaX8m.mjs} +3 -10
- package/dist/.setup/reaction-target-CSPO7gtu.mjs +11 -0
- package/dist/.setup/{resolve-outbound-target-CzyNKmrl.mjs → resolve-outbound-target-qikGL4r0.mjs} +3 -4
- package/dist/.setup/{send-CGUsUdoX.mjs → send-CLBfAzd6.mjs} +34 -42
- package/dist/.setup/{send-api-B03VDwZ1.mjs → send-api-COzRvqXx.mjs} +28 -60
- package/dist/.setup/{setup-finalize-GtBmrO8p.mjs → setup-finalize-DSiP_-wa.mjs} +53 -69
- package/dist/.setup/setup-plugin-api-8WdNCjRW.mjs +3 -0
- package/dist/.setup/{setup-surface-BuA39k6K.mjs → setup-surface-C_flQyHy.mjs} +2 -2
- package/dist/.setup/{shared-CP_zs2U7.mjs → shared-SqcOkt51.mjs} +4 -4
- package/dist/.setup/{socket-close-DU7eerAa.mjs → socket-close-C9OU9mVN.mjs} +67 -86
- package/dist/.setup/{targets-runtime-Dls-Xh4F.mjs → targets-runtime-D5ryyPxh.mjs} +16 -25
- package/dist/action-runtime-api.js +1 -1
- package/dist/action-runtime.runtime.js +1 -1
- package/dist/agent-tools-api.js +4 -8
- package/dist/api.js +13 -15
- package/dist/channel-plugin-api.js +1 -1
- package/dist/contract-api.js +1 -1
- package/dist/directory-contract-api.js +1 -1
- package/dist/doctor-contract-api.js +12 -32
- package/dist/light-runtime-api.js +2 -2
- package/dist/login-qr-runtime.js +2 -4
- package/dist/runtime-api.js +8 -8
- package/dist/setup-entry.js +1 -1
- package/dist/setup-plugin-api.js +1 -1
- package/node_modules/audio-decode/node_modules/@audio/decode/package.json +7 -7
- package/node_modules/audio-decode/node_modules/@audio/decode/readme.md +2 -1
- package/node_modules/audio-decode/node_modules/@audio/decode-aac/README.md +10 -0
- package/node_modules/audio-decode/node_modules/@audio/decode-aac/decode-aac.d.ts +22 -0
- package/node_modules/audio-decode/node_modules/@audio/decode-aac/decode-aac.js +142 -7
- package/node_modules/audio-decode/node_modules/@audio/decode-aac/package.json +1 -1
- package/node_modules/audio-decode/node_modules/@audio/decode-caf/README.md +2 -0
- package/node_modules/audio-decode/node_modules/@audio/decode-caf/decode-caf.js +4 -1
- package/node_modules/audio-decode/node_modules/@audio/decode-caf/package.json +1 -1
- package/node_modules/audio-decode/node_modules/@audio/decode-flac/decode-flac.js +161 -29
- package/node_modules/audio-decode/node_modules/@audio/decode-flac/package.json +1 -1
- package/node_modules/audio-decode/node_modules/@audio/decode-mp4/README.md +1 -1
- package/node_modules/audio-decode/node_modules/@audio/decode-mp4/decode-mp4.js +127 -28
- package/node_modules/audio-decode/node_modules/@audio/decode-mp4/package.json +3 -3
- package/node_modules/audio-decode/node_modules/@audio/decode-opus/package.json +1 -1
- package/node_modules/audio-decode/node_modules/@audio/decode-opus/src/decode-opus.js +2 -2
- package/node_modules/audio-decode/node_modules/@audio/decode-qoa/README.md +1 -1
- package/node_modules/audio-decode/node_modules/@audio/decode-qoa/decode-qoa.js +79 -227
- package/node_modules/audio-decode/node_modules/@audio/decode-qoa/package.json +1 -1
- package/node_modules/audio-decode/node_modules/@audio/decode-vorbis/decode-vorbis.js +51 -10
- package/node_modules/audio-decode/node_modules/@audio/decode-vorbis/package.json +1 -1
- package/node_modules/audio-decode/node_modules/@audio/decode-wav/decode-wav.js +40 -18
- package/node_modules/audio-decode/node_modules/@audio/decode-wav/package.json +1 -1
- package/node_modules/audio-decode/node_modules/@audio/decode-wma/LICENSE.ffmpeg +502 -0
- package/node_modules/audio-decode/node_modules/@audio/decode-wma/README.md +5 -5
- package/node_modules/audio-decode/node_modules/@audio/decode-wma/decode-wma.js +15 -3
- package/node_modules/audio-decode/node_modules/@audio/decode-wma/package.json +5 -4
- package/node_modules/audio-decode/node_modules/@audio/decode-wma/src/wma.wasm.js +0 -0
- package/node_modules/audio-decode/node_modules/audio-type/audio-type.js +13 -0
- package/node_modules/audio-decode/node_modules/audio-type/package.json +1 -1
- package/node_modules/audio-decode/node_modules/audio-type/readme.md +1 -1
- package/node_modules/baileys/lib/Utils/messages-media.js +7 -11
- package/node_modules/baileys/node_modules/lru-cache/dist/commonjs/react-native/diagnostics-channel-react-native.d.ts.map +1 -0
- package/node_modules/baileys/node_modules/lru-cache/dist/commonjs/react-native/diagnostics-channel-react-native.js.map +1 -0
- package/node_modules/baileys/node_modules/lru-cache/dist/commonjs/react-native/diagnostics-channel.d.ts +5 -0
- package/node_modules/baileys/node_modules/lru-cache/dist/commonjs/react-native/diagnostics-channel.js +7 -0
- package/node_modules/baileys/node_modules/lru-cache/dist/commonjs/react-native/index.d.ts +1400 -0
- package/node_modules/baileys/node_modules/lru-cache/dist/commonjs/react-native/index.d.ts.map +1 -0
- package/node_modules/baileys/node_modules/lru-cache/dist/commonjs/react-native/index.js +1733 -0
- package/node_modules/baileys/node_modules/lru-cache/dist/commonjs/react-native/index.js.map +1 -0
- package/node_modules/baileys/node_modules/lru-cache/dist/commonjs/react-native/perf.d.ts +12 -0
- package/node_modules/baileys/node_modules/lru-cache/dist/commonjs/react-native/perf.d.ts.map +1 -0
- package/node_modules/baileys/node_modules/lru-cache/dist/commonjs/react-native/perf.js +10 -0
- package/node_modules/baileys/node_modules/lru-cache/dist/commonjs/react-native/perf.js.map +1 -0
- package/node_modules/baileys/node_modules/lru-cache/dist/esm/react-native/diagnostics-channel-react-native.d.ts.map +1 -0
- package/node_modules/baileys/node_modules/lru-cache/dist/esm/react-native/diagnostics-channel-react-native.js.map +1 -0
- package/node_modules/baileys/node_modules/lru-cache/dist/esm/react-native/diagnostics-channel.d.ts +5 -0
- package/node_modules/baileys/node_modules/lru-cache/dist/esm/react-native/diagnostics-channel.js +4 -0
- package/node_modules/baileys/node_modules/lru-cache/dist/esm/react-native/index.d.ts +1400 -0
- package/node_modules/baileys/node_modules/lru-cache/dist/esm/react-native/index.d.ts.map +1 -0
- package/node_modules/baileys/node_modules/lru-cache/dist/esm/react-native/index.js +1729 -0
- package/node_modules/baileys/node_modules/lru-cache/dist/esm/react-native/index.js.map +1 -0
- package/node_modules/baileys/node_modules/lru-cache/dist/esm/react-native/perf.d.ts +12 -0
- package/node_modules/baileys/node_modules/lru-cache/dist/esm/react-native/perf.d.ts.map +1 -0
- package/node_modules/baileys/node_modules/lru-cache/dist/esm/react-native/perf.js +7 -0
- package/node_modules/baileys/node_modules/lru-cache/dist/esm/react-native/perf.js.map +1 -0
- package/node_modules/baileys/node_modules/lru-cache/package.json +27 -1
- package/node_modules/baileys/node_modules/music-metadata/README.md +35 -32
- package/node_modules/baileys/node_modules/music-metadata/lib/ParserFactory.d.ts +1 -1
- package/node_modules/baileys/node_modules/music-metadata/lib/ParserFactory.js +17 -13
- package/node_modules/baileys/node_modules/music-metadata/lib/aiff/AiffParser.js +19 -12
- package/node_modules/baileys/node_modules/music-metadata/lib/aiff/AiffToken.d.ts +1 -1
- package/node_modules/baileys/node_modules/music-metadata/lib/aiff/AiffToken.js +2 -1
- package/node_modules/baileys/node_modules/music-metadata/lib/apev2/APEv2Parser.d.ts +4 -3
- package/node_modules/baileys/node_modules/music-metadata/lib/apev2/APEv2Parser.js +59 -16
- package/node_modules/baileys/node_modules/music-metadata/lib/apev2/APEv2TagMapper.js +1 -0
- package/node_modules/baileys/node_modules/music-metadata/lib/apev2/APEv2Token.d.ts +1 -1
- package/node_modules/baileys/node_modules/music-metadata/lib/apev2/APEv2Token.js +1 -1
- package/node_modules/baileys/node_modules/music-metadata/lib/asf/AsfGuid.js +56 -50
- package/node_modules/baileys/node_modules/music-metadata/lib/asf/AsfObject.d.ts +1 -1
- package/node_modules/baileys/node_modules/music-metadata/lib/asf/AsfObject.js +3 -2
- package/node_modules/baileys/node_modules/music-metadata/lib/asf/AsfParser.js +15 -7
- package/node_modules/baileys/node_modules/music-metadata/lib/asf/AsfTagMapper.d.ts +3 -2
- package/node_modules/baileys/node_modules/music-metadata/lib/asf/AsfTagMapper.js +21 -4
- package/node_modules/baileys/node_modules/music-metadata/lib/common/CaseInsensitiveTagMap.d.ts +1 -1
- package/node_modules/baileys/node_modules/music-metadata/lib/common/CombinedTagMapper.d.ts +2 -2
- package/node_modules/baileys/node_modules/music-metadata/lib/common/CombinedTagMapper.js +6 -6
- package/node_modules/baileys/node_modules/music-metadata/lib/common/FourCC.js +3 -2
- package/node_modules/baileys/node_modules/music-metadata/lib/common/GenericTagMapper.d.ts +1 -1
- package/node_modules/baileys/node_modules/music-metadata/lib/common/GenericTagTypes.js +1 -1
- package/node_modules/baileys/node_modules/music-metadata/lib/common/MetadataCollector.d.ts +3 -1
- package/node_modules/baileys/node_modules/music-metadata/lib/common/MetadataCollector.js +28 -9
- package/node_modules/baileys/node_modules/music-metadata/lib/common/Util.js +25 -17
- package/node_modules/baileys/node_modules/music-metadata/lib/core.d.ts +4 -4
- package/node_modules/baileys/node_modules/music-metadata/lib/core.js +18 -11
- package/node_modules/baileys/node_modules/music-metadata/lib/dsdiff/DsdiffParser.js +29 -16
- package/node_modules/baileys/node_modules/music-metadata/lib/dsf/DsfChunk.d.ts +1 -1
- package/node_modules/baileys/node_modules/music-metadata/lib/dsf/DsfParser.js +3 -5
- package/node_modules/baileys/node_modules/music-metadata/lib/ebml/EbmlIterator.d.ts +1 -1
- package/node_modules/baileys/node_modules/music-metadata/lib/ebml/EbmlIterator.js +35 -6
- package/node_modules/baileys/node_modules/music-metadata/lib/ebml/types.d.ts +1 -1
- package/node_modules/baileys/node_modules/music-metadata/lib/ebml/types.js +1 -1
- package/node_modules/baileys/node_modules/music-metadata/lib/flac/FlacParser.d.ts +1 -1
- package/node_modules/baileys/node_modules/music-metadata/lib/flac/FlacParser.js +6 -5
- package/node_modules/baileys/node_modules/music-metadata/lib/flac/FlacToken.d.ts +1 -1
- package/node_modules/baileys/node_modules/music-metadata/lib/flac/FlacToken.js +1 -1
- package/node_modules/baileys/node_modules/music-metadata/lib/id3v1/ID3v1Parser.d.ts +1 -1
- package/node_modules/baileys/node_modules/music-metadata/lib/id3v1/ID3v1Parser.js +212 -42
- package/node_modules/baileys/node_modules/music-metadata/lib/id3v2/AbstractID3Parser.js +5 -5
- package/node_modules/baileys/node_modules/music-metadata/lib/id3v2/FrameHeader.d.ts +1 -1
- package/node_modules/baileys/node_modules/music-metadata/lib/id3v2/FrameHeader.js +8 -5
- package/node_modules/baileys/node_modules/music-metadata/lib/id3v2/FrameParser.d.ts +2 -1
- package/node_modules/baileys/node_modules/music-metadata/lib/id3v2/FrameParser.js +54 -23
- package/node_modules/baileys/node_modules/music-metadata/lib/id3v2/ID3v22TagMapper.d.ts +1 -1
- package/node_modules/baileys/node_modules/music-metadata/lib/id3v2/ID3v22TagMapper.js +1 -1
- package/node_modules/baileys/node_modules/music-metadata/lib/id3v2/ID3v24TagMapper.js +3 -3
- package/node_modules/baileys/node_modules/music-metadata/lib/id3v2/ID3v2ChapterToken.js +2 -2
- package/node_modules/baileys/node_modules/music-metadata/lib/id3v2/ID3v2Parser.d.ts +1 -1
- package/node_modules/baileys/node_modules/music-metadata/lib/id3v2/ID3v2Parser.js +32 -16
- package/node_modules/baileys/node_modules/music-metadata/lib/id3v2/ID3v2Token.d.ts +2 -2
- package/node_modules/baileys/node_modules/music-metadata/lib/id3v2/ID3v2Token.js +2 -3
- package/node_modules/baileys/node_modules/music-metadata/lib/index.js +6 -3
- package/node_modules/baileys/node_modules/music-metadata/lib/lrc/LyricsParser.js +3 -5
- package/node_modules/baileys/node_modules/music-metadata/lib/matroska/MatroskaDtd.js +7 -3
- package/node_modules/baileys/node_modules/music-metadata/lib/matroska/MatroskaParser.js +22 -11
- package/node_modules/baileys/node_modules/music-metadata/lib/matroska/types.d.ts +2 -2
- package/node_modules/baileys/node_modules/music-metadata/lib/mp4/Atom.d.ts +4 -3
- package/node_modules/baileys/node_modules/music-metadata/lib/mp4/Atom.js +44 -11
- package/node_modules/baileys/node_modules/music-metadata/lib/mp4/AtomToken.d.ts +1 -1
- package/node_modules/baileys/node_modules/music-metadata/lib/mp4/AtomToken.js +30 -8
- package/node_modules/baileys/node_modules/music-metadata/lib/mp4/MP4Parser.d.ts +2 -0
- package/node_modules/baileys/node_modules/music-metadata/lib/mp4/MP4Parser.js +79 -54
- package/node_modules/baileys/node_modules/music-metadata/lib/mp4/MP4TagMapper.d.ts +2 -2
- package/node_modules/baileys/node_modules/music-metadata/lib/mpeg/MpegLoader.js +1 -1
- package/node_modules/baileys/node_modules/music-metadata/lib/mpeg/MpegParser.js +41 -19
- package/node_modules/baileys/node_modules/music-metadata/lib/mpeg/ReplayGainDataFormat.d.ts +2 -2
- package/node_modules/baileys/node_modules/music-metadata/lib/mpeg/ReplayGainDataFormat.js +1 -1
- package/node_modules/baileys/node_modules/music-metadata/lib/mpeg/XingTag.d.ts +1 -1
- package/node_modules/baileys/node_modules/music-metadata/lib/musepack/MusepackParser.js +2 -2
- package/node_modules/baileys/node_modules/music-metadata/lib/musepack/sv7/BitReader.js +1 -1
- package/node_modules/baileys/node_modules/music-metadata/lib/musepack/sv7/MpcSv7Parser.js +4 -3
- package/node_modules/baileys/node_modules/music-metadata/lib/musepack/sv7/StreamVersion7.js +3 -3
- package/node_modules/baileys/node_modules/music-metadata/lib/musepack/sv8/MpcSv8Parser.js +7 -5
- package/node_modules/baileys/node_modules/music-metadata/lib/musepack/sv8/StreamVersion8.js +2 -2
- package/node_modules/baileys/node_modules/music-metadata/lib/ogg/OggParser.js +23 -13
- package/node_modules/baileys/node_modules/music-metadata/lib/ogg/OggToken.d.ts +2 -0
- package/node_modules/baileys/node_modules/music-metadata/lib/ogg/OggToken.js +1 -1
- package/node_modules/baileys/node_modules/music-metadata/lib/ogg/flac/FlacStream.d.ts +2 -2
- package/node_modules/baileys/node_modules/music-metadata/lib/ogg/flac/FlacStream.js +2 -2
- package/node_modules/baileys/node_modules/music-metadata/lib/ogg/opus/OpusStream.d.ts +2 -2
- package/node_modules/baileys/node_modules/music-metadata/lib/ogg/opus/OpusStream.js +8 -4
- package/node_modules/baileys/node_modules/music-metadata/lib/ogg/speex/SpeexStream.d.ts +2 -2
- package/node_modules/baileys/node_modules/music-metadata/lib/ogg/speex/SpeexStream.js +2 -1
- package/node_modules/baileys/node_modules/music-metadata/lib/ogg/theora/TheoraStream.d.ts +2 -2
- package/node_modules/baileys/node_modules/music-metadata/lib/ogg/vorbis/Vorbis.d.ts +1 -1
- package/node_modules/baileys/node_modules/music-metadata/lib/ogg/vorbis/VorbisDecoder.js +1 -1
- package/node_modules/baileys/node_modules/music-metadata/lib/ogg/vorbis/VorbisStream.d.ts +4 -3
- package/node_modules/baileys/node_modules/music-metadata/lib/ogg/vorbis/VorbisStream.js +16 -9
- package/node_modules/baileys/node_modules/music-metadata/lib/ogg/vorbis/VorbisTagMapper.js +4 -0
- package/node_modules/baileys/node_modules/music-metadata/lib/riff/RiffChunk.d.ts +3 -1
- package/node_modules/baileys/node_modules/music-metadata/lib/riff/RiffChunk.js +3 -2
- package/node_modules/baileys/node_modules/music-metadata/lib/riff/RiffInfoTagMap.d.ts +1 -1
- package/node_modules/baileys/node_modules/music-metadata/lib/type.d.ts +3 -3
- package/node_modules/baileys/node_modules/music-metadata/lib/type.js +1 -1
- package/node_modules/baileys/node_modules/music-metadata/lib/wav/WaveChunk.d.ts +1 -1
- package/node_modules/baileys/node_modules/music-metadata/lib/wav/WaveChunk.js +3 -2
- package/node_modules/baileys/node_modules/music-metadata/lib/wav/WaveParser.d.ts +6 -2
- package/node_modules/baileys/node_modules/music-metadata/lib/wav/WaveParser.js +75 -22
- package/node_modules/baileys/node_modules/music-metadata/lib/wavpack/WavPackParser.js +22 -13
- package/node_modules/baileys/node_modules/music-metadata/lib/wavpack/WavPackToken.js +3 -2
- package/node_modules/baileys/node_modules/music-metadata/package.json +3 -2
- package/node_modules/baileys/node_modules/uint8array-extras/index.d.ts +7 -7
- package/node_modules/baileys/node_modules/uint8array-extras/index.js +27 -13
- package/node_modules/baileys/node_modules/uint8array-extras/package.json +6 -6
- package/node_modules/baileys/node_modules/uint8array-extras/readme.md +7 -7
- package/node_modules/baileys/node_modules/ws/lib/websocket.js +17 -3
- package/node_modules/baileys/node_modules/ws/package.json +1 -1
- package/package.json +4 -4
- package/dist/.setup/audio-preflight.runtime-C_glQhZY.mjs +0 -7
- package/dist/.setup/channel.setup-CsS_NAKQ.mjs +0 -5
- package/dist/.setup/setup-plugin-api-Bsp7jI-r.mjs +0 -3
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { a as resolveWhatsAppAccount } from "./accounts-F0vHuze2.mjs";
|
|
2
|
-
import { t as resolveWhatsAppOutboundTarget } from "./resolve-outbound-target-
|
|
3
|
-
import { r as sendReactionWhatsApp,
|
|
2
|
+
import { t as resolveWhatsAppOutboundTarget } from "./resolve-outbound-target-qikGL4r0.mjs";
|
|
3
|
+
import { r as sendReactionWhatsApp, v as resolveWhatsAppReactionLevel } from "./send-CLBfAzd6.mjs";
|
|
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) {
|
|
@@ -27,7 +27,8 @@ function createWhatsAppLoginTool(context) {
|
|
|
27
27
|
context.assertInvocationCurrent?.();
|
|
28
28
|
if (!signal || signal.aborted) throw new Error("WhatsApp login authority is no longer active.");
|
|
29
29
|
};
|
|
30
|
-
const
|
|
30
|
+
const renderReply = (params, noQrDetails) => {
|
|
31
|
+
if (!params.qrDataUrl) return textResult(params.message, noQrDetails);
|
|
31
32
|
const text = [
|
|
32
33
|
params.message,
|
|
33
34
|
"",
|
|
@@ -49,26 +50,15 @@ function createWhatsAppLoginTool(context) {
|
|
|
49
50
|
timeoutMs,
|
|
50
51
|
currentQrDataUrl: readNonBlankString(args.currentQrDataUrl)
|
|
51
52
|
});
|
|
52
|
-
|
|
53
|
-
message: result.message,
|
|
54
|
-
qrDataUrl: result.qrDataUrl,
|
|
55
|
-
connected: result.connected
|
|
56
|
-
});
|
|
57
|
-
return textResult(result.message, { connected: result.connected });
|
|
53
|
+
return renderReply(result, { connected: result.connected });
|
|
58
54
|
}
|
|
59
55
|
await beforeCredentialPersistence();
|
|
60
|
-
|
|
56
|
+
return renderReply(await startWebLoginWithQr({
|
|
61
57
|
accountId,
|
|
62
58
|
timeoutMs,
|
|
63
59
|
beforeCredentialPersistence,
|
|
64
60
|
force: typeof args.force === "boolean" ? args.force : false
|
|
65
|
-
});
|
|
66
|
-
if (!result.qrDataUrl) return textResult(result.message, { qr: false });
|
|
67
|
-
return renderQrReply({
|
|
68
|
-
message: result.message,
|
|
69
|
-
qrDataUrl: result.qrDataUrl,
|
|
70
|
-
connected: result.connected
|
|
71
|
-
});
|
|
61
|
+
}), { qr: false });
|
|
72
62
|
}
|
|
73
63
|
};
|
|
74
64
|
}
|
package/dist/.setup/{approval-handler.runtime-CKposl6w.mjs → approval-handler.runtime-BEaAKSoU.mjs}
RENAMED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import "./accounts-F0vHuze2.mjs";
|
|
2
2
|
import { r as resolveDefaultWhatsAppAccountId } from "./account-ids-CB5SOWjc.mjs";
|
|
3
|
-
import { s as normalizeWhatsAppMessagingTarget } from "./normalize-target-
|
|
4
|
-
import { i as sendTypingWhatsApp, t as sendMessageWhatsApp } from "./send-
|
|
3
|
+
import { s as normalizeWhatsAppMessagingTarget } from "./normalize-target-D67Kc3g6.mjs";
|
|
4
|
+
import { i as sendTypingWhatsApp, t as sendMessageWhatsApp } from "./send-CLBfAzd6.mjs";
|
|
5
5
|
import { i as getWhatsAppRuntime } from "./runtime-BLlToOi6.mjs";
|
|
6
|
-
import { i as unregisterWhatsAppApprovalReactionTarget, r as registerWhatsAppApprovalReactionTarget } from "./approval-reactions-
|
|
6
|
+
import { i as unregisterWhatsAppApprovalReactionTarget, r as registerWhatsAppApprovalReactionTarget } from "./approval-reactions-CWkZ_ham.mjs";
|
|
7
7
|
import { createSubsystemLogger } from "openclaw/plugin-sdk/runtime-env";
|
|
8
8
|
import { DEFAULT_ACCOUNT_ID } from "openclaw/plugin-sdk/account-id";
|
|
9
9
|
import { buildApprovalReactionPendingContent } from "openclaw/plugin-sdk/approval-reaction-runtime";
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-BBjsoOtd.mjs";
|
|
2
2
|
import { a as resolveWhatsAppAccount } from "./accounts-F0vHuze2.mjs";
|
|
3
|
-
import {
|
|
3
|
+
import { u as listWhatsAppDeliveredMessageIdentities } from "./send-CLBfAzd6.mjs";
|
|
4
4
|
import { n as getOptionalWhatsAppRuntime } from "./runtime-BLlToOi6.mjs";
|
|
5
|
-
import { c as whatsappApprovalAuth, s as getWhatsAppApprovalApprovers } from "./group-session-key-
|
|
5
|
+
import { c as whatsappApprovalAuth, s as getWhatsAppApprovalApprovers } from "./group-session-key-BbTPosdy.mjs";
|
|
6
|
+
import { t as buildWhatsAppReactionTargetKey } from "./reaction-target-CSPO7gtu.mjs";
|
|
6
7
|
import { normalizeUniqueTrimmedStringList } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
7
|
-
import { createLazyRuntimeSurface } from "openclaw/plugin-sdk/lazy-runtime";
|
|
8
8
|
import { approvalReactionDecisionSetsMatch, buildApprovalReactionDeliveredBindingMarker, createApprovalReactionTargetStore, listApprovalReactionBindings, readApprovalReactionDecisionList, readApprovalReactionDeliveredBinding, readApprovalReactionPresentationBinding, readApprovalReactionTargetRecord, resolveTypedApprovalReactionTarget, settleApprovalReaction } from "openclaw/plugin-sdk/approval-reaction-runtime";
|
|
9
9
|
import { createPluginStateErrorReporter } from "openclaw/plugin-sdk/plugin-state-runtime";
|
|
10
10
|
//#region extensions/whatsapp/src/approval-reactions.ts
|
|
@@ -21,7 +21,6 @@ const PERSISTENT_NAMESPACE = "whatsapp.approval-reactions";
|
|
|
21
21
|
const PERSISTENT_MAX_ENTRIES = 1e3;
|
|
22
22
|
const DEFAULT_REACTION_TARGET_TTL_MS = 864e5;
|
|
23
23
|
const DELIVERY_BINDING_CHANNEL_DATA_KEY = "whatsappApprovalReactionBindingV1";
|
|
24
|
-
const loadResolveApprovalOverGateway = createLazyRuntimeSurface(() => import("openclaw/plugin-sdk/approval-gateway-runtime"), (runtime) => runtime.resolveApprovalOverGateway);
|
|
25
24
|
const reportPersistentApprovalReactionError = createPluginStateErrorReporter(getOptionalWhatsAppRuntime, "whatsapp", "approval-reaction-state", "WhatsApp persistent approval reaction state failed");
|
|
26
25
|
const whatsappApprovalReactionTargets = createApprovalReactionTargetStore({
|
|
27
26
|
namespace: PERSISTENT_NAMESPACE,
|
|
@@ -31,13 +30,6 @@ const whatsappApprovalReactionTargets = createApprovalReactionTargetStore({
|
|
|
31
30
|
logPersistentError: reportPersistentApprovalReactionError,
|
|
32
31
|
readPersistedTarget: readApprovalReactionTargetRecord
|
|
33
32
|
});
|
|
34
|
-
function buildReactionTargetKey(params) {
|
|
35
|
-
const accountId = params.accountId.trim();
|
|
36
|
-
const remoteJid = params.remoteJid.trim();
|
|
37
|
-
const messageId = params.messageId.trim();
|
|
38
|
-
if (!accountId || !remoteJid || !messageId) return null;
|
|
39
|
-
return `${accountId}:${remoteJid}:${messageId}`;
|
|
40
|
-
}
|
|
41
33
|
function reportApprovalBindingCorrelationMismatch(binding) {
|
|
42
34
|
try {
|
|
43
35
|
getOptionalWhatsAppRuntime()?.logging.getChildLogger({
|
|
@@ -97,7 +89,7 @@ function prepareWhatsAppApprovalPayloadForDelivery(params) {
|
|
|
97
89
|
};
|
|
98
90
|
}
|
|
99
91
|
async function registerWhatsAppApprovalReactionTarget(params) {
|
|
100
|
-
const key =
|
|
92
|
+
const key = buildWhatsAppReactionTargetKey(params);
|
|
101
93
|
const approvalId = params.approvalId.trim();
|
|
102
94
|
const allowedDecisions = listApprovalReactionBindings({ allowedDecisions: params.allowedDecisions }).map((binding) => binding.decision);
|
|
103
95
|
if (!key || !approvalId || params.approvalKind !== "exec" && params.approvalKind !== "plugin" && params.approvalKind !== "system-agent" || allowedDecisions.length === 0) return null;
|
|
@@ -138,12 +130,12 @@ async function registerWhatsAppApprovalReactionTargetForDeliveredPayload(params)
|
|
|
138
130
|
return (await Promise.all(registrations)).some(Boolean);
|
|
139
131
|
}
|
|
140
132
|
async function unregisterWhatsAppApprovalReactionTarget(params) {
|
|
141
|
-
const key =
|
|
133
|
+
const key = buildWhatsAppReactionTargetKey(params);
|
|
142
134
|
if (!key) return;
|
|
143
135
|
await whatsappApprovalReactionTargets.delete(key);
|
|
144
136
|
}
|
|
145
137
|
async function resolveWhatsAppApprovalReactionTargetWithPersistence(params) {
|
|
146
|
-
const key =
|
|
138
|
+
const key = buildWhatsAppReactionTargetKey(params);
|
|
147
139
|
if (!key) return null;
|
|
148
140
|
const resolved = resolveTypedApprovalReactionTarget({
|
|
149
141
|
target: await whatsappApprovalReactionTargets.lookup(key),
|
|
@@ -231,7 +223,7 @@ async function maybeResolveWhatsAppApprovalReaction(params) {
|
|
|
231
223
|
accountId: params.accountId
|
|
232
224
|
}),
|
|
233
225
|
authorizeActorAction: (input) => whatsappApprovalAuth.authorizeActorAction(input),
|
|
234
|
-
loadResolver:
|
|
226
|
+
loadResolver: async () => (await import("openclaw/plugin-sdk/approval-gateway-runtime")).resolveApprovalOverGateway,
|
|
235
227
|
clearTarget: () => unregisterWhatsAppApprovalReactionTarget({
|
|
236
228
|
accountId: params.accountId,
|
|
237
229
|
remoteJid: target.remoteJid,
|
|
@@ -247,7 +239,6 @@ async function maybeResolveWhatsAppApprovalReaction(params) {
|
|
|
247
239
|
}
|
|
248
240
|
function clearWhatsAppApprovalReactionTargetsForTest() {
|
|
249
241
|
whatsappApprovalReactionTargets.clearForTest();
|
|
250
|
-
loadResolveApprovalOverGateway.clear();
|
|
251
242
|
}
|
|
252
243
|
//#endregion
|
|
253
244
|
export { unregisterWhatsAppApprovalReactionTarget as i, maybeResolveWhatsAppApprovalReaction as n, registerWhatsAppApprovalReactionTarget as r, approval_reactions_exports as t };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-BBjsoOtd.mjs";
|
|
2
2
|
import { a as readWebCredsJsonRawSync, c as statWebCredsFileSync, i as readWebCredsJsonRaw, n as hasWebCredsSync, o as resolveWebCredsBackupPath, r as isWhatsAppBaileysAuthFileName, s as resolveWebCredsPath, t as assertWebCredsPathRegularFileOrMissing } from "./creds-files-B8WcOAmE.mjs";
|
|
3
|
-
import { r as jidToE164 } from "./targets-runtime-
|
|
3
|
+
import { r as jidToE164 } from "./targets-runtime-D5ryyPxh.mjs";
|
|
4
4
|
import path from "node:path";
|
|
5
5
|
import { resolveOAuthDir as resolveOAuthDir$1 } from "openclaw/plugin-sdk/state-paths";
|
|
6
6
|
import { isPathStrictlyInside } from "openclaw/plugin-sdk/file-access-runtime";
|
|
@@ -371,16 +371,19 @@ async function logoutWeb(params) {
|
|
|
371
371
|
runtime.log(success("Cleared WhatsApp Web credentials."));
|
|
372
372
|
return true;
|
|
373
373
|
}
|
|
374
|
+
function parseWebSelfIdentity(raw, authDir) {
|
|
375
|
+
const parsed = JSON.parse(raw);
|
|
376
|
+
return resolveComparableIdentity({
|
|
377
|
+
jid: parsed?.me?.id ?? null,
|
|
378
|
+
lid: parsed?.me?.lid ?? null
|
|
379
|
+
}, authDir);
|
|
380
|
+
}
|
|
374
381
|
function readWebSelfId(authDir = resolveDefaultWebAuthDir()) {
|
|
375
382
|
try {
|
|
376
383
|
const credsPath = resolveWebCredsPath(resolveUserPath(authDir));
|
|
377
384
|
const raw = readWebCredsJsonRawSync(credsPath);
|
|
378
385
|
if (!raw) return emptyWebSelfId();
|
|
379
|
-
const
|
|
380
|
-
const identity = resolveComparableIdentity({
|
|
381
|
-
jid: parsed?.me?.id ?? null,
|
|
382
|
-
lid: parsed?.me?.lid ?? null
|
|
383
|
-
}, authDir);
|
|
386
|
+
const identity = parseWebSelfIdentity(raw, authDir);
|
|
384
387
|
return {
|
|
385
388
|
e164: identity.e164 ?? null,
|
|
386
389
|
jid: identity.jid ?? null,
|
|
@@ -394,11 +397,7 @@ async function readWebSelfIdentity(authDir = resolveDefaultWebAuthDir(), fallbac
|
|
|
394
397
|
const resolvedAuthDir = resolveUserPath(authDir);
|
|
395
398
|
const raw = await readWebCredsJsonRaw(resolveWebCredsPath(resolvedAuthDir));
|
|
396
399
|
if (raw) try {
|
|
397
|
-
|
|
398
|
-
return resolveComparableIdentity({
|
|
399
|
-
jid: parsed?.me?.id ?? null,
|
|
400
|
-
lid: parsed?.me?.lid ?? null
|
|
401
|
-
}, resolvedAuthDir);
|
|
400
|
+
return parseWebSelfIdentity(raw, resolvedAuthDir);
|
|
402
401
|
} catch {}
|
|
403
402
|
return resolveComparableIdentity({
|
|
404
403
|
jid: fallback?.id ?? null,
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { a as resolveWhatsAppAccount } from "./accounts-F0vHuze2.mjs";
|
|
2
2
|
import { r as resolveDefaultWhatsAppAccountId, t as listAccountIds } from "./account-ids-CB5SOWjc.mjs";
|
|
3
|
-
import { a as normalizeWhatsAppAllowFromEntries, c as normalizeWhatsAppTarget, i as looksLikeWhatsAppTargetId, n as isWhatsAppNewsletterJid, o as normalizeWhatsAppAllowFromEntry, s as normalizeWhatsAppMessagingTarget, t as isWhatsAppGroupJid } from "./normalize-target-
|
|
4
|
-
import { t as resolveWhatsAppOutboundTarget } from "./resolve-outbound-target-
|
|
5
|
-
import {
|
|
3
|
+
import { a as normalizeWhatsAppAllowFromEntries, c as normalizeWhatsAppTarget, i as looksLikeWhatsAppTargetId, n as isWhatsAppNewsletterJid, o as normalizeWhatsAppAllowFromEntry, s as normalizeWhatsAppMessagingTarget, t as isWhatsAppGroupJid } from "./normalize-target-D67Kc3g6.mjs";
|
|
4
|
+
import { t as resolveWhatsAppOutboundTarget } from "./resolve-outbound-target-qikGL4r0.mjs";
|
|
5
|
+
import { i as sendTypingWhatsApp, n as sendPollWhatsApp, o as normalizeWhatsAppOutboundPayload, s as normalizeWhatsAppPayloadTextPreservingIndentation, t as sendMessageWhatsApp, v as resolveWhatsAppReactionLevel } from "./send-CLBfAzd6.mjs";
|
|
6
6
|
import { i as getWhatsAppRuntime } from "./runtime-BLlToOi6.mjs";
|
|
7
|
-
import { c as toWhatsappJid } from "./targets-runtime-
|
|
8
|
-
import { c as whatsappApprovalAuth, o as lookupInboundMessageMetaForTarget, s as getWhatsAppApprovalApprovers, t as resolveWhatsAppGroupSessionKey } from "./group-session-key-
|
|
9
|
-
import { a as loadWhatsAppChannelRuntime, t as createWhatsAppPluginBase } from "./shared-
|
|
7
|
+
import { c as toWhatsappJid } from "./targets-runtime-D5ryyPxh.mjs";
|
|
8
|
+
import { c as whatsappApprovalAuth, o as lookupInboundMessageMetaForTarget, s as getWhatsAppApprovalApprovers, t as resolveWhatsAppGroupSessionKey } from "./group-session-key-BbTPosdy.mjs";
|
|
9
|
+
import { a as loadWhatsAppChannelRuntime, t as createWhatsAppPluginBase } from "./shared-SqcOkt51.mjs";
|
|
10
10
|
import { t as whatsappCommandPolicy } from "./command-policy-BIOSHySD.mjs";
|
|
11
|
-
import { d as readWebAuthExistsForDecision, n as WHATSAPP_AUTH_UNSTABLE_CODE } from "./auth-store-
|
|
11
|
+
import { d as readWebAuthExistsForDecision, n as WHATSAPP_AUTH_UNSTABLE_CODE } from "./auth-store-DOBi5BPe.mjs";
|
|
12
12
|
import { createActionGate } from "openclaw/plugin-sdk/channel-actions";
|
|
13
13
|
import { normalizeOptionalAccountId } from "openclaw/plugin-sdk/account-core";
|
|
14
14
|
import { normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
@@ -19,9 +19,9 @@ import { buildChannelOutboundSessionRoute } from "openclaw/plugin-sdk/core";
|
|
|
19
19
|
import { sendTextMediaPayload } from "openclaw/plugin-sdk/reply-payload";
|
|
20
20
|
import { escapeRegExp } from "openclaw/plugin-sdk/text-utility-runtime";
|
|
21
21
|
import { DEFAULT_ACCOUNT_ID as DEFAULT_ACCOUNT_ID$1 } from "openclaw/plugin-sdk/account-id";
|
|
22
|
-
import { createLazyRuntimeModule } from "openclaw/plugin-sdk/lazy-runtime";
|
|
23
22
|
import { buildDmGroupAccountAllowlistAdapter } from "openclaw/plugin-sdk/allowlist-config-edit";
|
|
24
23
|
import { createChatChannelPlugin } from "openclaw/plugin-sdk/channel-core";
|
|
24
|
+
import { createLazyRuntimeModule } from "openclaw/plugin-sdk/lazy-runtime";
|
|
25
25
|
import { createApproverRestrictedNativeApprovalCapabilityFromForwardingRoutes } from "openclaw/plugin-sdk/approval-delivery-runtime";
|
|
26
26
|
import { createLazyChannelApprovalNativeRuntimeAdapter } from "openclaw/plugin-sdk/approval-handler-adapter-runtime";
|
|
27
27
|
import { buildApprovalReactionPromptPayloadForRequest } from "openclaw/plugin-sdk/approval-reaction-runtime";
|
|
@@ -82,7 +82,7 @@ const whatsappApproval = createApproverRestrictedNativeApprovalCapabilityFromFor
|
|
|
82
82
|
approvalKind,
|
|
83
83
|
request
|
|
84
84
|
}),
|
|
85
|
-
load: async () => (await import("./approval-handler.runtime-
|
|
85
|
+
load: async () => (await import("./approval-handler.runtime-BEaAKSoU.mjs")).whatsappApprovalNativeRuntime
|
|
86
86
|
})
|
|
87
87
|
});
|
|
88
88
|
function buildWhatsAppPendingPayload(params, approvalKind) {
|
|
@@ -127,120 +127,123 @@ function hasAnyWhatsAppAccountWithAgentReactionsEnabled(cfg) {
|
|
|
127
127
|
function describeWhatsAppMessageActions(params) {
|
|
128
128
|
if (!params.cfg.channels?.whatsapp) return null;
|
|
129
129
|
const gate = createActionGate(params.cfg.channels.whatsapp.actions);
|
|
130
|
-
const actions =
|
|
130
|
+
const actions = [];
|
|
131
131
|
if (params.accountId != null ? Boolean(resolveEnabledWhatsAppAgentReactions({
|
|
132
132
|
cfg: params.cfg,
|
|
133
133
|
accountId: params.accountId
|
|
134
|
-
})) : hasAnyWhatsAppAccountWithAgentReactionsEnabled(params.cfg)) actions.
|
|
135
|
-
if (gate("polls")) actions.
|
|
136
|
-
actions.
|
|
137
|
-
return { actions
|
|
134
|
+
})) : hasAnyWhatsAppAccountWithAgentReactionsEnabled(params.cfg)) actions.push("react");
|
|
135
|
+
if (gate("polls")) actions.push("poll");
|
|
136
|
+
actions.push("upload-file");
|
|
137
|
+
return { actions };
|
|
138
138
|
}
|
|
139
139
|
//#endregion
|
|
140
140
|
//#region extensions/whatsapp/src/outbound-send-deps.ts
|
|
141
141
|
const WHATSAPP_LEGACY_OUTBOUND_SEND_DEP_KEYS = ["sendWhatsApp"];
|
|
142
142
|
//#endregion
|
|
143
143
|
//#region extensions/whatsapp/src/outbound-base.ts
|
|
144
|
-
|
|
145
|
-
const
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
media: cachedMeta?.media
|
|
158
|
-
};
|
|
159
|
-
};
|
|
160
|
-
const dispatchMessage = async (params, text, mediaOptions) => {
|
|
161
|
-
const lookupAccountId = normalizeOptionalAccountId(params.accountId) ?? resolveDefaultWhatsAppAccountId(params.cfg);
|
|
162
|
-
const quotedMessageKey = resolveQuotedMessageKey({
|
|
163
|
-
accountId: lookupAccountId,
|
|
164
|
-
to: params.to,
|
|
165
|
-
replyToId: params.replyToId
|
|
166
|
-
});
|
|
167
|
-
const send = quotedMessageKey ? sendMessageWhatsApp : resolveOutboundSendDep(params.deps, "whatsapp", { legacyKeys: WHATSAPP_LEGACY_OUTBOUND_SEND_DEP_KEYS }) ?? sendMessageWhatsApp;
|
|
168
|
-
const onDeliveryResult = params.onDeliveryResult;
|
|
169
|
-
return await send(params.to, text ?? normalizeText(params.text), {
|
|
170
|
-
verbose: false,
|
|
171
|
-
cfg: params.cfg,
|
|
172
|
-
...mediaOptions,
|
|
173
|
-
accountId: params.accountId ?? void 0,
|
|
174
|
-
gifPlayback: params.gifPlayback,
|
|
175
|
-
replyToIdSource: params.replyToIdSource,
|
|
176
|
-
replyToMode: params.replyToMode,
|
|
177
|
-
formatting: params.formatting,
|
|
178
|
-
onPlatformSendDispatch: params.onPlatformSendDispatch,
|
|
179
|
-
...quotedMessageKey ? { quotedMessageKey } : {},
|
|
180
|
-
...onDeliveryResult ? { onDeliveryResult: async (result) => {
|
|
181
|
-
await onDeliveryResult(attachChannelToResult("whatsapp", result));
|
|
182
|
-
} } : {}
|
|
183
|
-
});
|
|
144
|
+
const resolveQuotedMessageKey = (params) => {
|
|
145
|
+
const replyToId = params.replyToId?.trim();
|
|
146
|
+
if (!replyToId) return;
|
|
147
|
+
const targetJid = toWhatsappJid(params.to);
|
|
148
|
+
const cachedMeta = lookupInboundMessageMetaForTarget(params.accountId, targetJid, replyToId);
|
|
149
|
+
return {
|
|
150
|
+
id: replyToId,
|
|
151
|
+
remoteJid: cachedMeta?.remoteJid ?? targetJid,
|
|
152
|
+
fromMe: cachedMeta?.fromMe ?? false,
|
|
153
|
+
participant: cachedMeta?.participant,
|
|
154
|
+
...cachedMeta && cachedMeta.remoteJid !== targetJid ? { lookupTargetJid: targetJid } : {},
|
|
155
|
+
messageText: cachedMeta?.body,
|
|
156
|
+
media: cachedMeta?.media
|
|
184
157
|
};
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
158
|
+
};
|
|
159
|
+
const dispatchMessage = async (params, text, mediaOptions) => {
|
|
160
|
+
const lookupAccountId = normalizeOptionalAccountId(params.accountId) ?? resolveDefaultWhatsAppAccountId(params.cfg);
|
|
161
|
+
const quotedMessageKey = resolveQuotedMessageKey({
|
|
162
|
+
accountId: lookupAccountId,
|
|
163
|
+
to: params.to,
|
|
164
|
+
replyToId: params.replyToId
|
|
165
|
+
});
|
|
166
|
+
const send = quotedMessageKey ? void 0 : resolveOutboundSendDep(params.deps, "whatsapp", { legacyKeys: WHATSAPP_LEGACY_OUTBOUND_SEND_DEP_KEYS });
|
|
167
|
+
const onDeliveryResult = params.onDeliveryResult;
|
|
168
|
+
return await (send ?? sendMessageWhatsApp)(params.to, text ?? normalizeWhatsAppPayloadTextPreservingIndentation(params.text), {
|
|
169
|
+
verbose: false,
|
|
170
|
+
...!send ? { preserveLeadingWhitespace: true } : {},
|
|
171
|
+
cfg: params.cfg,
|
|
172
|
+
...mediaOptions,
|
|
173
|
+
accountId: params.accountId ?? void 0,
|
|
174
|
+
gifPlayback: params.gifPlayback,
|
|
175
|
+
replyToIdSource: params.replyToIdSource,
|
|
176
|
+
replyToMode: params.replyToMode,
|
|
177
|
+
formatting: params.formatting,
|
|
178
|
+
onPlatformSendDispatch: params.onPlatformSendDispatch,
|
|
179
|
+
...quotedMessageKey ? { quotedMessageKey } : {},
|
|
180
|
+
...onDeliveryResult ? { onDeliveryResult: async (result) => {
|
|
181
|
+
await onDeliveryResult(attachChannelToResult("whatsapp", result));
|
|
182
|
+
} } : {}
|
|
183
|
+
});
|
|
184
|
+
};
|
|
185
|
+
const outbound = {
|
|
186
|
+
deliveryMode: "gateway",
|
|
187
|
+
textChunkLimit: 4e3,
|
|
188
|
+
sanitizeText: ({ text }) => normalizeWhatsAppPayloadTextPreservingIndentation(text),
|
|
189
|
+
deliveryCapabilities: { durableFinal: {
|
|
190
|
+
text: true,
|
|
191
|
+
replyTo: true,
|
|
192
|
+
messageSendingHooks: true
|
|
193
|
+
} },
|
|
194
|
+
pollMaxOptions: 12,
|
|
195
|
+
resolveTarget: ({ to, allowFrom, mode }) => resolveWhatsAppOutboundTarget({
|
|
196
|
+
to,
|
|
197
|
+
allowFrom,
|
|
198
|
+
mode
|
|
199
|
+
}),
|
|
200
|
+
...createAttachedChannelResultAdapter({
|
|
201
|
+
channel: "whatsapp",
|
|
202
|
+
sendText: async (params) => {
|
|
203
|
+
const normalizedText = normalizeWhatsAppPayloadTextPreservingIndentation(params.text);
|
|
204
|
+
if (!normalizedText) return { messageId: "" };
|
|
205
|
+
return await dispatchMessage(params, normalizedText);
|
|
206
|
+
},
|
|
207
|
+
sendMedia: async (params) => await dispatchMessage(params, void 0, {
|
|
208
|
+
mediaUrl: params.mediaUrl,
|
|
209
|
+
mediaAccess: params.mediaAccess,
|
|
210
|
+
mediaLocalRoots: params.mediaLocalRoots,
|
|
211
|
+
mediaReadFile: params.mediaReadFile,
|
|
212
|
+
...params.audioAsVoice === void 0 ? {} : { audioAsVoice: params.audioAsVoice },
|
|
213
|
+
forceDocument: params.forceDocument
|
|
214
|
+
}),
|
|
215
|
+
sendPoll: async ({ cfg, to, poll, accountId }) => await sendPollWhatsApp(to, poll, {
|
|
216
|
+
verbose: getWhatsAppRuntime().logging.shouldLogVerbose(),
|
|
217
|
+
accountId: accountId ?? void 0,
|
|
218
|
+
cfg
|
|
216
219
|
})
|
|
217
|
-
}
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
messageId: ""
|
|
227
|
-
};
|
|
228
|
-
}
|
|
229
|
-
return await sendTextMediaPayload({
|
|
220
|
+
})
|
|
221
|
+
};
|
|
222
|
+
const whatsappOutboundBase = {
|
|
223
|
+
...outbound,
|
|
224
|
+
sendPayload: async (ctx) => {
|
|
225
|
+
const payload = normalizeWhatsAppOutboundPayload(ctx.payload, { normalizeText: normalizeWhatsAppPayloadTextPreservingIndentation });
|
|
226
|
+
if (!payload.text && !(payload.mediaUrl || payload.mediaUrls?.length)) {
|
|
227
|
+
if (ctx.payload.interactive || ctx.payload.presentation || ctx.payload.channelData) throw new Error("WhatsApp sendPayload does not support structured-only payloads without text or media.");
|
|
228
|
+
return {
|
|
230
229
|
channel: "whatsapp",
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
payload
|
|
234
|
-
},
|
|
235
|
-
adapter: outbound
|
|
236
|
-
});
|
|
230
|
+
messageId: ""
|
|
231
|
+
};
|
|
237
232
|
}
|
|
238
|
-
|
|
239
|
-
|
|
233
|
+
return await sendTextMediaPayload({
|
|
234
|
+
channel: "whatsapp",
|
|
235
|
+
ctx: {
|
|
236
|
+
...ctx,
|
|
237
|
+
payload
|
|
238
|
+
},
|
|
239
|
+
adapter: outbound
|
|
240
|
+
});
|
|
241
|
+
}
|
|
242
|
+
};
|
|
240
243
|
//#endregion
|
|
241
244
|
//#region extensions/whatsapp/src/channel-outbound.ts
|
|
242
|
-
const loadWhatsAppApprovalReactionsModule = createLazyRuntimeModule(() => import("./approval-reactions-
|
|
243
|
-
const loadWhatsAppQuestionReactionsModule = createLazyRuntimeModule(() => import("./question-reactions-
|
|
245
|
+
const loadWhatsAppApprovalReactionsModule = createLazyRuntimeModule(() => import("./approval-reactions-CWkZ_ham.mjs").then((n) => n.t));
|
|
246
|
+
const loadWhatsAppQuestionReactionsModule = createLazyRuntimeModule(() => import("./question-reactions-DywNaX8m.mjs").then((n) => n.n));
|
|
244
247
|
async function prepareWhatsAppApprovalPayloadForDelivery(params) {
|
|
245
248
|
const questionPayload = questionGatewayRuntime.prepareReactionPayloadForDelivery({
|
|
246
249
|
payload: params.payload,
|
|
@@ -257,20 +260,7 @@ async function registerDeliveredWhatsAppApprovalPayload(params) {
|
|
|
257
260
|
await (await loadWhatsAppApprovalReactionsModule()).registerWhatsAppApprovalReactionTargetForDeliveredPayload(params);
|
|
258
261
|
}
|
|
259
262
|
const whatsappChannelOutbound = {
|
|
260
|
-
...
|
|
261
|
-
sendMessageWhatsApp: async (to, text, options) => await sendMessageWhatsApp(to, text, {
|
|
262
|
-
...options,
|
|
263
|
-
preserveLeadingWhitespace: true
|
|
264
|
-
}),
|
|
265
|
-
sendPollWhatsApp,
|
|
266
|
-
shouldLogVerbose: () => getWhatsAppRuntime().logging.shouldLogVerbose(),
|
|
267
|
-
resolveTarget: ({ to, allowFrom, mode }) => resolveWhatsAppOutboundTarget({
|
|
268
|
-
to,
|
|
269
|
-
allowFrom,
|
|
270
|
-
mode
|
|
271
|
-
}),
|
|
272
|
-
normalizeText: normalizeWhatsAppPayloadTextPreservingIndentation
|
|
273
|
-
}),
|
|
263
|
+
...whatsappOutboundBase,
|
|
274
264
|
sendTextOnlyErrorPayloads: true,
|
|
275
265
|
renderPresentation: prepareWhatsAppApprovalPayloadForDelivery,
|
|
276
266
|
afterDeliverPayload: registerDeliveredWhatsAppApprovalPayload,
|
|
@@ -353,8 +343,8 @@ async function checkWhatsAppHeartbeatReady(params) {
|
|
|
353
343
|
function resolveWhatsAppOutboundSessionRoute(params) {
|
|
354
344
|
const normalized = normalizeWhatsAppTarget(params.target);
|
|
355
345
|
if (!normalized) return null;
|
|
356
|
-
const isGroup =
|
|
357
|
-
const isNewsletter =
|
|
346
|
+
const isGroup = normalized.endsWith("@g.us");
|
|
347
|
+
const isNewsletter = normalized.endsWith("@newsletter");
|
|
358
348
|
const chatType = isGroup ? "group" : isNewsletter ? "channel" : "direct";
|
|
359
349
|
const route = buildChannelOutboundSessionRoute({
|
|
360
350
|
cfg: params.cfg,
|
|
@@ -434,31 +424,32 @@ function collectWhatsAppStatusIssues(accounts) {
|
|
|
434
424
|
const relink = `Run: ${formatCliCommand("openclaw channels login")} (scan QR on the gateway host).`;
|
|
435
425
|
const repair = `Run: ${formatCliCommand("openclaw doctor")} (or restart the gateway). If it persists, relink via channels login and check logs.`;
|
|
436
426
|
const linkedRuntimePrefix = linked ? "Linked but " : "";
|
|
427
|
+
const addRuntimeIssue = (label, includeReconnectAttempts = true) => addIssue("runtime", `${linkedRuntimePrefix}${label}${includeReconnectAttempts && reconnectAttempts != null ? ` (reconnectAttempts=${reconnectAttempts})` : ""}${lastError ? `: ${lastError}` : "."}`, repair);
|
|
437
428
|
if (statusState === "unstable") addIssue("auth", "Auth state is still stabilizing.", "Wait a moment for queued credential writes to finish, then retry the command or rerun health.");
|
|
438
429
|
else if (healthState === "logged-out") addIssue("auth", `Session logged out${lastError ? `: ${lastError}` : "."}`, relink);
|
|
439
430
|
else if (!linked) addIssue("auth", "Not linked (no WhatsApp Web session).", relink);
|
|
440
431
|
if (healthState === "logged-out") return;
|
|
441
432
|
if (!linked && healthState === "stopped" && !lastError && lastDisconnect?.at == null && (reconnectAttempts ?? 0) === 0) return;
|
|
442
433
|
if (healthState === "stale") {
|
|
443
|
-
|
|
434
|
+
addRuntimeIssue(`stale${lastInboundAt != null ? ` (last inbound ${Math.max(0, Math.floor((Date.now() - lastInboundAt) / 6e4))}m ago)` : ""}`, false);
|
|
444
435
|
return;
|
|
445
436
|
}
|
|
446
437
|
if (healthState === "reconnecting" || healthState === "conflict" || healthState === "stopped") {
|
|
447
|
-
|
|
438
|
+
addRuntimeIssue(healthState === "conflict" ? "session conflict" : healthState === "reconnecting" ? "reconnecting" : "stopped");
|
|
448
439
|
return;
|
|
449
440
|
}
|
|
450
441
|
if (linked && running && connected && reconnectAttempts != null && reconnectAttempts > 0 && isRecentDisconnect(lastDisconnect)) {
|
|
451
442
|
addIssue("runtime", `Linked but recently reconnected (reconnectAttempts=${reconnectAttempts})${lastError ? `: ${lastError}` : "."}`, `Watch: ${formatCliCommand("openclaw logs --follow")} and run ${formatCliCommand("openclaw channels status --probe")} if disconnects continue. If it keeps flapping, restart the gateway or relink via channels login.`);
|
|
452
443
|
return;
|
|
453
444
|
}
|
|
454
|
-
if (running && !connected)
|
|
445
|
+
if (running && !connected) addRuntimeIssue("disconnected");
|
|
455
446
|
}
|
|
456
447
|
});
|
|
457
448
|
}
|
|
458
449
|
//#endregion
|
|
459
450
|
//#region extensions/whatsapp/src/channel.ts
|
|
460
|
-
const loadWhatsAppDirectoryConfig = createLazyRuntimeModule(() => import("./directory-config-
|
|
461
|
-
const loadWhatsAppChannelReactAction = createLazyRuntimeModule(() => import("./channel-react-action-
|
|
451
|
+
const loadWhatsAppDirectoryConfig = createLazyRuntimeModule(() => import("./directory-config-DPLTUAqy.mjs").then((n) => n.t));
|
|
452
|
+
const loadWhatsAppChannelReactAction = createLazyRuntimeModule(() => import("./channel-react-action-C5E8_iDk.mjs"));
|
|
462
453
|
function projectWhatsAppRuntimeStatus(runtime) {
|
|
463
454
|
return {
|
|
464
455
|
connected: runtime?.connected ?? false,
|
|
@@ -666,14 +657,24 @@ const whatsappPlugin = createChatChannelPlugin({
|
|
|
666
657
|
gateway: {
|
|
667
658
|
startAccount: async (ctx) => {
|
|
668
659
|
const account = ctx.account;
|
|
669
|
-
const
|
|
660
|
+
const channelRuntime = await loadWhatsAppChannelRuntime();
|
|
661
|
+
const auth = await channelRuntime.readWebAuthSnapshot(account.authDir);
|
|
662
|
+
ctx.abortSignal.throwIfAborted();
|
|
663
|
+
const { e164, jid } = auth.selfId;
|
|
670
664
|
const identity = e164 ? e164 : jid ? `jid ${jid}` : "unknown";
|
|
671
665
|
ctx.log?.info(`[${account.accountId}] starting provider (${identity})`);
|
|
672
|
-
return
|
|
673
|
-
statusSink: (next) =>
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
666
|
+
return channelRuntime.monitorWebChannel(getWhatsAppRuntime().logging.shouldLogVerbose(), void 0, true, void 0, ctx.runtime, ctx.abortSignal, {
|
|
667
|
+
statusSink: (next) => {
|
|
668
|
+
const hasIdentity = next.running && next.healthState !== "logged-out";
|
|
669
|
+
const snapshot = {
|
|
670
|
+
accountId: ctx.accountId,
|
|
671
|
+
...next,
|
|
672
|
+
self: hasIdentity ? auth.selfId : null,
|
|
673
|
+
authAgeMs: hasIdentity ? next.authAgeMs === void 0 ? auth.authAgeMs : next.authAgeMs : null,
|
|
674
|
+
...next.healthState === "logged-out" ? { linked: false } : {}
|
|
675
|
+
};
|
|
676
|
+
ctx.setStatus(snapshot);
|
|
677
|
+
},
|
|
677
678
|
accountId: account.accountId,
|
|
678
679
|
channelRuntime: ctx.channelRuntime
|
|
679
680
|
});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { a as resolveWhatsAppAccount, s as resolveWhatsAppMediaMaxBytes } from "./accounts-F0vHuze2.mjs";
|
|
2
|
-
import { c as normalizeWhatsAppTarget, t as isWhatsAppGroupJid } from "./normalize-target-
|
|
3
|
-
import { r as resolveAuthorizedWhatsAppOutboundTarget, t as handleWhatsAppAction } from "./action-runtime-
|
|
4
|
-
import { a as sendWhatsAppUploadFile } from "./send-
|
|
2
|
+
import { c as normalizeWhatsAppTarget, t as isWhatsAppGroupJid } from "./normalize-target-D67Kc3g6.mjs";
|
|
3
|
+
import { r as resolveAuthorizedWhatsAppOutboundTarget, t as handleWhatsAppAction } from "./action-runtime-DUSkWTiZ.mjs";
|
|
4
|
+
import { a as sendWhatsAppUploadFile } from "./send-CLBfAzd6.mjs";
|
|
5
5
|
import { jsonResult, readStringOrNumberParam, readStringParam as readStringParam$1, resolveReactionMessageId } from "openclaw/plugin-sdk/channel-actions";
|
|
6
6
|
import { canonicalizeBase64, estimateBase64DecodedBytes } from "openclaw/plugin-sdk/media-runtime";
|
|
7
7
|
import { readBooleanParam } from "openclaw/plugin-sdk/boolean-param";
|
|
@@ -1,16 +1,10 @@
|
|
|
1
|
-
import { startWebLoginWithQr
|
|
2
|
-
import { b as webAuthExists, c as logoutWeb, d as readWebAuthExistsForDecision, f as readWebAuthSnapshot, h as readWebSelfId, m as readWebAuthState, o as getWebAuthAgeMs, p as readWebAuthSnapshotBestEffort, s as logWebSelfId, u as readWebAuthExistsBestEffort } from "./auth-store-
|
|
1
|
+
import { startWebLoginWithQr, waitForWebLogin } from "../login-qr-runtime.js";
|
|
2
|
+
import { b as webAuthExists, c as logoutWeb, d as readWebAuthExistsForDecision, f as readWebAuthSnapshot, h as readWebSelfId, m as readWebAuthState, o as getWebAuthAgeMs, p as readWebAuthSnapshotBestEffort, s as logWebSelfId, u as readWebAuthExistsBestEffort } from "./auth-store-DOBi5BPe.mjs";
|
|
3
3
|
import { t as getActiveWebListener } from "./active-listener-CDjoX9QR.mjs";
|
|
4
|
-
import { t as monitorWebChannel } from "./monitor-
|
|
5
|
-
import { t as loginWeb } from "./login-
|
|
6
|
-
import { whatsappSetupWizard as whatsappSetupWizard$1 } from "./setup-surface-
|
|
4
|
+
import { t as monitorWebChannel } from "./monitor-CmXEQad9.mjs";
|
|
5
|
+
import { t as loginWeb } from "./login-DUx5JYuW.mjs";
|
|
6
|
+
import { whatsappSetupWizard as whatsappSetupWizard$1 } from "./setup-surface-C_flQyHy.mjs";
|
|
7
7
|
//#region extensions/whatsapp/src/channel.runtime.ts
|
|
8
|
-
async function startWebLoginWithQr(...args) {
|
|
9
|
-
return await startWebLoginWithQr$1(...args);
|
|
10
|
-
}
|
|
11
|
-
async function waitForWebLogin(...args) {
|
|
12
|
-
return await waitForWebLogin$1(...args);
|
|
13
|
-
}
|
|
14
8
|
const whatsappSetupWizard = { ...whatsappSetupWizard$1 };
|
|
15
9
|
//#endregion
|
|
16
10
|
export { getActiveWebListener, getWebAuthAgeMs, logWebSelfId, loginWeb, logoutWeb, monitorWebChannel, readWebAuthExistsBestEffort, readWebAuthExistsForDecision, readWebAuthSnapshot, readWebAuthSnapshotBestEffort, readWebAuthState, readWebSelfId, startWebLoginWithQr, waitForWebLogin, webAuthExists, whatsappSetupWizard };
|