@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,23 +1,24 @@
|
|
|
1
|
-
import { a as resolveWhatsAppAccount, s as resolveWhatsAppMediaMaxBytes } from "./accounts-
|
|
2
|
-
import { c as normalizeWhatsAppPayloadTextPreservingIndentation, d as listWhatsAppSendResultMessageIds, f as mergeWhatsAppAcceptedSendError, g as withWhatsAppLogicalDeliveryActivity, h as rememberWhatsAppPartialSend, l as prepareWhatsAppOutboundMedia, m as rememberWhatsAppAcceptedSend, o as normalizeWhatsAppOutboundPayload, p as normalizeWhatsAppSendResult, r as sendReactionWhatsApp, v as resolveWhatsAppReactionLevel } from "./send-
|
|
1
|
+
import { a as resolveWhatsAppAccount, s as resolveWhatsAppMediaMaxBytes } from "./accounts-CeKQbu_s.js";
|
|
2
|
+
import { c as normalizeWhatsAppPayloadTextPreservingIndentation, d as listWhatsAppSendResultMessageIds, f as mergeWhatsAppAcceptedSendError, g as withWhatsAppLogicalDeliveryActivity, h as rememberWhatsAppPartialSend, l as prepareWhatsAppOutboundMedia, m as rememberWhatsAppAcceptedSend, o as normalizeWhatsAppOutboundPayload, p as normalizeWhatsAppSendResult, r as sendReactionWhatsApp, v as resolveWhatsAppReactionLevel } from "./send-DiPjiygK.js";
|
|
3
3
|
import { i as getWhatsAppRuntime } from "./runtime-BLlToOi6.js";
|
|
4
4
|
import { r as getWhatsAppConnectionController } from "./connection-controller-runtime-context-DG0tuYuw.js";
|
|
5
|
-
import { a as markdownToWhatsAppChunks, c as toWhatsappJid, l as toWhatsappJidWithLid, n as isSelfChatMode, o as resolveEquivalentWhatsAppDirectChatJids, r as jidToE164, s as resolveJidToE164 } from "./targets-runtime-
|
|
6
|
-
import { t as normalizeE164 } from "./text-runtime-
|
|
7
|
-
import { a as cacheInboundMessageMeta, i as buildQuotedMessageOptions, n as resolveWhatsAppGroupSessionRoute, o as lookupInboundMessageMeta, r as resolveWhatsAppLegacyGroupSessionKey } from "./group-session-key-
|
|
8
|
-
import { C as getMentionIdentities, D as getSenderIdentity, E as getSelfIdentity, O as identitiesOverlap, S as getComparableIdentityValues, T as getReplyContext, g as readWebSelfId, k as resolveComparableIdentity, o as getWebAuthAgeMs, r as WhatsAppAuthUnstableError, v as readWebSelfIdentityForDecision, w as getPrimaryIdentityId } from "./auth-store-
|
|
5
|
+
import { a as markdownToWhatsAppChunks, c as toWhatsappJid, l as toWhatsappJidWithLid, n as isSelfChatMode, o as resolveEquivalentWhatsAppDirectChatJids, r as jidToE164, s as resolveJidToE164 } from "./targets-runtime-RBjx3pg_.js";
|
|
6
|
+
import { t as normalizeE164 } from "./text-runtime-DyfmcATV.js";
|
|
7
|
+
import { a as cacheInboundMessageMeta, i as buildQuotedMessageOptions, n as resolveWhatsAppGroupSessionRoute, o as lookupInboundMessageMeta, r as resolveWhatsAppLegacyGroupSessionKey } from "./group-session-key-KUguLmSZ.js";
|
|
8
|
+
import { C as getMentionIdentities, D as getSenderIdentity, E as getSelfIdentity, O as identitiesOverlap, S as getComparableIdentityValues, T as getReplyContext, g as readWebSelfId, k as resolveComparableIdentity, o as getWebAuthAgeMs, r as WhatsAppAuthUnstableError, v as readWebSelfIdentityForDecision, w as getPrimaryIdentityId } from "./auth-store-DTj1H9pv.js";
|
|
9
9
|
import { n as resolveWhatsAppGroupsConfigPath } from "./group-config-path-BGyzT9Lg.js";
|
|
10
|
-
import { a as waitForWaConnection, c as isWhatsAppSocketOperationTimeoutError, d as withWhatsAppSocketOperationTimeout, l as resolveWhatsAppSocketOperationTimeoutMs, r as createWaSocket, s as createWhatsAppSocketOperationTimeoutAdapter, u as resolveWhatsAppSocketTiming } from "./socket-close-
|
|
10
|
+
import { a as waitForWaConnection, c as isWhatsAppSocketOperationTimeoutError, d as withWhatsAppSocketOperationTimeout, l as resolveWhatsAppSocketOperationTimeoutMs, r as createWaSocket, s as createWhatsAppSocketOperationTimeoutAdapter, u as resolveWhatsAppSocketTiming } from "./socket-close-CpkkJZCU.js";
|
|
11
11
|
import { n as getStatusCode, t as formatError } from "./session-errors-JuazczrA.js";
|
|
12
12
|
import { t as BufferJSON } from "./session.runtime-Nsqaehbd.js";
|
|
13
|
-
import { _ as resolveInboundMediaMimetype, a as addWhatsAppImagePreviewFields, c as extractContextInfo, d as extractMediaKind, f as extractMentionedJids, g as projectWhatsAppInboundMessage, h as hasInboundUserContent, i as resolveWhatsAppOutboundMentions, l as extractExternalAdReplyContext, n as addWhatsAppOutboundMentionsToContent, o as describeReplyContext, p as extractText, r as mayContainWhatsAppOutboundMention, s as extractContactContext, t as createWebSendApi, u as extractLocationData } from "./send-api-
|
|
13
|
+
import { _ as resolveInboundMediaMimetype, a as addWhatsAppImagePreviewFields, c as extractContextInfo, d as extractMediaKind, f as extractMentionedJids, g as projectWhatsAppInboundMessage, h as hasInboundUserContent, i as resolveWhatsAppOutboundMentions, l as extractExternalAdReplyContext, n as addWhatsAppOutboundMentionsToContent, o as describeReplyContext, p as extractText, r as mayContainWhatsAppOutboundMention, s as extractContactContext, t as createWebSendApi, u as extractLocationData } from "./send-api-kFcuhSiY.js";
|
|
14
14
|
import { t as resolveWhatsAppRuntimeGroupPolicy } from "./runtime-group-policy-DeSRFXEV.js";
|
|
15
|
-
import { c as computeBackoff, d as resolveReconnectPolicy, f as sleepWithAbort, l as newConnectionId, n as WHATSAPP_WATCHDOG_TIMEOUT_ERROR, r as WhatsAppConnectionController, s as DEFAULT_RECONNECT_POLICY, u as resolveHeartbeatSeconds } from "./connection-controller-
|
|
16
|
-
import { n as maybeResolveWhatsAppApprovalReaction } from "./approval-reactions-
|
|
17
|
-
import { t as maybeResolveWhatsAppQuestionReaction } from "./question-reactions-
|
|
18
|
-
import { normalizeLowercaseStringOrEmpty, normalizeOptionalString
|
|
15
|
+
import { c as computeBackoff, d as resolveReconnectPolicy, f as sleepWithAbort, l as newConnectionId, n as WHATSAPP_WATCHDOG_TIMEOUT_ERROR, r as WhatsAppConnectionController, s as DEFAULT_RECONNECT_POLICY, u as resolveHeartbeatSeconds } from "./connection-controller-BvkxsbWi.js";
|
|
16
|
+
import { n as maybeResolveWhatsAppApprovalReaction } from "./approval-reactions-DGDA6hQ7.js";
|
|
17
|
+
import { t as maybeResolveWhatsAppQuestionReaction } from "./question-reactions-B9D6MHXZ.js";
|
|
18
|
+
import { normalizeLowercaseStringOrEmpty, normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
19
19
|
import { filterSupplementalContextItems, resolvePinnedMainDmOwnerFromAllowlist } from "openclaw/plugin-sdk/security-runtime";
|
|
20
20
|
import { createAckReactionHandle, createStatusReactionController, logAckFailure, removeAckReactionHandleAfterReply, shouldAckReaction } from "openclaw/plugin-sdk/channel-feedback";
|
|
21
|
+
import { bindIngressLifecycleToReplyOptions, createChannelIngressMonitor, createChannelMessageReplyPipeline, createMessageReceiptFromOutboundResults, listMessageReceiptPlatformIds, resolveChannelMessageSourceReplyDeliveryMode, resolveChannelStreamingBlockEnabled } from "openclaw/plugin-sdk/channel-outbound";
|
|
21
22
|
import { formatCliCommand } from "openclaw/plugin-sdk/cli-runtime";
|
|
22
23
|
import { PlatformMessageNotDispatchedError } from "openclaw/plugin-sdk/error-runtime";
|
|
23
24
|
import { createSubsystemLogger, getChildLogger, redactToolPayloadText } from "openclaw/plugin-sdk/logging-core";
|
|
@@ -26,9 +27,8 @@ import { createSubsystemLogger as createSubsystemLogger$1, defaultRuntime, forma
|
|
|
26
27
|
import { registerChannelRuntimeContext } from "openclaw/plugin-sdk/channel-runtime-context";
|
|
27
28
|
import { recordChannelActivity } from "openclaw/plugin-sdk/channel-activity-runtime";
|
|
28
29
|
import { buildChannelInboundEventContext, createChannelPartialDeliveryError, filterChannelInboundQuoteContext, formatInboundEnvelope, formatInboundEnvelope as formatInboundEnvelope$1, formatInboundMediaUnavailableText, formatLocationText, formatMediaPlaceholderText, hasVisibleInboundReplyDispatch, isChannelPartialDeliveryError, readAgentRunTerminalOutcome, resolveInboundSessionEnvelopeContext, resolveInboundSupplementalSenderAllowed, runChannelInboundEvent, shouldDebounceTextInbound, toInboundMediaFactsWithMetadata, toLocationContext } from "openclaw/plugin-sdk/channel-inbound";
|
|
29
|
-
import { bindIngressLifecycleToReplyOptions, createChannelIngressMonitor, createChannelMessageReplyPipeline, createMessageReceiptFromOutboundResults, listMessageReceiptPlatformIds, resolveChannelMessageSourceReplyDeliveryMode, resolveChannelStreamingBlockEnabled } from "openclaw/plugin-sdk/channel-outbound";
|
|
30
30
|
import { getAgentScopedMediaLocalRoots } from "openclaw/plugin-sdk/media-runtime";
|
|
31
|
-
import { isReasoningReplyPayload, resolveSendableOutboundReplyParts, sendMediaWithLeadingCaption } from "openclaw/plugin-sdk/reply-payload";
|
|
31
|
+
import { isReasoningReplyPayload, resolveSendableOutboundReplyParts, resolveTextChunksWithFallback, sendMediaWithLeadingCaption } from "openclaw/plugin-sdk/reply-payload";
|
|
32
32
|
import { truncateUtf16Safe } from "openclaw/plugin-sdk/text-utility-runtime";
|
|
33
33
|
import { createLazyRuntimeModule } from "openclaw/plugin-sdk/lazy-runtime";
|
|
34
34
|
import { DisconnectReason, downloadMediaMessage, isHostedLidUser, isHostedPnUser, isJidGroup, isJidGroup as isJidGroup$1, jidDecode, jidEncode, jidNormalizedUser, normalizeMessageContent as normalizeMessageContent$1 } from "baileys";
|
|
@@ -357,7 +357,7 @@ function createWhatsAppIngressMonitor(params) {
|
|
|
357
357
|
deliver: (admission, lifecycle) => params.dispatch(admission, lifecycle),
|
|
358
358
|
pollIntervalMs: params.pollIntervalMs,
|
|
359
359
|
retention: {
|
|
360
|
-
completedTtlMs:
|
|
360
|
+
completedTtlMs: 6048e5,
|
|
361
361
|
completedMaxEntries: 5e3,
|
|
362
362
|
failedMaxEntries: 450
|
|
363
363
|
},
|
|
@@ -381,7 +381,7 @@ function createWhatsAppIngressMonitor(params) {
|
|
|
381
381
|
}
|
|
382
382
|
//#endregion
|
|
383
383
|
//#region extensions/whatsapp/src/inbound/group-metadata-cache.ts
|
|
384
|
-
const GROUP_META_TTL_MS =
|
|
384
|
+
const GROUP_META_TTL_MS = 3e5;
|
|
385
385
|
const WHATSAPP_GROUP_METADATA_CACHE_MAX_ENTRIES = 500;
|
|
386
386
|
function resolveGroupMetadataExpiresAt(nowRaw = Date.now()) {
|
|
387
387
|
const now = asDateTimestampMs(nowRaw);
|
|
@@ -416,8 +416,7 @@ function readGroupMetadataCacheEntry(cache, jid) {
|
|
|
416
416
|
function createWhatsAppGroupMetadataCacheOwner(params) {
|
|
417
417
|
const reconnectCache = params.reconnectCache ?? /* @__PURE__ */ new Map();
|
|
418
418
|
const localCache = /* @__PURE__ */ new Map();
|
|
419
|
-
const
|
|
420
|
-
const invalidatedJids = /* @__PURE__ */ new Set();
|
|
419
|
+
const groupMetadataGenerations = /* @__PURE__ */ new Map();
|
|
421
420
|
const detachListeners = [];
|
|
422
421
|
let closed = false;
|
|
423
422
|
let started = false;
|
|
@@ -447,46 +446,51 @@ function createWhatsAppGroupMetadataCacheOwner(params) {
|
|
|
447
446
|
});
|
|
448
447
|
const rememberFullUpdate = (jid, meta) => {
|
|
449
448
|
if (closed) return;
|
|
449
|
+
groupMetadataGenerations.set(jid, {});
|
|
450
450
|
rememberWhatsAppBaileysCacheEntry(params.baileysCache, jid, meta, GROUP_META_TTL_MS);
|
|
451
|
-
publishedJids.add(jid);
|
|
452
|
-
invalidatedJids.delete(jid);
|
|
453
451
|
rememberGroupMetadataCacheEntry(reconnectCache, jid, summarizeForReconnect(meta));
|
|
454
452
|
localCache.delete(jid);
|
|
455
453
|
};
|
|
456
454
|
const forgetFullMetadata = (jid) => {
|
|
455
|
+
groupMetadataGenerations.set(jid, {});
|
|
457
456
|
params.baileysCache?.delete(jid);
|
|
458
457
|
reconnectCache.delete(jid);
|
|
459
458
|
localCache.delete(jid);
|
|
460
|
-
publishedJids.delete(jid);
|
|
461
|
-
invalidatedJids.add(jid);
|
|
462
459
|
};
|
|
463
460
|
const get = async (jid) => {
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
const
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
rememberGroupMetadataCacheEntry(localCache, jid,
|
|
485
|
-
|
|
486
|
-
|
|
461
|
+
for (;;) {
|
|
462
|
+
if (closed) return { expires: resolveGroupMetadataExpiresAt() ?? 0 };
|
|
463
|
+
const cached = readGroupMetadataCacheEntry(localCache, jid);
|
|
464
|
+
if (cached) return cached;
|
|
465
|
+
const generation = groupMetadataGenerations.get(jid);
|
|
466
|
+
try {
|
|
467
|
+
const hydratedEntry = params.baileysCache?.get(jid);
|
|
468
|
+
const providerMetadata = params.baileysCache ? readWhatsAppBaileysCacheEntry(params.baileysCache, jid) : void 0;
|
|
469
|
+
const hydratedMetadata = providerMetadata?.participants?.length ? providerMetadata : void 0;
|
|
470
|
+
const meta = hydratedMetadata ?? await (params.getCurrentSock() ?? params.sock).groupMetadata(jid);
|
|
471
|
+
if (closed || groupMetadataGenerations.get(jid) !== generation) continue;
|
|
472
|
+
const entry = await summarize(meta);
|
|
473
|
+
if (closed || groupMetadataGenerations.get(jid) !== generation) continue;
|
|
474
|
+
if (hydratedMetadata && hydratedEntry) entry.expires = hydratedEntry.expiresAt;
|
|
475
|
+
else rememberWhatsAppBaileysCacheEntry(params.baileysCache, jid, meta, GROUP_META_TTL_MS);
|
|
476
|
+
groupMetadataGenerations.set(jid, {});
|
|
477
|
+
rememberGroupMetadataCacheEntry(reconnectCache, jid, {
|
|
478
|
+
subject: entry.subject,
|
|
479
|
+
expires: entry.expires
|
|
480
|
+
});
|
|
481
|
+
rememberGroupMetadataCacheEntry(localCache, jid, entry);
|
|
482
|
+
return entry;
|
|
483
|
+
} catch (error) {
|
|
484
|
+
if (closed || groupMetadataGenerations.get(jid) !== generation) continue;
|
|
485
|
+
const hydrated = readGroupMetadataCacheEntry(reconnectCache, jid);
|
|
486
|
+
if (hydrated) {
|
|
487
|
+
rememberGroupMetadataCacheEntry(localCache, jid, hydrated);
|
|
488
|
+
params.logVerbose(`Using cached group metadata for ${jid} after fetch failure: ${String(error)}`);
|
|
489
|
+
return hydrated;
|
|
490
|
+
}
|
|
491
|
+
params.logVerbose(`Failed to fetch group metadata for ${jid}: ${String(error)}`);
|
|
492
|
+
return { expires: resolveGroupMetadataExpiresAt() ?? 0 };
|
|
487
493
|
}
|
|
488
|
-
params.logVerbose(`Failed to fetch group metadata for ${jid}: ${String(error)}`);
|
|
489
|
-
return { expires: resolveGroupMetadataExpiresAt() ?? 0 };
|
|
490
494
|
}
|
|
491
495
|
};
|
|
492
496
|
const resolveOutboundMentions = async (jid, text) => {
|
|
@@ -494,10 +498,11 @@ function createWhatsAppGroupMetadataCacheOwner(params) {
|
|
|
494
498
|
text,
|
|
495
499
|
mentionedJids: []
|
|
496
500
|
};
|
|
501
|
+
const meta = await get(jid);
|
|
497
502
|
return resolveWhatsAppOutboundMentions({
|
|
498
503
|
chatJid: jid,
|
|
499
504
|
text,
|
|
500
|
-
participants:
|
|
505
|
+
participants: meta.mentionParticipants
|
|
501
506
|
});
|
|
502
507
|
};
|
|
503
508
|
const applyOutboundMentions = async (jid, content) => {
|
|
@@ -544,10 +549,10 @@ function createWhatsAppGroupMetadataCacheOwner(params) {
|
|
|
544
549
|
try {
|
|
545
550
|
const groups = await params.sock.groupFetchAllParticipating();
|
|
546
551
|
if (closed) return;
|
|
547
|
-
for (const [jid, meta] of Object.entries(groups ?? {})) if (meta && !
|
|
552
|
+
for (const [jid, meta] of Object.entries(groups ?? {})) if (meta && !groupMetadataGenerations.has(jid)) {
|
|
548
553
|
rememberGroupMetadataCacheEntry(reconnectCache, jid, summarizeForReconnect(meta));
|
|
549
554
|
rememberWhatsAppBaileysCacheEntry(params.baileysCache, jid, meta, GROUP_META_TTL_MS);
|
|
550
|
-
|
|
555
|
+
groupMetadataGenerations.set(jid, {});
|
|
551
556
|
}
|
|
552
557
|
params.logVerbose(`Hydrated ${Object.keys(groups ?? {}).length} participating groups on connect`);
|
|
553
558
|
} catch (error) {
|
|
@@ -744,26 +749,28 @@ function createWhatsAppInboundMessageDebouncer(options) {
|
|
|
744
749
|
function unwrapMessage(message) {
|
|
745
750
|
return normalizeMessageContent$1(message);
|
|
746
751
|
}
|
|
747
|
-
async function downloadInboundMedia(msg, sock, maxBytes =
|
|
752
|
+
async function downloadInboundMedia(msg, sock, maxBytes = 52428800, normalizedMessage) {
|
|
748
753
|
const message = normalizedMessage ?? unwrapMessage(msg.message);
|
|
749
754
|
if (!message) return;
|
|
750
755
|
const mimetype = resolveInboundMediaMimetype(message);
|
|
751
756
|
const fileName = message.documentMessage?.fileName ?? void 0;
|
|
752
757
|
if (!message.imageMessage && !message.videoMessage && !message.ptvMessage && !message.documentMessage && !message.audioMessage && !message.stickerMessage) return;
|
|
758
|
+
const stream = await downloadMediaMessage(msg, "stream", {}, {
|
|
759
|
+
reuploadRequest: sock.updateMediaMessage,
|
|
760
|
+
logger: sock.logger
|
|
761
|
+
});
|
|
753
762
|
return {
|
|
754
|
-
saved: await saveMediaStream(
|
|
755
|
-
|
|
756
|
-
logger: sock.logger
|
|
757
|
-
}), mimetype, "inbound", maxBytes, fileName).catch((err) => {
|
|
758
|
-
if (err instanceof Error && /Media exceeds/i.test(err.message)) throw new Error(`Media exceeds ${Math.round(maxBytes / (1024 * 1024))}MB limit`);
|
|
763
|
+
saved: await saveMediaStream(stream, mimetype, "inbound", maxBytes, fileName).catch((err) => {
|
|
764
|
+
if (err instanceof Error && /Media exceeds/i.test(err.message)) throw new Error(`Media exceeds ${Math.round(maxBytes / 1048576)}MB limit`);
|
|
759
765
|
throw err;
|
|
760
766
|
}),
|
|
761
767
|
mimetype,
|
|
762
768
|
fileName
|
|
763
769
|
};
|
|
764
770
|
}
|
|
765
|
-
async function downloadQuotedInboundMedia(msg, sock, maxBytes =
|
|
766
|
-
const
|
|
771
|
+
async function downloadQuotedInboundMedia(msg, sock, maxBytes = 52428800) {
|
|
772
|
+
const message = unwrapMessage(msg.message);
|
|
773
|
+
const contextInfo = extractContextInfo(message);
|
|
767
774
|
if (!contextInfo?.quotedMessage) return;
|
|
768
775
|
const quotedMessage = contextInfo.quotedMessage;
|
|
769
776
|
const self = sock.user;
|
|
@@ -788,7 +795,9 @@ async function downloadQuotedInboundMedia(msg, sock, maxBytes = 50 * 1024 * 1024
|
|
|
788
795
|
const inboundMediaLogger = createSubsystemLogger("gateway/channels/whatsapp").child("inbound");
|
|
789
796
|
const MAX_MEDIA_ERROR_MESSAGE_CHARS = 256;
|
|
790
797
|
function sanitizeMediaErrorMessage(error) {
|
|
791
|
-
|
|
798
|
+
const rawMessage = error instanceof Error ? error.message : String(error);
|
|
799
|
+
const redacted = redactToolPayloadText(rawMessage).replace(/https?:\/\/\S+/giu, "[redacted-url]").replace(/\b[^@\s]+@[a-z][a-z\d.-]*\b/giu, "[redacted-jid]").replace(/\+?\d[\d ().-]{6,}\d/gu, "[redacted-phone]");
|
|
800
|
+
return truncateUtf16Safe(redacted.split("\n", 1)[0]?.trim() || "unknown error", MAX_MEDIA_ERROR_MESSAGE_CHARS);
|
|
792
801
|
}
|
|
793
802
|
function logMediaMaterializationFailure(params) {
|
|
794
803
|
const errorClass = params.error instanceof Error && /^[A-Za-z][A-Za-z0-9_.-]{0,63}$/u.test(params.error.name) ? params.error.name : "Error";
|
|
@@ -997,7 +1006,7 @@ async function checkInboundAccessControl(params) {
|
|
|
997
1006
|
//#endregion
|
|
998
1007
|
//#region extensions/whatsapp/src/inbound/dedupe.ts
|
|
999
1008
|
const recentOutboundMessages = createDedupeCache({
|
|
1000
|
-
ttlMs:
|
|
1009
|
+
ttlMs: 12e5,
|
|
1001
1010
|
maxSize: 5e3
|
|
1002
1011
|
});
|
|
1003
1012
|
function buildMessageKey(params) {
|
|
@@ -1211,11 +1220,13 @@ function createWhatsAppMessageDeliveryCoordinator(options) {
|
|
|
1211
1220
|
};
|
|
1212
1221
|
const reply = async (text, optionsResult) => {
|
|
1213
1222
|
const resolved = await groupMetadata.resolveOutboundMentions(chatJid, text);
|
|
1214
|
-
|
|
1223
|
+
const result = await sendTrackedMessage(chatJid, addWhatsAppOutboundMentionsToContent({ text: resolved.text }, resolved.mentionedJids), optionsResult);
|
|
1224
|
+
return normalizeWhatsAppSendResult(result, "text");
|
|
1215
1225
|
};
|
|
1216
1226
|
const sendMedia = async (payload, optionsValue) => {
|
|
1217
1227
|
const previewPayload = await addWhatsAppImagePreviewFields(payload);
|
|
1218
|
-
|
|
1228
|
+
const result = await sendTrackedMessage(chatJid, await groupMetadata.applyOutboundMentions(chatJid, previewPayload), optionsValue);
|
|
1229
|
+
return normalizeWhatsAppSendResult(result, "media");
|
|
1219
1230
|
};
|
|
1220
1231
|
const timestamp = inbound.messageTimestampMs;
|
|
1221
1232
|
const mentionedJids = enriched.mentionedJids;
|
|
@@ -1435,14 +1446,15 @@ function createWhatsAppMessageDeliveryCoordinator(options) {
|
|
|
1435
1446
|
finishPreparation(void 0);
|
|
1436
1447
|
const inbound = await normalizeInboundMessage(msg);
|
|
1437
1448
|
if (inbound) await maybeMarkNonSelfChatReadReceipt(inbound, buildReadReceiptTarget(inbound));
|
|
1438
|
-
} else if (result.kind === "durable" && result.queueResult.kind === "accepted")
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1449
|
+
} else if (result.kind === "durable" && result.queueResult.kind === "accepted") {
|
|
1450
|
+
if (skipRecentOutboundEcho) finishPreparation(null);
|
|
1451
|
+
else try {
|
|
1452
|
+
finishPreparation(await normalizeInboundMessage(msg), true);
|
|
1453
|
+
} catch (error) {
|
|
1454
|
+
finishPreparation(void 0);
|
|
1455
|
+
inboundLogger.warn({ error: formatError(error) }, "failed preparing WhatsApp inbound identity; durable drain will normalize again");
|
|
1456
|
+
}
|
|
1457
|
+
} else finishPreparation(void 0);
|
|
1446
1458
|
}
|
|
1447
1459
|
};
|
|
1448
1460
|
const handleMessagesUpsertEvent = (upsert) => {
|
|
@@ -1510,7 +1522,7 @@ function createWhatsAppMessageDeliveryCoordinator(options) {
|
|
|
1510
1522
|
//#region extensions/whatsapp/src/inbound/socket-session.ts
|
|
1511
1523
|
const LOGGED_OUT_STATUS = DisconnectReason.loggedOut;
|
|
1512
1524
|
const RECONNECT_IN_PROGRESS_ERROR = "no active socket - reconnection in progress";
|
|
1513
|
-
const BAILEYS_MESSAGE_TTL_MS =
|
|
1525
|
+
const BAILEYS_MESSAGE_TTL_MS = 6e5;
|
|
1514
1526
|
function isDirectUserJid(jid) {
|
|
1515
1527
|
return /^(\d+)(?::\d+)?@(s\.whatsapp\.net|c\.us|lid|hosted|hosted\.lid)$/i.test(jid.trim());
|
|
1516
1528
|
}
|
|
@@ -2466,11 +2478,13 @@ async function applyGroupGating(params) {
|
|
|
2466
2478
|
conversationId
|
|
2467
2479
|
}) !== "always";
|
|
2468
2480
|
const replyContext = getReplyContext(params.msg, params.authDir);
|
|
2481
|
+
const implicitReplyToSelf = params.selfChatMode === true && identitiesOverlap(self, sender);
|
|
2482
|
+
const implicitMentionKinds = implicitMentionKindWhen("quoted_bot", !implicitReplyToSelf && identitiesOverlap(self, replyContext?.sender));
|
|
2469
2483
|
const mentionDecision = resolveInboundMentionDecision({
|
|
2470
2484
|
facts: {
|
|
2471
2485
|
canDetectMention: true,
|
|
2472
2486
|
wasMentioned,
|
|
2473
|
-
implicitMentionKinds
|
|
2487
|
+
implicitMentionKinds
|
|
2474
2488
|
},
|
|
2475
2489
|
policy: {
|
|
2476
2490
|
isGroup: true,
|
|
@@ -2648,7 +2662,8 @@ function isLikelyWhatsAppCryptoError(reason) {
|
|
|
2648
2662
|
if (typeof value === "function") return value.name ? `[function ${value.name}]` : "[function]";
|
|
2649
2663
|
return Object.prototype.toString.call(value);
|
|
2650
2664
|
};
|
|
2651
|
-
const
|
|
2665
|
+
const raw = reason instanceof Error ? `${reason.message}\n${reason.stack ?? ""}` : formatReason(reason);
|
|
2666
|
+
const haystack = normalizeLowercaseStringOrEmpty(raw);
|
|
2652
2667
|
if (!(haystack.includes("unsupported state or unable to authenticate data") || haystack.includes("bad mac"))) return false;
|
|
2653
2668
|
return haystack.includes("baileys") || haystack.includes("noise-handler") || haystack.includes("aesdecryptgcm");
|
|
2654
2669
|
}
|
|
@@ -2713,6 +2728,11 @@ async function deliverWebReplyInActivityScope(params) {
|
|
|
2713
2728
|
const isGroupConversation = transport.conversationKind === "group";
|
|
2714
2729
|
const replyStarted = Date.now();
|
|
2715
2730
|
const sendResults = [];
|
|
2731
|
+
const acceptedMediaUrls = /* @__PURE__ */ new Set();
|
|
2732
|
+
const recordMediaAccepted = (mediaUrl) => {
|
|
2733
|
+
acceptedMediaUrls.add(mediaUrl);
|
|
2734
|
+
params.onMediaAccepted?.(mediaUrl);
|
|
2735
|
+
};
|
|
2716
2736
|
const finishDelivery = () => {
|
|
2717
2737
|
const receipt = createWhatsAppReplyDeliveryReceipt(sendResults);
|
|
2718
2738
|
return {
|
|
@@ -2721,20 +2741,22 @@ async function deliverWebReplyInActivityScope(params) {
|
|
|
2721
2741
|
providerAccepted: sendResults.some((result) => result.providerAccepted)
|
|
2722
2742
|
};
|
|
2723
2743
|
};
|
|
2724
|
-
const preserveAcceptedDeliveryError = (error, kind) => {
|
|
2744
|
+
const preserveAcceptedDeliveryError = (error, kind, mediaUrl) => {
|
|
2725
2745
|
const sendKind = kind ?? sendResults[0]?.kind ?? "text";
|
|
2726
|
-
if (isChannelPartialDeliveryError(error))
|
|
2727
|
-
|
|
2728
|
-
|
|
2729
|
-
|
|
2730
|
-
|
|
2746
|
+
if (isChannelPartialDeliveryError(error)) {
|
|
2747
|
+
if (rememberWhatsAppPartialSend({
|
|
2748
|
+
error,
|
|
2749
|
+
kind: sendKind,
|
|
2750
|
+
results: sendResults
|
|
2751
|
+
}) && mediaUrl) recordMediaAccepted(mediaUrl);
|
|
2752
|
+
}
|
|
2731
2753
|
return mergeWhatsAppAcceptedSendError({
|
|
2732
2754
|
error,
|
|
2733
2755
|
kind: sendKind,
|
|
2734
2756
|
results: sendResults
|
|
2735
2757
|
});
|
|
2736
2758
|
};
|
|
2737
|
-
const rememberSendResult = (result) => {
|
|
2759
|
+
const rememberSendResult = (result, mediaUrl) => {
|
|
2738
2760
|
if (!result) return;
|
|
2739
2761
|
try {
|
|
2740
2762
|
rememberWhatsAppAcceptedSend({
|
|
@@ -2745,6 +2767,8 @@ async function deliverWebReplyInActivityScope(params) {
|
|
|
2745
2767
|
} catch (error) {
|
|
2746
2768
|
if (sendResults.some((accepted) => accepted.providerAccepted)) throw preserveAcceptedDeliveryError(error, result.kind);
|
|
2747
2769
|
throw error;
|
|
2770
|
+
} finally {
|
|
2771
|
+
if (mediaUrl && sendResults.includes(result)) recordMediaAccepted(mediaUrl);
|
|
2748
2772
|
}
|
|
2749
2773
|
};
|
|
2750
2774
|
if (isReasoningReplyPayload(replyResult)) {
|
|
@@ -2754,7 +2778,8 @@ async function deliverWebReplyInActivityScope(params) {
|
|
|
2754
2778
|
const tableMode = params.tableMode ?? "code";
|
|
2755
2779
|
const chunkMode = params.chunkMode ?? "length";
|
|
2756
2780
|
const normalizedReply = params.normalizedReplyResult ?? normalizeWhatsAppOutboundPayload(replyResult, { normalizeText: normalizeWhatsAppPayloadTextPreservingIndentation });
|
|
2757
|
-
const
|
|
2781
|
+
const text = normalizedReply.text ?? "";
|
|
2782
|
+
const textChunks = resolveTextChunksWithFallback(text, markdownToWhatsAppChunks(text, textLimit, tableMode, chunkMode));
|
|
2758
2783
|
const mediaList = normalizedReply.mediaUrls ?? [];
|
|
2759
2784
|
const getQuote = () => {
|
|
2760
2785
|
if (!replyResult.replyToId) return;
|
|
@@ -2768,7 +2793,7 @@ async function deliverWebReplyInActivityScope(params) {
|
|
|
2768
2793
|
media: cached?.media
|
|
2769
2794
|
});
|
|
2770
2795
|
};
|
|
2771
|
-
const sendWithRetry = async (fn, label, kind) => {
|
|
2796
|
+
const sendWithRetry = async (fn, label, kind, mediaUrl) => {
|
|
2772
2797
|
try {
|
|
2773
2798
|
return await sendWhatsAppOutboundWithRetry({
|
|
2774
2799
|
send: fn,
|
|
@@ -2777,7 +2802,7 @@ async function deliverWebReplyInActivityScope(params) {
|
|
|
2777
2802
|
}
|
|
2778
2803
|
});
|
|
2779
2804
|
} catch (error) {
|
|
2780
|
-
if (isChannelPartialDeliveryError(error) || sendResults.some((result) => result.providerAccepted)) throw preserveAcceptedDeliveryError(error, kind);
|
|
2805
|
+
if (isChannelPartialDeliveryError(error) || sendResults.some((result) => result.providerAccepted)) throw preserveAcceptedDeliveryError(error, kind, mediaUrl);
|
|
2781
2806
|
throw error;
|
|
2782
2807
|
}
|
|
2783
2808
|
};
|
|
@@ -2810,52 +2835,39 @@ async function deliverWebReplyInActivityScope(params) {
|
|
|
2810
2835
|
}
|
|
2811
2836
|
const remainingText = [...textChunks];
|
|
2812
2837
|
const leadingCaption = remainingText.shift() || "";
|
|
2813
|
-
let acceptedIdsBeforeCurrentMedia = /* @__PURE__ */ new Set();
|
|
2814
2838
|
await sendMediaWithLeadingCaption({
|
|
2815
2839
|
mediaUrls: mediaList,
|
|
2816
2840
|
caption: leadingCaption,
|
|
2817
2841
|
send: async ({ mediaUrl, caption }) => {
|
|
2818
|
-
acceptedIdsBeforeCurrentMedia = new Set(sendResults.flatMap(listWhatsAppSendResultMessageIds));
|
|
2819
2842
|
const media = await prepareWhatsAppOutboundMedia(await loadWebMedia(mediaUrl, {
|
|
2820
2843
|
maxBytes: maxMediaBytes,
|
|
2821
2844
|
localRoots: params.mediaLocalRoots
|
|
2822
2845
|
}), mediaUrl);
|
|
2823
2846
|
if (shouldLogVerbose()) {
|
|
2824
|
-
logVerbose(`Web auto-reply media size: ${(media.buffer.length /
|
|
2847
|
+
logVerbose(`Web auto-reply media size: ${(media.buffer.length / 1048576).toFixed(2)}MB`);
|
|
2825
2848
|
logVerbose(`Web auto-reply media source: ${mediaUrl} (kind ${media.kind})`);
|
|
2826
2849
|
}
|
|
2827
|
-
|
|
2828
|
-
|
|
2829
|
-
|
|
2830
|
-
|
|
2831
|
-
|
|
2832
|
-
|
|
2833
|
-
|
|
2834
|
-
}
|
|
2835
|
-
|
|
2836
|
-
|
|
2837
|
-
|
|
2838
|
-
|
|
2839
|
-
|
|
2840
|
-
|
|
2841
|
-
|
|
2842
|
-
|
|
2843
|
-
|
|
2844
|
-
|
|
2845
|
-
|
|
2846
|
-
|
|
2847
|
-
|
|
2848
|
-
}, quote), "media:video", "media"));
|
|
2849
|
-
} else {
|
|
2850
|
-
const quote = getQuote();
|
|
2851
|
-
rememberSendResult(await sendWithRetry(() => transport.sendMedia({
|
|
2852
|
-
document: media.buffer,
|
|
2853
|
-
fileName: media.fileName,
|
|
2854
|
-
caption,
|
|
2855
|
-
mimetype: media.mimetype
|
|
2856
|
-
}, quote), "media:document", "media"));
|
|
2857
|
-
}
|
|
2858
|
-
whatsappOutboundLog.info(`Sent media reply to ${conversationId} (${(media.buffer.length / (1024 * 1024)).toFixed(2)}MB)`);
|
|
2850
|
+
const quote = getQuote();
|
|
2851
|
+
const mediaContent = media.kind === "image" ? {
|
|
2852
|
+
image: media.buffer,
|
|
2853
|
+
caption
|
|
2854
|
+
} : media.kind === "audio" ? {
|
|
2855
|
+
audio: media.buffer,
|
|
2856
|
+
ptt: true
|
|
2857
|
+
} : media.kind === "video" ? {
|
|
2858
|
+
video: media.buffer,
|
|
2859
|
+
caption
|
|
2860
|
+
} : {
|
|
2861
|
+
document: media.buffer,
|
|
2862
|
+
fileName: media.fileName,
|
|
2863
|
+
caption
|
|
2864
|
+
};
|
|
2865
|
+
rememberSendResult(await sendWithRetry(() => transport.sendMedia({
|
|
2866
|
+
...mediaContent,
|
|
2867
|
+
mimetype: media.mimetype
|
|
2868
|
+
}, quote), `media:${media.kind}`, "media", mediaUrl), mediaUrl);
|
|
2869
|
+
if (media.kind === "audio" && caption) rememberSendResult(await sendWithRetry(() => transport.reply(caption, quote), "media:audio-text", "text"));
|
|
2870
|
+
whatsappOutboundLog.info(`Sent media reply to ${conversationId} (${(media.buffer.length / 1048576).toFixed(2)}MB)`);
|
|
2859
2871
|
replyLogger.info({
|
|
2860
2872
|
correlationId: transport.correlationId ?? newConnectionId(),
|
|
2861
2873
|
connectionId: connectionId ?? null,
|
|
@@ -2869,7 +2881,7 @@ async function deliverWebReplyInActivityScope(params) {
|
|
|
2869
2881
|
}, "auto-reply sent (media)");
|
|
2870
2882
|
},
|
|
2871
2883
|
onError: async ({ error, mediaUrl, caption, isFirst }) => {
|
|
2872
|
-
if (
|
|
2884
|
+
if (acceptedMediaUrls.has(mediaUrl)) throw preserveAcceptedDeliveryError(error);
|
|
2873
2885
|
whatsappOutboundLog.error(`Failed sending web media to ${conversationId}: ${formatError(error)}`);
|
|
2874
2886
|
replyLogger.warn({
|
|
2875
2887
|
err: error,
|
|
@@ -3072,9 +3084,6 @@ function resolveWhatsAppDeliverablePayload(payload, info) {
|
|
|
3072
3084
|
}
|
|
3073
3085
|
return payload;
|
|
3074
3086
|
}
|
|
3075
|
-
function getWhatsAppPayloadMediaUrls(payload) {
|
|
3076
|
-
return new Set(normalizeStringEntries([...Array.isArray(payload.mediaUrls) ? payload.mediaUrls : [], ...typeof payload.mediaUrl === "string" ? [payload.mediaUrl] : []]));
|
|
3077
|
-
}
|
|
3078
3087
|
function hasWhatsAppMediaUrlOverlap(left, right) {
|
|
3079
3088
|
for (const url of left) if (right.has(url)) return true;
|
|
3080
3089
|
return false;
|
|
@@ -3122,16 +3131,28 @@ function createWhatsAppMediaOnlyReplyCoalescer(params) {
|
|
|
3122
3131
|
return finalization;
|
|
3123
3132
|
},
|
|
3124
3133
|
flushNonDuplicateMedia: (mediaUrls) => flushWhere((pending) => !hasWhatsAppMediaUrlOverlap(pending.mediaUrls, mediaUrls)),
|
|
3125
|
-
|
|
3134
|
+
supersedeMedia(mediaUrl) {
|
|
3126
3135
|
const flushResult = {
|
|
3127
3136
|
delivered: 0,
|
|
3128
3137
|
droppedDuplicateMedia: 0
|
|
3129
3138
|
};
|
|
3130
3139
|
const retained = [];
|
|
3131
|
-
for (const pending of pendingMediaOnlyPayloads.splice(0))
|
|
3132
|
-
pending.
|
|
3133
|
-
|
|
3134
|
-
|
|
3140
|
+
for (const pending of pendingMediaOnlyPayloads.splice(0)) {
|
|
3141
|
+
if (pending.mediaUrls.delete(mediaUrl)) {
|
|
3142
|
+
flushResult.droppedDuplicateMedia += 1;
|
|
3143
|
+
const mediaUrls = [...pending.mediaUrls];
|
|
3144
|
+
pending.payload = {
|
|
3145
|
+
...pending.payload,
|
|
3146
|
+
mediaUrl: mediaUrls[0],
|
|
3147
|
+
mediaUrls
|
|
3148
|
+
};
|
|
3149
|
+
}
|
|
3150
|
+
if (pending.mediaUrls.size === 0) {
|
|
3151
|
+
pending.resolveFinalization(whatsAppReplyDeliveryVisibility(false));
|
|
3152
|
+
continue;
|
|
3153
|
+
}
|
|
3154
|
+
retained.push(pending);
|
|
3155
|
+
}
|
|
3135
3156
|
pendingMediaOnlyPayloads.push(...retained);
|
|
3136
3157
|
return flushResult;
|
|
3137
3158
|
},
|
|
@@ -3140,7 +3161,7 @@ function createWhatsAppMediaOnlyReplyCoalescer(params) {
|
|
|
3140
3161
|
}
|
|
3141
3162
|
function logWhatsAppMediaOnlyFlushResult(result) {
|
|
3142
3163
|
if (!shouldLogVerbose$1()) return;
|
|
3143
|
-
if (result.droppedDuplicateMedia > 0) logVerbose$1(`
|
|
3164
|
+
if (result.droppedDuplicateMedia > 0) logVerbose$1(`Superseded ${result.droppedDuplicateMedia} deferred WhatsApp attachment(s) with accepted replacement media`);
|
|
3144
3165
|
if (result.delivered > 0) logVerbose$1(`Flushed ${result.delivered} deferred media-only WhatsApp reply payload(s)`);
|
|
3145
3166
|
}
|
|
3146
3167
|
function resolveWhatsAppResponsePrefix(params) {
|
|
@@ -3202,7 +3223,8 @@ async function prepareWhatsAppInboundContext(params) {
|
|
|
3202
3223
|
from: conversationId,
|
|
3203
3224
|
sender: {
|
|
3204
3225
|
id: params.sender.id ?? params.sender.e164,
|
|
3205
|
-
name: params.sender.name
|
|
3226
|
+
name: params.sender.name,
|
|
3227
|
+
isSelf: params.msg.platform.fromMe === true
|
|
3206
3228
|
},
|
|
3207
3229
|
conversation: {
|
|
3208
3230
|
kind: conversationKind,
|
|
@@ -3311,7 +3333,8 @@ function createWhatsAppReplyPlan(params) {
|
|
|
3311
3333
|
didSendReply = true;
|
|
3312
3334
|
if (shouldLogVerbose$1()) {
|
|
3313
3335
|
const reply = resolveSendableOutboundReplyParts(payload);
|
|
3314
|
-
|
|
3336
|
+
const preview = payload.text != null ? reply.text : "<media>";
|
|
3337
|
+
logVerbose$1(`Reply body: ${preview}${reply.hasMedia ? " (media)" : ""} -> ${conversationId}`);
|
|
3315
3338
|
}
|
|
3316
3339
|
};
|
|
3317
3340
|
const deliverNormalizedPayload = async (normalizedDeliveryPayload, info, options) => {
|
|
@@ -3330,7 +3353,8 @@ function createWhatsAppReplyPlan(params) {
|
|
|
3330
3353
|
replyLogger: params.replyLogger,
|
|
3331
3354
|
connectionId: params.connectionId,
|
|
3332
3355
|
skipLog: false,
|
|
3333
|
-
tableMode
|
|
3356
|
+
tableMode,
|
|
3357
|
+
onMediaAccepted: options?.onMediaAccepted
|
|
3334
3358
|
});
|
|
3335
3359
|
} catch (error) {
|
|
3336
3360
|
if (isWhatsAppVisibleDeliveryError(error) && !isChannelPartialDeliveryError(error)) throw createChannelPartialDeliveryError(error, {
|
|
@@ -3392,7 +3416,7 @@ function createWhatsAppReplyPlan(params) {
|
|
|
3392
3416
|
} : normalizedOutboundPayload;
|
|
3393
3417
|
const reply = resolveSendableOutboundReplyParts(normalizedDeliveryPayload);
|
|
3394
3418
|
if (!reply.hasMedia && !reply.text.trim()) return normalizedDeliveryPayload;
|
|
3395
|
-
const mediaUrls =
|
|
3419
|
+
const mediaUrls = new Set(normalizedDeliveryPayload.mediaUrls);
|
|
3396
3420
|
logWhatsAppMediaOnlyFlushResult(reply.hasMedia ? shouldDeferWhatsAppMediaOnlyPayload({
|
|
3397
3421
|
info,
|
|
3398
3422
|
mediaUrls,
|
|
@@ -3426,7 +3450,7 @@ function createWhatsAppReplyPlan(params) {
|
|
|
3426
3450
|
const reply = resolveSendableOutboundReplyParts(normalizedDeliveryPayload);
|
|
3427
3451
|
if (!reply.hasMedia && !reply.text.trim()) return whatsAppReplyDeliveryVisibility(false);
|
|
3428
3452
|
if (!reply.hasMedia) return await deliverNormalizedPayload(normalizedDeliveryPayload, info, { recordDelivery: false });
|
|
3429
|
-
const mediaUrls =
|
|
3453
|
+
const mediaUrls = new Set(normalizedDeliveryPayload.mediaUrls);
|
|
3430
3454
|
if (shouldDeferWhatsAppMediaOnlyPayload({
|
|
3431
3455
|
info,
|
|
3432
3456
|
mediaUrls,
|
|
@@ -3439,14 +3463,10 @@ function createWhatsAppReplyPlan(params) {
|
|
|
3439
3463
|
payload: normalizedDeliveryPayload
|
|
3440
3464
|
})
|
|
3441
3465
|
};
|
|
3442
|
-
|
|
3443
|
-
|
|
3444
|
-
|
|
3445
|
-
|
|
3446
|
-
} catch (error) {
|
|
3447
|
-
if (isWhatsAppVisibleDeliveryError(error)) logWhatsAppMediaOnlyFlushResult(mediaOnlyCoalescer.dropDuplicateMedia(mediaUrls));
|
|
3448
|
-
throw error;
|
|
3449
|
-
}
|
|
3466
|
+
return await deliverNormalizedPayload(normalizedDeliveryPayload, info, { onMediaAccepted: (mediaUrl) => {
|
|
3467
|
+
didSendReply = true;
|
|
3468
|
+
logWhatsAppMediaOnlyFlushResult(mediaOnlyCoalescer.supersedeMedia(mediaUrl));
|
|
3469
|
+
} });
|
|
3450
3470
|
},
|
|
3451
3471
|
onDelivered: (payload, _info, result) => {
|
|
3452
3472
|
if (!resolveSendableOutboundReplyParts(payload).hasMedia && result?.visibleReplySent === true) recordDeliveredPayload(payload);
|
|
@@ -3711,27 +3731,30 @@ async function processMessage(params) {
|
|
|
3711
3731
|
}) : void 0;
|
|
3712
3732
|
if (conversationKind === "group") {
|
|
3713
3733
|
const history = visibleGroupHistory ?? [];
|
|
3714
|
-
if (history.length > 0)
|
|
3715
|
-
|
|
3734
|
+
if (history.length > 0) {
|
|
3735
|
+
const historyEntries = history.map((m) => ({
|
|
3716
3736
|
sender: m.sender,
|
|
3717
3737
|
body: m.body,
|
|
3718
3738
|
timestamp: m.timestamp,
|
|
3719
3739
|
media: m.media
|
|
3720
|
-
}))
|
|
3721
|
-
|
|
3722
|
-
|
|
3723
|
-
|
|
3724
|
-
|
|
3725
|
-
|
|
3726
|
-
|
|
3727
|
-
|
|
3728
|
-
|
|
3729
|
-
|
|
3730
|
-
|
|
3731
|
-
|
|
3732
|
-
|
|
3733
|
-
|
|
3734
|
-
|
|
3740
|
+
}));
|
|
3741
|
+
combinedBody = buildHistoryContextFromEntries({
|
|
3742
|
+
entries: historyEntries,
|
|
3743
|
+
currentMessage: combinedBody,
|
|
3744
|
+
excludeLast: false,
|
|
3745
|
+
formatEntry: (entry) => {
|
|
3746
|
+
return formatInboundEnvelope$1({
|
|
3747
|
+
channel: "WhatsApp",
|
|
3748
|
+
from: conversationId,
|
|
3749
|
+
timestamp: entry.timestamp,
|
|
3750
|
+
body: [entry.body, formatMediaPlaceholderText(entry.media ?? [])].filter(Boolean).join("\n"),
|
|
3751
|
+
chatType: "group",
|
|
3752
|
+
senderLabel: entry.sender,
|
|
3753
|
+
envelope: envelopeOptions
|
|
3754
|
+
});
|
|
3755
|
+
}
|
|
3756
|
+
});
|
|
3757
|
+
}
|
|
3735
3758
|
shouldClearGroupHistory = !(params.suppressGroupHistoryClear ?? false);
|
|
3736
3759
|
}
|
|
3737
3760
|
const statusReactionController = params.statusReactionController ?? (params.cfg.messages?.statusReactions?.enabled === true && !params.ackAlreadySent ? await createWhatsAppStatusReactionController({
|
|
@@ -4258,8 +4281,8 @@ function normalizeReconnectAccountId(accountId) {
|
|
|
4258
4281
|
function isRetryableAuthUnstableError(error) {
|
|
4259
4282
|
return error instanceof WhatsAppAuthUnstableError || typeof error === "object" && error !== null && "code" in error && error.code === "whatsapp-auth-unstable";
|
|
4260
4283
|
}
|
|
4261
|
-
const DEFAULT_TRANSPORT_TIMEOUT_MS =
|
|
4262
|
-
const WHATSAPP_RECONNECT_CATCH_UP_MAX_MS =
|
|
4284
|
+
const DEFAULT_TRANSPORT_TIMEOUT_MS = 3e5;
|
|
4285
|
+
const WHATSAPP_RECONNECT_CATCH_UP_MAX_MS = 12e5;
|
|
4263
4286
|
async function monitorWebChannel(verbose, listenerFactory = attachWebInboxToSocket, keepAlive = true, replyResolver, runtime = defaultRuntime, abortSignal, tuning = {}) {
|
|
4264
4287
|
const activeReplyResolver = replyResolver ?? (await loadReplyResolverRuntime()).getReplyFromConfig;
|
|
4265
4288
|
const runId = newConnectionId();
|
|
@@ -4304,9 +4327,9 @@ async function monitorWebChannel(verbose, listenerFactory = attachWebInboxToSock
|
|
|
4304
4327
|
};
|
|
4305
4328
|
process.once("SIGINT", handleSigint);
|
|
4306
4329
|
const transportTimeoutMs = tuning.transportTimeoutMs ?? DEFAULT_TRANSPORT_TIMEOUT_MS;
|
|
4307
|
-
const messageTimeoutMs = tuning.messageTimeoutMs ??
|
|
4330
|
+
const messageTimeoutMs = tuning.messageTimeoutMs ?? 18e5;
|
|
4308
4331
|
const reconnectCatchUpWindowMs = Math.min(Math.max(messageTimeoutMs, 6e4), WHATSAPP_RECONNECT_CATCH_UP_MAX_MS);
|
|
4309
|
-
const watchdogCheckMs = tuning.watchdogCheckMs ??
|
|
4332
|
+
const watchdogCheckMs = tuning.watchdogCheckMs ?? 6e4;
|
|
4310
4333
|
const controller = new WhatsAppConnectionController({
|
|
4311
4334
|
accountId: account.accountId,
|
|
4312
4335
|
authDir: account.authDir,
|