@openclaw/whatsapp 2026.8.1-beta.3 → 2026.8.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/{accounts-BX2fZUyR.js → accounts-CeKQbu_s.js} +9 -26
- package/dist/{action-runtime-pM-ExU0l.js → action-runtime-Bw0loEdy.js} +2 -2
- package/dist/action-runtime-api.js +1 -1
- package/dist/action-runtime.runtime.js +1 -1
- package/dist/{call-tool-api.js → agent-tools-api.js} +13 -6
- package/dist/{agent-tools-login-BjRpD-JQ.js → agent-tools-login-B-2qZPzc.js} +12 -3
- package/dist/api.js +10 -10
- package/dist/{approval-handler.runtime-CkMMvUjk.js → approval-handler.runtime-DeyPb57-.js} +3 -3
- package/dist/{approval-reactions-Jyr1JaAK.js → approval-reactions-DGDA6hQ7.js} +7 -5
- package/dist/{auth-store-CtpBqH5S.js → auth-store-DTj1H9pv.js} +5 -3
- package/dist/{channel-DRMYRfZ8.js → channel-DxMmDjqK.js} +26 -24
- package/dist/channel-config-api.js +1 -1
- package/dist/channel-plugin-api.js +1 -1
- package/dist/{channel-react-action-CstrR0CT.js → channel-react-action-BUp7Wbfr.js} +3 -3
- package/dist/{channel.runtime-X3JC2gaq.js → channel.runtime-BwSnyXRX.js} +4 -4
- package/dist/{channel.setup-DhBBhbQv.js → channel.setup-aOFLSQyw.js} +1 -1
- package/dist/{config-schema-BQP5YCeK.js → config-schema-BYA6e_Ii.js} +6 -4
- package/dist/{connection-controller-CIYuBJrs.js → connection-controller-BvkxsbWi.js} +2 -2
- package/dist/{constants-HU41RHGI.js → constants-C7m81BNe.js} +1 -1
- package/dist/{directory-config-P7_3U73Z.js → directory-config-LgxYJLWY.js} +3 -3
- package/dist/directory-contract-api.js +1 -1
- package/dist/{group-session-key-DmFc_Cqi.js → group-session-key-KUguLmSZ.js} +4 -4
- package/dist/index.js +4 -4
- package/dist/light-runtime-api.js +2 -2
- package/dist/{login-BkpKpndm.js → login-Bk_jiXKD.js} +6 -5
- package/dist/{login-qr-1dpv6jjT.js → login-qr-B3m61NqA.js} +43 -20
- package/dist/login-qr-runtime.js +1 -1
- package/dist/{monitor-IzwQKizW.js → monitor-CTsyo-HE.js} +185 -162
- package/dist/{question-reactions-D3eAeB0i.js → question-reactions-B9D6MHXZ.js} +1 -1
- package/dist/runtime-api.js +9 -9
- package/dist/{send-CwvTU4RI.js → send-DiPjiygK.js} +54 -29
- package/dist/{send-api-obOSm2cC.js → send-api-kFcuhSiY.js} +43 -41
- package/dist/{setup-finalize-n4K2I2gJ.js → setup-finalize-CqH5wTK5.js} +7 -6
- package/dist/setup-plugin-api.js +1 -1
- package/dist/{setup-surface-Cwn3zyxK.js → setup-surface-Dm3T6S8t.js} +3 -3
- package/dist/{shared-wg42NKFB.js → shared-DDjonGys.js} +7 -6
- package/dist/{socket-close-2T0_jZTN.js → socket-close-CpkkJZCU.js} +9 -6
- package/dist/{targets-runtime-TMk0lGuy.js → targets-runtime-RBjx3pg_.js} +1 -2
- package/dist/{text-runtime-CaKLhowd.js → text-runtime-DyfmcATV.js} +1 -1
- package/node_modules/baileys/lib/Defaults/index.js +1 -1
- package/node_modules/baileys/lib/Socket/business.d.ts.map +1 -1
- package/node_modules/baileys/lib/Socket/chats.d.ts +1 -0
- package/node_modules/baileys/lib/Socket/chats.d.ts.map +1 -1
- package/node_modules/baileys/lib/Socket/chats.js +10 -5
- package/node_modules/baileys/lib/Socket/chats.js.map +1 -1
- package/node_modules/baileys/lib/Socket/communities.d.ts.map +1 -1
- package/node_modules/baileys/lib/Socket/groups.d.ts.map +1 -1
- package/node_modules/baileys/lib/Socket/index.d.ts.map +1 -1
- package/node_modules/baileys/lib/Socket/messages-recv.d.ts.map +1 -1
- package/node_modules/baileys/lib/Socket/messages-send.d.ts.map +1 -1
- package/node_modules/baileys/lib/Socket/newsletter.d.ts.map +1 -1
- package/node_modules/baileys/lib/Socket/socket.d.ts.map +1 -1
- package/node_modules/baileys/lib/Socket/socket.js +3 -0
- package/node_modules/baileys/lib/Socket/socket.js.map +1 -1
- package/node_modules/baileys/lib/Types/index.d.ts +1 -0
- package/node_modules/baileys/lib/Types/index.d.ts.map +1 -1
- package/node_modules/baileys/lib/Types/index.js.map +1 -1
- package/node_modules/baileys/lib/Utils/browser-utils.d.ts.map +1 -1
- package/node_modules/baileys/lib/Utils/browser-utils.js +1 -0
- package/node_modules/baileys/lib/Utils/browser-utils.js.map +1 -1
- package/node_modules/baileys/lib/Utils/generics.d.ts +1 -0
- package/node_modules/baileys/lib/Utils/generics.d.ts.map +1 -1
- package/node_modules/baileys/lib/Utils/generics.js +1 -1
- package/node_modules/baileys/lib/Utils/generics.js.map +1 -1
- package/node_modules/baileys/lib/Utils/tc-token-utils.d.ts.map +1 -1
- package/node_modules/baileys/lib/Utils/tc-token-utils.js +3 -2
- package/node_modules/baileys/lib/Utils/tc-token-utils.js.map +1 -1
- package/node_modules/baileys/lib/Utils/validate-connection.d.ts.map +1 -1
- package/node_modules/baileys/lib/Utils/validate-connection.js +9 -2
- package/node_modules/baileys/lib/Utils/validate-connection.js.map +1 -1
- package/node_modules/baileys/node_modules/content-type/README.md +2 -0
- package/node_modules/baileys/node_modules/content-type/dist/index.d.ts +20 -0
- package/node_modules/baileys/node_modules/content-type/dist/index.js +20 -14
- package/node_modules/baileys/node_modules/content-type/dist/index.js.map +1 -1
- package/node_modules/baileys/node_modules/content-type/package.json +1 -1
- package/node_modules/baileys/node_modules/file-type/package.json +1 -1
- package/node_modules/baileys/node_modules/file-type/readme.md +3 -0
- package/node_modules/baileys/node_modules/file-type/source/detectors/zip.js +6 -1
- package/node_modules/baileys/node_modules/file-type/source/index.d.ts +3 -0
- package/node_modules/baileys/node_modules/file-type/source/index.js +25 -13
- package/node_modules/baileys/node_modules/music-metadata/LICENSE.txt +9 -9
- package/node_modules/baileys/node_modules/music-metadata/README.md +878 -878
- package/node_modules/baileys/node_modules/music-metadata/lib/ParseError.d.ts +1 -1
- package/node_modules/baileys/node_modules/music-metadata/lib/ParseError.js +1 -1
- package/node_modules/baileys/node_modules/music-metadata/lib/asf/AsfObject.d.ts +1 -4
- package/node_modules/baileys/node_modules/music-metadata/lib/asf/AsfObject.js +66 -30
- package/node_modules/baileys/node_modules/music-metadata/lib/asf/AsfParser.d.ts +5 -1
- package/node_modules/baileys/node_modules/music-metadata/lib/asf/AsfParser.js +94 -25
- package/node_modules/baileys/node_modules/music-metadata/lib/dsf/DsfChunk.js +2 -2
- package/node_modules/baileys/node_modules/music-metadata/lib/dsf/DsfParser.js +38 -13
- package/node_modules/baileys/node_modules/music-metadata/lib/mp4/AtomToken.js +2 -1
- package/node_modules/baileys/node_modules/music-metadata/lib/mp4/MP4Parser.js +34 -7
- package/node_modules/baileys/node_modules/music-metadata/lib/ogg/speex/SpeexStream.d.ts +7 -0
- package/node_modules/baileys/node_modules/music-metadata/lib/ogg/speex/SpeexStream.js +13 -0
- package/node_modules/baileys/node_modules/music-metadata/lib/riff/RiffChunk.js +1 -1
- package/node_modules/baileys/node_modules/music-metadata/package.json +156 -156
- package/node_modules/baileys/node_modules/process-warning/.github/dependabot.yml +42 -2
- package/node_modules/baileys/node_modules/process-warning/.github/workflows/ci.yml +12 -1
- package/node_modules/baileys/node_modules/process-warning/.github/workflows/lock-threads.yml +19 -0
- package/node_modules/baileys/node_modules/process-warning/LICENSE +1 -1
- package/node_modules/baileys/node_modules/process-warning/README.md +41 -2
- package/node_modules/baileys/node_modules/process-warning/index.js +85 -17
- package/node_modules/baileys/node_modules/process-warning/package.json +6 -7
- package/node_modules/baileys/node_modules/process-warning/test/emit-once-only.test.js +3 -3
- package/node_modules/baileys/node_modules/process-warning/test/emit-reset.test.js +4 -4
- package/node_modules/baileys/node_modules/process-warning/test/emit-unlimited.test.js +2 -2
- package/node_modules/baileys/node_modules/process-warning/test/spy-warning.test.js +143 -0
- package/node_modules/baileys/node_modules/process-warning/types/index.d.ts +15 -1
- package/node_modules/baileys/node_modules/process-warning/types/index.tst.ts +48 -0
- package/node_modules/baileys/node_modules/protobufjs/README.md +61 -84
- package/node_modules/baileys/node_modules/protobufjs/dist/light/protobuf.js +66 -45
- package/node_modules/baileys/node_modules/protobufjs/dist/light/protobuf.js.map +1 -1
- package/node_modules/baileys/node_modules/protobufjs/dist/light/protobuf.min.js +3 -3
- package/node_modules/baileys/node_modules/protobufjs/dist/light/protobuf.min.js.map +1 -1
- package/node_modules/baileys/node_modules/protobufjs/dist/minimal/protobuf.js +47 -40
- package/node_modules/baileys/node_modules/protobufjs/dist/minimal/protobuf.js.map +1 -1
- package/node_modules/baileys/node_modules/protobufjs/dist/minimal/protobuf.min.js +3 -3
- package/node_modules/baileys/node_modules/protobufjs/dist/minimal/protobuf.min.js.map +1 -1
- package/node_modules/baileys/node_modules/protobufjs/dist/protobuf.js +92 -68
- package/node_modules/baileys/node_modules/protobufjs/dist/protobuf.js.map +1 -1
- package/node_modules/baileys/node_modules/protobufjs/dist/protobuf.min.js +3 -3
- package/node_modules/baileys/node_modules/protobufjs/dist/protobuf.min.js.map +1 -1
- package/node_modules/baileys/node_modules/protobufjs/ext/descriptor.js +26 -10
- package/node_modules/baileys/node_modules/protobufjs/index.d.ts +3 -0
- package/node_modules/baileys/node_modules/protobufjs/package.json +1 -1
- package/node_modules/baileys/node_modules/protobufjs/src/converter.js +5 -1
- package/node_modules/baileys/node_modules/protobufjs/src/enum.js +5 -2
- package/node_modules/baileys/node_modules/protobufjs/src/field.js +6 -1
- package/node_modules/baileys/node_modules/protobufjs/src/parse.js +26 -23
- package/node_modules/baileys/node_modules/protobufjs/src/reader.js +36 -9
- package/node_modules/baileys/node_modules/protobufjs/src/util/codegen.js +3 -1
- package/node_modules/baileys/node_modules/protobufjs/src/util/utf8.js +2 -28
- package/node_modules/baileys/node_modules/protobufjs/src/writer.js +7 -1
- package/node_modules/baileys/node_modules/ws/lib/permessage-deflate.js +3 -1
- package/node_modules/baileys/node_modules/ws/package.json +1 -1
- package/node_modules/baileys/package.json +1 -1
- package/node_modules/typebox/build/format/date.d.mts +1 -1
- package/node_modules/typebox/build/format/date.mjs +1 -1
- package/node_modules/typebox/build/format/date_time.d.mts +2 -2
- package/node_modules/typebox/build/format/date_time.mjs +3 -3
- package/node_modules/typebox/build/format/email.d.mts +1 -1
- package/node_modules/typebox/build/format/email.mjs +2 -2
- package/node_modules/typebox/build/format/hostname.mjs +2 -10
- package/node_modules/typebox/build/format/idn_email.d.mts +1 -1
- package/node_modules/typebox/build/format/idn_email.mjs +3 -3
- package/node_modules/typebox/build/format/idn_hostname.d.mts +1 -0
- package/node_modules/typebox/build/format/idn_hostname.mjs +3 -11
- package/node_modules/typebox/build/format/idna/format/bidi.d.mts +3 -0
- package/node_modules/typebox/build/format/idna/format/bidi.mjs +98 -0
- package/node_modules/typebox/build/format/idna/format/puny.d.mts +3 -0
- package/node_modules/typebox/build/format/idna/format/puny.mjs +144 -0
- package/node_modules/typebox/build/format/idna/hostname.d.mts +1 -0
- package/node_modules/typebox/build/format/idna/hostname.mjs +16 -0
- package/node_modules/typebox/build/format/idna/idn-hostname.d.mts +1 -0
- package/node_modules/typebox/build/format/idna/idn-hostname.mjs +41 -0
- package/node_modules/typebox/build/format/idna/index.d.mts +2 -0
- package/node_modules/typebox/build/format/idna/index.mjs +2 -0
- package/node_modules/typebox/build/format/idna/label/ascii.d.mts +1 -0
- package/node_modules/typebox/build/format/idna/label/ascii.mjs +9 -0
- package/node_modules/typebox/build/format/idna/label/puny.d.mts +1 -0
- package/node_modules/typebox/build/format/idna/label/puny.mjs +28 -0
- package/node_modules/typebox/build/format/idna/label/unicode.d.mts +1 -0
- package/node_modules/typebox/build/format/idna/label/unicode.mjs +106 -0
- package/node_modules/typebox/build/format/idna/pattern/pattern.d.mts +30 -0
- package/node_modules/typebox/build/format/idna/pattern/pattern.mjs +70 -0
- package/node_modules/typebox/build/format/ipv4.d.mts +0 -1
- package/node_modules/typebox/build/format/ipv4.mjs +2 -32
- package/node_modules/typebox/build/format/ipv6.mjs +2 -61
- package/node_modules/typebox/build/format/iri.d.mts +2 -2
- package/node_modules/typebox/build/format/iri.mjs +26 -8
- package/node_modules/typebox/build/format/iri_reference.d.mts +2 -2
- package/node_modules/typebox/build/format/iri_reference.mjs +9 -55
- package/node_modules/typebox/build/format/regex.d.mts +1 -2
- package/node_modules/typebox/build/format/regex.mjs +2 -6
- package/node_modules/typebox/build/format/time.d.mts +2 -2
- package/node_modules/typebox/build/format/time.mjs +19 -14
- package/node_modules/typebox/build/format/uri.d.mts +1 -1
- package/node_modules/typebox/build/format/uri.mjs +3 -130
- package/node_modules/typebox/build/format/uri_reference.d.mts +1 -1
- package/node_modules/typebox/build/format/uri_reference.mjs +2 -3
- package/node_modules/typebox/build/format/uri_template.d.mts +2 -3
- package/node_modules/typebox/build/format/uri_template.mjs +4 -5
- package/node_modules/typebox/build/format/url.d.mts +3 -3
- package/node_modules/typebox/build/format/url.mjs +4 -5
- package/node_modules/typebox/build/guard/emit.d.mts +3 -1
- package/node_modules/typebox/build/guard/emit.mjs +12 -5
- package/node_modules/typebox/build/guard/guard.d.mts +8 -2
- package/node_modules/typebox/build/guard/guard.mjs +25 -4
- package/node_modules/typebox/build/guard/string.d.mts +2 -2
- package/node_modules/typebox/build/guard/string.mjs +7 -7
- package/node_modules/typebox/build/schema/engine/_context.mjs +3 -3
- package/node_modules/typebox/build/schema/engine/_functions.mjs +1 -2
- package/node_modules/typebox/build/schema/engine/_regexp.d.mts +2 -0
- package/node_modules/typebox/build/schema/engine/_regexp.mjs +4 -0
- package/node_modules/typebox/build/schema/engine/_stack.mjs +12 -13
- package/node_modules/typebox/build/schema/engine/additionalItems.mjs +17 -7
- package/node_modules/typebox/build/schema/engine/additionalProperties.mjs +4 -3
- package/node_modules/typebox/build/schema/engine/contains.mjs +18 -6
- package/node_modules/typebox/build/schema/engine/enum.mjs +1 -1
- package/node_modules/typebox/build/schema/engine/items.mjs +26 -6
- package/node_modules/typebox/build/schema/engine/maxContains.mjs +3 -3
- package/node_modules/typebox/build/schema/engine/minContains.mjs +14 -4
- package/node_modules/typebox/build/schema/engine/not.mjs +4 -2
- package/node_modules/typebox/build/schema/engine/oneOf.mjs +7 -6
- package/node_modules/typebox/build/schema/engine/pattern.mjs +3 -2
- package/node_modules/typebox/build/schema/engine/patternProperties.mjs +4 -3
- package/node_modules/typebox/build/schema/engine/ref.mjs +1 -7
- package/node_modules/typebox/build/schema/engine/schema.mjs +13 -4
- package/node_modules/typebox/build/schema/engine/type.mjs +1 -1
- package/node_modules/typebox/build/schema/resolve/resolve.d.mts +4 -1
- package/node_modules/typebox/build/schema/resolve/resolve.mjs +202 -1
- package/node_modules/typebox/build/schema/static/propertyNames.d.mts +5 -0
- package/node_modules/typebox/build/schema/static/propertyNames.mjs +3 -0
- package/node_modules/typebox/build/schema/static/schema.d.mts +3 -0
- package/node_modules/typebox/build/schema/types/index.d.mts +0 -2
- package/node_modules/typebox/build/schema/types/index.mjs +0 -2
- package/node_modules/typebox/build/system/memory/clone.mjs +14 -11
- package/node_modules/typebox/build/system/memory/discard.mjs +6 -5
- package/node_modules/typebox/build/system/settings/settings.d.mts +9 -0
- package/node_modules/typebox/build/system/settings/settings.mjs +2 -0
- package/node_modules/typebox/build/type/engine/call/distribute_arguments.d.mts +6 -1
- package/node_modules/typebox/build/type/engine/call/distribute_arguments.mjs +16 -3
- package/node_modules/typebox/build/type/engine/call/instantiate.mjs +34 -4
- package/node_modules/typebox/build/type/engine/evaluate/broaden.d.mts +5 -5
- package/node_modules/typebox/build/type/engine/evaluate/broaden.mjs +20 -26
- package/node_modules/typebox/build/type/engine/evaluate/compare.d.mts +6 -10
- package/node_modules/typebox/build/type/engine/evaluate/compare.mjs +9 -13
- package/node_modules/typebox/build/type/engine/evaluate/composite.d.mts +7 -4
- package/node_modules/typebox/build/type/engine/evaluate/composite.mjs +12 -19
- package/node_modules/typebox/build/type/engine/evaluate/distribute.d.mts +4 -20
- package/node_modules/typebox/build/type/engine/evaluate/distribute.mjs +8 -20
- package/node_modules/typebox/build/type/engine/evaluate/evaluate.d.mts +4 -4
- package/node_modules/typebox/build/type/engine/evaluate/evaluate.mjs +11 -8
- package/node_modules/typebox/build/type/engine/evaluate/flatten.d.mts +1 -1
- package/node_modules/typebox/build/type/engine/evaluate/flatten.mjs +3 -4
- package/node_modules/typebox/build/type/engine/evaluate/narrow.d.mts +17 -2
- package/node_modules/typebox/build/type/engine/evaluate/narrow.mjs +26 -6
- package/node_modules/typebox/build/type/engine/exclude/operation.mjs +3 -4
- package/node_modules/typebox/build/type/engine/extract/operation.d.mts +1 -1
- package/node_modules/typebox/build/type/engine/extract/operation.mjs +3 -4
- package/node_modules/typebox/build/type/engine/priority/priority.d.mts +2 -2
- package/node_modules/typebox/build/type/engine/priority/priority.mjs +3 -4
- package/node_modules/typebox/build/type/script/mapping.d.mts +32 -29
- package/node_modules/typebox/build/type/script/mapping.mjs +18 -25
- package/node_modules/typebox/build/type/script/parser.d.mts +19 -25
- package/node_modules/typebox/build/type/script/parser.mjs +27 -23
- package/node_modules/typebox/build/value/errors/errors.d.mts +2 -2
- package/node_modules/typebox/build/value/errors/errors.mjs +1 -1
- package/node_modules/typebox/package.json +27 -27
- package/node_modules/typebox/readme.md +79 -82
- package/openclaw.plugin.json +2 -1
- package/package.json +6 -6
- package/node_modules/baileys/node_modules/process-warning/types/index.test-d.ts +0 -36
- package/node_modules/typebox/build/format/_idna.d.mts +0 -2
- package/node_modules/typebox/build/format/_idna.mjs +0 -246
- package/node_modules/typebox/build/format/_puny.d.mts +0 -1
- package/node_modules/typebox/build/format/_puny.mjs +0 -77
- package/node_modules/typebox/build/schema/resolve/ref.d.mts +0 -3
- package/node_modules/typebox/build/schema/resolve/ref.mjs +0 -146
- package/node_modules/typebox/build/schema/types/contentEncoding.d.mts +0 -9
- package/node_modules/typebox/build/schema/types/contentEncoding.mjs +0 -13
- package/node_modules/typebox/build/schema/types/contentMediaType.d.mts +0 -9
- package/node_modules/typebox/build/schema/types/contentMediaType.mjs +0 -13
|
@@ -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-CeKQbu_s.js";
|
|
3
3
|
import { createQuestionReactionTargetStore, 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({
|
package/dist/runtime-api.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { c as resolveWebCredsPath, r as hasWebCredsSync, s as resolveWebCredsBackupPath } from "./creds-files-W6B3EMZ8.js";
|
|
2
|
-
import { n as whatsAppActionRuntime, t as handleWhatsAppAction } from "./action-runtime-
|
|
3
|
-
import { i as sendTypingWhatsApp, n as sendPollWhatsApp, r as sendReactionWhatsApp, t as sendMessageWhatsApp } from "./send-
|
|
2
|
+
import { n as whatsAppActionRuntime, t as handleWhatsAppAction } from "./action-runtime-Bw0loEdy.js";
|
|
3
|
+
import { i as sendTypingWhatsApp, n as sendPollWhatsApp, r as sendReactionWhatsApp, t as sendMessageWhatsApp } from "./send-DiPjiygK.js";
|
|
4
4
|
import { a as setWhatsAppRuntime } from "./runtime-BLlToOi6.js";
|
|
5
5
|
import { startWebLoginWithQr, waitForWebLogin } from "./login-qr-runtime.js";
|
|
6
|
-
import { t as createWhatsAppLoginTool } from "./agent-tools-login-
|
|
7
|
-
import { M as waitForCredsSaveQueueWithTimeout, N 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, j as waitForCredsSaveQueue, 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, x as webAuthExists, y as resolveDefaultWebAuthDir } from "./auth-store-
|
|
8
|
-
import { t as DEFAULT_WEB_MEDIA_BYTES } from "./constants-
|
|
6
|
+
import { t as createWhatsAppLoginTool } from "./agent-tools-login-B-2qZPzc.js";
|
|
7
|
+
import { M as waitForCredsSaveQueueWithTimeout, N 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, j as waitForCredsSaveQueue, 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, x as webAuthExists, y as resolveDefaultWebAuthDir } from "./auth-store-DTj1H9pv.js";
|
|
8
|
+
import { t as DEFAULT_WEB_MEDIA_BYTES } from "./constants-C7m81BNe.js";
|
|
9
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-
|
|
10
|
+
import { a as waitForWaConnection, i as newConnectionId, r as createWaSocket } from "./socket-close-CpkkJZCU.js";
|
|
11
11
|
import { n as getStatusCode, t as formatError } from "./session-errors-JuazczrA.js";
|
|
12
|
-
import { p as extractText, s as extractContactContext, u as extractLocationData } from "./send-api-
|
|
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 { p as extractText, s as extractContactContext, u as extractLocationData } from "./send-api-kFcuhSiY.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-CTsyo-HE.js";
|
|
14
|
+
import { t as loginWeb } from "./login-Bk_jiXKD.js";
|
|
15
15
|
import { HEARTBEAT_PROMPT, HEARTBEAT_TOKEN, SILENT_REPLY_TOKEN, stripHeartbeatToken } from "openclaw/plugin-sdk/reply-runtime";
|
|
16
16
|
export { DEFAULT_WEB_MEDIA_BYTES, HEARTBEAT_PROMPT, HEARTBEAT_TOKEN, LocalMediaAccessError, SILENT_REPLY_TOKEN, WA_WEB_AUTH_DIR, WHATSAPP_AUTH_UNSTABLE_CODE, WhatsAppAuthUnstableError, createWaSocket, createWhatsAppLoginTool, extractContactContext, extractLocationData, 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,13 +1,14 @@
|
|
|
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-CeKQbu_s.js";
|
|
2
2
|
import { r as resolveDefaultWhatsAppAccountId } from "./account-ids-CB5SOWjc.js";
|
|
3
3
|
import { n as isWhatsAppNewsletterJid } from "./normalize-target-CugRyONv.js";
|
|
4
4
|
import { r as getWhatsAppConnectionController } from "./connection-controller-runtime-context-DG0tuYuw.js";
|
|
5
5
|
import "./normalize-C7Hkc_vE.js";
|
|
6
|
-
import { a as markdownToWhatsAppChunks, c as toWhatsappJid } from "./targets-runtime-
|
|
7
|
-
import { a as stripToolCallXmlTags, i as sanitizeAssistantVisibleTextWithProfile, r as sanitizeAssistantVisibleText } from "./text-runtime-
|
|
6
|
+
import { a as markdownToWhatsAppChunks, c as toWhatsappJid } from "./targets-runtime-RBjx3pg_.js";
|
|
7
|
+
import { a as stripToolCallXmlTags, i as sanitizeAssistantVisibleTextWithProfile, r as sanitizeAssistantVisibleText } from "./text-runtime-DyfmcATV.js";
|
|
8
8
|
import path from "node:path";
|
|
9
9
|
import { normalizeStringEntries, normalizeUniqueStringEntries, uniqueStrings } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
10
10
|
import { resolveReactionLevel } from "openclaw/plugin-sdk/status-helpers";
|
|
11
|
+
import { createMessageReceiptFromOutboundResults, createReplyToFanout, listMessageReceiptPlatformIds, sanitizeForPlainText } from "openclaw/plugin-sdk/channel-outbound";
|
|
11
12
|
import { formatCliCommand } from "openclaw/plugin-sdk/cli-runtime";
|
|
12
13
|
import { generateSecureUuid } from "openclaw/plugin-sdk/core";
|
|
13
14
|
import { PlatformMessageNotDispatchedError } from "openclaw/plugin-sdk/error-runtime";
|
|
@@ -22,17 +23,17 @@ import { extensionForMime, mediaKindFromMime, mimeTypeFromFilePath, normalizeMim
|
|
|
22
23
|
import { AsyncLocalStorage } from "node:async_hooks";
|
|
23
24
|
import { recordChannelActivity } from "openclaw/plugin-sdk/channel-activity-runtime";
|
|
24
25
|
import { createChannelPartialDeliveryError, isChannelPartialDeliveryError } from "openclaw/plugin-sdk/channel-inbound";
|
|
25
|
-
import { createMessageReceiptFromOutboundResults, listMessageReceiptPlatformIds, sanitizeForPlainText } from "openclaw/plugin-sdk/channel-outbound";
|
|
26
26
|
import { MEDIA_FFMPEG_MAX_AUDIO_DURATION_SECS, transcodeAudioBufferToOpus } from "openclaw/plugin-sdk/media-runtime";
|
|
27
27
|
import { resolveOutboundMediaUrls } from "openclaw/plugin-sdk/reply-payload";
|
|
28
28
|
//#region extensions/whatsapp/src/reaction-level.ts
|
|
29
29
|
/** Resolve the effective reaction level and its implications for WhatsApp. */
|
|
30
30
|
function resolveWhatsAppReactionLevel(params) {
|
|
31
|
+
const account = resolveMergedWhatsAppAccountConfig({
|
|
32
|
+
cfg: params.cfg,
|
|
33
|
+
accountId: params.accountId
|
|
34
|
+
});
|
|
31
35
|
return resolveReactionLevel({
|
|
32
|
-
value:
|
|
33
|
-
cfg: params.cfg,
|
|
34
|
-
accountId: params.accountId
|
|
35
|
-
}).reactionLevel,
|
|
36
|
+
value: account.reactionLevel,
|
|
36
37
|
defaultLevel: "minimal",
|
|
37
38
|
invalidFallback: "minimal"
|
|
38
39
|
});
|
|
@@ -494,9 +495,10 @@ async function sendMessageWhatsAppInActivityScope(to, body, options) {
|
|
|
494
495
|
accountId: resolvedAccountId ?? options.accountId
|
|
495
496
|
});
|
|
496
497
|
const accountIdForFormatting = resolvedAccountId ?? options.accountId;
|
|
497
|
-
const
|
|
498
|
-
const
|
|
499
|
-
|
|
498
|
+
const requestedLimit = options.formatting?.textLimit ?? Infinity;
|
|
499
|
+
const textLimit = Math.min(requestedLimit > 0 ? requestedLimit : Infinity, resolveTextChunkLimit(cfg, "whatsapp", accountIdForFormatting, { fallbackLimit: 4e3 }), 4096);
|
|
500
|
+
const textChunks = markdownToWhatsAppChunks(text, textLimit, tableMode, options.formatting?.chunkMode ?? resolveChunkMode(cfg, "whatsapp", accountIdForFormatting));
|
|
501
|
+
text = textChunks.shift() ?? text;
|
|
500
502
|
if (!text && !hasMedia) return {
|
|
501
503
|
messageId: "",
|
|
502
504
|
toJid: jid
|
|
@@ -565,30 +567,52 @@ async function sendMessageWhatsAppInActivityScope(to, body, options) {
|
|
|
565
567
|
}
|
|
566
568
|
}
|
|
567
569
|
const accountId = Boolean(options.accountId?.trim()) ? resolvedAccountId : void 0;
|
|
568
|
-
const
|
|
570
|
+
const trailingTextChunks = [visibleTextAfterVoice, ...textChunks].filter((chunk) => Boolean(chunk));
|
|
571
|
+
const reportProgress = trailingTextChunks.length > 0 ? options.onDeliveryResult : void 0;
|
|
572
|
+
const sendOptions = options.gifPlayback || forceDocumentDelivery || accountId || documentFileName ? {
|
|
569
573
|
...options.gifPlayback ? { gifPlayback: true } : {},
|
|
570
574
|
...forceDocumentDelivery ? { asDocument: true } : {},
|
|
571
575
|
...documentFileName ? { fileName: documentFileName } : {},
|
|
572
|
-
...options.quotedMessageKey ? { quotedMessageKey: options.quotedMessageKey } : {},
|
|
573
576
|
accountId
|
|
574
577
|
} : void 0;
|
|
575
|
-
const
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
const
|
|
578
|
+
const quotedSendOptions = options.quotedMessageKey ? {
|
|
579
|
+
...sendOptions,
|
|
580
|
+
quotedMessageKey: options.quotedMessageKey
|
|
581
|
+
} : sendOptions;
|
|
582
|
+
const nextReplyToId = createReplyToFanout({
|
|
583
|
+
replyToId: options.quotedMessageKey?.id,
|
|
584
|
+
replyToIdSource: options.replyToIdSource,
|
|
585
|
+
replyToMode: options.replyToMode
|
|
586
|
+
});
|
|
587
|
+
const sendPart = async (part, buffer, mime) => {
|
|
588
|
+
await options.onPlatformSendDispatch?.();
|
|
589
|
+
const replyToId = nextReplyToId();
|
|
590
|
+
const partOptions = replyToId ? quotedSendOptions : sendOptions;
|
|
591
|
+
const accepted = requireWhatsAppAcceptedSendResult(partOptions ? await active.sendMessage(to, part, buffer, mime, partOptions) : await active.sendMessage(to, part, buffer, mime));
|
|
592
|
+
acceptedResults.push(accepted);
|
|
593
|
+
const result = {
|
|
594
|
+
messageId: accepted.messageId,
|
|
595
|
+
toJid: resolveActualSentRemoteJid(accepted, jid)
|
|
596
|
+
};
|
|
597
|
+
return {
|
|
598
|
+
...result,
|
|
599
|
+
...reportProgress ? { receipt: createMessageReceiptFromOutboundResults({
|
|
600
|
+
results: [{
|
|
601
|
+
channel: "whatsapp",
|
|
602
|
+
...result
|
|
603
|
+
}],
|
|
604
|
+
kind: buffer ? "media" : "text",
|
|
605
|
+
replyToId
|
|
606
|
+
}) } : {}
|
|
607
|
+
};
|
|
608
|
+
};
|
|
609
|
+
const result = await sendPart(text, mediaBuffer, mediaType);
|
|
610
|
+
const { messageId, toJid: sentRemoteJid } = result;
|
|
580
611
|
if (trailingTextChunks.length > 0) {
|
|
581
|
-
await
|
|
582
|
-
messageId,
|
|
583
|
-
toJid: sentRemoteJid
|
|
584
|
-
});
|
|
612
|
+
await reportProgress?.(result);
|
|
585
613
|
for (const trailingText of trailingTextChunks) {
|
|
586
|
-
const trailingResult =
|
|
587
|
-
|
|
588
|
-
await options.onDeliveryResult?.({
|
|
589
|
-
messageId: trailingResult.messageId,
|
|
590
|
-
toJid: resolveActualSentRemoteJid(trailingResult, jid)
|
|
591
|
-
});
|
|
614
|
+
const trailingResult = await sendPart(trailingText);
|
|
615
|
+
await reportProgress?.(trailingResult);
|
|
592
616
|
}
|
|
593
617
|
}
|
|
594
618
|
const durationMs = Date.now() - startedAt;
|
|
@@ -639,7 +663,8 @@ async function sendReactionWhatsApp(chatJid, messageId, emoji, options) {
|
|
|
639
663
|
messageId
|
|
640
664
|
});
|
|
641
665
|
try {
|
|
642
|
-
const
|
|
666
|
+
const jid = toWhatsappJid(chatJid);
|
|
667
|
+
const redactedJid = redactIdentifier(jid);
|
|
643
668
|
outboundLog.info(`Sending reaction "${emoji}" -> message ${messageId}`);
|
|
644
669
|
logger.info({
|
|
645
670
|
chatJid: redactedJid,
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { n as isWhatsAppNewsletterJid } from "./normalize-target-CugRyONv.js";
|
|
2
|
-
import { _ as resolveWhatsAppDocumentFileName, f as mergeWhatsAppAcceptedSendError, m as rememberWhatsAppAcceptedSend, p as normalizeWhatsAppSendResult, u as combineWhatsAppSendResults } from "./send-
|
|
2
|
+
import { _ as resolveWhatsAppDocumentFileName, f as mergeWhatsAppAcceptedSendError, m as rememberWhatsAppAcceptedSend, p as normalizeWhatsAppSendResult, u as combineWhatsAppSendResults } from "./send-DiPjiygK.js";
|
|
3
3
|
import "./normalize-C7Hkc_vE.js";
|
|
4
|
-
import { c as toWhatsappJid, l as toWhatsappJidWithLid, r as jidToE164 } from "./targets-runtime-
|
|
5
|
-
import "./text-runtime-
|
|
6
|
-
import { i as buildQuotedMessageOptions } from "./group-session-key-
|
|
7
|
-
import { k as resolveComparableIdentity } from "./auth-store-
|
|
4
|
+
import { c as toWhatsappJid, l as toWhatsappJidWithLid, r as jidToE164 } from "./targets-runtime-RBjx3pg_.js";
|
|
5
|
+
import "./text-runtime-DyfmcATV.js";
|
|
6
|
+
import { i as buildQuotedMessageOptions } from "./group-session-key-KUguLmSZ.js";
|
|
7
|
+
import { k as resolveComparableIdentity } from "./auth-store-DTj1H9pv.js";
|
|
8
8
|
import { isRecord, normalizeLowercaseStringOrEmpty, uniqueStrings } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
9
9
|
import { logVerbose } from "openclaw/plugin-sdk/runtime-env";
|
|
10
10
|
import { formatLocationText } from "openclaw/plugin-sdk/channel-inbound";
|
|
@@ -401,7 +401,7 @@ async function addWhatsAppImagePreviewFields(content) {
|
|
|
401
401
|
//#endregion
|
|
402
402
|
//#region extensions/whatsapp/src/inbound/outbound-mentions.ts
|
|
403
403
|
const CODE_FENCE_RE = /```[\s\S]*?```/g;
|
|
404
|
-
const INLINE_CODE_RE =
|
|
404
|
+
const INLINE_CODE_RE = /(?<=(?:^|[^\\])(?:\\\\)*)(`+)[\s\S]*?(?:(?<!`)\1(?!`)|$)/g;
|
|
405
405
|
const OUTBOUND_MENTION_RE = /@(\+?\d+)/g;
|
|
406
406
|
const KNOWN_USER_JID_RE = /^(\d+)(?::\d+)?@(s\.whatsapp\.net|hosted|lid|hosted\.lid|c\.us)$/i;
|
|
407
407
|
const PHONE_JID_DOMAIN_RE = /^(s\.whatsapp\.net|hosted|c\.us)$/i;
|
|
@@ -625,43 +625,44 @@ function createWebSendApi(params) {
|
|
|
625
625
|
text,
|
|
626
626
|
mentionedJids: []
|
|
627
627
|
} : await resolveMentions(jid, text);
|
|
628
|
-
if (mediaBuffer && mediaType)
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
fileName:
|
|
628
|
+
if (mediaBuffer && mediaType) {
|
|
629
|
+
if (sendOptions?.asDocument === true && supportsForcedDocumentMediaType(mediaType)) payload = {
|
|
630
|
+
document: mediaBuffer,
|
|
631
|
+
fileName: resolveWhatsAppDocumentFileName({
|
|
632
|
+
fileName: sendOptions?.fileName,
|
|
633
|
+
mimetype: mediaType
|
|
634
|
+
}),
|
|
635
|
+
caption: resolvedPayloadText.text || void 0,
|
|
632
636
|
mimetype: mediaType
|
|
633
|
-
}
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
};
|
|
637
|
-
else if (mediaType.startsWith("image/")) payload = await addWhatsAppImagePreviewFields({
|
|
638
|
-
image: mediaBuffer,
|
|
639
|
-
caption: resolvedPayloadText.text || void 0,
|
|
640
|
-
mimetype: mediaType
|
|
641
|
-
});
|
|
642
|
-
else if (mediaType.startsWith("audio/")) payload = {
|
|
643
|
-
audio: mediaBuffer,
|
|
644
|
-
ptt: true,
|
|
645
|
-
mimetype: mediaType
|
|
646
|
-
};
|
|
647
|
-
else if (mediaType.startsWith("video/")) {
|
|
648
|
-
const gifPlayback = sendOptions?.gifPlayback;
|
|
649
|
-
payload = {
|
|
650
|
-
video: mediaBuffer,
|
|
637
|
+
};
|
|
638
|
+
else if (mediaType.startsWith("image/")) payload = await addWhatsAppImagePreviewFields({
|
|
639
|
+
image: mediaBuffer,
|
|
651
640
|
caption: resolvedPayloadText.text || void 0,
|
|
652
|
-
mimetype: mediaType
|
|
653
|
-
|
|
641
|
+
mimetype: mediaType
|
|
642
|
+
});
|
|
643
|
+
else if (mediaType.startsWith("audio/")) payload = {
|
|
644
|
+
audio: mediaBuffer,
|
|
645
|
+
ptt: true,
|
|
646
|
+
mimetype: mediaType
|
|
654
647
|
};
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
648
|
+
else if (mediaType.startsWith("video/")) {
|
|
649
|
+
const gifPlayback = sendOptions?.gifPlayback;
|
|
650
|
+
payload = {
|
|
651
|
+
video: mediaBuffer,
|
|
652
|
+
caption: resolvedPayloadText.text || void 0,
|
|
653
|
+
mimetype: mediaType,
|
|
654
|
+
...gifPlayback ? { gifPlayback: true } : {}
|
|
655
|
+
};
|
|
656
|
+
} else payload = {
|
|
657
|
+
document: mediaBuffer,
|
|
658
|
+
fileName: resolveWhatsAppDocumentFileName({
|
|
659
|
+
fileName: sendOptions?.fileName,
|
|
660
|
+
mimetype: mediaType
|
|
661
|
+
}),
|
|
662
|
+
caption: resolvedPayloadText.text || void 0,
|
|
659
663
|
mimetype: mediaType
|
|
660
|
-
}
|
|
661
|
-
|
|
662
|
-
mimetype: mediaType
|
|
663
|
-
};
|
|
664
|
-
else payload = { text: resolvedPayloadText.text };
|
|
664
|
+
};
|
|
665
|
+
} else payload = { text: resolvedPayloadText.text };
|
|
665
666
|
payload = addWhatsAppOutboundMentionsToContent(payload, resolvedPayloadText.mentionedJids);
|
|
666
667
|
const quotedOpts = buildQuotedMessageOptions({
|
|
667
668
|
messageId: sendOptions?.quotedMessageKey?.id,
|
|
@@ -717,7 +718,7 @@ function createWebSendApi(params) {
|
|
|
717
718
|
},
|
|
718
719
|
sendReaction: async (chatJid, messageId, emoji, fromMe, participant) => {
|
|
719
720
|
const jid = resolveOutboundJid(chatJid);
|
|
720
|
-
|
|
721
|
+
const result = await params.sock.sendMessage(jid, { react: {
|
|
721
722
|
text: emoji,
|
|
722
723
|
key: {
|
|
723
724
|
remoteJid: jid,
|
|
@@ -725,7 +726,8 @@ function createWebSendApi(params) {
|
|
|
725
726
|
fromMe,
|
|
726
727
|
participant: participant ? toWhatsappJid(participant) : void 0
|
|
727
728
|
}
|
|
728
|
-
} })
|
|
729
|
+
} });
|
|
730
|
+
return normalizeWhatsAppSendResult(result, "reaction");
|
|
729
731
|
},
|
|
730
732
|
sendComposingTo: async (to) => {
|
|
731
733
|
const jid = resolveOutboundJid(to);
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { a as resolveWhatsAppAccount, o as resolveWhatsAppAuthDir } from "./accounts-
|
|
1
|
+
import { a as resolveWhatsAppAccount, o as resolveWhatsAppAuthDir } from "./accounts-CeKQbu_s.js";
|
|
2
2
|
import { r as resolveDefaultWhatsAppAccountId } from "./account-ids-CB5SOWjc.js";
|
|
3
3
|
import { r as hasWebCredsSync } from "./creds-files-W6B3EMZ8.js";
|
|
4
4
|
import { a as normalizeWhatsAppAllowFromEntries, o as normalizeWhatsAppAllowFromEntry } from "./normalize-target-CugRyONv.js";
|
|
5
|
-
import { r as whatsappSetupAdapter } from "./shared-
|
|
6
|
-
import { DEFAULT_ACCOUNT_ID, createSetupTranslator, splitSetupEntries } from "openclaw/plugin-sdk/setup";
|
|
5
|
+
import { r as whatsappSetupAdapter } from "./shared-DDjonGys.js";
|
|
7
6
|
import { formatCliCommand, formatDocsLink } from "openclaw/plugin-sdk/setup-tools";
|
|
7
|
+
import { DEFAULT_ACCOUNT_ID, createSetupTranslator, splitSetupEntries } from "openclaw/plugin-sdk/setup";
|
|
8
8
|
//#region extensions/whatsapp/src/setup-finalize.ts
|
|
9
9
|
const t = createSetupTranslator();
|
|
10
10
|
function trimPromptText(value) {
|
|
@@ -94,7 +94,7 @@ async function detectWhatsAppLinked(cfg, accountId) {
|
|
|
94
94
|
async function promptWhatsAppOwnerAllowFrom(params) {
|
|
95
95
|
const { prompter, existingAllowFrom } = params;
|
|
96
96
|
await prompter.note(t("wizard.whatsapp.ownerNumberNote"), t("wizard.whatsapp.numberTitle"));
|
|
97
|
-
const
|
|
97
|
+
const entry = await prompter.text({
|
|
98
98
|
message: t("wizard.whatsapp.personalNumberPrompt"),
|
|
99
99
|
placeholder: "+15555550123",
|
|
100
100
|
initialValue: existingAllowFrom[0],
|
|
@@ -103,7 +103,8 @@ async function promptWhatsAppOwnerAllowFrom(params) {
|
|
|
103
103
|
if (!raw) return t("common.required");
|
|
104
104
|
if (!normalizeWhatsAppAllowFromEntry(raw)) return `Invalid number: ${raw}`;
|
|
105
105
|
}
|
|
106
|
-
})
|
|
106
|
+
});
|
|
107
|
+
const normalized = normalizeWhatsAppAllowFromEntry(trimPromptText(entry));
|
|
107
108
|
if (!normalized) throw new Error("Invalid WhatsApp owner number (expected E.164 after validation).");
|
|
108
109
|
return {
|
|
109
110
|
normalized,
|
|
@@ -295,7 +296,7 @@ async function finalizeWhatsAppSetup(params) {
|
|
|
295
296
|
};
|
|
296
297
|
let loginWeb;
|
|
297
298
|
try {
|
|
298
|
-
({loginWeb} = await import("./login-
|
|
299
|
+
({loginWeb} = await import("./login-Bk_jiXKD.js").then((n) => n.n));
|
|
299
300
|
} catch (error) {
|
|
300
301
|
await reportLoginFailure(error);
|
|
301
302
|
}
|
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-aOFLSQyw.js";
|
|
2
2
|
export { whatsappSetupPlugin };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { o as resolveWhatsAppAuthDir } from "./accounts-
|
|
1
|
+
import { o as resolveWhatsAppAuthDir } from "./accounts-CeKQbu_s.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-DTj1H9pv.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-CqH5wTK5.js")).finalizeWhatsAppSetup(params),
|
|
40
40
|
disable: (cfg) => setSetupChannelEnabled(cfg, channel, false),
|
|
41
41
|
onAccountRecorded: (accountId, options) => {
|
|
42
42
|
options?.onAccountId?.(channel, accountId);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { a as resolveWhatsAppAccount, n as hasAnyWhatsAppAuth } from "./accounts-
|
|
1
|
+
import { a as resolveWhatsAppAccount, n as hasAnyWhatsAppAuth } from "./accounts-CeKQbu_s.js";
|
|
2
2
|
import { r as resolveDefaultWhatsAppAccountId, t as listAccountIds } from "./account-ids-CB5SOWjc.js";
|
|
3
3
|
import { a as normalizeWhatsAppAllowFromEntries } from "./normalize-target-CugRyONv.js";
|
|
4
|
-
import { t as WhatsAppChannelConfigSchema } from "./config-schema-
|
|
4
|
+
import { t as WhatsAppChannelConfigSchema } from "./config-schema-BYA6e_Ii.js";
|
|
5
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";
|
|
@@ -20,14 +20,14 @@ import { adaptScopedAccountAccessor, createScopedChannelConfigAdapter, createSco
|
|
|
20
20
|
import { createDelegatedSetupWizardProxy } from "openclaw/plugin-sdk/setup-runtime";
|
|
21
21
|
import { readChannelAllowFromStore } from "openclaw/plugin-sdk/channel-pairing";
|
|
22
22
|
//#region extensions/whatsapp/src/channel-runtime-loader.ts
|
|
23
|
-
const loadWhatsAppAuthStore = createLazyRuntimeModule(() => import("./auth-store-
|
|
23
|
+
const loadWhatsAppAuthStore = createLazyRuntimeModule(() => import("./auth-store-DTj1H9pv.js").then((n) => n.i));
|
|
24
24
|
async function readWhatsAppAccountLinkState(authDir) {
|
|
25
25
|
const state = await (await loadWhatsAppAuthStore()).readWebAuthState(authDir);
|
|
26
26
|
return state === "unstable" ? "unknown" : state;
|
|
27
27
|
}
|
|
28
28
|
const loadWhatsAppChannelRuntime = createLazyRuntimeModule(async () => {
|
|
29
29
|
await loadWhatsAppAuthStore();
|
|
30
|
-
return await import("./channel.runtime-
|
|
30
|
+
return await import("./channel.runtime-BwSnyXRX.js");
|
|
31
31
|
});
|
|
32
32
|
//#endregion
|
|
33
33
|
//#region extensions/whatsapp/src/config-accessors.ts
|
|
@@ -96,7 +96,8 @@ function applyGroupAllowFromFromStore(params) {
|
|
|
96
96
|
return changed ? next : params.cfg;
|
|
97
97
|
}
|
|
98
98
|
async function applyWhatsAppSecurityConfigFixes(params) {
|
|
99
|
-
const
|
|
99
|
+
const fromStore = await readChannelAllowFromStore("whatsapp", params.env, DEFAULT_ACCOUNT_ID).catch(() => []);
|
|
100
|
+
const normalized = normalizeUniqueStringEntries(fromStore);
|
|
100
101
|
if (normalized.length === 0) return {
|
|
101
102
|
config: params.cfg,
|
|
102
103
|
changes: []
|
|
@@ -115,7 +116,7 @@ async function applyWhatsAppSecurityConfigFixes(params) {
|
|
|
115
116
|
//#region extensions/whatsapp/src/shared.ts
|
|
116
117
|
const WHATSAPP_CHANNEL = "whatsapp";
|
|
117
118
|
async function loadWhatsAppSetupSurface() {
|
|
118
|
-
return await import("./setup-surface-
|
|
119
|
+
return await import("./setup-surface-Dm3T6S8t.js");
|
|
119
120
|
}
|
|
120
121
|
const whatsappSetupWizardProxy = createWhatsAppSetupWizardProxy(async () => (await loadWhatsAppSetupSurface()).whatsappSetupWizard);
|
|
121
122
|
const whatsappConfigAdapter = createScopedChannelConfigAdapter({
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { c as resolveWebCredsPath, s as resolveWebCredsBackupPath, t as assertWebCredsPathRegularFileOrMissing } from "./creds-files-W6B3EMZ8.js";
|
|
2
|
-
import { A as enqueueCredsSave, M as waitForCredsSaveQueueWithTimeout, N as writeCredsJsonAtomically, P as writeWebCredsRawAtomically, b as restoreCredsFromBackupIfNeeded, u as readCredsJsonRaw, y as resolveDefaultWebAuthDir } from "./auth-store-
|
|
2
|
+
import { A as enqueueCredsSave, M as waitForCredsSaveQueueWithTimeout, N as writeCredsJsonAtomically, P as writeWebCredsRawAtomically, b as restoreCredsFromBackupIfNeeded, u as readCredsJsonRaw, y as resolveDefaultWebAuthDir } from "./auth-store-DTj1H9pv.js";
|
|
3
3
|
import { n as getStatusCode } from "./session-errors-JuazczrA.js";
|
|
4
4
|
import { a as makeWASocket, i as makeCacheableSignalKeyStore, n as createBaileysSignalRepository, r as fetchLatestBaileysVersion, s as useMultiFileAuthState } from "./session.runtime-Nsqaehbd.js";
|
|
5
5
|
import { VERSION, formatCliCommand } from "openclaw/plugin-sdk/cli-runtime";
|
|
@@ -22,7 +22,7 @@ var WhatsAppConnectionOwnerBusyError = class extends Error {
|
|
|
22
22
|
this.name = "WhatsAppConnectionOwnerBusyError";
|
|
23
23
|
}
|
|
24
24
|
};
|
|
25
|
-
const OWNER_LOCK_STALE_MS =
|
|
25
|
+
const OWNER_LOCK_STALE_MS = 3e5;
|
|
26
26
|
const GATEWAY_LOCAL_OWNER_WAIT_MS = 15e4;
|
|
27
27
|
const processOwners = /* @__PURE__ */ new Map();
|
|
28
28
|
function ownershipCancelledError(signal) {
|
|
@@ -325,7 +325,8 @@ async function createWaSocket(printQr, verbose, opts = {}) {
|
|
|
325
325
|
return await createWaSocketInternal(printQr, verbose, opts, "normal");
|
|
326
326
|
}
|
|
327
327
|
async function createWaSocketInternal(printQr, verbose, opts, receiveMode) {
|
|
328
|
-
const
|
|
328
|
+
const baseLogger = getChildLogger({ module: "baileys" }, { level: verbose ? "info" : "silent" });
|
|
329
|
+
const logger = toPinoLikeLogger(baseLogger, verbose ? "info" : "silent");
|
|
329
330
|
const authDir = resolveUserPath(opts.authDir ?? resolveDefaultWebAuthDir());
|
|
330
331
|
await rejectUnsafeWebCredsPath(authDir);
|
|
331
332
|
await opts.beforeCredentialPersistence?.();
|
|
@@ -357,13 +358,14 @@ async function createWaSocketInternal(printQr, verbose, opts, receiveMode) {
|
|
|
357
358
|
else pendingSocketAbort = { error };
|
|
358
359
|
opts.onCredentialPersistenceError?.(error);
|
|
359
360
|
};
|
|
360
|
-
const
|
|
361
|
+
const persistedSignalKeys = opts.beforeCredentialPersistence ? {
|
|
361
362
|
...state.keys,
|
|
362
363
|
async set(data) {
|
|
363
364
|
await opts.beforeCredentialPersistence?.();
|
|
364
365
|
await state.keys.set(data);
|
|
365
366
|
}
|
|
366
|
-
} : state.keys
|
|
367
|
+
} : state.keys;
|
|
368
|
+
const cachedSignalKeys = makeCacheableSignalKeyStore(persistedSignalKeys, logger);
|
|
367
369
|
const signalKeys = opts.beforeCredentialPersistence ? {
|
|
368
370
|
...cachedSignalKeys,
|
|
369
371
|
get(type, ids) {
|
|
@@ -542,7 +544,8 @@ async function waitForWaConnection(sock, options = { timeout: "none" }) {
|
|
|
542
544
|
}
|
|
543
545
|
if (update.connection === "close") {
|
|
544
546
|
cleanup();
|
|
545
|
-
|
|
547
|
+
const disconnectError = update.lastDisconnect?.error ?? update.lastDisconnect;
|
|
548
|
+
reject(toErrorObject(disconnectError ?? /* @__PURE__ */ new Error("Connection closed"), "Non-Error rejection"));
|
|
546
549
|
}
|
|
547
550
|
};
|
|
548
551
|
sock.ev.on("connection.update", handler);
|
|
@@ -282,8 +282,7 @@ function markdownToWhatsAppChunks(text, limit, tableMode = "bullets", chunkMode
|
|
|
282
282
|
if (!text.trim()) return chunkMarkdownTextWithMode(text, limit, chunkMode);
|
|
283
283
|
const { ir, escapedMarkers } = prepareWhatsAppMarkdown(text, tableMode);
|
|
284
284
|
const render = (chunk) => renderWhatsAppMarkdownIR(chunk, escapedMarkers);
|
|
285
|
-
|
|
286
|
-
let chunks = ir.styles.length === 0 && ir.links.length === 0 ? chunkMarkdownTextWithMode(rendered, limit, chunkMode) : splitWhatsAppIRForChunkMode(ir, limit, chunkMode).flatMap((source) => renderMarkdownIRChunksWithinLimit({
|
|
285
|
+
let chunks = ir.styles.length === 0 && ir.links.length === 0 ? chunkMarkdownTextWithMode(render(ir), limit, chunkMode) : splitWhatsAppIRForChunkMode(ir, limit, chunkMode).flatMap((source) => renderMarkdownIRChunksWithinLimit({
|
|
287
286
|
ir: source,
|
|
288
287
|
limit,
|
|
289
288
|
renderChunk: render,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import "./targets-runtime-
|
|
1
|
+
import "./targets-runtime-RBjx3pg_.js";
|
|
2
2
|
import { sanitizeAssistantVisibleText, sanitizeAssistantVisibleTextWithProfile, stripToolCallXmlTags } from "openclaw/plugin-sdk/text-chunking";
|
|
3
3
|
import { normalizeE164, resolveUserPath as resolveUserPath$1 } from "openclaw/plugin-sdk/text-utility-runtime";
|
|
4
4
|
export { stripToolCallXmlTags as a, sanitizeAssistantVisibleTextWithProfile as i, resolveUserPath$1 as n, sanitizeAssistantVisibleText as r, normalizeE164 as t };
|
|
@@ -2,7 +2,7 @@ import { proto } from '../../WAProto/index.js';
|
|
|
2
2
|
import { makeLibSignalRepository } from '../Signal/libsignal.js';
|
|
3
3
|
import { Browsers } from '../Utils/browser-utils.js';
|
|
4
4
|
import logger from '../Utils/logger.js';
|
|
5
|
-
const version = [2, 3000,
|
|
5
|
+
const version = [2, 3000, 1043857760];
|
|
6
6
|
export const UNAUTHORIZED_CODES = [401, 403, 419];
|
|
7
7
|
export const DEFAULT_ORIGIN = 'https://web.whatsapp.com';
|
|
8
8
|
export const CALL_VIDEO_PREFIX = 'https://call.whatsapp.com/video/';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"business.d.ts","sourceRoot":"","sources":["../../src/Socket/business.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,aAAa,EAAE,aAAa,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA;AAC5G,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,mBAAmB,CAAA;AAUnE,OAAO,EAAE,KAAK,UAAU,EAAqC,MAAM,aAAa,CAAA;AAIhF,eAAO,MAAM,kBAAkB,GAAI,QAAQ,YAAY;;+BA8Od,MAAM,eAAe,MAAM;yCAjGjB,iBAAiB;;;;2BAmD/B,MAAM;;;4BAkIL,aAAa;gCAwCT,MAAM,EAAE;;;+BA9ET,MAAM,UAAU,aAAa;kCAxR1B,0BAA0B;8BA2E9B,aAAa;2BAoChB,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"business.d.ts","sourceRoot":"","sources":["../../src/Socket/business.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,aAAa,EAAE,aAAa,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA;AAC5G,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,mBAAmB,CAAA;AAUnE,OAAO,EAAE,KAAK,UAAU,EAAqC,MAAM,aAAa,CAAA;AAIhF,eAAO,MAAM,kBAAkB,GAAI,QAAQ,YAAY;;+BA8Od,MAAM,eAAe,MAAM;yCAjGjB,iBAAiB;;;;2BAmD/B,MAAM;;;4BAkIL,aAAa;gCAwCT,MAAM,EAAE;;;+BA9ET,MAAM,UAAU,aAAa;kCAxR1B,0BAA0B;8BA2E9B,aAAa;2BAoChB,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAsS6+nB,CAAC;;;;;;;;;0DAhXtgoB,GAAG,0BAChB,GAAH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA8WF,CAAA"}
|
|
@@ -5,6 +5,7 @@ import type { QuickReplyAction } from '../Types/Bussines.js';
|
|
|
5
5
|
import type { LabelActionBody } from '../Types/Label.js';
|
|
6
6
|
import { type BinaryNode } from '../WABinary/index.js';
|
|
7
7
|
import { USyncQuery } from '../WAUSync/index.js';
|
|
8
|
+
export declare const buildProfilePictureQueryContent: (type: "preview" | "image", tcTokenContent?: BinaryNode[]) => BinaryNode[];
|
|
8
9
|
export declare const makeChatsSocket: (config: SocketConfig) => {
|
|
9
10
|
serverProps: {
|
|
10
11
|
/** AB prop 10518: gate tctoken on 1:1 messages. Default true (safe: avoids 463). */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chats.d.ts","sourceRoot":"","sources":["../../src/Socket/chats.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAA;AACjC,OAAO,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAA;AAE9C,OAAO,KAAK,EACX,WAAW,EACX,UAAU,EACV,gBAAgB,EAGhB,iBAAiB,EAEjB,YAAY,EAEZ,iBAAiB,EACjB,aAAa,EACb,SAAS,EACT,aAAa,EAEb,UAAU,EACV,kBAAkB,EAClB,sBAAsB,EACtB,sBAAsB,EACtB,oBAAoB,EACpB,cAAc,EACd,mBAAmB,EACnB,MAAM,UAAU,CAAA;AAEjB,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAA;AAC5D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAA;AAqBrD,OAAO,EACN,KAAK,UAAU,EAWf,MAAM,aAAa,CAAA;AACpB,OAAO,EAAE,UAAU,EAAa,MAAM,YAAY,CAAA;AAGlD,eAAO,MAAM,eAAe,GAAI,QAAQ,YAAY;;QA8BlD,oFAAoF;;QAEpF,+EAA+E;;QAE/E,iFAAiF;;;
|
|
1
|
+
{"version":3,"file":"chats.d.ts","sourceRoot":"","sources":["../../src/Socket/chats.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAA;AACjC,OAAO,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAA;AAE9C,OAAO,KAAK,EACX,WAAW,EACX,UAAU,EACV,gBAAgB,EAGhB,iBAAiB,EAEjB,YAAY,EAEZ,iBAAiB,EACjB,aAAa,EACb,SAAS,EACT,aAAa,EAEb,UAAU,EACV,kBAAkB,EAClB,sBAAsB,EACtB,sBAAsB,EACtB,oBAAoB,EACpB,cAAc,EACd,mBAAmB,EACnB,MAAM,UAAU,CAAA;AAEjB,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAA;AAC5D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAA;AAqBrD,OAAO,EACN,KAAK,UAAU,EAWf,MAAM,aAAa,CAAA;AACpB,OAAO,EAAE,UAAU,EAAa,MAAM,YAAY,CAAA;AAGlD,eAAO,MAAM,+BAA+B,GAC3C,MAAM,SAAS,GAAG,OAAO,EACzB,iBAAiB,UAAU,EAAE,KAC3B,UAAU,EAOZ,CAAA;AAED,eAAO,MAAM,eAAe,GAAI,QAAQ,YAAY;;QA8BlD,oFAAoF;;QAEpF,+EAA+E;;QAE/E,iFAAiF;;;2BAkqB9C,OAAO,GAAG,OAAO,UAAU;QAAE,SAAS,EAAE,MAAM,CAAA;KAAE,cAAc,MAAM;;;;;;;;;;;;;;;;;;4BA2HnE,aAAa;+BArGV,UAAU,UAAU,MAAM;+BA8C1B,MAAM;6BAzGR,MAAM,SAAQ,SAAS,GAAG,OAAO,cAA0B,MAAM;;2BAjdnE,MAAM,EAAE;yCAaM,MAAM,EAAE;gCAepD,MAAM,WACF,aAAa,eACT;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE;gCAmCN,MAAM;kCA0BJ,MAAM;8BAkBV,MAAM;6BAkBP,MAAM,UAAU,OAAO,GAAG,SAAS;2DAioBX,OAAO;+BAl1B7B,kBAAkB;mCAJd,sBAAsB;mCAQtB,cAAc;iCAIhB,oBAAoB;yCAIZ,cAAc;iCAItB,cAAc;uCAIR,mBAAmB;oCAItB,sBAAsB;8CAIZ,MAAM;8BAqPtB,MAAM,KAAG,OAAO,CAAC,iBAAiB,GAAG,IAAI,CAAC;;sBAyjBxD,gBAAgB,OAAO,MAAM;2BAvgBlB,cAAc,GAAG,QAAQ,kBAAkB,MAAM,GAAG,MAAM;4BA0iB/D,MAAM,WAAW,KAAK,CAAC,eAAe,CAAC,cAAc;yBAYxD,MAAM;;oBAYX,MAAM,UAAU,eAAe;wBAc3B,MAAM,WAAW,MAAM;2BAcpB,MAAM,WAAW,MAAM;2BAcvB,MAAM,aAAa,MAAM,WAAW,MAAM;8BAevC,MAAM,aAAa,MAAM,WAAW,MAAM;gBAhGxD,MAAM,YAAY;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,OAAO,CAAA;KAAE,EAAE,QAAQ,OAAO;sCA+G7C,gBAAgB;kCAYpB,MAAM;;;;;;0DAjmC5B,GAAG,0BAA0B,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA07C/C,CAAA"}
|
|
@@ -11,6 +11,13 @@ import { buildTcTokenFromJid } from '../Utils/tc-token-utils.js';
|
|
|
11
11
|
import { getBinaryNodeChild, getBinaryNodeChildren, isHostedLidUser, isHostedPnUser, isLidUser, isPnUser, jidDecode, jidNormalizedUser, reduceBinaryNodeToDictionary, S_WHATSAPP_NET } from '../WABinary/index.js';
|
|
12
12
|
import { USyncQuery, USyncUser } from '../WAUSync/index.js';
|
|
13
13
|
import { makeSocket } from './socket.js';
|
|
14
|
+
export const buildProfilePictureQueryContent = (type, tcTokenContent) => {
|
|
15
|
+
const picture = { tag: 'picture', attrs: { type, query: 'url' } };
|
|
16
|
+
if (tcTokenContent?.length) {
|
|
17
|
+
picture.content = tcTokenContent;
|
|
18
|
+
}
|
|
19
|
+
return [picture];
|
|
20
|
+
};
|
|
14
21
|
export const makeChatsSocket = (config) => {
|
|
15
22
|
const { logger, markOnlineOnConnect, fireInitQueries, appStateMacVerification, shouldIgnoreJid, shouldSyncHistoryMessage, getMessage } = config;
|
|
16
23
|
const sock = makeSocket(config);
|
|
@@ -546,7 +553,6 @@ export const makeChatsSocket = (config) => {
|
|
|
546
553
|
* type = "image for the high res picture"
|
|
547
554
|
*/
|
|
548
555
|
const profilePictureUrl = async (jid, type = 'preview', timeoutMs) => {
|
|
549
|
-
const baseContent = [{ tag: 'picture', attrs: { type, query: 'url' } }];
|
|
550
556
|
// WA Web only includes tctoken for user JIDs (not groups/newsletters)
|
|
551
557
|
// and never for own profile pic (Chat model for self has no tcToken).
|
|
552
558
|
// Including tctoken for own JID causes the server to never respond.
|
|
@@ -554,12 +560,11 @@ export const makeChatsSocket = (config) => {
|
|
|
554
560
|
const isUserJid = isPnUser(normalizedJid) || isLidUser(normalizedJid);
|
|
555
561
|
const me = authState.creds.me;
|
|
556
562
|
const isSelf = me && (normalizedJid === jidNormalizedUser(me.id) || (me.lid && normalizedJid === jidNormalizedUser(me.lid)));
|
|
557
|
-
let
|
|
563
|
+
let tcTokenContent;
|
|
558
564
|
if (serverProps.profilePicPrivacyToken && isUserJid && !isSelf) {
|
|
559
|
-
|
|
565
|
+
tcTokenContent = await buildTcTokenFromJid({
|
|
560
566
|
authState,
|
|
561
567
|
jid: normalizedJid,
|
|
562
|
-
baseContent,
|
|
563
568
|
getLIDForPN
|
|
564
569
|
});
|
|
565
570
|
}
|
|
@@ -572,7 +577,7 @@ export const makeChatsSocket = (config) => {
|
|
|
572
577
|
type: 'get',
|
|
573
578
|
xmlns: 'w:profile:picture'
|
|
574
579
|
},
|
|
575
|
-
content
|
|
580
|
+
content: buildProfilePictureQueryContent(type, tcTokenContent)
|
|
576
581
|
}, timeoutMs);
|
|
577
582
|
const child = getBinaryNodeChild(result, 'picture');
|
|
578
583
|
return child?.attrs?.url;
|