@openclaw/whatsapp 2026.7.2-beta.4 → 2026.7.2-beta.7
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/README.md +1 -1
- package/dist/access-control-pZcxTmd5.js +363 -0
- package/dist/accounts-CSqLvCY5.js +152 -0
- package/dist/action-runtime-BzfDFPbH.js +73 -0
- package/dist/action-runtime-api.js +1 -1
- package/dist/action-runtime.runtime.js +1 -1
- package/dist/agent-tools-login-DE9MU98T.js +87 -0
- package/dist/api.js +13 -19
- package/dist/approval-handler.runtime-DrA59QSA.js +128 -0
- package/dist/approval-reactions-Cu66aYdq.js +373 -0
- package/dist/auth-store-DcEpIOmE.js +400 -0
- package/dist/call-tool-api.js +2 -2
- package/dist/channel-Dg62olhy.js +912 -0
- package/dist/channel-config-api.js +1 -1
- package/dist/channel-plugin-api.js +1 -1
- package/dist/channel-react-action-J_YtyMGX.js +124 -0
- package/dist/channel.runtime-BP0xNmLi.js +55 -0
- package/dist/channel.setup-pMwNVkCA.js +19 -0
- package/dist/config-schema-BQP5YCeK.js +50 -0
- package/dist/connection-controller-BOB2MVKY.js +690 -0
- package/dist/contract-api.js +2 -2
- package/dist/directory-config-DalGrfGN.js +196 -0
- package/dist/directory-contract-api.js +1 -1
- package/dist/group-session-key-DVMZlO3x.js +170 -0
- package/dist/identity-CPrT5aEU.js +76 -0
- package/dist/light-runtime-api.js +2 -2
- package/dist/login-CvY2Dhch.js +110 -0
- package/dist/login-qr-Bncpb6js.js +418 -0
- package/dist/login-qr-runtime.js +1 -1
- package/dist/monitor-CfkaUSL2.js +4681 -0
- package/dist/normalize-C7Hkc_vE.js +2 -0
- package/dist/normalize-target-CugRyONv.js +97 -0
- package/dist/question-reactions-CRsnyoMK.js +142 -0
- package/dist/resolve-outbound-target-1GqbT1uX.js +40 -0
- package/dist/runtime-api.js +8 -8
- package/dist/send-D37ddk22.js +436 -0
- package/dist/send-api-7wk6eQyW.js +749 -0
- package/dist/setup-finalize-BZucx24W.js +329 -0
- package/dist/setup-plugin-api.js +1 -1
- package/dist/setup-surface-BkVcd769.js +46 -0
- package/dist/shared-CAxd15bp.js +307 -0
- package/dist/socket-close-DridEuzz.js +622 -0
- package/dist/targets-runtime-TMk0lGuy.js +299 -0
- package/dist/text-runtime-CaKLhowd.js +4 -0
- package/node_modules/baileys/node_modules/p-queue/dist/index.js +806 -0
- package/node_modules/baileys/node_modules/p-queue/package.json +81 -0
- package/node_modules/baileys/node_modules/protobufjs/README.md +440 -0
- package/node_modules/baileys/node_modules/protobufjs/dist/light/protobuf.js +9276 -0
- package/node_modules/baileys/node_modules/protobufjs/dist/light/protobuf.js.map +1 -0
- package/node_modules/baileys/node_modules/protobufjs/dist/light/protobuf.min.js +8 -0
- package/node_modules/baileys/node_modules/protobufjs/dist/light/protobuf.min.js.map +1 -0
- package/node_modules/baileys/node_modules/protobufjs/dist/minimal/protobuf.js +3556 -0
- package/node_modules/baileys/node_modules/protobufjs/dist/minimal/protobuf.js.map +1 -0
- package/node_modules/baileys/node_modules/protobufjs/dist/minimal/protobuf.min.js +8 -0
- package/node_modules/baileys/node_modules/protobufjs/dist/minimal/protobuf.min.js.map +1 -0
- package/node_modules/baileys/node_modules/protobufjs/dist/protobuf.js +11233 -0
- package/node_modules/baileys/node_modules/protobufjs/dist/protobuf.js.map +1 -0
- package/node_modules/baileys/node_modules/protobufjs/dist/protobuf.min.js +8 -0
- package/node_modules/baileys/node_modules/protobufjs/dist/protobuf.min.js.map +1 -0
- package/node_modules/baileys/node_modules/protobufjs/ext/README.md +70 -0
- package/node_modules/baileys/node_modules/protobufjs/ext/descriptor/README.md +5 -0
- package/node_modules/baileys/node_modules/protobufjs/ext/descriptor/index.d.ts +2 -0
- package/node_modules/baileys/node_modules/protobufjs/ext/descriptor/index.js +2 -0
- package/node_modules/baileys/node_modules/protobufjs/ext/descriptor.d.ts +87 -0
- package/node_modules/baileys/node_modules/protobufjs/ext/descriptor.generated.d.ts +417 -0
- package/node_modules/baileys/node_modules/protobufjs/ext/descriptor.js +1356 -0
- package/node_modules/baileys/node_modules/protobufjs/ext/protojson.LICENSE +201 -0
- package/node_modules/baileys/node_modules/protobufjs/ext/protojson.d.ts +20 -0
- package/node_modules/baileys/node_modules/protobufjs/ext/protojson.generated.d.ts +49 -0
- package/node_modules/baileys/node_modules/protobufjs/ext/protojson.js +951 -0
- package/node_modules/baileys/node_modules/protobufjs/ext/textformat.d.ts +19 -0
- package/node_modules/baileys/node_modules/protobufjs/ext/textformat.generated.d.ts +33 -0
- package/node_modules/baileys/node_modules/protobufjs/ext/textformat.js +1276 -0
- package/node_modules/baileys/node_modules/protobufjs/google/api/annotations.json +85 -0
- package/node_modules/baileys/node_modules/protobufjs/google/api/http.json +87 -0
- package/node_modules/baileys/node_modules/protobufjs/google/protobuf/api.json +124 -0
- package/node_modules/baileys/node_modules/protobufjs/google/protobuf/compiler/plugin.json +126 -0
- package/node_modules/baileys/node_modules/protobufjs/google/protobuf/compiler/plugin.proto +47 -0
- package/node_modules/baileys/node_modules/protobufjs/google/protobuf/descriptor.json +1465 -0
- package/node_modules/baileys/node_modules/protobufjs/google/protobuf/descriptor.proto +527 -0
- package/node_modules/baileys/node_modules/protobufjs/google/protobuf/source_context.json +21 -0
- package/node_modules/baileys/node_modules/protobufjs/google/protobuf/type.json +209 -0
- package/node_modules/baileys/node_modules/protobufjs/index.d.ts +3203 -0
- package/node_modules/baileys/node_modules/protobufjs/package.json +93 -0
- package/node_modules/baileys/node_modules/protobufjs/src/common.js +405 -0
- package/node_modules/baileys/node_modules/protobufjs/src/converter.js +352 -0
- package/node_modules/baileys/node_modules/protobufjs/src/decoder.js +279 -0
- package/node_modules/baileys/node_modules/protobufjs/src/encoder.js +123 -0
- package/node_modules/baileys/node_modules/protobufjs/src/enum.js +239 -0
- package/node_modules/baileys/node_modules/protobufjs/src/field.js +505 -0
- package/node_modules/baileys/node_modules/protobufjs/src/index-light.js +104 -0
- package/node_modules/baileys/node_modules/protobufjs/src/index-minimal.js +35 -0
- package/node_modules/baileys/node_modules/protobufjs/src/index.js +12 -0
- package/node_modules/baileys/node_modules/protobufjs/src/mapfield.js +144 -0
- package/node_modules/baileys/node_modules/protobufjs/src/message.js +137 -0
- package/node_modules/baileys/node_modules/protobufjs/src/method.js +183 -0
- package/node_modules/baileys/node_modules/protobufjs/src/namespace.js +574 -0
- package/node_modules/baileys/node_modules/protobufjs/src/object.js +392 -0
- package/node_modules/baileys/node_modules/protobufjs/src/oneof.js +233 -0
- package/node_modules/baileys/node_modules/protobufjs/src/parse.js +1111 -0
- package/node_modules/baileys/node_modules/protobufjs/src/reader.js +788 -0
- package/node_modules/baileys/node_modules/protobufjs/src/reader_buffer.js +77 -0
- package/node_modules/baileys/node_modules/protobufjs/src/root.js +424 -0
- package/node_modules/baileys/node_modules/protobufjs/src/rpc/service.js +155 -0
- package/node_modules/baileys/node_modules/protobufjs/src/service.js +206 -0
- package/node_modules/baileys/node_modules/protobufjs/src/tokenize.js +421 -0
- package/node_modules/baileys/node_modules/protobufjs/src/type.js +676 -0
- package/node_modules/baileys/node_modules/protobufjs/src/typescript.js +25 -0
- package/node_modules/baileys/node_modules/protobufjs/src/util/aspromise.d.ts +13 -0
- package/node_modules/baileys/node_modules/protobufjs/src/util/aspromise.js +52 -0
- package/node_modules/baileys/node_modules/protobufjs/src/util/base64.d.ts +32 -0
- package/node_modules/baileys/node_modules/protobufjs/src/util/base64.js +146 -0
- package/node_modules/baileys/node_modules/protobufjs/src/util/codegen.d.ts +31 -0
- package/node_modules/baileys/node_modules/protobufjs/src/util/codegen.js +118 -0
- package/node_modules/baileys/node_modules/protobufjs/src/util/eventemitter.d.ts +45 -0
- package/node_modules/baileys/node_modules/protobufjs/src/util/eventemitter.js +86 -0
- package/node_modules/baileys/node_modules/protobufjs/src/util/fetch.d.ts +56 -0
- package/node_modules/baileys/node_modules/protobufjs/src/util/fetch.js +112 -0
- package/node_modules/baileys/node_modules/protobufjs/src/util/float.js +335 -0
- package/node_modules/baileys/node_modules/protobufjs/src/util/longbits.js +204 -0
- package/node_modules/baileys/node_modules/protobufjs/src/util/minimal.js +511 -0
- package/node_modules/baileys/node_modules/protobufjs/src/util/path.d.ts +22 -0
- package/node_modules/baileys/node_modules/protobufjs/src/util/path.js +100 -0
- package/node_modules/baileys/node_modules/protobufjs/src/util/pool.d.ts +32 -0
- package/node_modules/baileys/node_modules/protobufjs/src/util/pool.js +48 -0
- package/node_modules/baileys/node_modules/protobufjs/src/util/utf8.d.ts +24 -0
- package/node_modules/baileys/node_modules/protobufjs/src/util/utf8.js +190 -0
- package/node_modules/baileys/node_modules/protobufjs/src/util.js +264 -0
- package/node_modules/baileys/node_modules/protobufjs/src/verifier.js +185 -0
- package/node_modules/baileys/node_modules/protobufjs/src/wrappers.js +106 -0
- package/node_modules/baileys/node_modules/protobufjs/src/writer.js +700 -0
- package/node_modules/baileys/node_modules/protobufjs/src/writer_buffer.js +100 -0
- package/node_modules/baileys/node_modules/protobufjs/tsconfig.json +6 -0
- package/openclaw.plugin.json +9 -17
- package/package.json +5 -6
- package/dist/access-control-CRz_v6bR.js +0 -363
- package/dist/accounts-CxPuEFi-.js +0 -153
- package/dist/action-runtime-CHU7xb6o.js +0 -73
- package/dist/agent-tools-login-DfyToBpG.js +0 -87
- package/dist/approval-handler.runtime-C4ddB7Kc.js +0 -128
- package/dist/approval-reactions-P2HXjmln.js +0 -373
- package/dist/auth-store-DirYMTbo.js +0 -400
- package/dist/channel-B9xjrOGG.js +0 -948
- package/dist/channel-react-action-CBW-PA8q.js +0 -124
- package/dist/channel.runtime-DdKuhlNu.js +0 -55
- package/dist/channel.setup-DXUCPHel.js +0 -18
- package/dist/config-schema-C6IeKIC0.js +0 -46
- package/dist/connection-controller-BVRExqrB.js +0 -690
- package/dist/directory-config-BTbJkV1W.js +0 -196
- package/dist/group-session-key-DJSdYfnb.js +0 -170
- package/dist/identity-BM4_wZeM.js +0 -76
- package/dist/login-BKUm7KSk.js +0 -110
- package/dist/login-qr-DagJvMbg.js +0 -418
- package/dist/monitor-CBVNJ2lb.js +0 -4451
- package/dist/normalize-C-Z16y7Q.js +0 -2
- package/dist/normalize-target-DSZnHkKF.js +0 -93
- package/dist/question-reactions-CaOrSYzU.js +0 -142
- package/dist/resolve-outbound-target-BR97fAbB.js +0 -40
- package/dist/send-DhJVN30g.js +0 -431
- package/dist/send-api-CpHwbor_.js +0 -744
- package/dist/setup-finalize-9XzKdFq6.js +0 -329
- package/dist/setup-surface-Kv3mPki2.js +0 -46
- package/dist/shared-CuqHFnKd.js +0 -343
- package/dist/socket-close-BoSHhQNJ.js +0 -622
- package/dist/targets-runtime-CKFrhoX4.js +0 -308
- package/dist/text-runtime-CU_IlbK5.js +0 -4
- package/node_modules/@protobufjs/aspromise/LICENSE +0 -26
- package/node_modules/@protobufjs/aspromise/README.md +0 -13
- package/node_modules/@protobufjs/aspromise/index.d.ts +0 -13
- package/node_modules/@protobufjs/aspromise/index.js +0 -52
- package/node_modules/@protobufjs/aspromise/package.json +0 -21
- package/node_modules/@protobufjs/aspromise/tests/index.js +0 -130
- package/node_modules/@protobufjs/base64/LICENSE +0 -26
- package/node_modules/@protobufjs/base64/README.md +0 -19
- package/node_modules/@protobufjs/base64/index.d.ts +0 -32
- package/node_modules/@protobufjs/base64/index.js +0 -139
- package/node_modules/@protobufjs/base64/package.json +0 -21
- package/node_modules/@protobufjs/base64/tests/index.js +0 -46
- package/node_modules/@protobufjs/codegen/LICENSE +0 -26
- package/node_modules/@protobufjs/codegen/README.md +0 -49
- package/node_modules/@protobufjs/codegen/index.d.ts +0 -31
- package/node_modules/@protobufjs/codegen/index.js +0 -112
- package/node_modules/@protobufjs/codegen/package.json +0 -13
- package/node_modules/@protobufjs/codegen/tests/index.js +0 -13
- package/node_modules/@protobufjs/eventemitter/CHANGELOG.md +0 -8
- package/node_modules/@protobufjs/eventemitter/LICENSE +0 -26
- package/node_modules/@protobufjs/eventemitter/README.md +0 -22
- package/node_modules/@protobufjs/eventemitter/index.d.ts +0 -45
- package/node_modules/@protobufjs/eventemitter/index.js +0 -86
- package/node_modules/@protobufjs/eventemitter/package.json +0 -21
- package/node_modules/@protobufjs/eventemitter/tests/index.js +0 -83
- package/node_modules/@protobufjs/fetch/CHANGELOG.md +0 -8
- package/node_modules/@protobufjs/fetch/LICENSE +0 -26
- package/node_modules/@protobufjs/fetch/README.md +0 -13
- package/node_modules/@protobufjs/fetch/index.d.ts +0 -56
- package/node_modules/@protobufjs/fetch/index.js +0 -112
- package/node_modules/@protobufjs/fetch/package.json +0 -27
- package/node_modules/@protobufjs/fetch/tests/data/file.txt +0 -1
- package/node_modules/@protobufjs/fetch/tests/index.js +0 -158
- package/node_modules/@protobufjs/fetch/util/fs.js +0 -11
- package/node_modules/@protobufjs/float/LICENSE +0 -26
- package/node_modules/@protobufjs/float/README.md +0 -102
- package/node_modules/@protobufjs/float/bench/index.js +0 -87
- package/node_modules/@protobufjs/float/bench/suite.js +0 -46
- package/node_modules/@protobufjs/float/index.js +0 -335
- package/node_modules/@protobufjs/float/package.json +0 -26
- package/node_modules/@protobufjs/float/tests/index.js +0 -100
- package/node_modules/@protobufjs/path/LICENSE +0 -26
- package/node_modules/@protobufjs/path/README.md +0 -19
- package/node_modules/@protobufjs/path/index.d.ts +0 -22
- package/node_modules/@protobufjs/path/index.js +0 -65
- package/node_modules/@protobufjs/path/package.json +0 -21
- package/node_modules/@protobufjs/path/tests/index.js +0 -60
- package/node_modules/@protobufjs/pool/.npmignore +0 -3
- package/node_modules/@protobufjs/pool/LICENSE +0 -26
- package/node_modules/@protobufjs/pool/README.md +0 -13
- package/node_modules/@protobufjs/pool/index.d.ts +0 -32
- package/node_modules/@protobufjs/pool/index.js +0 -48
- package/node_modules/@protobufjs/pool/package.json +0 -21
- package/node_modules/@protobufjs/pool/tests/index.js +0 -33
- package/node_modules/@protobufjs/utf8/CHANGELOG.md +0 -8
- package/node_modules/@protobufjs/utf8/LICENSE +0 -26
- package/node_modules/@protobufjs/utf8/README.md +0 -20
- package/node_modules/@protobufjs/utf8/index.d.ts +0 -24
- package/node_modules/@protobufjs/utf8/index.js +0 -115
- package/node_modules/@protobufjs/utf8/package.json +0 -21
- package/node_modules/@protobufjs/utf8/tests/data/surrogate_pair_bug.txt +0 -207
- package/node_modules/@protobufjs/utf8/tests/data/utf8.txt +0 -216
- package/node_modules/@protobufjs/utf8/tests/index.js +0 -79
- package/node_modules/@types/node/LICENSE +0 -21
- package/node_modules/@types/node/README.md +0 -15
- package/node_modules/@types/node/assert/strict.d.ts +0 -68
- package/node_modules/@types/node/assert.d.ts +0 -1077
- package/node_modules/@types/node/async_hooks.d.ts +0 -711
- package/node_modules/@types/node/buffer.buffer.d.ts +0 -466
- package/node_modules/@types/node/buffer.d.ts +0 -1799
- package/node_modules/@types/node/child_process.d.ts +0 -1362
- package/node_modules/@types/node/cluster.d.ts +0 -432
- package/node_modules/@types/node/console.d.ts +0 -93
- package/node_modules/@types/node/constants.d.ts +0 -14
- package/node_modules/@types/node/crypto.d.ts +0 -3954
- package/node_modules/@types/node/dgram.d.ts +0 -537
- package/node_modules/@types/node/diagnostics_channel.d.ts +0 -794
- package/node_modules/@types/node/dns/promises.d.ts +0 -497
- package/node_modules/@types/node/dns.d.ts +0 -876
- package/node_modules/@types/node/domain.d.ts +0 -150
- package/node_modules/@types/node/events.d.ts +0 -1008
- package/node_modules/@types/node/ffi.d.ts +0 -486
- package/node_modules/@types/node/fs/promises.d.ts +0 -1481
- package/node_modules/@types/node/fs.d.ts +0 -4786
- package/node_modules/@types/node/globals.d.ts +0 -150
- package/node_modules/@types/node/globals.typedarray.d.ts +0 -101
- package/node_modules/@types/node/http.d.ts +0 -2172
- package/node_modules/@types/node/http2.d.ts +0 -2489
- package/node_modules/@types/node/https.d.ts +0 -400
- package/node_modules/@types/node/index.d.ts +0 -115
- package/node_modules/@types/node/inspector/promises.d.ts +0 -35
- package/node_modules/@types/node/inspector.d.ts +0 -264
- package/node_modules/@types/node/inspector.generated.d.ts +0 -4406
- package/node_modules/@types/node/module.d.ts +0 -726
- package/node_modules/@types/node/net.d.ts +0 -970
- package/node_modules/@types/node/os.d.ts +0 -498
- package/node_modules/@types/node/package.json +0 -155
- package/node_modules/@types/node/path/posix.d.ts +0 -8
- package/node_modules/@types/node/path/win32.d.ts +0 -8
- package/node_modules/@types/node/path.d.ts +0 -178
- package/node_modules/@types/node/perf_hooks.d.ts +0 -604
- package/node_modules/@types/node/process.d.ts +0 -2217
- package/node_modules/@types/node/punycode.d.ts +0 -89
- package/node_modules/@types/node/querystring.d.ts +0 -139
- package/node_modules/@types/node/quic.d.ts +0 -978
- package/node_modules/@types/node/readline/promises.d.ts +0 -158
- package/node_modules/@types/node/readline.d.ts +0 -508
- package/node_modules/@types/node/repl.d.ts +0 -420
- package/node_modules/@types/node/sea.d.ts +0 -47
- package/node_modules/@types/node/sqlite.d.ts +0 -1123
- package/node_modules/@types/node/stream/consumers.d.ts +0 -114
- package/node_modules/@types/node/stream/iter.d.ts +0 -451
- package/node_modules/@types/node/stream/promises.d.ts +0 -211
- package/node_modules/@types/node/stream/web.d.ts +0 -300
- package/node_modules/@types/node/stream.d.ts +0 -1806
- package/node_modules/@types/node/string_decoder.d.ts +0 -27
- package/node_modules/@types/node/test/reporters.d.ts +0 -59
- package/node_modules/@types/node/test.d.ts +0 -2389
- package/node_modules/@types/node/timers/promises.d.ts +0 -93
- package/node_modules/@types/node/timers.d.ts +0 -149
- package/node_modules/@types/node/tls.d.ts +0 -1193
- package/node_modules/@types/node/trace_events.d.ts +0 -103
- package/node_modules/@types/node/ts5.6/buffer.buffer.d.ts +0 -462
- package/node_modules/@types/node/ts5.6/compatibility/float16array.d.ts +0 -71
- package/node_modules/@types/node/ts5.6/globals.typedarray.d.ts +0 -36
- package/node_modules/@types/node/ts5.6/index.d.ts +0 -117
- package/node_modules/@types/node/ts5.7/compatibility/float16array.d.ts +0 -72
- package/node_modules/@types/node/ts5.7/index.d.ts +0 -117
- package/node_modules/@types/node/tty.d.ts +0 -225
- package/node_modules/@types/node/url.d.ts +0 -556
- package/node_modules/@types/node/util/types.d.ts +0 -558
- package/node_modules/@types/node/util.d.ts +0 -1677
- package/node_modules/@types/node/v8.d.ts +0 -1062
- package/node_modules/@types/node/vm.d.ts +0 -1136
- package/node_modules/@types/node/wasi.d.ts +0 -131
- package/node_modules/@types/node/web-globals/abortcontroller.d.ts +0 -59
- package/node_modules/@types/node/web-globals/blob.d.ts +0 -23
- package/node_modules/@types/node/web-globals/console.d.ts +0 -9
- package/node_modules/@types/node/web-globals/crypto.d.ts +0 -39
- package/node_modules/@types/node/web-globals/domexception.d.ts +0 -83
- package/node_modules/@types/node/web-globals/encoding.d.ts +0 -11
- package/node_modules/@types/node/web-globals/events.d.ts +0 -106
- package/node_modules/@types/node/web-globals/fetch.d.ts +0 -69
- package/node_modules/@types/node/web-globals/importmeta.d.ts +0 -13
- package/node_modules/@types/node/web-globals/messaging.d.ts +0 -23
- package/node_modules/@types/node/web-globals/navigator.d.ts +0 -25
- package/node_modules/@types/node/web-globals/performance.d.ts +0 -45
- package/node_modules/@types/node/web-globals/storage.d.ts +0 -24
- package/node_modules/@types/node/web-globals/streams.d.ts +0 -115
- package/node_modules/@types/node/web-globals/timers.d.ts +0 -44
- package/node_modules/@types/node/web-globals/url.d.ts +0 -24
- package/node_modules/@types/node/worker_threads.d.ts +0 -669
- package/node_modules/@types/node/zlib/iter.d.ts +0 -131
- package/node_modules/@types/node/zlib.d.ts +0 -589
- package/node_modules/p-queue/dist/index.js +0 -807
- package/node_modules/p-queue/package.json +0 -81
- package/node_modules/protobufjs/README.md +0 -727
- package/node_modules/protobufjs/dist/light/protobuf.js +0 -8041
- package/node_modules/protobufjs/dist/light/protobuf.js.map +0 -1
- package/node_modules/protobufjs/dist/light/protobuf.min.js +0 -8
- package/node_modules/protobufjs/dist/light/protobuf.min.js.map +0 -1
- package/node_modules/protobufjs/dist/minimal/protobuf.js +0 -2791
- package/node_modules/protobufjs/dist/minimal/protobuf.js.map +0 -1
- package/node_modules/protobufjs/dist/minimal/protobuf.min.js +0 -8
- package/node_modules/protobufjs/dist/minimal/protobuf.min.js.map +0 -1
- package/node_modules/protobufjs/dist/protobuf.js +0 -9868
- package/node_modules/protobufjs/dist/protobuf.js.map +0 -1
- package/node_modules/protobufjs/dist/protobuf.min.js +0 -8
- package/node_modules/protobufjs/dist/protobuf.min.js.map +0 -1
- package/node_modules/protobufjs/ext/descriptor/README.md +0 -72
- package/node_modules/protobufjs/ext/descriptor/index.d.ts +0 -195
- package/node_modules/protobufjs/ext/descriptor/index.js +0 -1186
- package/node_modules/protobufjs/ext/descriptor/test.js +0 -54
- package/node_modules/protobufjs/google/api/annotations.json +0 -83
- package/node_modules/protobufjs/google/api/http.json +0 -86
- package/node_modules/protobufjs/google/protobuf/api.json +0 -118
- package/node_modules/protobufjs/google/protobuf/descriptor.json +0 -1382
- package/node_modules/protobufjs/google/protobuf/descriptor.proto +0 -535
- package/node_modules/protobufjs/google/protobuf/source_context.json +0 -20
- package/node_modules/protobufjs/google/protobuf/type.json +0 -202
- package/node_modules/protobufjs/index.d.ts +0 -2832
- package/node_modules/protobufjs/package.json +0 -119
- package/node_modules/protobufjs/scripts/postinstall.js +0 -32
- package/node_modules/protobufjs/src/common.js +0 -399
- package/node_modules/protobufjs/src/converter.js +0 -318
- package/node_modules/protobufjs/src/decoder.js +0 -135
- package/node_modules/protobufjs/src/encoder.js +0 -103
- package/node_modules/protobufjs/src/enum.js +0 -226
- package/node_modules/protobufjs/src/field.js +0 -453
- package/node_modules/protobufjs/src/index-light.js +0 -104
- package/node_modules/protobufjs/src/index-minimal.js +0 -36
- package/node_modules/protobufjs/src/index.js +0 -12
- package/node_modules/protobufjs/src/mapfield.js +0 -126
- package/node_modules/protobufjs/src/message.js +0 -143
- package/node_modules/protobufjs/src/method.js +0 -160
- package/node_modules/protobufjs/src/namespace.js +0 -558
- package/node_modules/protobufjs/src/object.js +0 -382
- package/node_modules/protobufjs/src/oneof.js +0 -222
- package/node_modules/protobufjs/src/parse.js +0 -992
- package/node_modules/protobufjs/src/reader.js +0 -426
- package/node_modules/protobufjs/src/reader_buffer.js +0 -51
- package/node_modules/protobufjs/src/root.js +0 -412
- package/node_modules/protobufjs/src/rpc/service.js +0 -142
- package/node_modules/protobufjs/src/service.js +0 -193
- package/node_modules/protobufjs/src/tokenize.js +0 -416
- package/node_modules/protobufjs/src/type.js +0 -632
- package/node_modules/protobufjs/src/typescript.jsdoc +0 -15
- package/node_modules/protobufjs/src/util/longbits.js +0 -200
- package/node_modules/protobufjs/src/util/minimal.js +0 -491
- package/node_modules/protobufjs/src/util.js +0 -230
- package/node_modules/protobufjs/src/verifier.js +0 -180
- package/node_modules/protobufjs/src/wrappers.js +0 -107
- package/node_modules/protobufjs/src/writer.js +0 -467
- package/node_modules/protobufjs/src/writer_buffer.js +0 -85
- package/node_modules/protobufjs/tsconfig.json +0 -8
- package/node_modules/undici-types/LICENSE +0 -21
- package/node_modules/undici-types/README.md +0 -6
- package/node_modules/undici-types/agent.d.ts +0 -30
- package/node_modules/undici-types/api.d.ts +0 -43
- package/node_modules/undici-types/balanced-pool.d.ts +0 -30
- package/node_modules/undici-types/cache-interceptor.d.ts +0 -179
- package/node_modules/undici-types/cache.d.ts +0 -36
- package/node_modules/undici-types/client-stats.d.ts +0 -15
- package/node_modules/undici-types/client.d.ts +0 -129
- package/node_modules/undici-types/connector.d.ts +0 -36
- package/node_modules/undici-types/content-type.d.ts +0 -21
- package/node_modules/undici-types/cookies.d.ts +0 -30
- package/node_modules/undici-types/diagnostics-channel.d.ts +0 -74
- package/node_modules/undici-types/dispatcher.d.ts +0 -253
- package/node_modules/undici-types/dispatcher1-wrapper.d.ts +0 -7
- package/node_modules/undici-types/env-http-proxy-agent.d.ts +0 -22
- package/node_modules/undici-types/errors.d.ts +0 -177
- package/node_modules/undici-types/eventsource.d.ts +0 -66
- package/node_modules/undici-types/fetch.d.ts +0 -231
- package/node_modules/undici-types/formdata.d.ts +0 -108
- package/node_modules/undici-types/global-dispatcher.d.ts +0 -9
- package/node_modules/undici-types/global-origin.d.ts +0 -7
- package/node_modules/undici-types/h2c-client.d.ts +0 -73
- package/node_modules/undici-types/handlers.d.ts +0 -14
- package/node_modules/undici-types/header.d.ts +0 -165
- package/node_modules/undici-types/index.d.ts +0 -93
- package/node_modules/undici-types/interceptors.d.ts +0 -80
- package/node_modules/undici-types/mock-agent.d.ts +0 -68
- package/node_modules/undici-types/mock-call-history.d.ts +0 -111
- package/node_modules/undici-types/mock-client.d.ts +0 -27
- package/node_modules/undici-types/mock-errors.d.ts +0 -12
- package/node_modules/undici-types/mock-interceptor.d.ts +0 -94
- package/node_modules/undici-types/mock-pool.d.ts +0 -27
- package/node_modules/undici-types/package.json +0 -55
- package/node_modules/undici-types/patch.d.ts +0 -29
- package/node_modules/undici-types/pool-stats.d.ts +0 -19
- package/node_modules/undici-types/pool.d.ts +0 -39
- package/node_modules/undici-types/proxy-agent.d.ts +0 -29
- package/node_modules/undici-types/readable.d.ts +0 -68
- package/node_modules/undici-types/retry-agent.d.ts +0 -8
- package/node_modules/undici-types/retry-handler.d.ts +0 -125
- package/node_modules/undici-types/round-robin-pool.d.ts +0 -39
- package/node_modules/undici-types/snapshot-agent.d.ts +0 -113
- package/node_modules/undici-types/socks5-proxy-agent.d.ts +0 -25
- package/node_modules/undici-types/util.d.ts +0 -18
- package/node_modules/undici-types/utility.d.ts +0 -7
- package/node_modules/undici-types/webidl.d.ts +0 -346
- package/node_modules/undici-types/websocket.d.ts +0 -188
- package/npm-shrinkwrap.json +0 -954
- /package/node_modules/{@eshaz → audio-decode/node_modules/@eshaz}/web-worker/LICENSE +0 -0
- /package/node_modules/{@eshaz → audio-decode/node_modules/@eshaz}/web-worker/README.md +0 -0
- /package/node_modules/{@eshaz → audio-decode/node_modules/@eshaz}/web-worker/browser.js +0 -0
- /package/node_modules/{@eshaz → audio-decode/node_modules/@eshaz}/web-worker/cjs/browser.js +0 -0
- /package/node_modules/{@eshaz → audio-decode/node_modules/@eshaz}/web-worker/cjs/node.js +0 -0
- /package/node_modules/{@eshaz → audio-decode/node_modules/@eshaz}/web-worker/index.d.ts +0 -0
- /package/node_modules/{@eshaz → audio-decode/node_modules/@eshaz}/web-worker/node.js +0 -0
- /package/node_modules/{@eshaz → audio-decode/node_modules/@eshaz}/web-worker/package.json +0 -0
- /package/node_modules/{@thi.ng → audio-decode/node_modules/@thi.ng}/bitstream/LICENSE +0 -0
- /package/node_modules/{@thi.ng → audio-decode/node_modules/@thi.ng}/bitstream/README.md +0 -0
- /package/node_modules/{@thi.ng → audio-decode/node_modules/@thi.ng}/bitstream/index.d.ts +0 -0
- /package/node_modules/{@thi.ng → audio-decode/node_modules/@thi.ng}/bitstream/index.js +0 -0
- /package/node_modules/{@thi.ng → audio-decode/node_modules/@thi.ng}/bitstream/input.d.ts +0 -0
- /package/node_modules/{@thi.ng → audio-decode/node_modules/@thi.ng}/bitstream/input.js +0 -0
- /package/node_modules/{@thi.ng → audio-decode/node_modules/@thi.ng}/bitstream/output.d.ts +0 -0
- /package/node_modules/{@thi.ng → audio-decode/node_modules/@thi.ng}/bitstream/output.js +0 -0
- /package/node_modules/{@thi.ng → audio-decode/node_modules/@thi.ng}/bitstream/package.json +0 -0
- /package/node_modules/{@thi.ng → audio-decode/node_modules/@thi.ng}/bitstream/simple.d.ts +0 -0
- /package/node_modules/{@thi.ng → audio-decode/node_modules/@thi.ng}/bitstream/simple.js +0 -0
- /package/node_modules/{@thi.ng → audio-decode/node_modules/@thi.ng}/errors/LICENSE +0 -0
- /package/node_modules/{@thi.ng → audio-decode/node_modules/@thi.ng}/errors/README.md +0 -0
- /package/node_modules/{@thi.ng → audio-decode/node_modules/@thi.ng}/errors/assert.d.ts +0 -0
- /package/node_modules/{@thi.ng → audio-decode/node_modules/@thi.ng}/errors/assert.js +0 -0
- /package/node_modules/{@thi.ng → audio-decode/node_modules/@thi.ng}/errors/deferror.d.ts +0 -0
- /package/node_modules/{@thi.ng → audio-decode/node_modules/@thi.ng}/errors/deferror.js +0 -0
- /package/node_modules/{@thi.ng → audio-decode/node_modules/@thi.ng}/errors/ensure.d.ts +0 -0
- /package/node_modules/{@thi.ng → audio-decode/node_modules/@thi.ng}/errors/ensure.js +0 -0
- /package/node_modules/{@thi.ng → audio-decode/node_modules/@thi.ng}/errors/illegal-arguments.d.ts +0 -0
- /package/node_modules/{@thi.ng → audio-decode/node_modules/@thi.ng}/errors/illegal-arguments.js +0 -0
- /package/node_modules/{@thi.ng → audio-decode/node_modules/@thi.ng}/errors/illegal-arity.d.ts +0 -0
- /package/node_modules/{@thi.ng → audio-decode/node_modules/@thi.ng}/errors/illegal-arity.js +0 -0
- /package/node_modules/{@thi.ng → audio-decode/node_modules/@thi.ng}/errors/illegal-state.d.ts +0 -0
- /package/node_modules/{@thi.ng → audio-decode/node_modules/@thi.ng}/errors/illegal-state.js +0 -0
- /package/node_modules/{@thi.ng → audio-decode/node_modules/@thi.ng}/errors/index.d.ts +0 -0
- /package/node_modules/{@thi.ng → audio-decode/node_modules/@thi.ng}/errors/index.js +0 -0
- /package/node_modules/{@thi.ng → audio-decode/node_modules/@thi.ng}/errors/io.d.ts +0 -0
- /package/node_modules/{@thi.ng → audio-decode/node_modules/@thi.ng}/errors/io.js +0 -0
- /package/node_modules/{@thi.ng → audio-decode/node_modules/@thi.ng}/errors/out-of-bounds.d.ts +0 -0
- /package/node_modules/{@thi.ng → audio-decode/node_modules/@thi.ng}/errors/out-of-bounds.js +0 -0
- /package/node_modules/{@thi.ng → audio-decode/node_modules/@thi.ng}/errors/package.json +0 -0
- /package/node_modules/{@thi.ng → audio-decode/node_modules/@thi.ng}/errors/unsupported.d.ts +0 -0
- /package/node_modules/{@thi.ng → audio-decode/node_modules/@thi.ng}/errors/unsupported.js +0 -0
- /package/node_modules/{@wasm-audio-decoders → audio-decode/node_modules/@wasm-audio-decoders}/common/index.js +0 -0
- /package/node_modules/{@wasm-audio-decoders → audio-decode/node_modules/@wasm-audio-decoders}/common/package.json +0 -0
- /package/node_modules/{@wasm-audio-decoders → audio-decode/node_modules/@wasm-audio-decoders}/common/src/WASMAudioDecoderCommon.js +0 -0
- /package/node_modules/{@wasm-audio-decoders → audio-decode/node_modules/@wasm-audio-decoders}/common/src/WASMAudioDecoderWorker.js +0 -0
- /package/node_modules/{@wasm-audio-decoders → audio-decode/node_modules/@wasm-audio-decoders}/common/src/puff/README +0 -0
- /package/node_modules/{@wasm-audio-decoders → audio-decode/node_modules/@wasm-audio-decoders}/common/src/puff/build_puff.js +0 -0
- /package/node_modules/{@wasm-audio-decoders → audio-decode/node_modules/@wasm-audio-decoders}/common/src/puff/puff.c +0 -0
- /package/node_modules/{@wasm-audio-decoders → audio-decode/node_modules/@wasm-audio-decoders}/common/src/puff/puff.h +0 -0
- /package/node_modules/{@wasm-audio-decoders → audio-decode/node_modules/@wasm-audio-decoders}/common/src/utilities.js +0 -0
- /package/node_modules/{@wasm-audio-decoders → audio-decode/node_modules/@wasm-audio-decoders}/common/types.d.ts +0 -0
- /package/node_modules/{@wasm-audio-decoders → audio-decode/node_modules/@wasm-audio-decoders}/flac/README.md +0 -0
- /package/node_modules/{@wasm-audio-decoders → audio-decode/node_modules/@wasm-audio-decoders}/flac/dist/flac-decoder.min.js +0 -0
- /package/node_modules/{@wasm-audio-decoders → audio-decode/node_modules/@wasm-audio-decoders}/flac/dist/flac-decoder.min.js.map +0 -0
- /package/node_modules/{@wasm-audio-decoders → audio-decode/node_modules/@wasm-audio-decoders}/flac/index.js +0 -0
- /package/node_modules/{@wasm-audio-decoders → audio-decode/node_modules/@wasm-audio-decoders}/flac/package.json +0 -0
- /package/node_modules/{@wasm-audio-decoders → audio-decode/node_modules/@wasm-audio-decoders}/flac/src/EmscriptenWasm.js +0 -0
- /package/node_modules/{@wasm-audio-decoders → audio-decode/node_modules/@wasm-audio-decoders}/flac/src/FLACDecoder.js +0 -0
- /package/node_modules/{@wasm-audio-decoders → audio-decode/node_modules/@wasm-audio-decoders}/flac/src/FLACDecoderWebWorker.js +0 -0
- /package/node_modules/{@wasm-audio-decoders → audio-decode/node_modules/@wasm-audio-decoders}/flac/types.d.ts +0 -0
- /package/node_modules/{@wasm-audio-decoders → audio-decode/node_modules/@wasm-audio-decoders}/ogg-vorbis/README.md +0 -0
- /package/node_modules/{@wasm-audio-decoders → audio-decode/node_modules/@wasm-audio-decoders}/ogg-vorbis/dist/ogg-vorbis-decoder.min.js +0 -0
- /package/node_modules/{@wasm-audio-decoders → audio-decode/node_modules/@wasm-audio-decoders}/ogg-vorbis/dist/ogg-vorbis-decoder.min.js.map +0 -0
- /package/node_modules/{@wasm-audio-decoders → audio-decode/node_modules/@wasm-audio-decoders}/ogg-vorbis/index.js +0 -0
- /package/node_modules/{@wasm-audio-decoders → audio-decode/node_modules/@wasm-audio-decoders}/ogg-vorbis/package.json +0 -0
- /package/node_modules/{@wasm-audio-decoders → audio-decode/node_modules/@wasm-audio-decoders}/ogg-vorbis/src/EmscriptenWasm.js +0 -0
- /package/node_modules/{@wasm-audio-decoders → audio-decode/node_modules/@wasm-audio-decoders}/ogg-vorbis/src/OggVorbisDecoder.js +0 -0
- /package/node_modules/{@wasm-audio-decoders → audio-decode/node_modules/@wasm-audio-decoders}/ogg-vorbis/src/OggVorbisDecoderWebWorker.js +0 -0
- /package/node_modules/{@wasm-audio-decoders → audio-decode/node_modules/@wasm-audio-decoders}/ogg-vorbis/types.d.ts +0 -0
- /package/node_modules/{@wasm-audio-decoders → audio-decode/node_modules/@wasm-audio-decoders}/opus-ml/README.md +0 -0
- /package/node_modules/{@wasm-audio-decoders → audio-decode/node_modules/@wasm-audio-decoders}/opus-ml/dist/opus-ml-decoder.min.js +0 -0
- /package/node_modules/{@wasm-audio-decoders → audio-decode/node_modules/@wasm-audio-decoders}/opus-ml/dist/opus-ml-decoder.min.js.map +0 -0
- /package/node_modules/{@wasm-audio-decoders → audio-decode/node_modules/@wasm-audio-decoders}/opus-ml/index.js +0 -0
- /package/node_modules/{@wasm-audio-decoders → audio-decode/node_modules/@wasm-audio-decoders}/opus-ml/package.json +0 -0
- /package/node_modules/{@wasm-audio-decoders → audio-decode/node_modules/@wasm-audio-decoders}/opus-ml/src/EmscriptenWasm.js +0 -0
- /package/node_modules/{@wasm-audio-decoders → audio-decode/node_modules/@wasm-audio-decoders}/opus-ml/src/OpusMLDecoder.js +0 -0
- /package/node_modules/{@wasm-audio-decoders → audio-decode/node_modules/@wasm-audio-decoders}/opus-ml/src/OpusMLDecoderWebWorker.js +0 -0
- /package/node_modules/{@wasm-audio-decoders → audio-decode/node_modules/@wasm-audio-decoders}/opus-ml/types.d.ts +0 -0
- /package/node_modules/{audio-buffer → audio-decode/node_modules/audio-buffer}/.eslintrc.json +0 -0
- /package/node_modules/{audio-buffer → audio-decode/node_modules/audio-buffer}/.github/workflows/node.js.yml +0 -0
- /package/node_modules/{audio-buffer → audio-decode/node_modules/audio-buffer}/.travis.yml +0 -0
- /package/node_modules/{audio-buffer → audio-decode/node_modules/audio-buffer}/LICENSE +0 -0
- /package/node_modules/{audio-buffer → audio-decode/node_modules/audio-buffer}/index.js +0 -0
- /package/node_modules/{audio-buffer → audio-decode/node_modules/audio-buffer}/package.json +0 -0
- /package/node_modules/{audio-buffer → audio-decode/node_modules/audio-buffer}/readme.md +0 -0
- /package/node_modules/{audio-type → audio-decode/node_modules/audio-type}/audio-type.js +0 -0
- /package/node_modules/{audio-type → audio-decode/node_modules/audio-type}/license +0 -0
- /package/node_modules/{audio-type → audio-decode/node_modules/audio-type}/package.json +0 -0
- /package/node_modules/{audio-type → audio-decode/node_modules/audio-type}/readme.md +0 -0
- /package/node_modules/{codec-parser → audio-decode/node_modules/codec-parser}/.github/FUNDING.yml +0 -0
- /package/node_modules/{codec-parser → audio-decode/node_modules/codec-parser}/.prettierignore +0 -0
- /package/node_modules/{codec-parser → audio-decode/node_modules/codec-parser}/LICENSE +0 -0
- /package/node_modules/{codec-parser → audio-decode/node_modules/codec-parser}/README.md +0 -0
- /package/node_modules/{codec-parser → audio-decode/node_modules/codec-parser}/index.d.ts +0 -0
- /package/node_modules/{codec-parser → audio-decode/node_modules/codec-parser}/index.js +0 -0
- /package/node_modules/{codec-parser → audio-decode/node_modules/codec-parser}/package.json +0 -0
- /package/node_modules/{codec-parser → audio-decode/node_modules/codec-parser}/src/CodecParser.js +0 -0
- /package/node_modules/{codec-parser → audio-decode/node_modules/codec-parser}/src/codecs/CodecFrame.js +0 -0
- /package/node_modules/{codec-parser → audio-decode/node_modules/codec-parser}/src/codecs/CodecHeader.js +0 -0
- /package/node_modules/{codec-parser → audio-decode/node_modules/codec-parser}/src/codecs/HeaderCache.js +0 -0
- /package/node_modules/{codec-parser → audio-decode/node_modules/codec-parser}/src/codecs/Parser.js +0 -0
- /package/node_modules/{codec-parser → audio-decode/node_modules/codec-parser}/src/codecs/aac/AACFrame.js +0 -0
- /package/node_modules/{codec-parser → audio-decode/node_modules/codec-parser}/src/codecs/aac/AACHeader.js +0 -0
- /package/node_modules/{codec-parser → audio-decode/node_modules/codec-parser}/src/codecs/aac/AACParser.js +0 -0
- /package/node_modules/{codec-parser → audio-decode/node_modules/codec-parser}/src/codecs/flac/FLACFrame.js +0 -0
- /package/node_modules/{codec-parser → audio-decode/node_modules/codec-parser}/src/codecs/flac/FLACHeader.js +0 -0
- /package/node_modules/{codec-parser → audio-decode/node_modules/codec-parser}/src/codecs/flac/FLACParser.js +0 -0
- /package/node_modules/{codec-parser → audio-decode/node_modules/codec-parser}/src/codecs/mpeg/MPEGFrame.js +0 -0
- /package/node_modules/{codec-parser → audio-decode/node_modules/codec-parser}/src/codecs/mpeg/MPEGHeader.js +0 -0
- /package/node_modules/{codec-parser → audio-decode/node_modules/codec-parser}/src/codecs/mpeg/MPEGParser.js +0 -0
- /package/node_modules/{codec-parser → audio-decode/node_modules/codec-parser}/src/codecs/opus/OpusFrame.js +0 -0
- /package/node_modules/{codec-parser → audio-decode/node_modules/codec-parser}/src/codecs/opus/OpusHeader.js +0 -0
- /package/node_modules/{codec-parser → audio-decode/node_modules/codec-parser}/src/codecs/opus/OpusParser.js +0 -0
- /package/node_modules/{codec-parser → audio-decode/node_modules/codec-parser}/src/codecs/vorbis/VorbisFrame.js +0 -0
- /package/node_modules/{codec-parser → audio-decode/node_modules/codec-parser}/src/codecs/vorbis/VorbisHeader.js +0 -0
- /package/node_modules/{codec-parser → audio-decode/node_modules/codec-parser}/src/codecs/vorbis/VorbisParser.js +0 -0
- /package/node_modules/{codec-parser → audio-decode/node_modules/codec-parser}/src/constants.js +0 -0
- /package/node_modules/{codec-parser → audio-decode/node_modules/codec-parser}/src/containers/Frame.js +0 -0
- /package/node_modules/{codec-parser → audio-decode/node_modules/codec-parser}/src/containers/ogg/OggPage.js +0 -0
- /package/node_modules/{codec-parser → audio-decode/node_modules/codec-parser}/src/containers/ogg/OggPageHeader.js +0 -0
- /package/node_modules/{codec-parser → audio-decode/node_modules/codec-parser}/src/containers/ogg/OggParser.js +0 -0
- /package/node_modules/{codec-parser → audio-decode/node_modules/codec-parser}/src/globals.js +0 -0
- /package/node_modules/{codec-parser → audio-decode/node_modules/codec-parser}/src/metadata/ID3v2.js +0 -0
- /package/node_modules/{codec-parser → audio-decode/node_modules/codec-parser}/src/utilities.js +0 -0
- /package/node_modules/{mpg123-decoder → audio-decode/node_modules/mpg123-decoder}/README.md +0 -0
- /package/node_modules/{mpg123-decoder → audio-decode/node_modules/mpg123-decoder}/dist/mpg123-decoder.min.js +0 -0
- /package/node_modules/{mpg123-decoder → audio-decode/node_modules/mpg123-decoder}/dist/mpg123-decoder.min.js.map +0 -0
- /package/node_modules/{mpg123-decoder → audio-decode/node_modules/mpg123-decoder}/index.js +0 -0
- /package/node_modules/{mpg123-decoder → audio-decode/node_modules/mpg123-decoder}/package.json +0 -0
- /package/node_modules/{mpg123-decoder → audio-decode/node_modules/mpg123-decoder}/src/EmscriptenWasm.js +0 -0
- /package/node_modules/{mpg123-decoder → audio-decode/node_modules/mpg123-decoder}/src/MPEGDecoder.js +0 -0
- /package/node_modules/{mpg123-decoder → audio-decode/node_modules/mpg123-decoder}/src/MPEGDecoderWebWorker.js +0 -0
- /package/node_modules/{mpg123-decoder → audio-decode/node_modules/mpg123-decoder}/types.d.ts +0 -0
- /package/node_modules/{node-wav → audio-decode/node_modules/node-wav}/README.md +0 -0
- /package/node_modules/{node-wav → audio-decode/node_modules/node-wav}/file.wav +0 -0
- /package/node_modules/{node-wav → audio-decode/node_modules/node-wav}/index.js +0 -0
- /package/node_modules/{node-wav → audio-decode/node_modules/node-wav}/package.json +0 -0
- /package/node_modules/{node-wav → audio-decode/node_modules/node-wav}/tests/file1.wav +0 -0
- /package/node_modules/{node-wav → audio-decode/node_modules/node-wav}/tests/test.js +0 -0
- /package/node_modules/{node-wav → audio-decode/node_modules/node-wav}/x.js +0 -0
- /package/node_modules/{node-wav → audio-decode/node_modules/node-wav}/x.json +0 -0
- /package/node_modules/{node-wav → audio-decode/node_modules/node-wav}/x.js~ +0 -0
- /package/node_modules/{ogg-opus-decoder → audio-decode/node_modules/ogg-opus-decoder}/README.md +0 -0
- /package/node_modules/{ogg-opus-decoder → audio-decode/node_modules/ogg-opus-decoder}/dist/ogg-opus-decoder.min.js +0 -0
- /package/node_modules/{ogg-opus-decoder → audio-decode/node_modules/ogg-opus-decoder}/dist/ogg-opus-decoder.min.js.map +0 -0
- /package/node_modules/{ogg-opus-decoder → audio-decode/node_modules/ogg-opus-decoder}/dist/ogg-opus-decoder.opus-ml.min.js +0 -0
- /package/node_modules/{ogg-opus-decoder → audio-decode/node_modules/ogg-opus-decoder}/dist/ogg-opus-decoder.opus-ml.min.js.map +0 -0
- /package/node_modules/{ogg-opus-decoder → audio-decode/node_modules/ogg-opus-decoder}/index.js +0 -0
- /package/node_modules/{ogg-opus-decoder → audio-decode/node_modules/ogg-opus-decoder}/package.json +0 -0
- /package/node_modules/{ogg-opus-decoder → audio-decode/node_modules/ogg-opus-decoder}/src/OggOpusDecoder.js +0 -0
- /package/node_modules/{ogg-opus-decoder → audio-decode/node_modules/ogg-opus-decoder}/src/OggOpusDecoderWebWorker.js +0 -0
- /package/node_modules/{ogg-opus-decoder → audio-decode/node_modules/ogg-opus-decoder}/types.d.ts +0 -0
- /package/node_modules/{opus-decoder → audio-decode/node_modules/opus-decoder}/README.md +0 -0
- /package/node_modules/{opus-decoder → audio-decode/node_modules/opus-decoder}/dist/opus-decoder.min.js +0 -0
- /package/node_modules/{opus-decoder → audio-decode/node_modules/opus-decoder}/dist/opus-decoder.min.js.map +0 -0
- /package/node_modules/{opus-decoder → audio-decode/node_modules/opus-decoder}/index.js +0 -0
- /package/node_modules/{opus-decoder → audio-decode/node_modules/opus-decoder}/package.json +0 -0
- /package/node_modules/{opus-decoder → audio-decode/node_modules/opus-decoder}/src/EmscriptenWasm.js +0 -0
- /package/node_modules/{opus-decoder → audio-decode/node_modules/opus-decoder}/src/OpusDecoder.js +0 -0
- /package/node_modules/{opus-decoder → audio-decode/node_modules/opus-decoder}/src/OpusDecoderWebWorker.js +0 -0
- /package/node_modules/{opus-decoder → audio-decode/node_modules/opus-decoder}/types.d.ts +0 -0
- /package/node_modules/{qoa-format → audio-decode/node_modules/qoa-format}/LICENSE.md +0 -0
- /package/node_modules/{qoa-format → audio-decode/node_modules/qoa-format}/README.md +0 -0
- /package/node_modules/{qoa-format → audio-decode/node_modules/qoa-format}/decode.js +0 -0
- /package/node_modules/{qoa-format → audio-decode/node_modules/qoa-format}/encode.js +0 -0
- /package/node_modules/{qoa-format → audio-decode/node_modules/qoa-format}/index.js +0 -0
- /package/node_modules/{qoa-format → audio-decode/node_modules/qoa-format}/lib/common.js +0 -0
- /package/node_modules/{qoa-format → audio-decode/node_modules/qoa-format}/package.json +0 -0
- /package/node_modules/{simple-yenc → audio-decode/node_modules/simple-yenc}/.github/FUNDING.yml +0 -0
- /package/node_modules/{simple-yenc → audio-decode/node_modules/simple-yenc}/.prettierignore +0 -0
- /package/node_modules/{simple-yenc → audio-decode/node_modules/simple-yenc}/LICENSE +0 -0
- /package/node_modules/{simple-yenc → audio-decode/node_modules/simple-yenc}/README.md +0 -0
- /package/node_modules/{simple-yenc → audio-decode/node_modules/simple-yenc}/dist/esm.js +0 -0
- /package/node_modules/{simple-yenc → audio-decode/node_modules/simple-yenc}/dist/index.js +0 -0
- /package/node_modules/{simple-yenc → audio-decode/node_modules/simple-yenc}/package.json +0 -0
- /package/node_modules/{simple-yenc → audio-decode/node_modules/simple-yenc}/rollup.config.js +0 -0
- /package/node_modules/{simple-yenc → audio-decode/node_modules/simple-yenc}/src/simple-yenc.js +0 -0
- /package/node_modules/{@borewit → baileys/node_modules/@borewit}/text-codec/LICENSE.txt +0 -0
- /package/node_modules/{@borewit → baileys/node_modules/@borewit}/text-codec/README.md +0 -0
- /package/node_modules/{@borewit → baileys/node_modules/@borewit}/text-codec/lib/index.d.ts +0 -0
- /package/node_modules/{@borewit → baileys/node_modules/@borewit}/text-codec/lib/index.js +0 -0
- /package/node_modules/{@borewit → baileys/node_modules/@borewit}/text-codec/package.json +0 -0
- /package/node_modules/{@cacheable → baileys/node_modules/@cacheable}/memory/LICENSE +0 -0
- /package/node_modules/{@cacheable → baileys/node_modules/@cacheable}/memory/README.md +0 -0
- /package/node_modules/{@cacheable → baileys/node_modules/@cacheable}/memory/dist/index.cjs +0 -0
- /package/node_modules/{@cacheable → baileys/node_modules/@cacheable}/memory/dist/index.d.cts +0 -0
- /package/node_modules/{@cacheable → baileys/node_modules/@cacheable}/memory/dist/index.d.mts +0 -0
- /package/node_modules/{@cacheable → baileys/node_modules/@cacheable}/memory/dist/index.mjs +0 -0
- /package/node_modules/{@cacheable → baileys/node_modules/@cacheable}/memory/package.json +0 -0
- /package/node_modules/{@cacheable → baileys/node_modules/@cacheable}/node-cache/LICENSE +0 -0
- /package/node_modules/{@cacheable → baileys/node_modules/@cacheable}/node-cache/README.md +0 -0
- /package/node_modules/{@cacheable → baileys/node_modules/@cacheable}/node-cache/dist/index.cjs +0 -0
- /package/node_modules/{@cacheable → baileys/node_modules/@cacheable}/node-cache/dist/index.d.cts +0 -0
- /package/node_modules/{@cacheable → baileys/node_modules/@cacheable}/node-cache/dist/index.d.ts +0 -0
- /package/node_modules/{@cacheable → baileys/node_modules/@cacheable}/node-cache/dist/index.js +0 -0
- /package/node_modules/{@cacheable → baileys/node_modules/@cacheable}/node-cache/package.json +0 -0
- /package/node_modules/{@cacheable → baileys/node_modules/@cacheable}/utils/LICENSE +0 -0
- /package/node_modules/{@cacheable → baileys/node_modules/@cacheable}/utils/README.md +0 -0
- /package/node_modules/{@cacheable → baileys/node_modules/@cacheable}/utils/dist/index.cjs +0 -0
- /package/node_modules/{@cacheable → baileys/node_modules/@cacheable}/utils/dist/index.d.cts +0 -0
- /package/node_modules/{@cacheable → baileys/node_modules/@cacheable}/utils/dist/index.d.mts +0 -0
- /package/node_modules/{@cacheable → baileys/node_modules/@cacheable}/utils/dist/index.mjs +0 -0
- /package/node_modules/{@cacheable → baileys/node_modules/@cacheable}/utils/package.json +0 -0
- /package/node_modules/{@hapi → baileys/node_modules/@hapi}/boom/LICENSE.md +0 -0
- /package/node_modules/{@hapi → baileys/node_modules/@hapi}/boom/README.md +0 -0
- /package/node_modules/{@hapi → baileys/node_modules/@hapi}/boom/lib/index.d.ts +0 -0
- /package/node_modules/{@hapi → baileys/node_modules/@hapi}/boom/lib/index.js +0 -0
- /package/node_modules/{@hapi → baileys/node_modules/@hapi}/boom/package.json +0 -0
- /package/node_modules/{@hapi → baileys/node_modules/@hapi}/hoek/LICENSE.md +0 -0
- /package/node_modules/{@hapi → baileys/node_modules/@hapi}/hoek/README.md +0 -0
- /package/node_modules/{@hapi → baileys/node_modules/@hapi}/hoek/lib/applyToDefaults.js +0 -0
- /package/node_modules/{@hapi → baileys/node_modules/@hapi}/hoek/lib/assert.js +0 -0
- /package/node_modules/{@hapi → baileys/node_modules/@hapi}/hoek/lib/bench.js +0 -0
- /package/node_modules/{@hapi → baileys/node_modules/@hapi}/hoek/lib/block.js +0 -0
- /package/node_modules/{@hapi → baileys/node_modules/@hapi}/hoek/lib/clone.js +0 -0
- /package/node_modules/{@hapi → baileys/node_modules/@hapi}/hoek/lib/contain.js +0 -0
- /package/node_modules/{@hapi → baileys/node_modules/@hapi}/hoek/lib/deepEqual.js +0 -0
- /package/node_modules/{@hapi → baileys/node_modules/@hapi}/hoek/lib/error.js +0 -0
- /package/node_modules/{@hapi → baileys/node_modules/@hapi}/hoek/lib/escapeHeaderAttribute.js +0 -0
- /package/node_modules/{@hapi → baileys/node_modules/@hapi}/hoek/lib/escapeHtml.js +0 -0
- /package/node_modules/{@hapi → baileys/node_modules/@hapi}/hoek/lib/escapeJson.js +0 -0
- /package/node_modules/{@hapi → baileys/node_modules/@hapi}/hoek/lib/escapeRegex.js +0 -0
- /package/node_modules/{@hapi → baileys/node_modules/@hapi}/hoek/lib/flatten.js +0 -0
- /package/node_modules/{@hapi → baileys/node_modules/@hapi}/hoek/lib/ignore.js +0 -0
- /package/node_modules/{@hapi → baileys/node_modules/@hapi}/hoek/lib/index.d.ts +0 -0
- /package/node_modules/{@hapi → baileys/node_modules/@hapi}/hoek/lib/index.js +0 -0
- /package/node_modules/{@hapi → baileys/node_modules/@hapi}/hoek/lib/intersect.js +0 -0
- /package/node_modules/{@hapi → baileys/node_modules/@hapi}/hoek/lib/isPromise.js +0 -0
- /package/node_modules/{@hapi → baileys/node_modules/@hapi}/hoek/lib/merge.js +0 -0
- /package/node_modules/{@hapi → baileys/node_modules/@hapi}/hoek/lib/once.js +0 -0
- /package/node_modules/{@hapi → baileys/node_modules/@hapi}/hoek/lib/reach.js +0 -0
- /package/node_modules/{@hapi → baileys/node_modules/@hapi}/hoek/lib/reachTemplate.js +0 -0
- /package/node_modules/{@hapi → baileys/node_modules/@hapi}/hoek/lib/stringify.js +0 -0
- /package/node_modules/{@hapi → baileys/node_modules/@hapi}/hoek/lib/types.js +0 -0
- /package/node_modules/{@hapi → baileys/node_modules/@hapi}/hoek/lib/utils.js +0 -0
- /package/node_modules/{@hapi → baileys/node_modules/@hapi}/hoek/lib/wait.js +0 -0
- /package/node_modules/{@hapi → baileys/node_modules/@hapi}/hoek/package.json +0 -0
- /package/node_modules/{@keyv → baileys/node_modules/@keyv}/bigmap/LICENSE +0 -0
- /package/node_modules/{@keyv → baileys/node_modules/@keyv}/bigmap/README.md +0 -0
- /package/node_modules/{@keyv → baileys/node_modules/@keyv}/bigmap/dist/index.cjs +0 -0
- /package/node_modules/{@keyv → baileys/node_modules/@keyv}/bigmap/dist/index.d.cts +0 -0
- /package/node_modules/{@keyv → baileys/node_modules/@keyv}/bigmap/dist/index.d.ts +0 -0
- /package/node_modules/{@keyv → baileys/node_modules/@keyv}/bigmap/dist/index.js +0 -0
- /package/node_modules/{@keyv → baileys/node_modules/@keyv}/bigmap/package.json +0 -0
- /package/node_modules/{@keyv → baileys/node_modules/@keyv}/serialize/LICENSE +0 -0
- /package/node_modules/{@keyv → baileys/node_modules/@keyv}/serialize/README.md +0 -0
- /package/node_modules/{@keyv → baileys/node_modules/@keyv}/serialize/dist/index.cjs +0 -0
- /package/node_modules/{@keyv → baileys/node_modules/@keyv}/serialize/dist/index.d.cts +0 -0
- /package/node_modules/{@keyv → baileys/node_modules/@keyv}/serialize/dist/index.d.ts +0 -0
- /package/node_modules/{@keyv → baileys/node_modules/@keyv}/serialize/dist/index.js +0 -0
- /package/node_modules/{@keyv → baileys/node_modules/@keyv}/serialize/package.json +0 -0
- /package/node_modules/{@pinojs → baileys/node_modules/@pinojs}/redact/.github/dependabot.yml +0 -0
- /package/node_modules/{@pinojs → baileys/node_modules/@pinojs}/redact/.github/workflows/ci.yml +0 -0
- /package/node_modules/{@pinojs → baileys/node_modules/@pinojs}/redact/.github/workflows/publish-release.yml +0 -0
- /package/node_modules/{@pinojs → baileys/node_modules/@pinojs}/redact/LICENSE +0 -0
- /package/node_modules/{@pinojs → baileys/node_modules/@pinojs}/redact/README.md +0 -0
- /package/node_modules/{@pinojs → baileys/node_modules/@pinojs}/redact/benchmarks/basic.js +0 -0
- /package/node_modules/{@pinojs → baileys/node_modules/@pinojs}/redact/eslint.config.js +0 -0
- /package/node_modules/{@pinojs → baileys/node_modules/@pinojs}/redact/index.d.ts +0 -0
- /package/node_modules/{@pinojs → baileys/node_modules/@pinojs}/redact/index.js +0 -0
- /package/node_modules/{@pinojs → baileys/node_modules/@pinojs}/redact/index.test-d.ts +0 -0
- /package/node_modules/{@pinojs → baileys/node_modules/@pinojs}/redact/package.json +0 -0
- /package/node_modules/{@pinojs → baileys/node_modules/@pinojs}/redact/scripts/sync-version.mjs +0 -0
- /package/node_modules/{@pinojs → baileys/node_modules/@pinojs}/redact/test/actual-redact-comparison.test.js +0 -0
- /package/node_modules/{@pinojs → baileys/node_modules/@pinojs}/redact/test/index.test.js +0 -0
- /package/node_modules/{@pinojs → baileys/node_modules/@pinojs}/redact/test/integration.test.js +0 -0
- /package/node_modules/{@pinojs → baileys/node_modules/@pinojs}/redact/test/multiple-wildcards.test.js +0 -0
- /package/node_modules/{@pinojs → baileys/node_modules/@pinojs}/redact/test/prototype-pollution.test.js +0 -0
- /package/node_modules/{@pinojs → baileys/node_modules/@pinojs}/redact/test/selective-clone.test.js +0 -0
- /package/node_modules/{@pinojs → baileys/node_modules/@pinojs}/redact/tsconfig.json +0 -0
- /package/node_modules/{@tokenizer → baileys/node_modules/@tokenizer}/inflate/LICENSE +0 -0
- /package/node_modules/{@tokenizer → baileys/node_modules/@tokenizer}/inflate/README.md +0 -0
- /package/node_modules/{@tokenizer → baileys/node_modules/@tokenizer}/inflate/lib/GzipHandler.d.ts +0 -0
- /package/node_modules/{@tokenizer → baileys/node_modules/@tokenizer}/inflate/lib/GzipHandler.js +0 -0
- /package/node_modules/{@tokenizer → baileys/node_modules/@tokenizer}/inflate/lib/ZipHandler.d.ts +0 -0
- /package/node_modules/{@tokenizer → baileys/node_modules/@tokenizer}/inflate/lib/ZipHandler.js +0 -0
- /package/node_modules/{@tokenizer → baileys/node_modules/@tokenizer}/inflate/lib/ZipToken.d.ts +0 -0
- /package/node_modules/{@tokenizer → baileys/node_modules/@tokenizer}/inflate/lib/ZipToken.js +0 -0
- /package/node_modules/{@tokenizer → baileys/node_modules/@tokenizer}/inflate/lib/index.d.ts +0 -0
- /package/node_modules/{@tokenizer → baileys/node_modules/@tokenizer}/inflate/lib/index.js +0 -0
- /package/node_modules/{@tokenizer → baileys/node_modules/@tokenizer}/inflate/package.json +0 -0
- /package/node_modules/{@tokenizer → baileys/node_modules/@tokenizer}/token/README.md +0 -0
- /package/node_modules/{@tokenizer → baileys/node_modules/@tokenizer}/token/index.d.ts +0 -0
- /package/node_modules/{@tokenizer → baileys/node_modules/@tokenizer}/token/package.json +0 -0
- /package/node_modules/{async-mutex → baileys/node_modules/async-mutex}/LICENSE +0 -0
- /package/node_modules/{async-mutex → baileys/node_modules/async-mutex}/README.md +0 -0
- /package/node_modules/{async-mutex → baileys/node_modules/async-mutex}/es6/Mutex.js +0 -0
- /package/node_modules/{async-mutex → baileys/node_modules/async-mutex}/es6/MutexInterface.js +0 -0
- /package/node_modules/{async-mutex → baileys/node_modules/async-mutex}/es6/Semaphore.js +0 -0
- /package/node_modules/{async-mutex → baileys/node_modules/async-mutex}/es6/SemaphoreInterface.js +0 -0
- /package/node_modules/{async-mutex → baileys/node_modules/async-mutex}/es6/errors.js +0 -0
- /package/node_modules/{async-mutex → baileys/node_modules/async-mutex}/es6/index.js +0 -0
- /package/node_modules/{async-mutex → baileys/node_modules/async-mutex}/es6/tryAcquire.js +0 -0
- /package/node_modules/{async-mutex → baileys/node_modules/async-mutex}/es6/withTimeout.js +0 -0
- /package/node_modules/{async-mutex → baileys/node_modules/async-mutex}/index.mjs +0 -0
- /package/node_modules/{async-mutex → baileys/node_modules/async-mutex}/lib/Mutex.d.ts +0 -0
- /package/node_modules/{async-mutex → baileys/node_modules/async-mutex}/lib/Mutex.js +0 -0
- /package/node_modules/{async-mutex → baileys/node_modules/async-mutex}/lib/MutexInterface.d.ts +0 -0
- /package/node_modules/{async-mutex → baileys/node_modules/async-mutex}/lib/MutexInterface.js +0 -0
- /package/node_modules/{async-mutex → baileys/node_modules/async-mutex}/lib/Semaphore.d.ts +0 -0
- /package/node_modules/{async-mutex → baileys/node_modules/async-mutex}/lib/Semaphore.js +0 -0
- /package/node_modules/{async-mutex → baileys/node_modules/async-mutex}/lib/SemaphoreInterface.d.ts +0 -0
- /package/node_modules/{async-mutex → baileys/node_modules/async-mutex}/lib/SemaphoreInterface.js +0 -0
- /package/node_modules/{async-mutex → baileys/node_modules/async-mutex}/lib/errors.d.ts +0 -0
- /package/node_modules/{async-mutex → baileys/node_modules/async-mutex}/lib/errors.js +0 -0
- /package/node_modules/{async-mutex → baileys/node_modules/async-mutex}/lib/index.d.ts +0 -0
- /package/node_modules/{async-mutex → baileys/node_modules/async-mutex}/lib/index.js +0 -0
- /package/node_modules/{async-mutex → baileys/node_modules/async-mutex}/lib/tryAcquire.d.ts +0 -0
- /package/node_modules/{async-mutex → baileys/node_modules/async-mutex}/lib/tryAcquire.js +0 -0
- /package/node_modules/{async-mutex → baileys/node_modules/async-mutex}/lib/withTimeout.d.ts +0 -0
- /package/node_modules/{async-mutex → baileys/node_modules/async-mutex}/lib/withTimeout.js +0 -0
- /package/node_modules/{async-mutex → baileys/node_modules/async-mutex}/package.json +0 -0
- /package/node_modules/{atomic-sleep → baileys/node_modules/atomic-sleep}/.travis.yml +0 -0
- /package/node_modules/{atomic-sleep → baileys/node_modules/atomic-sleep}/LICENSE +0 -0
- /package/node_modules/{atomic-sleep → baileys/node_modules/atomic-sleep}/index.js +0 -0
- /package/node_modules/{atomic-sleep → baileys/node_modules/atomic-sleep}/package.json +0 -0
- /package/node_modules/{atomic-sleep → baileys/node_modules/atomic-sleep}/readme.md +0 -0
- /package/node_modules/{atomic-sleep → baileys/node_modules/atomic-sleep}/test.js +0 -0
- /package/node_modules/{cacheable → baileys/node_modules/cacheable}/LICENSE +0 -0
- /package/node_modules/{cacheable → baileys/node_modules/cacheable}/README.md +0 -0
- /package/node_modules/{cacheable → baileys/node_modules/cacheable}/dist/index.cjs +0 -0
- /package/node_modules/{cacheable → baileys/node_modules/cacheable}/dist/index.d.cts +0 -0
- /package/node_modules/{cacheable → baileys/node_modules/cacheable}/dist/index.d.mts +0 -0
- /package/node_modules/{cacheable → baileys/node_modules/cacheable}/dist/index.mjs +0 -0
- /package/node_modules/{cacheable → baileys/node_modules/cacheable}/package.json +0 -0
- /package/node_modules/{content-type → baileys/node_modules/content-type}/LICENSE +0 -0
- /package/node_modules/{content-type → baileys/node_modules/content-type}/README.md +0 -0
- /package/node_modules/{content-type → baileys/node_modules/content-type}/dist/index.d.ts +0 -0
- /package/node_modules/{content-type → baileys/node_modules/content-type}/dist/index.js +0 -0
- /package/node_modules/{content-type → baileys/node_modules/content-type}/dist/index.js.map +0 -0
- /package/node_modules/{content-type → baileys/node_modules/content-type}/package.json +0 -0
- /package/node_modules/{curve25519-js → baileys/node_modules/curve25519-js}/.prettierrc +0 -0
- /package/node_modules/{curve25519-js → baileys/node_modules/curve25519-js}/LICENSE +0 -0
- /package/node_modules/{curve25519-js → baileys/node_modules/curve25519-js}/README.md +0 -0
- /package/node_modules/{curve25519-js → baileys/node_modules/curve25519-js}/lib/index.d.ts +0 -0
- /package/node_modules/{curve25519-js → baileys/node_modules/curve25519-js}/lib/index.js +0 -0
- /package/node_modules/{curve25519-js → baileys/node_modules/curve25519-js}/package.json +0 -0
- /package/node_modules/{curve25519-js → baileys/node_modules/curve25519-js}/tsconfig.json +0 -0
- /package/node_modules/{curve25519-js → baileys/node_modules/curve25519-js}/tslint.json +0 -0
- /package/node_modules/{debug → baileys/node_modules/debug}/LICENSE +0 -0
- /package/node_modules/{debug → baileys/node_modules/debug}/README.md +0 -0
- /package/node_modules/{debug → baileys/node_modules/debug}/package.json +0 -0
- /package/node_modules/{debug → baileys/node_modules/debug}/src/browser.js +0 -0
- /package/node_modules/{debug → baileys/node_modules/debug}/src/common.js +0 -0
- /package/node_modules/{debug → baileys/node_modules/debug}/src/index.js +0 -0
- /package/node_modules/{debug → baileys/node_modules/debug}/src/node.js +0 -0
- /package/node_modules/{eventemitter3 → baileys/node_modules/eventemitter3}/LICENSE +0 -0
- /package/node_modules/{eventemitter3 → baileys/node_modules/eventemitter3}/README.md +0 -0
- /package/node_modules/{eventemitter3 → baileys/node_modules/eventemitter3}/dist/eventemitter3.esm.js +0 -0
- /package/node_modules/{eventemitter3 → baileys/node_modules/eventemitter3}/dist/eventemitter3.esm.min.js +0 -0
- /package/node_modules/{eventemitter3 → baileys/node_modules/eventemitter3}/dist/eventemitter3.esm.min.js.map +0 -0
- /package/node_modules/{eventemitter3 → baileys/node_modules/eventemitter3}/dist/eventemitter3.umd.js +0 -0
- /package/node_modules/{eventemitter3 → baileys/node_modules/eventemitter3}/dist/eventemitter3.umd.min.js +0 -0
- /package/node_modules/{eventemitter3 → baileys/node_modules/eventemitter3}/dist/eventemitter3.umd.min.js.map +0 -0
- /package/node_modules/{eventemitter3 → baileys/node_modules/eventemitter3}/index.d.ts +0 -0
- /package/node_modules/{eventemitter3 → baileys/node_modules/eventemitter3}/index.js +0 -0
- /package/node_modules/{eventemitter3 → baileys/node_modules/eventemitter3}/index.mjs +0 -0
- /package/node_modules/{eventemitter3 → baileys/node_modules/eventemitter3}/package.json +0 -0
- /package/node_modules/{file-type → baileys/node_modules/file-type}/license +0 -0
- /package/node_modules/{file-type → baileys/node_modules/file-type}/package.json +0 -0
- /package/node_modules/{file-type → baileys/node_modules/file-type}/readme.md +0 -0
- /package/node_modules/{file-type → baileys/node_modules/file-type}/source/detectors/asf.js +0 -0
- /package/node_modules/{file-type → baileys/node_modules/file-type}/source/detectors/ebml.js +0 -0
- /package/node_modules/{file-type → baileys/node_modules/file-type}/source/detectors/png.js +0 -0
- /package/node_modules/{file-type → baileys/node_modules/file-type}/source/detectors/zip.js +0 -0
- /package/node_modules/{file-type → baileys/node_modules/file-type}/source/index.d.ts +0 -0
- /package/node_modules/{file-type → baileys/node_modules/file-type}/source/index.js +0 -0
- /package/node_modules/{file-type → baileys/node_modules/file-type}/source/index.test-d.ts +0 -0
- /package/node_modules/{file-type → baileys/node_modules/file-type}/source/parser.js +0 -0
- /package/node_modules/{file-type → baileys/node_modules/file-type}/source/supported.js +0 -0
- /package/node_modules/{file-type → baileys/node_modules/file-type}/source/tokens.js +0 -0
- /package/node_modules/{hashery → baileys/node_modules/hashery}/LICENSE +0 -0
- /package/node_modules/{hashery → baileys/node_modules/hashery}/README.md +0 -0
- /package/node_modules/{hashery → baileys/node_modules/hashery}/dist/browser/index.global.js +0 -0
- /package/node_modules/{hashery → baileys/node_modules/hashery}/dist/browser/index.global.js.map +0 -0
- /package/node_modules/{hashery → baileys/node_modules/hashery}/dist/browser/index.js +0 -0
- /package/node_modules/{hashery → baileys/node_modules/hashery}/dist/browser/index.js.map +0 -0
- /package/node_modules/{hashery → baileys/node_modules/hashery}/dist/node/index.cjs +0 -0
- /package/node_modules/{hashery → baileys/node_modules/hashery}/dist/node/index.d.cts +0 -0
- /package/node_modules/{hashery → baileys/node_modules/hashery}/dist/node/index.d.ts +0 -0
- /package/node_modules/{hashery → baileys/node_modules/hashery}/dist/node/index.js +0 -0
- /package/node_modules/{hashery → baileys/node_modules/hashery}/package.json +0 -0
- /package/node_modules/{hookified → baileys/node_modules/hookified}/LICENSE +0 -0
- /package/node_modules/{hookified → baileys/node_modules/hookified}/README.md +0 -0
- /package/node_modules/{hookified → baileys/node_modules/hookified}/dist/browser/index.global.js +0 -0
- /package/node_modules/{hookified → baileys/node_modules/hookified}/dist/browser/index.global.js.map +0 -0
- /package/node_modules/{hookified → baileys/node_modules/hookified}/dist/browser/index.js +0 -0
- /package/node_modules/{hookified → baileys/node_modules/hookified}/dist/browser/index.js.map +0 -0
- /package/node_modules/{hookified → baileys/node_modules/hookified}/dist/node/index.cjs +0 -0
- /package/node_modules/{hookified → baileys/node_modules/hookified}/dist/node/index.d.cts +0 -0
- /package/node_modules/{hookified → baileys/node_modules/hookified}/dist/node/index.d.ts +0 -0
- /package/node_modules/{hookified → baileys/node_modules/hookified}/dist/node/index.js +0 -0
- /package/node_modules/{hookified → baileys/node_modules/hookified}/package.json +0 -0
- /package/node_modules/{ieee754 → baileys/node_modules/ieee754}/LICENSE +0 -0
- /package/node_modules/{ieee754 → baileys/node_modules/ieee754}/README.md +0 -0
- /package/node_modules/{ieee754 → baileys/node_modules/ieee754}/index.d.ts +0 -0
- /package/node_modules/{ieee754 → baileys/node_modules/ieee754}/index.js +0 -0
- /package/node_modules/{ieee754 → baileys/node_modules/ieee754}/package.json +0 -0
- /package/node_modules/{keyv → baileys/node_modules/keyv}/LICENSE +0 -0
- /package/node_modules/{keyv → baileys/node_modules/keyv}/README.md +0 -0
- /package/node_modules/{keyv → baileys/node_modules/keyv}/dist/index.cjs +0 -0
- /package/node_modules/{keyv → baileys/node_modules/keyv}/dist/index.d.cts +0 -0
- /package/node_modules/{keyv → baileys/node_modules/keyv}/dist/index.d.ts +0 -0
- /package/node_modules/{keyv → baileys/node_modules/keyv}/dist/index.js +0 -0
- /package/node_modules/{keyv → baileys/node_modules/keyv}/package.json +0 -0
- /package/node_modules/{libsignal → baileys/node_modules/libsignal}/LICENSE +0 -0
- /package/node_modules/{libsignal → baileys/node_modules/libsignal}/README.md +0 -0
- /package/node_modules/{libsignal → baileys/node_modules/libsignal}/index.d.ts +0 -0
- /package/node_modules/{libsignal → baileys/node_modules/libsignal}/index.js +0 -0
- /package/node_modules/{libsignal → baileys/node_modules/libsignal}/package.json +0 -0
- /package/node_modules/{libsignal → baileys/node_modules/libsignal}/src/.eslintrc.json +0 -0
- /package/node_modules/{libsignal → baileys/node_modules/libsignal}/src/WhisperTextProtocol.js +0 -0
- /package/node_modules/{libsignal → baileys/node_modules/libsignal}/src/base_key_type.js +0 -0
- /package/node_modules/{libsignal → baileys/node_modules/libsignal}/src/chain_type.js +0 -0
- /package/node_modules/{libsignal → baileys/node_modules/libsignal}/src/crypto.d.ts +0 -0
- /package/node_modules/{libsignal → baileys/node_modules/libsignal}/src/crypto.js +0 -0
- /package/node_modules/{libsignal → baileys/node_modules/libsignal}/src/curve.d.ts +0 -0
- /package/node_modules/{libsignal → baileys/node_modules/libsignal}/src/curve.js +0 -0
- /package/node_modules/{libsignal → baileys/node_modules/libsignal}/src/errors.js +0 -0
- /package/node_modules/{libsignal → baileys/node_modules/libsignal}/src/keyhelper.js +0 -0
- /package/node_modules/{libsignal → baileys/node_modules/libsignal}/src/numeric_fingerprint.js +0 -0
- /package/node_modules/{libsignal → baileys/node_modules/libsignal}/src/protobufs.js +0 -0
- /package/node_modules/{libsignal → baileys/node_modules/libsignal}/src/protocol_address.js +0 -0
- /package/node_modules/{libsignal → baileys/node_modules/libsignal}/src/queue_job.js +0 -0
- /package/node_modules/{libsignal → baileys/node_modules/libsignal}/src/session_builder.js +0 -0
- /package/node_modules/{libsignal → baileys/node_modules/libsignal}/src/session_cipher.js +0 -0
- /package/node_modules/{libsignal → baileys/node_modules/libsignal}/src/session_record.js +0 -0
- /package/node_modules/{long → baileys/node_modules/long}/LICENSE +0 -0
- /package/node_modules/{long → baileys/node_modules/long}/README.md +0 -0
- /package/node_modules/{long → baileys/node_modules/long}/index.d.ts +0 -0
- /package/node_modules/{long → baileys/node_modules/long}/index.js +0 -0
- /package/node_modules/{long → baileys/node_modules/long}/package.json +0 -0
- /package/node_modules/{long → baileys/node_modules/long}/types.d.ts +0 -0
- /package/node_modules/{long → baileys/node_modules/long}/umd/index.d.ts +0 -0
- /package/node_modules/{long → baileys/node_modules/long}/umd/index.js +0 -0
- /package/node_modules/{long → baileys/node_modules/long}/umd/package.json +0 -0
- /package/node_modules/{long → baileys/node_modules/long}/umd/types.d.ts +0 -0
- /package/node_modules/{lru-cache → baileys/node_modules/lru-cache}/LICENSE.md +0 -0
- /package/node_modules/{lru-cache → baileys/node_modules/lru-cache}/README.md +0 -0
- /package/node_modules/{lru-cache → baileys/node_modules/lru-cache}/dist/commonjs/browser/diagnostics-channel-browser.d.ts.map +0 -0
- /package/node_modules/{lru-cache → baileys/node_modules/lru-cache}/dist/commonjs/browser/diagnostics-channel-browser.js.map +0 -0
- /package/node_modules/{lru-cache → baileys/node_modules/lru-cache}/dist/commonjs/browser/diagnostics-channel.d.ts +0 -0
- /package/node_modules/{lru-cache → baileys/node_modules/lru-cache}/dist/commonjs/browser/diagnostics-channel.js +0 -0
- /package/node_modules/{lru-cache → baileys/node_modules/lru-cache}/dist/commonjs/browser/index.d.ts +0 -0
- /package/node_modules/{lru-cache → baileys/node_modules/lru-cache}/dist/commonjs/browser/index.d.ts.map +0 -0
- /package/node_modules/{lru-cache → baileys/node_modules/lru-cache}/dist/commonjs/browser/index.js +0 -0
- /package/node_modules/{lru-cache → baileys/node_modules/lru-cache}/dist/commonjs/browser/index.js.map +0 -0
- /package/node_modules/{lru-cache → baileys/node_modules/lru-cache}/dist/commonjs/browser/index.min.js +0 -0
- /package/node_modules/{lru-cache → baileys/node_modules/lru-cache}/dist/commonjs/browser/index.min.js.map +0 -0
- /package/node_modules/{lru-cache → baileys/node_modules/lru-cache}/dist/commonjs/browser/perf.d.ts +0 -0
- /package/node_modules/{lru-cache → baileys/node_modules/lru-cache}/dist/commonjs/browser/perf.d.ts.map +0 -0
- /package/node_modules/{lru-cache → baileys/node_modules/lru-cache}/dist/commonjs/browser/perf.js +0 -0
- /package/node_modules/{lru-cache → baileys/node_modules/lru-cache}/dist/commonjs/browser/perf.js.map +0 -0
- /package/node_modules/{lru-cache → baileys/node_modules/lru-cache}/dist/commonjs/diagnostics-channel-cjs.cjs.map +0 -0
- /package/node_modules/{lru-cache → baileys/node_modules/lru-cache}/dist/commonjs/diagnostics-channel-cjs.d.cts.map +0 -0
- /package/node_modules/{lru-cache → baileys/node_modules/lru-cache}/dist/commonjs/diagnostics-channel.d.ts +0 -0
- /package/node_modules/{lru-cache → baileys/node_modules/lru-cache}/dist/commonjs/diagnostics-channel.js +0 -0
- /package/node_modules/{lru-cache → baileys/node_modules/lru-cache}/dist/commonjs/index.d.ts +0 -0
- /package/node_modules/{lru-cache → baileys/node_modules/lru-cache}/dist/commonjs/index.d.ts.map +0 -0
- /package/node_modules/{lru-cache → baileys/node_modules/lru-cache}/dist/commonjs/index.js +0 -0
- /package/node_modules/{lru-cache → baileys/node_modules/lru-cache}/dist/commonjs/index.js.map +0 -0
- /package/node_modules/{lru-cache → baileys/node_modules/lru-cache}/dist/commonjs/index.min.js +0 -0
- /package/node_modules/{lru-cache → baileys/node_modules/lru-cache}/dist/commonjs/index.min.js.map +0 -0
- /package/node_modules/{lru-cache → baileys/node_modules/lru-cache}/dist/commonjs/node/diagnostics-channel-node.d.ts.map +0 -0
- /package/node_modules/{lru-cache → baileys/node_modules/lru-cache}/dist/commonjs/node/diagnostics-channel-node.js.map +0 -0
- /package/node_modules/{lru-cache → baileys/node_modules/lru-cache}/dist/commonjs/node/diagnostics-channel.d.ts +0 -0
- /package/node_modules/{lru-cache → baileys/node_modules/lru-cache}/dist/commonjs/node/diagnostics-channel.js +0 -0
- /package/node_modules/{lru-cache → baileys/node_modules/lru-cache}/dist/commonjs/node/index.d.ts +0 -0
- /package/node_modules/{lru-cache → baileys/node_modules/lru-cache}/dist/commonjs/node/index.d.ts.map +0 -0
- /package/node_modules/{lru-cache → baileys/node_modules/lru-cache}/dist/commonjs/node/index.js +0 -0
- /package/node_modules/{lru-cache → baileys/node_modules/lru-cache}/dist/commonjs/node/index.js.map +0 -0
- /package/node_modules/{lru-cache → baileys/node_modules/lru-cache}/dist/commonjs/node/index.min.js +0 -0
- /package/node_modules/{lru-cache → baileys/node_modules/lru-cache}/dist/commonjs/node/index.min.js.map +0 -0
- /package/node_modules/{lru-cache → baileys/node_modules/lru-cache}/dist/commonjs/node/perf.d.ts +0 -0
- /package/node_modules/{lru-cache → baileys/node_modules/lru-cache}/dist/commonjs/node/perf.d.ts.map +0 -0
- /package/node_modules/{lru-cache → baileys/node_modules/lru-cache}/dist/commonjs/node/perf.js +0 -0
- /package/node_modules/{lru-cache → baileys/node_modules/lru-cache}/dist/commonjs/node/perf.js.map +0 -0
- /package/node_modules/{lru-cache → baileys/node_modules/lru-cache}/dist/commonjs/package.json +0 -0
- /package/node_modules/{lru-cache → baileys/node_modules/lru-cache}/dist/commonjs/perf.d.ts +0 -0
- /package/node_modules/{lru-cache → baileys/node_modules/lru-cache}/dist/commonjs/perf.d.ts.map +0 -0
- /package/node_modules/{lru-cache → baileys/node_modules/lru-cache}/dist/commonjs/perf.js +0 -0
- /package/node_modules/{lru-cache → baileys/node_modules/lru-cache}/dist/commonjs/perf.js.map +0 -0
- /package/node_modules/{lru-cache → baileys/node_modules/lru-cache}/dist/esm/browser/diagnostics-channel-browser.d.ts.map +0 -0
- /package/node_modules/{lru-cache → baileys/node_modules/lru-cache}/dist/esm/browser/diagnostics-channel-browser.js.map +0 -0
- /package/node_modules/{lru-cache → baileys/node_modules/lru-cache}/dist/esm/browser/diagnostics-channel.d.ts +0 -0
- /package/node_modules/{lru-cache → baileys/node_modules/lru-cache}/dist/esm/browser/diagnostics-channel.js +0 -0
- /package/node_modules/{lru-cache → baileys/node_modules/lru-cache}/dist/esm/browser/index.d.ts +0 -0
- /package/node_modules/{lru-cache → baileys/node_modules/lru-cache}/dist/esm/browser/index.d.ts.map +0 -0
- /package/node_modules/{lru-cache → baileys/node_modules/lru-cache}/dist/esm/browser/index.js +0 -0
- /package/node_modules/{lru-cache → baileys/node_modules/lru-cache}/dist/esm/browser/index.js.map +0 -0
- /package/node_modules/{lru-cache → baileys/node_modules/lru-cache}/dist/esm/browser/index.min.js +0 -0
- /package/node_modules/{lru-cache → baileys/node_modules/lru-cache}/dist/esm/browser/index.min.js.map +0 -0
- /package/node_modules/{lru-cache → baileys/node_modules/lru-cache}/dist/esm/browser/perf.d.ts +0 -0
- /package/node_modules/{lru-cache → baileys/node_modules/lru-cache}/dist/esm/browser/perf.d.ts.map +0 -0
- /package/node_modules/{lru-cache → baileys/node_modules/lru-cache}/dist/esm/browser/perf.js +0 -0
- /package/node_modules/{lru-cache → baileys/node_modules/lru-cache}/dist/esm/browser/perf.js.map +0 -0
- /package/node_modules/{lru-cache → baileys/node_modules/lru-cache}/dist/esm/diagnostics-channel-esm.d.mts.map +0 -0
- /package/node_modules/{lru-cache → baileys/node_modules/lru-cache}/dist/esm/diagnostics-channel-esm.mjs.map +0 -0
- /package/node_modules/{lru-cache → baileys/node_modules/lru-cache}/dist/esm/diagnostics-channel.d.ts +0 -0
- /package/node_modules/{lru-cache → baileys/node_modules/lru-cache}/dist/esm/diagnostics-channel.js +0 -0
- /package/node_modules/{lru-cache → baileys/node_modules/lru-cache}/dist/esm/index.d.ts +0 -0
- /package/node_modules/{lru-cache → baileys/node_modules/lru-cache}/dist/esm/index.d.ts.map +0 -0
- /package/node_modules/{lru-cache → baileys/node_modules/lru-cache}/dist/esm/index.js +0 -0
- /package/node_modules/{lru-cache → baileys/node_modules/lru-cache}/dist/esm/index.js.map +0 -0
- /package/node_modules/{lru-cache → baileys/node_modules/lru-cache}/dist/esm/index.min.js +0 -0
- /package/node_modules/{lru-cache → baileys/node_modules/lru-cache}/dist/esm/index.min.js.map +0 -0
- /package/node_modules/{lru-cache → baileys/node_modules/lru-cache}/dist/esm/node/diagnostics-channel-node.d.ts.map +0 -0
- /package/node_modules/{lru-cache → baileys/node_modules/lru-cache}/dist/esm/node/diagnostics-channel-node.js.map +0 -0
- /package/node_modules/{lru-cache → baileys/node_modules/lru-cache}/dist/esm/node/diagnostics-channel.d.ts +0 -0
- /package/node_modules/{lru-cache → baileys/node_modules/lru-cache}/dist/esm/node/diagnostics-channel.js +0 -0
- /package/node_modules/{lru-cache → baileys/node_modules/lru-cache}/dist/esm/node/index.d.ts +0 -0
- /package/node_modules/{lru-cache → baileys/node_modules/lru-cache}/dist/esm/node/index.d.ts.map +0 -0
- /package/node_modules/{lru-cache → baileys/node_modules/lru-cache}/dist/esm/node/index.js +0 -0
- /package/node_modules/{lru-cache → baileys/node_modules/lru-cache}/dist/esm/node/index.js.map +0 -0
- /package/node_modules/{lru-cache → baileys/node_modules/lru-cache}/dist/esm/node/index.min.js +0 -0
- /package/node_modules/{lru-cache → baileys/node_modules/lru-cache}/dist/esm/node/index.min.js.map +0 -0
- /package/node_modules/{lru-cache → baileys/node_modules/lru-cache}/dist/esm/node/perf.d.ts +0 -0
- /package/node_modules/{lru-cache → baileys/node_modules/lru-cache}/dist/esm/node/perf.d.ts.map +0 -0
- /package/node_modules/{lru-cache → baileys/node_modules/lru-cache}/dist/esm/node/perf.js +0 -0
- /package/node_modules/{lru-cache → baileys/node_modules/lru-cache}/dist/esm/node/perf.js.map +0 -0
- /package/node_modules/{lru-cache → baileys/node_modules/lru-cache}/dist/esm/package.json +0 -0
- /package/node_modules/{lru-cache → baileys/node_modules/lru-cache}/dist/esm/perf.d.ts +0 -0
- /package/node_modules/{lru-cache → baileys/node_modules/lru-cache}/dist/esm/perf.d.ts.map +0 -0
- /package/node_modules/{lru-cache → baileys/node_modules/lru-cache}/dist/esm/perf.js +0 -0
- /package/node_modules/{lru-cache → baileys/node_modules/lru-cache}/dist/esm/perf.js.map +0 -0
- /package/node_modules/{lru-cache → baileys/node_modules/lru-cache}/package.json +0 -0
- /package/node_modules/{media-typer → baileys/node_modules/media-typer}/LICENSE +0 -0
- /package/node_modules/{media-typer → baileys/node_modules/media-typer}/README.md +0 -0
- /package/node_modules/{media-typer → baileys/node_modules/media-typer}/dist/index.d.ts +0 -0
- /package/node_modules/{media-typer → baileys/node_modules/media-typer}/dist/index.js +0 -0
- /package/node_modules/{media-typer → baileys/node_modules/media-typer}/dist/index.js.map +0 -0
- /package/node_modules/{media-typer → baileys/node_modules/media-typer}/package.json +0 -0
- /package/node_modules/{ms → baileys/node_modules/ms}/index.js +0 -0
- /package/node_modules/{ms → baileys/node_modules/ms}/license.md +0 -0
- /package/node_modules/{ms → baileys/node_modules/ms}/package.json +0 -0
- /package/node_modules/{ms → baileys/node_modules/ms}/readme.md +0 -0
- /package/node_modules/{music-metadata → baileys/node_modules/music-metadata}/LICENSE.txt +0 -0
- /package/node_modules/{music-metadata → baileys/node_modules/music-metadata}/README.md +0 -0
- /package/node_modules/{music-metadata → baileys/node_modules/music-metadata}/lib/ParseError.d.ts +0 -0
- /package/node_modules/{music-metadata → baileys/node_modules/music-metadata}/lib/ParseError.js +0 -0
- /package/node_modules/{music-metadata → baileys/node_modules/music-metadata}/lib/ParserFactory.d.ts +0 -0
- /package/node_modules/{music-metadata → baileys/node_modules/music-metadata}/lib/ParserFactory.js +0 -0
- /package/node_modules/{music-metadata → baileys/node_modules/music-metadata}/lib/aiff/AiffLoader.d.ts +0 -0
- /package/node_modules/{music-metadata → baileys/node_modules/music-metadata}/lib/aiff/AiffLoader.js +0 -0
- /package/node_modules/{music-metadata → baileys/node_modules/music-metadata}/lib/aiff/AiffParser.d.ts +0 -0
- /package/node_modules/{music-metadata → baileys/node_modules/music-metadata}/lib/aiff/AiffParser.js +0 -0
- /package/node_modules/{music-metadata → baileys/node_modules/music-metadata}/lib/aiff/AiffTagMap.d.ts +0 -0
- /package/node_modules/{music-metadata → baileys/node_modules/music-metadata}/lib/aiff/AiffTagMap.js +0 -0
- /package/node_modules/{music-metadata → baileys/node_modules/music-metadata}/lib/aiff/AiffToken.d.ts +0 -0
- /package/node_modules/{music-metadata → baileys/node_modules/music-metadata}/lib/aiff/AiffToken.js +0 -0
- /package/node_modules/{music-metadata → baileys/node_modules/music-metadata}/lib/apev2/APEv2Parser.d.ts +0 -0
- /package/node_modules/{music-metadata → baileys/node_modules/music-metadata}/lib/apev2/APEv2Parser.js +0 -0
- /package/node_modules/{music-metadata → baileys/node_modules/music-metadata}/lib/apev2/APEv2TagMapper.d.ts +0 -0
- /package/node_modules/{music-metadata → baileys/node_modules/music-metadata}/lib/apev2/APEv2TagMapper.js +0 -0
- /package/node_modules/{music-metadata → baileys/node_modules/music-metadata}/lib/apev2/APEv2Token.d.ts +0 -0
- /package/node_modules/{music-metadata → baileys/node_modules/music-metadata}/lib/apev2/APEv2Token.js +0 -0
- /package/node_modules/{music-metadata → baileys/node_modules/music-metadata}/lib/apev2/Apev2Loader.d.ts +0 -0
- /package/node_modules/{music-metadata → baileys/node_modules/music-metadata}/lib/apev2/Apev2Loader.js +0 -0
- /package/node_modules/{music-metadata → baileys/node_modules/music-metadata}/lib/asf/AsfGuid.d.ts +0 -0
- /package/node_modules/{music-metadata → baileys/node_modules/music-metadata}/lib/asf/AsfGuid.js +0 -0
- /package/node_modules/{music-metadata → baileys/node_modules/music-metadata}/lib/asf/AsfLoader.d.ts +0 -0
- /package/node_modules/{music-metadata → baileys/node_modules/music-metadata}/lib/asf/AsfLoader.js +0 -0
- /package/node_modules/{music-metadata → baileys/node_modules/music-metadata}/lib/asf/AsfObject.d.ts +0 -0
- /package/node_modules/{music-metadata → baileys/node_modules/music-metadata}/lib/asf/AsfObject.js +0 -0
- /package/node_modules/{music-metadata → baileys/node_modules/music-metadata}/lib/asf/AsfParser.d.ts +0 -0
- /package/node_modules/{music-metadata → baileys/node_modules/music-metadata}/lib/asf/AsfParser.js +0 -0
- /package/node_modules/{music-metadata → baileys/node_modules/music-metadata}/lib/asf/AsfTagMapper.d.ts +0 -0
- /package/node_modules/{music-metadata → baileys/node_modules/music-metadata}/lib/asf/AsfTagMapper.js +0 -0
- /package/node_modules/{music-metadata → baileys/node_modules/music-metadata}/lib/asf/AsfUtil.d.ts +0 -0
- /package/node_modules/{music-metadata → baileys/node_modules/music-metadata}/lib/asf/AsfUtil.js +0 -0
- /package/node_modules/{music-metadata → baileys/node_modules/music-metadata}/lib/common/BasicParser.d.ts +0 -0
- /package/node_modules/{music-metadata → baileys/node_modules/music-metadata}/lib/common/BasicParser.js +0 -0
- /package/node_modules/{music-metadata → baileys/node_modules/music-metadata}/lib/common/CaseInsensitiveTagMap.d.ts +0 -0
- /package/node_modules/{music-metadata → baileys/node_modules/music-metadata}/lib/common/CaseInsensitiveTagMap.js +0 -0
- /package/node_modules/{music-metadata → baileys/node_modules/music-metadata}/lib/common/CombinedTagMapper.d.ts +0 -0
- /package/node_modules/{music-metadata → baileys/node_modules/music-metadata}/lib/common/CombinedTagMapper.js +0 -0
- /package/node_modules/{music-metadata → baileys/node_modules/music-metadata}/lib/common/FourCC.d.ts +0 -0
- /package/node_modules/{music-metadata → baileys/node_modules/music-metadata}/lib/common/FourCC.js +0 -0
- /package/node_modules/{music-metadata → baileys/node_modules/music-metadata}/lib/common/GenericTagMapper.d.ts +0 -0
- /package/node_modules/{music-metadata → baileys/node_modules/music-metadata}/lib/common/GenericTagMapper.js +0 -0
- /package/node_modules/{music-metadata → baileys/node_modules/music-metadata}/lib/common/GenericTagTypes.d.ts +0 -0
- /package/node_modules/{music-metadata → baileys/node_modules/music-metadata}/lib/common/GenericTagTypes.js +0 -0
- /package/node_modules/{music-metadata → baileys/node_modules/music-metadata}/lib/common/MetadataCollector.d.ts +0 -0
- /package/node_modules/{music-metadata → baileys/node_modules/music-metadata}/lib/common/MetadataCollector.js +0 -0
- /package/node_modules/{music-metadata → baileys/node_modules/music-metadata}/lib/common/Util.d.ts +0 -0
- /package/node_modules/{music-metadata → baileys/node_modules/music-metadata}/lib/common/Util.js +0 -0
- /package/node_modules/{music-metadata → baileys/node_modules/music-metadata}/lib/core.d.ts +0 -0
- /package/node_modules/{music-metadata → baileys/node_modules/music-metadata}/lib/core.js +0 -0
- /package/node_modules/{music-metadata → baileys/node_modules/music-metadata}/lib/dsdiff/DsdiffLoader.d.ts +0 -0
- /package/node_modules/{music-metadata → baileys/node_modules/music-metadata}/lib/dsdiff/DsdiffLoader.js +0 -0
- /package/node_modules/{music-metadata → baileys/node_modules/music-metadata}/lib/dsdiff/DsdiffParser.d.ts +0 -0
- /package/node_modules/{music-metadata → baileys/node_modules/music-metadata}/lib/dsdiff/DsdiffParser.js +0 -0
- /package/node_modules/{music-metadata → baileys/node_modules/music-metadata}/lib/dsdiff/DsdiffToken.d.ts +0 -0
- /package/node_modules/{music-metadata → baileys/node_modules/music-metadata}/lib/dsdiff/DsdiffToken.js +0 -0
- /package/node_modules/{music-metadata → baileys/node_modules/music-metadata}/lib/dsf/DsfChunk.d.ts +0 -0
- /package/node_modules/{music-metadata → baileys/node_modules/music-metadata}/lib/dsf/DsfChunk.js +0 -0
- /package/node_modules/{music-metadata → baileys/node_modules/music-metadata}/lib/dsf/DsfLoader.d.ts +0 -0
- /package/node_modules/{music-metadata → baileys/node_modules/music-metadata}/lib/dsf/DsfLoader.js +0 -0
- /package/node_modules/{music-metadata → baileys/node_modules/music-metadata}/lib/dsf/DsfParser.d.ts +0 -0
- /package/node_modules/{music-metadata → baileys/node_modules/music-metadata}/lib/dsf/DsfParser.js +0 -0
- /package/node_modules/{music-metadata → baileys/node_modules/music-metadata}/lib/ebml/EbmlIterator.d.ts +0 -0
- /package/node_modules/{music-metadata → baileys/node_modules/music-metadata}/lib/ebml/EbmlIterator.js +0 -0
- /package/node_modules/{music-metadata → baileys/node_modules/music-metadata}/lib/ebml/types.d.ts +0 -0
- /package/node_modules/{music-metadata → baileys/node_modules/music-metadata}/lib/ebml/types.js +0 -0
- /package/node_modules/{music-metadata → baileys/node_modules/music-metadata}/lib/flac/FlacLoader.d.ts +0 -0
- /package/node_modules/{music-metadata → baileys/node_modules/music-metadata}/lib/flac/FlacLoader.js +0 -0
- /package/node_modules/{music-metadata → baileys/node_modules/music-metadata}/lib/flac/FlacParser.d.ts +0 -0
- /package/node_modules/{music-metadata → baileys/node_modules/music-metadata}/lib/flac/FlacParser.js +0 -0
- /package/node_modules/{music-metadata → baileys/node_modules/music-metadata}/lib/flac/FlacToken.d.ts +0 -0
- /package/node_modules/{music-metadata → baileys/node_modules/music-metadata}/lib/flac/FlacToken.js +0 -0
- /package/node_modules/{music-metadata → baileys/node_modules/music-metadata}/lib/id3v1/ID3v1Parser.d.ts +0 -0
- /package/node_modules/{music-metadata → baileys/node_modules/music-metadata}/lib/id3v1/ID3v1Parser.js +0 -0
- /package/node_modules/{music-metadata → baileys/node_modules/music-metadata}/lib/id3v1/ID3v1TagMap.d.ts +0 -0
- /package/node_modules/{music-metadata → baileys/node_modules/music-metadata}/lib/id3v1/ID3v1TagMap.js +0 -0
- /package/node_modules/{music-metadata → baileys/node_modules/music-metadata}/lib/id3v2/AbstractID3Parser.d.ts +0 -0
- /package/node_modules/{music-metadata → baileys/node_modules/music-metadata}/lib/id3v2/AbstractID3Parser.js +0 -0
- /package/node_modules/{music-metadata → baileys/node_modules/music-metadata}/lib/id3v2/FrameHeader.d.ts +0 -0
- /package/node_modules/{music-metadata → baileys/node_modules/music-metadata}/lib/id3v2/FrameHeader.js +0 -0
- /package/node_modules/{music-metadata → baileys/node_modules/music-metadata}/lib/id3v2/FrameParser.d.ts +0 -0
- /package/node_modules/{music-metadata → baileys/node_modules/music-metadata}/lib/id3v2/FrameParser.js +0 -0
- /package/node_modules/{music-metadata → baileys/node_modules/music-metadata}/lib/id3v2/ID3v22TagMapper.d.ts +0 -0
- /package/node_modules/{music-metadata → baileys/node_modules/music-metadata}/lib/id3v2/ID3v22TagMapper.js +0 -0
- /package/node_modules/{music-metadata → baileys/node_modules/music-metadata}/lib/id3v2/ID3v24TagMapper.d.ts +0 -0
- /package/node_modules/{music-metadata → baileys/node_modules/music-metadata}/lib/id3v2/ID3v24TagMapper.js +0 -0
- /package/node_modules/{music-metadata → baileys/node_modules/music-metadata}/lib/id3v2/ID3v2ChapterToken.d.ts +0 -0
- /package/node_modules/{music-metadata → baileys/node_modules/music-metadata}/lib/id3v2/ID3v2ChapterToken.js +0 -0
- /package/node_modules/{music-metadata → baileys/node_modules/music-metadata}/lib/id3v2/ID3v2Parser.d.ts +0 -0
- /package/node_modules/{music-metadata → baileys/node_modules/music-metadata}/lib/id3v2/ID3v2Parser.js +0 -0
- /package/node_modules/{music-metadata → baileys/node_modules/music-metadata}/lib/id3v2/ID3v2Token.d.ts +0 -0
- /package/node_modules/{music-metadata → baileys/node_modules/music-metadata}/lib/id3v2/ID3v2Token.js +0 -0
- /package/node_modules/{music-metadata → baileys/node_modules/music-metadata}/lib/iff/index.d.ts +0 -0
- /package/node_modules/{music-metadata → baileys/node_modules/music-metadata}/lib/iff/index.js +0 -0
- /package/node_modules/{music-metadata → baileys/node_modules/music-metadata}/lib/index.d.ts +0 -0
- /package/node_modules/{music-metadata → baileys/node_modules/music-metadata}/lib/index.js +0 -0
- /package/node_modules/{music-metadata → baileys/node_modules/music-metadata}/lib/lrc/LyricsParser.d.ts +0 -0
- /package/node_modules/{music-metadata → baileys/node_modules/music-metadata}/lib/lrc/LyricsParser.js +0 -0
- /package/node_modules/{music-metadata → baileys/node_modules/music-metadata}/lib/lyrics3/Lyrics3.d.ts +0 -0
- /package/node_modules/{music-metadata → baileys/node_modules/music-metadata}/lib/lyrics3/Lyrics3.js +0 -0
- /package/node_modules/{music-metadata → baileys/node_modules/music-metadata}/lib/matroska/MatroskaDtd.d.ts +0 -0
- /package/node_modules/{music-metadata → baileys/node_modules/music-metadata}/lib/matroska/MatroskaDtd.js +0 -0
- /package/node_modules/{music-metadata → baileys/node_modules/music-metadata}/lib/matroska/MatroskaLoader.d.ts +0 -0
- /package/node_modules/{music-metadata → baileys/node_modules/music-metadata}/lib/matroska/MatroskaLoader.js +0 -0
- /package/node_modules/{music-metadata → baileys/node_modules/music-metadata}/lib/matroska/MatroskaParser.d.ts +0 -0
- /package/node_modules/{music-metadata → baileys/node_modules/music-metadata}/lib/matroska/MatroskaParser.js +0 -0
- /package/node_modules/{music-metadata → baileys/node_modules/music-metadata}/lib/matroska/MatroskaTagMapper.d.ts +0 -0
- /package/node_modules/{music-metadata → baileys/node_modules/music-metadata}/lib/matroska/MatroskaTagMapper.js +0 -0
- /package/node_modules/{music-metadata → baileys/node_modules/music-metadata}/lib/matroska/types.d.ts +0 -0
- /package/node_modules/{music-metadata → baileys/node_modules/music-metadata}/lib/matroska/types.js +0 -0
- /package/node_modules/{music-metadata → baileys/node_modules/music-metadata}/lib/mp4/Atom.d.ts +0 -0
- /package/node_modules/{music-metadata → baileys/node_modules/music-metadata}/lib/mp4/Atom.js +0 -0
- /package/node_modules/{music-metadata → baileys/node_modules/music-metadata}/lib/mp4/AtomToken.d.ts +0 -0
- /package/node_modules/{music-metadata → baileys/node_modules/music-metadata}/lib/mp4/AtomToken.js +0 -0
- /package/node_modules/{music-metadata → baileys/node_modules/music-metadata}/lib/mp4/MP4Parser.d.ts +0 -0
- /package/node_modules/{music-metadata → baileys/node_modules/music-metadata}/lib/mp4/MP4Parser.js +0 -0
- /package/node_modules/{music-metadata → baileys/node_modules/music-metadata}/lib/mp4/MP4TagMapper.d.ts +0 -0
- /package/node_modules/{music-metadata → baileys/node_modules/music-metadata}/lib/mp4/MP4TagMapper.js +0 -0
- /package/node_modules/{music-metadata → baileys/node_modules/music-metadata}/lib/mp4/Mp4Loader.d.ts +0 -0
- /package/node_modules/{music-metadata → baileys/node_modules/music-metadata}/lib/mp4/Mp4Loader.js +0 -0
- /package/node_modules/{music-metadata → baileys/node_modules/music-metadata}/lib/mpeg/ExtendedLameHeader.d.ts +0 -0
- /package/node_modules/{music-metadata → baileys/node_modules/music-metadata}/lib/mpeg/ExtendedLameHeader.js +0 -0
- /package/node_modules/{music-metadata → baileys/node_modules/music-metadata}/lib/mpeg/MpegLoader.d.ts +0 -0
- /package/node_modules/{music-metadata → baileys/node_modules/music-metadata}/lib/mpeg/MpegLoader.js +0 -0
- /package/node_modules/{music-metadata → baileys/node_modules/music-metadata}/lib/mpeg/MpegParser.d.ts +0 -0
- /package/node_modules/{music-metadata → baileys/node_modules/music-metadata}/lib/mpeg/MpegParser.js +0 -0
- /package/node_modules/{music-metadata → baileys/node_modules/music-metadata}/lib/mpeg/ReplayGainDataFormat.d.ts +0 -0
- /package/node_modules/{music-metadata → baileys/node_modules/music-metadata}/lib/mpeg/ReplayGainDataFormat.js +0 -0
- /package/node_modules/{music-metadata → baileys/node_modules/music-metadata}/lib/mpeg/XingTag.d.ts +0 -0
- /package/node_modules/{music-metadata → baileys/node_modules/music-metadata}/lib/mpeg/XingTag.js +0 -0
- /package/node_modules/{music-metadata → baileys/node_modules/music-metadata}/lib/musepack/MusepackConentError.d.ts +0 -0
- /package/node_modules/{music-metadata → baileys/node_modules/music-metadata}/lib/musepack/MusepackConentError.js +0 -0
- /package/node_modules/{music-metadata → baileys/node_modules/music-metadata}/lib/musepack/MusepackLoader.d.ts +0 -0
- /package/node_modules/{music-metadata → baileys/node_modules/music-metadata}/lib/musepack/MusepackLoader.js +0 -0
- /package/node_modules/{music-metadata → baileys/node_modules/music-metadata}/lib/musepack/MusepackParser.d.ts +0 -0
- /package/node_modules/{music-metadata → baileys/node_modules/music-metadata}/lib/musepack/MusepackParser.js +0 -0
- /package/node_modules/{music-metadata → baileys/node_modules/music-metadata}/lib/musepack/sv7/BitReader.d.ts +0 -0
- /package/node_modules/{music-metadata → baileys/node_modules/music-metadata}/lib/musepack/sv7/BitReader.js +0 -0
- /package/node_modules/{music-metadata → baileys/node_modules/music-metadata}/lib/musepack/sv7/MpcSv7Parser.d.ts +0 -0
- /package/node_modules/{music-metadata → baileys/node_modules/music-metadata}/lib/musepack/sv7/MpcSv7Parser.js +0 -0
- /package/node_modules/{music-metadata → baileys/node_modules/music-metadata}/lib/musepack/sv7/StreamVersion7.d.ts +0 -0
- /package/node_modules/{music-metadata → baileys/node_modules/music-metadata}/lib/musepack/sv7/StreamVersion7.js +0 -0
- /package/node_modules/{music-metadata → baileys/node_modules/music-metadata}/lib/musepack/sv8/MpcSv8Parser.d.ts +0 -0
- /package/node_modules/{music-metadata → baileys/node_modules/music-metadata}/lib/musepack/sv8/MpcSv8Parser.js +0 -0
- /package/node_modules/{music-metadata → baileys/node_modules/music-metadata}/lib/musepack/sv8/StreamVersion8.d.ts +0 -0
- /package/node_modules/{music-metadata → baileys/node_modules/music-metadata}/lib/musepack/sv8/StreamVersion8.js +0 -0
- /package/node_modules/{music-metadata → baileys/node_modules/music-metadata}/lib/ogg/OggLoader.d.ts +0 -0
- /package/node_modules/{music-metadata → baileys/node_modules/music-metadata}/lib/ogg/OggLoader.js +0 -0
- /package/node_modules/{music-metadata → baileys/node_modules/music-metadata}/lib/ogg/OggParser.d.ts +0 -0
- /package/node_modules/{music-metadata → baileys/node_modules/music-metadata}/lib/ogg/OggParser.js +0 -0
- /package/node_modules/{music-metadata → baileys/node_modules/music-metadata}/lib/ogg/OggToken.d.ts +0 -0
- /package/node_modules/{music-metadata → baileys/node_modules/music-metadata}/lib/ogg/OggToken.js +0 -0
- /package/node_modules/{music-metadata → baileys/node_modules/music-metadata}/lib/ogg/flac/FlacStream.d.ts +0 -0
- /package/node_modules/{music-metadata → baileys/node_modules/music-metadata}/lib/ogg/flac/FlacStream.js +0 -0
- /package/node_modules/{music-metadata → baileys/node_modules/music-metadata}/lib/ogg/opus/Opus.d.ts +0 -0
- /package/node_modules/{music-metadata → baileys/node_modules/music-metadata}/lib/ogg/opus/Opus.js +0 -0
- /package/node_modules/{music-metadata → baileys/node_modules/music-metadata}/lib/ogg/opus/OpusStream.d.ts +0 -0
- /package/node_modules/{music-metadata → baileys/node_modules/music-metadata}/lib/ogg/opus/OpusStream.js +0 -0
- /package/node_modules/{music-metadata → baileys/node_modules/music-metadata}/lib/ogg/speex/Speex.d.ts +0 -0
- /package/node_modules/{music-metadata → baileys/node_modules/music-metadata}/lib/ogg/speex/Speex.js +0 -0
- /package/node_modules/{music-metadata → baileys/node_modules/music-metadata}/lib/ogg/speex/SpeexStream.d.ts +0 -0
- /package/node_modules/{music-metadata → baileys/node_modules/music-metadata}/lib/ogg/speex/SpeexStream.js +0 -0
- /package/node_modules/{music-metadata → baileys/node_modules/music-metadata}/lib/ogg/theora/Theora.d.ts +0 -0
- /package/node_modules/{music-metadata → baileys/node_modules/music-metadata}/lib/ogg/theora/Theora.js +0 -0
- /package/node_modules/{music-metadata → baileys/node_modules/music-metadata}/lib/ogg/theora/TheoraStream.d.ts +0 -0
- /package/node_modules/{music-metadata → baileys/node_modules/music-metadata}/lib/ogg/theora/TheoraStream.js +0 -0
- /package/node_modules/{music-metadata → baileys/node_modules/music-metadata}/lib/ogg/vorbis/Vorbis.d.ts +0 -0
- /package/node_modules/{music-metadata → baileys/node_modules/music-metadata}/lib/ogg/vorbis/Vorbis.js +0 -0
- /package/node_modules/{music-metadata → baileys/node_modules/music-metadata}/lib/ogg/vorbis/VorbisDecoder.d.ts +0 -0
- /package/node_modules/{music-metadata → baileys/node_modules/music-metadata}/lib/ogg/vorbis/VorbisDecoder.js +0 -0
- /package/node_modules/{music-metadata → baileys/node_modules/music-metadata}/lib/ogg/vorbis/VorbisStream.d.ts +0 -0
- /package/node_modules/{music-metadata → baileys/node_modules/music-metadata}/lib/ogg/vorbis/VorbisStream.js +0 -0
- /package/node_modules/{music-metadata → baileys/node_modules/music-metadata}/lib/ogg/vorbis/VorbisTagMapper.d.ts +0 -0
- /package/node_modules/{music-metadata → baileys/node_modules/music-metadata}/lib/ogg/vorbis/VorbisTagMapper.js +0 -0
- /package/node_modules/{music-metadata → baileys/node_modules/music-metadata}/lib/riff/RiffChunk.d.ts +0 -0
- /package/node_modules/{music-metadata → baileys/node_modules/music-metadata}/lib/riff/RiffChunk.js +0 -0
- /package/node_modules/{music-metadata → baileys/node_modules/music-metadata}/lib/riff/RiffInfoTagMap.d.ts +0 -0
- /package/node_modules/{music-metadata → baileys/node_modules/music-metadata}/lib/riff/RiffInfoTagMap.js +0 -0
- /package/node_modules/{music-metadata → baileys/node_modules/music-metadata}/lib/type.d.ts +0 -0
- /package/node_modules/{music-metadata → baileys/node_modules/music-metadata}/lib/type.js +0 -0
- /package/node_modules/{music-metadata → baileys/node_modules/music-metadata}/lib/wav/BwfChunk.d.ts +0 -0
- /package/node_modules/{music-metadata → baileys/node_modules/music-metadata}/lib/wav/BwfChunk.js +0 -0
- /package/node_modules/{music-metadata → baileys/node_modules/music-metadata}/lib/wav/WaveChunk.d.ts +0 -0
- /package/node_modules/{music-metadata → baileys/node_modules/music-metadata}/lib/wav/WaveChunk.js +0 -0
- /package/node_modules/{music-metadata → baileys/node_modules/music-metadata}/lib/wav/WaveLoader.d.ts +0 -0
- /package/node_modules/{music-metadata → baileys/node_modules/music-metadata}/lib/wav/WaveLoader.js +0 -0
- /package/node_modules/{music-metadata → baileys/node_modules/music-metadata}/lib/wav/WaveParser.d.ts +0 -0
- /package/node_modules/{music-metadata → baileys/node_modules/music-metadata}/lib/wav/WaveParser.js +0 -0
- /package/node_modules/{music-metadata → baileys/node_modules/music-metadata}/lib/wavpack/WavPackLoader.d.ts +0 -0
- /package/node_modules/{music-metadata → baileys/node_modules/music-metadata}/lib/wavpack/WavPackLoader.js +0 -0
- /package/node_modules/{music-metadata → baileys/node_modules/music-metadata}/lib/wavpack/WavPackParser.d.ts +0 -0
- /package/node_modules/{music-metadata → baileys/node_modules/music-metadata}/lib/wavpack/WavPackParser.js +0 -0
- /package/node_modules/{music-metadata → baileys/node_modules/music-metadata}/lib/wavpack/WavPackToken.d.ts +0 -0
- /package/node_modules/{music-metadata → baileys/node_modules/music-metadata}/lib/wavpack/WavPackToken.js +0 -0
- /package/node_modules/{music-metadata → baileys/node_modules/music-metadata}/package.json +0 -0
- /package/node_modules/{on-exit-leak-free → baileys/node_modules/on-exit-leak-free}/.github/dependabot.yml +0 -0
- /package/node_modules/{on-exit-leak-free → baileys/node_modules/on-exit-leak-free}/.github/workflows/ci.yml +0 -0
- /package/node_modules/{on-exit-leak-free → baileys/node_modules/on-exit-leak-free}/LICENSE +0 -0
- /package/node_modules/{on-exit-leak-free → baileys/node_modules/on-exit-leak-free}/README.md +0 -0
- /package/node_modules/{on-exit-leak-free → baileys/node_modules/on-exit-leak-free}/index.js +0 -0
- /package/node_modules/{on-exit-leak-free → baileys/node_modules/on-exit-leak-free}/package.json +0 -0
- /package/node_modules/{on-exit-leak-free → baileys/node_modules/on-exit-leak-free}/test/base.test.js +0 -0
- /package/node_modules/{on-exit-leak-free → baileys/node_modules/on-exit-leak-free}/test/event-emitter-leak.test.js +0 -0
- /package/node_modules/{on-exit-leak-free → baileys/node_modules/on-exit-leak-free}/test/fixtures/beforeExit.js +0 -0
- /package/node_modules/{on-exit-leak-free → baileys/node_modules/on-exit-leak-free}/test/fixtures/close.js +0 -0
- /package/node_modules/{on-exit-leak-free → baileys/node_modules/on-exit-leak-free}/test/fixtures/gc-not-close.js +0 -0
- /package/node_modules/{on-exit-leak-free → baileys/node_modules/on-exit-leak-free}/test/fixtures/unregister.js +0 -0
- /package/node_modules/{p-queue → baileys/node_modules/p-queue}/dist/index.d.ts +0 -0
- /package/node_modules/{p-queue → baileys/node_modules/p-queue}/dist/lower-bound.d.ts +0 -0
- /package/node_modules/{p-queue → baileys/node_modules/p-queue}/dist/lower-bound.js +0 -0
- /package/node_modules/{p-queue → baileys/node_modules/p-queue}/dist/options.d.ts +0 -0
- /package/node_modules/{p-queue → baileys/node_modules/p-queue}/dist/options.js +0 -0
- /package/node_modules/{p-queue → baileys/node_modules/p-queue}/dist/priority-queue.d.ts +0 -0
- /package/node_modules/{p-queue → baileys/node_modules/p-queue}/dist/priority-queue.js +0 -0
- /package/node_modules/{p-queue → baileys/node_modules/p-queue}/dist/queue.d.ts +0 -0
- /package/node_modules/{p-queue → baileys/node_modules/p-queue}/dist/queue.js +0 -0
- /package/node_modules/{p-queue → baileys/node_modules/p-queue}/license +0 -0
- /package/node_modules/{p-queue → baileys/node_modules/p-queue}/readme.md +0 -0
- /package/node_modules/{p-timeout → baileys/node_modules/p-timeout}/index.d.ts +0 -0
- /package/node_modules/{p-timeout → baileys/node_modules/p-timeout}/index.js +0 -0
- /package/node_modules/{p-timeout → baileys/node_modules/p-timeout}/license +0 -0
- /package/node_modules/{p-timeout → baileys/node_modules/p-timeout}/package.json +0 -0
- /package/node_modules/{p-timeout → baileys/node_modules/p-timeout}/readme.md +0 -0
- /package/node_modules/{pino → baileys/node_modules/pino}/.eslintignore +0 -0
- /package/node_modules/{pino → baileys/node_modules/pino}/.eslintrc +0 -0
- /package/node_modules/{pino → baileys/node_modules/pino}/.github/dependabot.yml +0 -0
- /package/node_modules/{pino → baileys/node_modules/pino}/.github/workflows/bench.yml +0 -0
- /package/node_modules/{pino → baileys/node_modules/pino}/.github/workflows/ci.yml +0 -0
- /package/node_modules/{pino → baileys/node_modules/pino}/.github/workflows/lock-threads.yml +0 -0
- /package/node_modules/{pino → baileys/node_modules/pino}/.github/workflows/publish-release.yml +0 -0
- /package/node_modules/{pino → baileys/node_modules/pino}/.github/workflows/target-main.yml +0 -0
- /package/node_modules/{pino → baileys/node_modules/pino}/.nojekyll +0 -0
- /package/node_modules/{pino → baileys/node_modules/pino}/.prettierignore +0 -0
- /package/node_modules/{pino → baileys/node_modules/pino}/.taprc.yaml +0 -0
- /package/node_modules/{pino → baileys/node_modules/pino}/CNAME +0 -0
- /package/node_modules/{pino → baileys/node_modules/pino}/CONTRIBUTING.md +0 -0
- /package/node_modules/{pino → baileys/node_modules/pino}/LICENSE +0 -0
- /package/node_modules/{pino → baileys/node_modules/pino}/README.md +0 -0
- /package/node_modules/{pino → baileys/node_modules/pino}/SECURITY.md +0 -0
- /package/node_modules/{pino → baileys/node_modules/pino}/benchmarks/basic.bench.js +0 -0
- /package/node_modules/{pino → baileys/node_modules/pino}/benchmarks/child-child.bench.js +0 -0
- /package/node_modules/{pino → baileys/node_modules/pino}/benchmarks/child-creation.bench.js +0 -0
- /package/node_modules/{pino → baileys/node_modules/pino}/benchmarks/child.bench.js +0 -0
- /package/node_modules/{pino → baileys/node_modules/pino}/benchmarks/deep-object.bench.js +0 -0
- /package/node_modules/{pino → baileys/node_modules/pino}/benchmarks/formatters.bench.js +0 -0
- /package/node_modules/{pino → baileys/node_modules/pino}/benchmarks/internal/custom-levels.js +0 -0
- /package/node_modules/{pino → baileys/node_modules/pino}/benchmarks/internal/just-pino-heavy.bench.js +0 -0
- /package/node_modules/{pino → baileys/node_modules/pino}/benchmarks/internal/just-pino.bench.js +0 -0
- /package/node_modules/{pino → baileys/node_modules/pino}/benchmarks/internal/parent-vs-child.bench.js +0 -0
- /package/node_modules/{pino → baileys/node_modules/pino}/benchmarks/internal/redact.bench.js +0 -0
- /package/node_modules/{pino → baileys/node_modules/pino}/benchmarks/long-string.bench.js +0 -0
- /package/node_modules/{pino → baileys/node_modules/pino}/benchmarks/multi-arg.bench.js +0 -0
- /package/node_modules/{pino → baileys/node_modules/pino}/benchmarks/multistream.js +0 -0
- /package/node_modules/{pino → baileys/node_modules/pino}/benchmarks/object.bench.js +0 -0
- /package/node_modules/{pino → baileys/node_modules/pino}/benchmarks/utils/generate-benchmark-doc.js +0 -0
- /package/node_modules/{pino → baileys/node_modules/pino}/benchmarks/utils/runbench.js +0 -0
- /package/node_modules/{pino → baileys/node_modules/pino}/benchmarks/utils/wrap-log-level.js +0 -0
- /package/node_modules/{pino → baileys/node_modules/pino}/bin.js +0 -0
- /package/node_modules/{pino → baileys/node_modules/pino}/browser.js +0 -0
- /package/node_modules/{pino → baileys/node_modules/pino}/build/sync-version.js +0 -0
- /package/node_modules/{pino → baileys/node_modules/pino}/docs/api.md +0 -0
- /package/node_modules/{pino → baileys/node_modules/pino}/docs/asynchronous.md +0 -0
- /package/node_modules/{pino → baileys/node_modules/pino}/docs/benchmarks.md +0 -0
- /package/node_modules/{pino → baileys/node_modules/pino}/docs/browser.md +0 -0
- /package/node_modules/{pino → baileys/node_modules/pino}/docs/bundling.md +0 -0
- /package/node_modules/{pino → baileys/node_modules/pino}/docs/child-loggers.md +0 -0
- /package/node_modules/{pino → baileys/node_modules/pino}/docs/diagnostics.md +0 -0
- /package/node_modules/{pino → baileys/node_modules/pino}/docs/ecosystem.md +0 -0
- /package/node_modules/{pino → baileys/node_modules/pino}/docs/help.md +0 -0
- /package/node_modules/{pino → baileys/node_modules/pino}/docs/lts.md +0 -0
- /package/node_modules/{pino → baileys/node_modules/pino}/docs/pretty.md +0 -0
- /package/node_modules/{pino → baileys/node_modules/pino}/docs/redaction.md +0 -0
- /package/node_modules/{pino → baileys/node_modules/pino}/docs/transports.md +0 -0
- /package/node_modules/{pino → baileys/node_modules/pino}/docs/web.md +0 -0
- /package/node_modules/{pino → baileys/node_modules/pino}/docsify/sidebar.md +0 -0
- /package/node_modules/{pino → baileys/node_modules/pino}/examples/basic.js +0 -0
- /package/node_modules/{pino → baileys/node_modules/pino}/examples/transport.js +0 -0
- /package/node_modules/{pino → baileys/node_modules/pino}/favicon-16x16.png +0 -0
- /package/node_modules/{pino → baileys/node_modules/pino}/favicon-32x32.png +0 -0
- /package/node_modules/{pino → baileys/node_modules/pino}/favicon.ico +0 -0
- /package/node_modules/{pino → baileys/node_modules/pino}/file.js +0 -0
- /package/node_modules/{pino → baileys/node_modules/pino}/inc-version.sh +0 -0
- /package/node_modules/{pino → baileys/node_modules/pino}/index.html +0 -0
- /package/node_modules/{pino → baileys/node_modules/pino}/lib/caller.js +0 -0
- /package/node_modules/{pino → baileys/node_modules/pino}/lib/constants.js +0 -0
- /package/node_modules/{pino → baileys/node_modules/pino}/lib/deprecations.js +0 -0
- /package/node_modules/{pino → baileys/node_modules/pino}/lib/levels.js +0 -0
- /package/node_modules/{pino → baileys/node_modules/pino}/lib/meta.js +0 -0
- /package/node_modules/{pino → baileys/node_modules/pino}/lib/multistream.js +0 -0
- /package/node_modules/{pino → baileys/node_modules/pino}/lib/proto.js +0 -0
- /package/node_modules/{pino → baileys/node_modules/pino}/lib/redaction.js +0 -0
- /package/node_modules/{pino → baileys/node_modules/pino}/lib/symbols.js +0 -0
- /package/node_modules/{pino → baileys/node_modules/pino}/lib/time.js +0 -0
- /package/node_modules/{pino → baileys/node_modules/pino}/lib/tools.js +0 -0
- /package/node_modules/{pino → baileys/node_modules/pino}/lib/transport-stream.js +0 -0
- /package/node_modules/{pino → baileys/node_modules/pino}/lib/transport.js +0 -0
- /package/node_modules/{pino → baileys/node_modules/pino}/lib/worker.js +0 -0
- /package/node_modules/{pino → baileys/node_modules/pino}/package.json +0 -0
- /package/node_modules/{pino → baileys/node_modules/pino}/pino-banner.png +0 -0
- /package/node_modules/{pino → baileys/node_modules/pino}/pino-logo-hire.png +0 -0
- /package/node_modules/{pino → baileys/node_modules/pino}/pino-tree.png +0 -0
- /package/node_modules/{pino → baileys/node_modules/pino}/pino.d.ts +0 -0
- /package/node_modules/{pino → baileys/node_modules/pino}/pino.js +0 -0
- /package/node_modules/{pino → baileys/node_modules/pino}/pretty-demo.png +0 -0
- /package/node_modules/{pino → baileys/node_modules/pino}/test/basic.test.js +0 -0
- /package/node_modules/{pino → baileys/node_modules/pino}/test/broken-pipe.test.js +0 -0
- /package/node_modules/{pino → baileys/node_modules/pino}/test/browser-child.test.js +0 -0
- /package/node_modules/{pino → baileys/node_modules/pino}/test/browser-disabled.test.js +0 -0
- /package/node_modules/{pino → baileys/node_modules/pino}/test/browser-early-console-freeze.test.js +0 -0
- /package/node_modules/{pino → baileys/node_modules/pino}/test/browser-is-level-enabled.test.js +0 -0
- /package/node_modules/{pino → baileys/node_modules/pino}/test/browser-levels.test.js +0 -0
- /package/node_modules/{pino → baileys/node_modules/pino}/test/browser-serializers.test.js +0 -0
- /package/node_modules/{pino → baileys/node_modules/pino}/test/browser-timestamp.test.js +0 -0
- /package/node_modules/{pino → baileys/node_modules/pino}/test/browser-transmit.test.js +0 -0
- /package/node_modules/{pino → baileys/node_modules/pino}/test/browser.test.js +0 -0
- /package/node_modules/{pino → baileys/node_modules/pino}/test/complex-objects.test.js +0 -0
- /package/node_modules/{pino → baileys/node_modules/pino}/test/crlf.test.js +0 -0
- /package/node_modules/{pino → baileys/node_modules/pino}/test/custom-levels.test.js +0 -0
- /package/node_modules/{pino → baileys/node_modules/pino}/test/diagnostics.test.js +0 -0
- /package/node_modules/{pino → baileys/node_modules/pino}/test/error.test.js +0 -0
- /package/node_modules/{pino → baileys/node_modules/pino}/test/errorKey.test.js +0 -0
- /package/node_modules/{pino → baileys/node_modules/pino}/test/escaping.test.js +0 -0
- /package/node_modules/{pino → baileys/node_modules/pino}/test/esm/esm.mjs +0 -0
- /package/node_modules/{pino → baileys/node_modules/pino}/test/esm/index.test.js +0 -0
- /package/node_modules/{pino → baileys/node_modules/pino}/test/esm/named-exports.mjs +0 -0
- /package/node_modules/{pino → baileys/node_modules/pino}/test/exit.test.js +0 -0
- /package/node_modules/{pino → baileys/node_modules/pino}/test/fixtures/broken-pipe/basic.js +0 -0
- /package/node_modules/{pino → baileys/node_modules/pino}/test/fixtures/broken-pipe/destination.js +0 -0
- /package/node_modules/{pino → baileys/node_modules/pino}/test/fixtures/broken-pipe/syncfalse.js +0 -0
- /package/node_modules/{pino → baileys/node_modules/pino}/test/fixtures/console-transport.js +0 -0
- /package/node_modules/{pino → baileys/node_modules/pino}/test/fixtures/crashing-transport.js +0 -0
- /package/node_modules/{pino → baileys/node_modules/pino}/test/fixtures/default-exit.js +0 -0
- /package/node_modules/{pino → baileys/node_modules/pino}/test/fixtures/destination-exit.js +0 -0
- /package/node_modules/{pino → baileys/node_modules/pino}/test/fixtures/eval/index.js +0 -0
- /package/node_modules/{pino → baileys/node_modules/pino}/test/fixtures/eval/node_modules/14-files.js +0 -0
- /package/node_modules/{pino → baileys/node_modules/pino}/test/fixtures/eval/node_modules/2-files.js +0 -0
- /package/node_modules/{pino → baileys/node_modules/pino}/test/fixtures/eval/node_modules/file1.js +0 -0
- /package/node_modules/{pino → baileys/node_modules/pino}/test/fixtures/eval/node_modules/file10.js +0 -0
- /package/node_modules/{pino → baileys/node_modules/pino}/test/fixtures/eval/node_modules/file11.js +0 -0
- /package/node_modules/{pino → baileys/node_modules/pino}/test/fixtures/eval/node_modules/file12.js +0 -0
- /package/node_modules/{pino → baileys/node_modules/pino}/test/fixtures/eval/node_modules/file13.js +0 -0
- /package/node_modules/{pino → baileys/node_modules/pino}/test/fixtures/eval/node_modules/file14.js +0 -0
- /package/node_modules/{pino → baileys/node_modules/pino}/test/fixtures/eval/node_modules/file2.js +0 -0
- /package/node_modules/{pino → baileys/node_modules/pino}/test/fixtures/eval/node_modules/file3.js +0 -0
- /package/node_modules/{pino → baileys/node_modules/pino}/test/fixtures/eval/node_modules/file4.js +0 -0
- /package/node_modules/{pino → baileys/node_modules/pino}/test/fixtures/eval/node_modules/file5.js +0 -0
- /package/node_modules/{pino → baileys/node_modules/pino}/test/fixtures/eval/node_modules/file6.js +0 -0
- /package/node_modules/{pino → baileys/node_modules/pino}/test/fixtures/eval/node_modules/file7.js +0 -0
- /package/node_modules/{pino → baileys/node_modules/pino}/test/fixtures/eval/node_modules/file8.js +0 -0
- /package/node_modules/{pino → baileys/node_modules/pino}/test/fixtures/eval/node_modules/file9.js +0 -0
- /package/node_modules/{pino → baileys/node_modules/pino}/test/fixtures/noop-transport.js +0 -0
- /package/node_modules/{pino → baileys/node_modules/pino}/test/fixtures/pretty/null-prototype.js +0 -0
- /package/node_modules/{pino → baileys/node_modules/pino}/test/fixtures/stdout-hack-protection.js +0 -0
- /package/node_modules/{pino → baileys/node_modules/pino}/test/fixtures/syncfalse-child.js +0 -0
- /package/node_modules/{pino → baileys/node_modules/pino}/test/fixtures/syncfalse-exit.js +0 -0
- /package/node_modules/{pino → baileys/node_modules/pino}/test/fixtures/syncfalse-flush-exit.js +0 -0
- /package/node_modules/{pino → baileys/node_modules/pino}/test/fixtures/syncfalse.js +0 -0
- /package/node_modules/{pino → baileys/node_modules/pino}/test/fixtures/syntax-error-esm.mjs +0 -0
- /package/node_modules/{pino → baileys/node_modules/pino}/test/fixtures/to-file-transport-with-transform.js +0 -0
- /package/node_modules/{pino → baileys/node_modules/pino}/test/fixtures/to-file-transport.js +0 -0
- /package/node_modules/{pino → baileys/node_modules/pino}/test/fixtures/to-file-transport.mjs +0 -0
- /package/node_modules/{pino → baileys/node_modules/pino}/test/fixtures/transport/index.js +0 -0
- /package/node_modules/{pino → baileys/node_modules/pino}/test/fixtures/transport/package.json +0 -0
- /package/node_modules/{pino → baileys/node_modules/pino}/test/fixtures/transport-exit-immediately-with-async-dest.js +0 -0
- /package/node_modules/{pino → baileys/node_modules/pino}/test/fixtures/transport-exit-immediately.js +0 -0
- /package/node_modules/{pino → baileys/node_modules/pino}/test/fixtures/transport-exit-on-ready.js +0 -0
- /package/node_modules/{pino → baileys/node_modules/pino}/test/fixtures/transport-main.js +0 -0
- /package/node_modules/{pino → baileys/node_modules/pino}/test/fixtures/transport-many-lines.js +0 -0
- /package/node_modules/{pino → baileys/node_modules/pino}/test/fixtures/transport-string-stdout.js +0 -0
- /package/node_modules/{pino → baileys/node_modules/pino}/test/fixtures/transport-transform.js +0 -0
- /package/node_modules/{pino → baileys/node_modules/pino}/test/fixtures/transport-uses-pino-config.js +0 -0
- /package/node_modules/{pino → baileys/node_modules/pino}/test/fixtures/transport-with-on-exit.js +0 -0
- /package/node_modules/{pino → baileys/node_modules/pino}/test/fixtures/transport-worker-data.js +0 -0
- /package/node_modules/{pino → baileys/node_modules/pino}/test/fixtures/transport-worker.js +0 -0
- /package/node_modules/{pino → baileys/node_modules/pino}/test/fixtures/transport-wrong-export-type.js +0 -0
- /package/node_modules/{pino → baileys/node_modules/pino}/test/fixtures/ts/to-file-transport-with-transform.ts +0 -0
- /package/node_modules/{pino → baileys/node_modules/pino}/test/fixtures/ts/to-file-transport.ts +0 -0
- /package/node_modules/{pino → baileys/node_modules/pino}/test/fixtures/ts/transpile.cjs +0 -0
- /package/node_modules/{pino → baileys/node_modules/pino}/test/fixtures/ts/transport-exit-immediately-with-async-dest.ts +0 -0
- /package/node_modules/{pino → baileys/node_modules/pino}/test/fixtures/ts/transport-exit-immediately.ts +0 -0
- /package/node_modules/{pino → baileys/node_modules/pino}/test/fixtures/ts/transport-exit-on-ready.ts +0 -0
- /package/node_modules/{pino → baileys/node_modules/pino}/test/fixtures/ts/transport-main.ts +0 -0
- /package/node_modules/{pino → baileys/node_modules/pino}/test/fixtures/ts/transport-string-stdout.ts +0 -0
- /package/node_modules/{pino → baileys/node_modules/pino}/test/fixtures/ts/transport-worker.ts +0 -0
- /package/node_modules/{pino → baileys/node_modules/pino}/test/formatters.test.js +0 -0
- /package/node_modules/{pino → baileys/node_modules/pino}/test/helper.d.ts +0 -0
- /package/node_modules/{pino → baileys/node_modules/pino}/test/helper.js +0 -0
- /package/node_modules/{pino → baileys/node_modules/pino}/test/hooks.test.js +0 -0
- /package/node_modules/{pino → baileys/node_modules/pino}/test/http.test.js +0 -0
- /package/node_modules/{pino → baileys/node_modules/pino}/test/internals/version.test.js +0 -0
- /package/node_modules/{pino → baileys/node_modules/pino}/test/is-level-enabled.test.js +0 -0
- /package/node_modules/{pino → baileys/node_modules/pino}/test/jest/basic.spec.js +0 -0
- /package/node_modules/{pino → baileys/node_modules/pino}/test/levels.test.js +0 -0
- /package/node_modules/{pino → baileys/node_modules/pino}/test/metadata.test.js +0 -0
- /package/node_modules/{pino → baileys/node_modules/pino}/test/mixin-merge-strategy.test.js +0 -0
- /package/node_modules/{pino → baileys/node_modules/pino}/test/mixin.test.js +0 -0
- /package/node_modules/{pino → baileys/node_modules/pino}/test/multistream.test.js +0 -0
- /package/node_modules/{pino → baileys/node_modules/pino}/test/pkg/index.js +0 -0
- /package/node_modules/{pino → baileys/node_modules/pino}/test/pkg/pkg.config.json +0 -0
- /package/node_modules/{pino → baileys/node_modules/pino}/test/pkg/pkg.test.js +0 -0
- /package/node_modules/{pino → baileys/node_modules/pino}/test/redact.test.js +0 -0
- /package/node_modules/{pino → baileys/node_modules/pino}/test/serializers.test.js +0 -0
- /package/node_modules/{pino → baileys/node_modules/pino}/test/sinon-child-logger.test.js +0 -0
- /package/node_modules/{pino → baileys/node_modules/pino}/test/stdout-protection.test.js +0 -0
- /package/node_modules/{pino → baileys/node_modules/pino}/test/syncfalse.test.js +0 -0
- /package/node_modules/{pino → baileys/node_modules/pino}/test/timestamp-nano.test.js +0 -0
- /package/node_modules/{pino → baileys/node_modules/pino}/test/timestamp.test.js +0 -0
- /package/node_modules/{pino → baileys/node_modules/pino}/test/transport/big.test.js +0 -0
- /package/node_modules/{pino → baileys/node_modules/pino}/test/transport/bundlers-support.test.js +0 -0
- /package/node_modules/{pino → baileys/node_modules/pino}/test/transport/caller.test.js +0 -0
- /package/node_modules/{pino → baileys/node_modules/pino}/test/transport/core.test.js +0 -0
- /package/node_modules/{pino → baileys/node_modules/pino}/test/transport/core.test.ts +0 -0
- /package/node_modules/{pino → baileys/node_modules/pino}/test/transport/core.transpiled.test.ts +0 -0
- /package/node_modules/{pino → baileys/node_modules/pino}/test/transport/crash.test.js +0 -0
- /package/node_modules/{pino → baileys/node_modules/pino}/test/transport/module-link.test.js +0 -0
- /package/node_modules/{pino → baileys/node_modules/pino}/test/transport/pipeline.test.js +0 -0
- /package/node_modules/{pino → baileys/node_modules/pino}/test/transport/repl.test.js +0 -0
- /package/node_modules/{pino → baileys/node_modules/pino}/test/transport/syncTrue.test.js +0 -0
- /package/node_modules/{pino → baileys/node_modules/pino}/test/transport/syncfalse.test.js +0 -0
- /package/node_modules/{pino → baileys/node_modules/pino}/test/transport/targets.test.js +0 -0
- /package/node_modules/{pino → baileys/node_modules/pino}/test/transport/uses-pino-config.test.js +0 -0
- /package/node_modules/{pino → baileys/node_modules/pino}/test/transport-stream.test.js +0 -0
- /package/node_modules/{pino → baileys/node_modules/pino}/test/types/pino-import.test-d.cts +0 -0
- /package/node_modules/{pino → baileys/node_modules/pino}/test/types/pino-multistream.test-d.ts +0 -0
- /package/node_modules/{pino → baileys/node_modules/pino}/test/types/pino-top-export.test-d.ts +0 -0
- /package/node_modules/{pino → baileys/node_modules/pino}/test/types/pino-transport.test-d.ts +0 -0
- /package/node_modules/{pino → baileys/node_modules/pino}/test/types/pino-type-only.test-d.ts +0 -0
- /package/node_modules/{pino → baileys/node_modules/pino}/test/types/pino.test-d.ts +0 -0
- /package/node_modules/{pino → baileys/node_modules/pino}/test/types/pino.ts +0 -0
- /package/node_modules/{pino → baileys/node_modules/pino}/tsconfig.json +0 -0
- /package/node_modules/{pino-abstract-transport → baileys/node_modules/pino-abstract-transport}/.github/dependabot.yml +0 -0
- /package/node_modules/{pino-abstract-transport → baileys/node_modules/pino-abstract-transport}/.github/workflows/ci.yml +0 -0
- /package/node_modules/{pino-abstract-transport → baileys/node_modules/pino-abstract-transport}/.husky/pre-commit +0 -0
- /package/node_modules/{pino-abstract-transport → baileys/node_modules/pino-abstract-transport}/LICENSE +0 -0
- /package/node_modules/{pino-abstract-transport → baileys/node_modules/pino-abstract-transport}/README.md +0 -0
- /package/node_modules/{pino-abstract-transport → baileys/node_modules/pino-abstract-transport}/index.d.ts +0 -0
- /package/node_modules/{pino-abstract-transport → baileys/node_modules/pino-abstract-transport}/index.js +0 -0
- /package/node_modules/{pino-abstract-transport → baileys/node_modules/pino-abstract-transport}/package.json +0 -0
- /package/node_modules/{pino-abstract-transport → baileys/node_modules/pino-abstract-transport}/test/base.test.js +0 -0
- /package/node_modules/{pino-abstract-transport → baileys/node_modules/pino-abstract-transport}/test/fixtures/transport-async-iteration.js +0 -0
- /package/node_modules/{pino-abstract-transport → baileys/node_modules/pino-abstract-transport}/test/fixtures/transport-on-data.js +0 -0
- /package/node_modules/{pino-abstract-transport → baileys/node_modules/pino-abstract-transport}/test/fixtures/transport-transform.js +0 -0
- /package/node_modules/{pino-abstract-transport → baileys/node_modules/pino-abstract-transport}/test/fixtures/worker-pipeline.js +0 -0
- /package/node_modules/{pino-abstract-transport → baileys/node_modules/pino-abstract-transport}/test/types/index.test-d.ts +0 -0
- /package/node_modules/{pino-abstract-transport → baileys/node_modules/pino-abstract-transport}/test/worker.test.js +0 -0
- /package/node_modules/{pino-std-serializers → baileys/node_modules/pino-std-serializers}/.editorconfig +0 -0
- /package/node_modules/{pino-std-serializers → baileys/node_modules/pino-std-serializers}/.github/dependabot.yml +0 -0
- /package/node_modules/{pino-std-serializers → baileys/node_modules/pino-std-serializers}/.github/workflows/ci.yml +0 -0
- /package/node_modules/{pino-std-serializers → baileys/node_modules/pino-std-serializers}/LICENSE +0 -0
- /package/node_modules/{pino-std-serializers → baileys/node_modules/pino-std-serializers}/Readme.md +0 -0
- /package/node_modules/{pino-std-serializers → baileys/node_modules/pino-std-serializers}/eslint.config.js +0 -0
- /package/node_modules/{pino-std-serializers → baileys/node_modules/pino-std-serializers}/index.d.ts +0 -0
- /package/node_modules/{pino-std-serializers → baileys/node_modules/pino-std-serializers}/index.js +0 -0
- /package/node_modules/{pino-std-serializers → baileys/node_modules/pino-std-serializers}/lib/err-helpers.js +0 -0
- /package/node_modules/{pino-std-serializers → baileys/node_modules/pino-std-serializers}/lib/err-proto.js +0 -0
- /package/node_modules/{pino-std-serializers → baileys/node_modules/pino-std-serializers}/lib/err-with-cause.js +0 -0
- /package/node_modules/{pino-std-serializers → baileys/node_modules/pino-std-serializers}/lib/err.js +0 -0
- /package/node_modules/{pino-std-serializers → baileys/node_modules/pino-std-serializers}/lib/req.js +0 -0
- /package/node_modules/{pino-std-serializers → baileys/node_modules/pino-std-serializers}/lib/res.js +0 -0
- /package/node_modules/{pino-std-serializers → baileys/node_modules/pino-std-serializers}/package.json +0 -0
- /package/node_modules/{pino-std-serializers → baileys/node_modules/pino-std-serializers}/test/err-with-cause.test.js +0 -0
- /package/node_modules/{pino-std-serializers → baileys/node_modules/pino-std-serializers}/test/err.test.js +0 -0
- /package/node_modules/{pino-std-serializers → baileys/node_modules/pino-std-serializers}/test/req.test.js +0 -0
- /package/node_modules/{pino-std-serializers → baileys/node_modules/pino-std-serializers}/test/res.test.js +0 -0
- /package/node_modules/{pino-std-serializers → baileys/node_modules/pino-std-serializers}/test/types/index.test-d.ts +0 -0
- /package/node_modules/{pino-std-serializers → baileys/node_modules/pino-std-serializers}/tsconfig.json +0 -0
- /package/node_modules/{process-warning → baileys/node_modules/process-warning}/.gitattributes +0 -0
- /package/node_modules/{process-warning → baileys/node_modules/process-warning}/.github/dependabot.yml +0 -0
- /package/node_modules/{process-warning → baileys/node_modules/process-warning}/.github/workflows/ci.yml +0 -0
- /package/node_modules/{process-warning → baileys/node_modules/process-warning}/LICENSE +0 -0
- /package/node_modules/{process-warning → baileys/node_modules/process-warning}/README.md +0 -0
- /package/node_modules/{process-warning → baileys/node_modules/process-warning}/benchmarks/warn.js +0 -0
- /package/node_modules/{process-warning → baileys/node_modules/process-warning}/eslint.config.js +0 -0
- /package/node_modules/{process-warning → baileys/node_modules/process-warning}/examples/example.js +0 -0
- /package/node_modules/{process-warning → baileys/node_modules/process-warning}/index.js +0 -0
- /package/node_modules/{process-warning → baileys/node_modules/process-warning}/package.json +0 -0
- /package/node_modules/{process-warning → baileys/node_modules/process-warning}/test/emit-interpolated-string.test.js +0 -0
- /package/node_modules/{process-warning → baileys/node_modules/process-warning}/test/emit-once-only.test.js +0 -0
- /package/node_modules/{process-warning → baileys/node_modules/process-warning}/test/emit-reset.test.js +0 -0
- /package/node_modules/{process-warning → baileys/node_modules/process-warning}/test/emit-set.test.js +0 -0
- /package/node_modules/{process-warning → baileys/node_modules/process-warning}/test/emit-unlimited.test.js +0 -0
- /package/node_modules/{process-warning → baileys/node_modules/process-warning}/test/index.test.js +0 -0
- /package/node_modules/{process-warning → baileys/node_modules/process-warning}/test/issue-88.test.js +0 -0
- /package/node_modules/{process-warning → baileys/node_modules/process-warning}/test/jest.test.js +0 -0
- /package/node_modules/{process-warning → baileys/node_modules/process-warning}/test/no-warnings.test.js +0 -0
- /package/node_modules/{process-warning → baileys/node_modules/process-warning}/test/promise.js +0 -0
- /package/node_modules/{process-warning → baileys/node_modules/process-warning}/types/index.d.ts +0 -0
- /package/node_modules/{process-warning → baileys/node_modules/process-warning}/types/index.test-d.ts +0 -0
- /package/node_modules/{protobufjs → baileys/node_modules/protobufjs}/LICENSE +0 -0
- /package/node_modules/{protobufjs → baileys/node_modules/protobufjs}/ext/debug/README.md +0 -0
- /package/node_modules/{protobufjs → baileys/node_modules/protobufjs}/ext/debug/index.js +0 -0
- /package/node_modules/{protobufjs → baileys/node_modules/protobufjs}/google/LICENSE +0 -0
- /package/node_modules/{protobufjs → baileys/node_modules/protobufjs}/google/README.md +0 -0
- /package/node_modules/{protobufjs → baileys/node_modules/protobufjs}/google/api/annotations.proto +0 -0
- /package/node_modules/{protobufjs → baileys/node_modules/protobufjs}/google/api/http.proto +0 -0
- /package/node_modules/{protobufjs → baileys/node_modules/protobufjs}/google/protobuf/api.proto +0 -0
- /package/node_modules/{protobufjs → baileys/node_modules/protobufjs}/google/protobuf/source_context.proto +0 -0
- /package/node_modules/{protobufjs → baileys/node_modules/protobufjs}/google/protobuf/type.proto +0 -0
- /package/node_modules/{protobufjs → baileys/node_modules/protobufjs}/index.js +0 -0
- /package/node_modules/{protobufjs → baileys/node_modules/protobufjs}/light.d.ts +0 -0
- /package/node_modules/{protobufjs → baileys/node_modules/protobufjs}/light.js +0 -0
- /package/node_modules/{protobufjs → baileys/node_modules/protobufjs}/minimal.d.ts +0 -0
- /package/node_modules/{protobufjs → baileys/node_modules/protobufjs}/minimal.js +0 -0
- /package/node_modules/{protobufjs → baileys/node_modules/protobufjs}/src/roots.js +0 -0
- /package/node_modules/{protobufjs → baileys/node_modules/protobufjs}/src/rpc.js +0 -0
- /package/node_modules/{protobufjs → baileys/node_modules/protobufjs}/src/types.js +0 -0
- /package/node_modules/{@protobufjs/float/index.d.ts → baileys/node_modules/protobufjs/src/util/float.d.ts} +0 -0
- /package/node_modules/{protobufjs → baileys/node_modules/protobufjs}/src/util/fs.js +0 -0
- /package/node_modules/{protobufjs → baileys/node_modules/protobufjs}/src/util/patterns.js +0 -0
- /package/node_modules/{qified → baileys/node_modules/qified}/LICENSE +0 -0
- /package/node_modules/{qified → baileys/node_modules/qified}/README.md +0 -0
- /package/node_modules/{qified → baileys/node_modules/qified}/dist/index.cjs +0 -0
- /package/node_modules/{qified → baileys/node_modules/qified}/dist/index.d.cts +0 -0
- /package/node_modules/{qified → baileys/node_modules/qified}/dist/index.d.mts +0 -0
- /package/node_modules/{qified → baileys/node_modules/qified}/dist/index.mjs +0 -0
- /package/node_modules/{qified → baileys/node_modules/qified}/node_modules/hookified/LICENSE +0 -0
- /package/node_modules/{qified → baileys/node_modules/qified}/node_modules/hookified/README.md +0 -0
- /package/node_modules/{qified → baileys/node_modules/qified}/node_modules/hookified/dist/browser/index.global.js +0 -0
- /package/node_modules/{qified → baileys/node_modules/qified}/node_modules/hookified/dist/browser/index.global.js.map +0 -0
- /package/node_modules/{qified → baileys/node_modules/qified}/node_modules/hookified/dist/browser/index.js +0 -0
- /package/node_modules/{qified → baileys/node_modules/qified}/node_modules/hookified/dist/browser/index.js.map +0 -0
- /package/node_modules/{qified → baileys/node_modules/qified}/node_modules/hookified/dist/node/index.cjs +0 -0
- /package/node_modules/{qified → baileys/node_modules/qified}/node_modules/hookified/dist/node/index.d.cts +0 -0
- /package/node_modules/{qified → baileys/node_modules/qified}/node_modules/hookified/dist/node/index.d.ts +0 -0
- /package/node_modules/{qified → baileys/node_modules/qified}/node_modules/hookified/dist/node/index.js +0 -0
- /package/node_modules/{qified → baileys/node_modules/qified}/node_modules/hookified/package.json +0 -0
- /package/node_modules/{qified → baileys/node_modules/qified}/package.json +0 -0
- /package/node_modules/{quick-format-unescaped → baileys/node_modules/quick-format-unescaped}/.github/workflows/ci.yml +0 -0
- /package/node_modules/{quick-format-unescaped → baileys/node_modules/quick-format-unescaped}/LICENSE +0 -0
- /package/node_modules/{quick-format-unescaped → baileys/node_modules/quick-format-unescaped}/benchmark.js +0 -0
- /package/node_modules/{quick-format-unescaped → baileys/node_modules/quick-format-unescaped}/index.js +0 -0
- /package/node_modules/{quick-format-unescaped → baileys/node_modules/quick-format-unescaped}/package.json +0 -0
- /package/node_modules/{quick-format-unescaped → baileys/node_modules/quick-format-unescaped}/readme.md +0 -0
- /package/node_modules/{quick-format-unescaped → baileys/node_modules/quick-format-unescaped}/test/index.js +0 -0
- /package/node_modules/{real-require → baileys/node_modules/real-require}/LICENSE.md +0 -0
- /package/node_modules/{real-require → baileys/node_modules/real-require}/README.md +0 -0
- /package/node_modules/{real-require → baileys/node_modules/real-require}/package.json +0 -0
- /package/node_modules/{real-require → baileys/node_modules/real-require}/src/index.js +0 -0
- /package/node_modules/{safe-stable-stringify → baileys/node_modules/safe-stable-stringify}/LICENSE +0 -0
- /package/node_modules/{safe-stable-stringify → baileys/node_modules/safe-stable-stringify}/esm/package.json +0 -0
- /package/node_modules/{safe-stable-stringify → baileys/node_modules/safe-stable-stringify}/esm/wrapper.d.ts +0 -0
- /package/node_modules/{safe-stable-stringify → baileys/node_modules/safe-stable-stringify}/esm/wrapper.js +0 -0
- /package/node_modules/{safe-stable-stringify → baileys/node_modules/safe-stable-stringify}/index.d.ts +0 -0
- /package/node_modules/{safe-stable-stringify → baileys/node_modules/safe-stable-stringify}/index.js +0 -0
- /package/node_modules/{safe-stable-stringify → baileys/node_modules/safe-stable-stringify}/package.json +0 -0
- /package/node_modules/{safe-stable-stringify → baileys/node_modules/safe-stable-stringify}/readme.md +0 -0
- /package/node_modules/{sonic-boom → baileys/node_modules/sonic-boom}/.eslintignore +0 -0
- /package/node_modules/{sonic-boom → baileys/node_modules/sonic-boom}/.taprc +0 -0
- /package/node_modules/{sonic-boom → baileys/node_modules/sonic-boom}/LICENSE +0 -0
- /package/node_modules/{sonic-boom → baileys/node_modules/sonic-boom}/README.md +0 -0
- /package/node_modules/{sonic-boom → baileys/node_modules/sonic-boom}/bench.js +0 -0
- /package/node_modules/{sonic-boom → baileys/node_modules/sonic-boom}/check.js +0 -0
- /package/node_modules/{sonic-boom → baileys/node_modules/sonic-boom}/example.js +0 -0
- /package/node_modules/{sonic-boom → baileys/node_modules/sonic-boom}/fixtures/firehose.js +0 -0
- /package/node_modules/{sonic-boom → baileys/node_modules/sonic-boom}/index.js +0 -0
- /package/node_modules/{sonic-boom → baileys/node_modules/sonic-boom}/package.json +0 -0
- /package/node_modules/{sonic-boom → baileys/node_modules/sonic-boom}/test/destroy.test.js +0 -0
- /package/node_modules/{sonic-boom → baileys/node_modules/sonic-boom}/test/end.test.js +0 -0
- /package/node_modules/{sonic-boom → baileys/node_modules/sonic-boom}/test/flush-sync.test.js +0 -0
- /package/node_modules/{sonic-boom → baileys/node_modules/sonic-boom}/test/flush.test.js +0 -0
- /package/node_modules/{sonic-boom → baileys/node_modules/sonic-boom}/test/fsync.test.js +0 -0
- /package/node_modules/{sonic-boom → baileys/node_modules/sonic-boom}/test/helper.js +0 -0
- /package/node_modules/{sonic-boom → baileys/node_modules/sonic-boom}/test/minlength.test.js +0 -0
- /package/node_modules/{sonic-boom → baileys/node_modules/sonic-boom}/test/mode.test.js +0 -0
- /package/node_modules/{sonic-boom → baileys/node_modules/sonic-boom}/test/periodicflush.test.js +0 -0
- /package/node_modules/{sonic-boom → baileys/node_modules/sonic-boom}/test/reopen.test.js +0 -0
- /package/node_modules/{sonic-boom → baileys/node_modules/sonic-boom}/test/retry.test.js +0 -0
- /package/node_modules/{sonic-boom → baileys/node_modules/sonic-boom}/test/sync.test.js +0 -0
- /package/node_modules/{sonic-boom → baileys/node_modules/sonic-boom}/test/write.test.js +0 -0
- /package/node_modules/{sonic-boom → baileys/node_modules/sonic-boom}/types/index.d.ts +0 -0
- /package/node_modules/{sonic-boom → baileys/node_modules/sonic-boom}/types/tests/test.ts +0 -0
- /package/node_modules/{split2 → baileys/node_modules/split2}/LICENSE +0 -0
- /package/node_modules/{split2 → baileys/node_modules/split2}/README.md +0 -0
- /package/node_modules/{split2 → baileys/node_modules/split2}/bench.js +0 -0
- /package/node_modules/{split2 → baileys/node_modules/split2}/index.js +0 -0
- /package/node_modules/{split2 → baileys/node_modules/split2}/package.json +0 -0
- /package/node_modules/{split2 → baileys/node_modules/split2}/test.js +0 -0
- /package/node_modules/{strtok3 → baileys/node_modules/strtok3}/LICENSE.txt +0 -0
- /package/node_modules/{strtok3 → baileys/node_modules/strtok3}/README.md +0 -0
- /package/node_modules/{strtok3 → baileys/node_modules/strtok3}/lib/AbstractTokenizer.d.ts +0 -0
- /package/node_modules/{strtok3 → baileys/node_modules/strtok3}/lib/AbstractTokenizer.js +0 -0
- /package/node_modules/{strtok3 → baileys/node_modules/strtok3}/lib/BlobTokenizer.d.ts +0 -0
- /package/node_modules/{strtok3 → baileys/node_modules/strtok3}/lib/BlobTokenizer.js +0 -0
- /package/node_modules/{strtok3 → baileys/node_modules/strtok3}/lib/BufferTokenizer.d.ts +0 -0
- /package/node_modules/{strtok3 → baileys/node_modules/strtok3}/lib/BufferTokenizer.js +0 -0
- /package/node_modules/{strtok3 → baileys/node_modules/strtok3}/lib/FileTokenizer.d.ts +0 -0
- /package/node_modules/{strtok3 → baileys/node_modules/strtok3}/lib/FileTokenizer.js +0 -0
- /package/node_modules/{strtok3 → baileys/node_modules/strtok3}/lib/ReadStreamTokenizer.d.ts +0 -0
- /package/node_modules/{strtok3 → baileys/node_modules/strtok3}/lib/ReadStreamTokenizer.js +0 -0
- /package/node_modules/{strtok3 → baileys/node_modules/strtok3}/lib/core.d.ts +0 -0
- /package/node_modules/{strtok3 → baileys/node_modules/strtok3}/lib/core.js +0 -0
- /package/node_modules/{strtok3 → baileys/node_modules/strtok3}/lib/index.d.ts +0 -0
- /package/node_modules/{strtok3 → baileys/node_modules/strtok3}/lib/index.js +0 -0
- /package/node_modules/{strtok3 → baileys/node_modules/strtok3}/lib/stream/AbstractStreamReader.d.ts +0 -0
- /package/node_modules/{strtok3 → baileys/node_modules/strtok3}/lib/stream/AbstractStreamReader.js +0 -0
- /package/node_modules/{strtok3 → baileys/node_modules/strtok3}/lib/stream/Deferred.d.ts +0 -0
- /package/node_modules/{strtok3 → baileys/node_modules/strtok3}/lib/stream/Deferred.js +0 -0
- /package/node_modules/{strtok3 → baileys/node_modules/strtok3}/lib/stream/Errors.d.ts +0 -0
- /package/node_modules/{strtok3 → baileys/node_modules/strtok3}/lib/stream/Errors.js +0 -0
- /package/node_modules/{strtok3 → baileys/node_modules/strtok3}/lib/stream/StreamReader.d.ts +0 -0
- /package/node_modules/{strtok3 → baileys/node_modules/strtok3}/lib/stream/StreamReader.js +0 -0
- /package/node_modules/{strtok3 → baileys/node_modules/strtok3}/lib/stream/WebStreamByobReader.d.ts +0 -0
- /package/node_modules/{strtok3 → baileys/node_modules/strtok3}/lib/stream/WebStreamByobReader.js +0 -0
- /package/node_modules/{strtok3 → baileys/node_modules/strtok3}/lib/stream/WebStreamDefaultReader.d.ts +0 -0
- /package/node_modules/{strtok3 → baileys/node_modules/strtok3}/lib/stream/WebStreamDefaultReader.js +0 -0
- /package/node_modules/{strtok3 → baileys/node_modules/strtok3}/lib/stream/WebStreamReader.d.ts +0 -0
- /package/node_modules/{strtok3 → baileys/node_modules/strtok3}/lib/stream/WebStreamReader.js +0 -0
- /package/node_modules/{strtok3 → baileys/node_modules/strtok3}/lib/stream/WebStreamReaderFactory.d.ts +0 -0
- /package/node_modules/{strtok3 → baileys/node_modules/strtok3}/lib/stream/WebStreamReaderFactory.js +0 -0
- /package/node_modules/{strtok3 → baileys/node_modules/strtok3}/lib/stream/index.d.ts +0 -0
- /package/node_modules/{strtok3 → baileys/node_modules/strtok3}/lib/stream/index.js +0 -0
- /package/node_modules/{strtok3 → baileys/node_modules/strtok3}/lib/types.d.ts +0 -0
- /package/node_modules/{strtok3 → baileys/node_modules/strtok3}/lib/types.js +0 -0
- /package/node_modules/{strtok3 → baileys/node_modules/strtok3}/package.json +0 -0
- /package/node_modules/{thread-stream → baileys/node_modules/thread-stream}/.claude/settings.local.json +0 -0
- /package/node_modules/{thread-stream → baileys/node_modules/thread-stream}/.github/dependabot.yml +0 -0
- /package/node_modules/{thread-stream → baileys/node_modules/thread-stream}/.github/workflows/ci.yml +0 -0
- /package/node_modules/{thread-stream → baileys/node_modules/thread-stream}/.husky/pre-commit +0 -0
- /package/node_modules/{thread-stream → baileys/node_modules/thread-stream}/.taprc +0 -0
- /package/node_modules/{thread-stream → baileys/node_modules/thread-stream}/CLAUDE.md +0 -0
- /package/node_modules/{thread-stream → baileys/node_modules/thread-stream}/LICENSE +0 -0
- /package/node_modules/{thread-stream → baileys/node_modules/thread-stream}/README.md +0 -0
- /package/node_modules/{thread-stream → baileys/node_modules/thread-stream}/bench.js +0 -0
- /package/node_modules/{thread-stream → baileys/node_modules/thread-stream}/index.d.ts +0 -0
- /package/node_modules/{thread-stream → baileys/node_modules/thread-stream}/index.js +0 -0
- /package/node_modules/{thread-stream → baileys/node_modules/thread-stream}/lib/indexes.js +0 -0
- /package/node_modules/{thread-stream → baileys/node_modules/thread-stream}/lib/wait.js +0 -0
- /package/node_modules/{thread-stream → baileys/node_modules/thread-stream}/lib/worker.js +0 -0
- /package/node_modules/{thread-stream → baileys/node_modules/thread-stream}/package.json +0 -0
- /package/node_modules/{thread-stream → baileys/node_modules/thread-stream}/test/base.test.js +0 -0
- /package/node_modules/{thread-stream → baileys/node_modules/thread-stream}/test/bench.test.js +0 -0
- /package/node_modules/{thread-stream → baileys/node_modules/thread-stream}/test/bundlers.test.js +0 -0
- /package/node_modules/{thread-stream → baileys/node_modules/thread-stream}/test/close-on-gc.js +0 -0
- /package/node_modules/{thread-stream → baileys/node_modules/thread-stream}/test/commonjs-fallback.test.js +0 -0
- /package/node_modules/{thread-stream → baileys/node_modules/thread-stream}/test/context.test.js +0 -0
- /package/node_modules/{thread-stream → baileys/node_modules/thread-stream}/test/create-and-exit.js +0 -0
- /package/node_modules/{thread-stream → baileys/node_modules/thread-stream}/test/custom-worker.js +0 -0
- /package/node_modules/{thread-stream → baileys/node_modules/thread-stream}/test/dir with spaces/test-package.zip +0 -0
- /package/node_modules/{thread-stream → baileys/node_modules/thread-stream}/test/emit-event.js +0 -0
- /package/node_modules/{thread-stream → baileys/node_modules/thread-stream}/test/end.test.js +0 -0
- /package/node_modules/{thread-stream → baileys/node_modules/thread-stream}/test/error.js +0 -0
- /package/node_modules/{thread-stream → baileys/node_modules/thread-stream}/test/esm.test.mjs +0 -0
- /package/node_modules/{thread-stream → baileys/node_modules/thread-stream}/test/event.test.js +0 -0
- /package/node_modules/{thread-stream → baileys/node_modules/thread-stream}/test/exit.js +0 -0
- /package/node_modules/{thread-stream → baileys/node_modules/thread-stream}/test/get-context.js +0 -0
- /package/node_modules/{thread-stream → baileys/node_modules/thread-stream}/test/helper.d.ts +0 -0
- /package/node_modules/{thread-stream → baileys/node_modules/thread-stream}/test/helper.js +0 -0
- /package/node_modules/{thread-stream → baileys/node_modules/thread-stream}/test/indexes.test.js +0 -0
- /package/node_modules/{thread-stream → baileys/node_modules/thread-stream}/test/message-without-code.js +0 -0
- /package/node_modules/{thread-stream → baileys/node_modules/thread-stream}/test/multibyte-chars.test.mjs +0 -0
- /package/node_modules/{thread-stream → baileys/node_modules/thread-stream}/test/never-drain.test.js +0 -0
- /package/node_modules/{thread-stream → baileys/node_modules/thread-stream}/test/on-message.js +0 -0
- /package/node_modules/{thread-stream → baileys/node_modules/thread-stream}/test/pkg/index.js +0 -0
- /package/node_modules/{thread-stream → baileys/node_modules/thread-stream}/test/pkg/pkg.config.json +0 -0
- /package/node_modules/{thread-stream → baileys/node_modules/thread-stream}/test/pkg/pkg.test.js +0 -0
- /package/node_modules/{thread-stream → baileys/node_modules/thread-stream}/test/port.js +0 -0
- /package/node_modules/{thread-stream → baileys/node_modules/thread-stream}/test/post-message.test.js +0 -0
- /package/node_modules/{thread-stream → baileys/node_modules/thread-stream}/test/string-limit-2.test.js +0 -0
- /package/node_modules/{thread-stream → baileys/node_modules/thread-stream}/test/string-limit.test.js +0 -0
- /package/node_modules/{thread-stream → baileys/node_modules/thread-stream}/test/syntax-error.mjs +0 -0
- /package/node_modules/{thread-stream → baileys/node_modules/thread-stream}/test/thread-management.test.js +0 -0
- /package/node_modules/{thread-stream → baileys/node_modules/thread-stream}/test/to-file-on-destroy.js +0 -0
- /package/node_modules/{thread-stream → baileys/node_modules/thread-stream}/test/to-file-on-final.js +0 -0
- /package/node_modules/{thread-stream → baileys/node_modules/thread-stream}/test/to-file.js +0 -0
- /package/node_modules/{thread-stream → baileys/node_modules/thread-stream}/test/to-file.mjs +0 -0
- /package/node_modules/{thread-stream → baileys/node_modules/thread-stream}/test/to-next.js +0 -0
- /package/node_modules/{thread-stream → baileys/node_modules/thread-stream}/test/transpiled.test.js +0 -0
- /package/node_modules/{thread-stream → baileys/node_modules/thread-stream}/test/ts/to-file.ts +0 -0
- /package/node_modules/{thread-stream → baileys/node_modules/thread-stream}/test/ts/transpile.sh +0 -0
- /package/node_modules/{thread-stream → baileys/node_modules/thread-stream}/test/ts-commonjs-default-export.zip +0 -0
- /package/node_modules/{thread-stream → baileys/node_modules/thread-stream}/test/ts.test.ts +0 -0
- /package/node_modules/{thread-stream → baileys/node_modules/thread-stream}/test/uncaughtException.js +0 -0
- /package/node_modules/{thread-stream → baileys/node_modules/thread-stream}/test/unhandledRejection.js +0 -0
- /package/node_modules/{thread-stream → baileys/node_modules/thread-stream}/test/watch-mode.test.js +0 -0
- /package/node_modules/{thread-stream → baileys/node_modules/thread-stream}/test/yarnrc.yml +0 -0
- /package/node_modules/{thread-stream → baileys/node_modules/thread-stream}/tsconfig.json +0 -0
- /package/node_modules/{token-types → baileys/node_modules/token-types}/LICENSE.txt +0 -0
- /package/node_modules/{token-types → baileys/node_modules/token-types}/README.md +0 -0
- /package/node_modules/{token-types → baileys/node_modules/token-types}/lib/index.d.ts +0 -0
- /package/node_modules/{token-types → baileys/node_modules/token-types}/lib/index.js +0 -0
- /package/node_modules/{token-types → baileys/node_modules/token-types}/package.json +0 -0
- /package/node_modules/{tslib → baileys/node_modules/tslib}/CopyrightNotice.txt +0 -0
- /package/node_modules/{tslib → baileys/node_modules/tslib}/LICENSE.txt +0 -0
- /package/node_modules/{tslib → baileys/node_modules/tslib}/README.md +0 -0
- /package/node_modules/{tslib → baileys/node_modules/tslib}/SECURITY.md +0 -0
- /package/node_modules/{tslib → baileys/node_modules/tslib}/modules/index.d.ts +0 -0
- /package/node_modules/{tslib → baileys/node_modules/tslib}/modules/index.js +0 -0
- /package/node_modules/{tslib → baileys/node_modules/tslib}/modules/package.json +0 -0
- /package/node_modules/{tslib → baileys/node_modules/tslib}/package.json +0 -0
- /package/node_modules/{tslib → baileys/node_modules/tslib}/tslib.d.ts +0 -0
- /package/node_modules/{tslib → baileys/node_modules/tslib}/tslib.es6.html +0 -0
- /package/node_modules/{tslib → baileys/node_modules/tslib}/tslib.es6.js +0 -0
- /package/node_modules/{tslib → baileys/node_modules/tslib}/tslib.es6.mjs +0 -0
- /package/node_modules/{tslib → baileys/node_modules/tslib}/tslib.html +0 -0
- /package/node_modules/{tslib → baileys/node_modules/tslib}/tslib.js +0 -0
- /package/node_modules/{uint8array-extras → baileys/node_modules/uint8array-extras}/index.d.ts +0 -0
- /package/node_modules/{uint8array-extras → baileys/node_modules/uint8array-extras}/index.js +0 -0
- /package/node_modules/{uint8array-extras → baileys/node_modules/uint8array-extras}/license +0 -0
- /package/node_modules/{uint8array-extras → baileys/node_modules/uint8array-extras}/package.json +0 -0
- /package/node_modules/{uint8array-extras → baileys/node_modules/uint8array-extras}/readme.md +0 -0
- /package/node_modules/{whatsapp-rust-bridge → baileys/node_modules/whatsapp-rust-bridge}/README.md +0 -0
- /package/node_modules/{whatsapp-rust-bridge → baileys/node_modules/whatsapp-rust-bridge}/dist/index.d.ts +0 -0
- /package/node_modules/{whatsapp-rust-bridge → baileys/node_modules/whatsapp-rust-bridge}/dist/index.js +0 -0
- /package/node_modules/{whatsapp-rust-bridge → baileys/node_modules/whatsapp-rust-bridge}/package.json +0 -0
- /package/node_modules/{whatsapp-rust-bridge → baileys/node_modules/whatsapp-rust-bridge}/pkg/whatsapp_rust_bridge.d.ts +0 -0
- /package/node_modules/{win-guid → baileys/node_modules/win-guid}/LICENSE.txt +0 -0
- /package/node_modules/{win-guid → baileys/node_modules/win-guid}/README.md +0 -0
- /package/node_modules/{win-guid → baileys/node_modules/win-guid}/lib/guid.d.ts +0 -0
- /package/node_modules/{win-guid → baileys/node_modules/win-guid}/lib/guid.js +0 -0
- /package/node_modules/{win-guid → baileys/node_modules/win-guid}/package.json +0 -0
- /package/node_modules/{ws → baileys/node_modules/ws}/LICENSE +0 -0
- /package/node_modules/{ws → baileys/node_modules/ws}/README.md +0 -0
- /package/node_modules/{ws → baileys/node_modules/ws}/browser.js +0 -0
- /package/node_modules/{ws → baileys/node_modules/ws}/index.js +0 -0
- /package/node_modules/{ws → baileys/node_modules/ws}/lib/buffer-util.js +0 -0
- /package/node_modules/{ws → baileys/node_modules/ws}/lib/constants.js +0 -0
- /package/node_modules/{ws → baileys/node_modules/ws}/lib/event-target.js +0 -0
- /package/node_modules/{ws → baileys/node_modules/ws}/lib/extension.js +0 -0
- /package/node_modules/{ws → baileys/node_modules/ws}/lib/limiter.js +0 -0
- /package/node_modules/{ws → baileys/node_modules/ws}/lib/permessage-deflate.js +0 -0
- /package/node_modules/{ws → baileys/node_modules/ws}/lib/receiver.js +0 -0
- /package/node_modules/{ws → baileys/node_modules/ws}/lib/sender.js +0 -0
- /package/node_modules/{ws → baileys/node_modules/ws}/lib/stream.js +0 -0
- /package/node_modules/{ws → baileys/node_modules/ws}/lib/subprotocol.js +0 -0
- /package/node_modules/{ws → baileys/node_modules/ws}/lib/validation.js +0 -0
- /package/node_modules/{ws → baileys/node_modules/ws}/lib/websocket-server.js +0 -0
- /package/node_modules/{ws → baileys/node_modules/ws}/lib/websocket.js +0 -0
- /package/node_modules/{ws → baileys/node_modules/ws}/package.json +0 -0
- /package/node_modules/{ws → baileys/node_modules/ws}/wrapper.mjs +0 -0
package/dist/monitor-CBVNJ2lb.js
DELETED
|
@@ -1,4451 +0,0 @@
|
|
|
1
|
-
import { a as resolveWhatsAppAccount, s as resolveWhatsAppMediaMaxBytes } from "./accounts-CxPuEFi-.js";
|
|
2
|
-
import { a as normalizeWhatsAppOutboundPayload, c as prepareWhatsAppOutboundMedia, r as sendReactionWhatsApp, s as normalizeWhatsAppPayloadTextPreservingIndentation, u as resolveWhatsAppReactionLevel } from "./send-DhJVN30g.js";
|
|
3
|
-
import { i as getWhatsAppRuntime } from "./runtime-BLlToOi6.js";
|
|
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-CKFrhoX4.js";
|
|
6
|
-
import { t as normalizeE164 } from "./text-runtime-CU_IlbK5.js";
|
|
7
|
-
import { a as cacheInboundMessageMeta, i as buildQuotedMessageOptions, n as resolveWhatsAppGroupSessionRoute, o as lookupInboundMessageMeta, r as resolveWhatsAppLegacyGroupSessionKey } from "./group-session-key-DJSdYfnb.js";
|
|
8
|
-
import { g as readWebSelfId, o as getWebAuthAgeMs, r as WhatsAppAuthUnstableError, v as readWebSelfIdentityForDecision } from "./auth-store-DirYMTbo.js";
|
|
9
|
-
import { a as getSelfIdentity, c as resolveComparableIdentity, i as getReplyContext, n as getMentionIdentities, o as getSenderIdentity, r as getPrimaryIdentityId, s as identitiesOverlap, t as getComparableIdentityValues } from "./identity-BM4_wZeM.js";
|
|
10
|
-
import { n as resolveWhatsAppGroupsConfigPath } from "./group-config-path-BGyzT9Lg.js";
|
|
11
|
-
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-BoSHhQNJ.js";
|
|
12
|
-
import { n as getStatusCode, t as formatError } from "./session-errors-JuazczrA.js";
|
|
13
|
-
import { t as BufferJSON } from "./session.runtime-Nsqaehbd.js";
|
|
14
|
-
import { c as requireWhatsAppInboundAdmission, i as resolveWhatsAppInboundPolicy, l as resolveWhatsAppGroupConversationId, o as buildDeprecatedFlatWhatsAppInboundAdmission, r as resolveWhatsAppCommandAuthorized, s as requireAdmittedWhatsAppInboundMessage, t as checkInboundAccessControl } from "./access-control-CRz_v6bR.js";
|
|
15
|
-
import { _ as extractMediaKind, a as mayContainWhatsAppOutboundMention, b as hasInboundUserContent, c as DisconnectReason, d as normalizeMessageContent, f as describeReplyContext, g as extractLocationData, h as extractExternalAdReplyContext, i as addWhatsAppOutboundMentionsToContent, l as downloadMediaMessage, m as extractContextInfo, n as listWhatsAppSendResultMessageIds, o as resolveWhatsAppOutboundMentions, p as extractContactContext, r as normalizeWhatsAppSendResult, s as addWhatsAppImagePreviewFields, t as createWebSendApi, u as isJidGroup, v as extractMentionedJids, x as resolveInboundMediaMimetype, y as extractText } from "./send-api-CpHwbor_.js";
|
|
16
|
-
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-BVRExqrB.js";
|
|
17
|
-
import { n as maybeResolveWhatsAppApprovalReaction } from "./approval-reactions-P2HXjmln.js";
|
|
18
|
-
import { t as maybeResolveWhatsAppQuestionReaction } from "./question-reactions-CaOrSYzU.js";
|
|
19
|
-
import { resolveAccountEntry } from "openclaw/plugin-sdk/account-core";
|
|
20
|
-
import { normalizeLowercaseStringOrEmpty, normalizeStringEntries } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
21
|
-
import { filterSupplementalContextItems, resolvePinnedMainDmOwnerFromAllowlist } from "openclaw/plugin-sdk/security-runtime";
|
|
22
|
-
import { createAckReactionHandle, createStatusReactionController, logAckFailure, removeAckReactionHandleAfterReply, shouldAckReactionForWhatsApp } from "openclaw/plugin-sdk/channel-feedback";
|
|
23
|
-
import { formatCliCommand } from "openclaw/plugin-sdk/cli-runtime";
|
|
24
|
-
import { getChildLogger } from "openclaw/plugin-sdk/logging-core";
|
|
25
|
-
import { resolveMarkdownTableMode as resolveMarkdownTableMode$1 } from "openclaw/plugin-sdk/markdown-table-runtime";
|
|
26
|
-
import { createSubsystemLogger, defaultRuntime, formatDurationPrecise, getChildLogger as getChildLogger$1, logVerbose, logVerbose as logVerbose$1, registerUnhandledRejectionHandler, shouldLogVerbose, shouldLogVerbose as shouldLogVerbose$1, warn } from "openclaw/plugin-sdk/runtime-env";
|
|
27
|
-
import { registerChannelRuntimeContext } from "openclaw/plugin-sdk/channel-runtime-context";
|
|
28
|
-
import { bindIngressLifecycleToReplyOptions, createChannelIngressMonitor, createChannelMessageReplyPipeline, createMessageReceiptFromOutboundResults, deliverInboundReplyWithMessageSendContext, resolveChannelMessageSourceReplyDeliveryMode, resolveChannelStreamingBlockEnabled } from "openclaw/plugin-sdk/channel-outbound";
|
|
29
|
-
import { getAgentScopedMediaLocalRoots } from "openclaw/plugin-sdk/media-runtime";
|
|
30
|
-
import { isReasoningReplyPayload, resolveSendableOutboundReplyParts, sendMediaWithLeadingCaption } from "openclaw/plugin-sdk/reply-payload";
|
|
31
|
-
import { truncateUtf16Safe } from "openclaw/plugin-sdk/text-utility-runtime";
|
|
32
|
-
import { createLazyRuntimeModule } from "openclaw/plugin-sdk/lazy-runtime";
|
|
33
|
-
import { buildChannelInboundEventContext, filterChannelInboundQuoteContext, formatInboundEnvelope, formatInboundEnvelope as formatInboundEnvelope$1, formatInboundMediaUnavailableText, formatLocationText, formatMediaPlaceholderText, hasVisibleInboundReplyDispatch, resolveInboundSessionEnvelopeContext, resolveInboundSupplementalSenderAllowed, runChannelInboundEvent, shouldDebounceTextInbound, toInboundMediaFacts, toLocationContext } from "openclaw/plugin-sdk/channel-inbound";
|
|
34
|
-
import { DEFAULT_ACCOUNT_ID as DEFAULT_ACCOUNT_ID$1, DEFAULT_MAIN_KEY, buildAgentMainSessionKey, buildAgentSessionKey, buildGroupHistoryKey, deriveLastRoutePolicy, normalizeAccountId as normalizeAccountId$1, normalizeAgentId, resolveAgentRoute, resolveInboundLastRouteSessionKey } from "openclaw/plugin-sdk/routing";
|
|
35
|
-
import { asDateTimestampMs, parseStrictFiniteNumber, resolveExpiresAtMsFromDurationMs } from "openclaw/plugin-sdk/number-runtime";
|
|
36
|
-
import { createHash } from "node:crypto";
|
|
37
|
-
import { getSessionEntry, patchSessionEntry, resolveStorePath, resolveStorePath as resolveStorePath$1, updateLastRoute } from "openclaw/plugin-sdk/session-store-runtime";
|
|
38
|
-
import { recordChannelActivity } from "openclaw/plugin-sdk/channel-activity-runtime";
|
|
39
|
-
import { resolveChunkMode, resolveTextChunkLimit } from "openclaw/plugin-sdk/reply-runtime";
|
|
40
|
-
import { CHANNEL_APPROVAL_NATIVE_RUNTIME_CONTEXT_CAPABILITY } from "openclaw/plugin-sdk/approval-handler-runtime";
|
|
41
|
-
import { createInboundDebouncer, resolveInboundDebounceMs } from "openclaw/plugin-sdk/channel-inbound-debounce";
|
|
42
|
-
import { drainPendingDeliveries } from "openclaw/plugin-sdk/delivery-queue-runtime";
|
|
43
|
-
import { DEFAULT_GROUP_HISTORY_LIMIT, buildHistoryContextFromEntries, buildInboundHistoryFromEntries, createChannelHistoryWindow } from "openclaw/plugin-sdk/reply-history";
|
|
44
|
-
import { enqueueSystemEvent } from "openclaw/plugin-sdk/system-event-runtime";
|
|
45
|
-
import { createDedupeCache } from "openclaw/plugin-sdk/dedupe-runtime";
|
|
46
|
-
import { saveMediaStream } from "openclaw/plugin-sdk/media-store";
|
|
47
|
-
import { getRuntimeConfig as getRuntimeConfig$1, getRuntimeConfigSourceSnapshot } from "openclaw/plugin-sdk/runtime-config-snapshot";
|
|
48
|
-
import { resolveChannelContextVisibilityMode } from "openclaw/plugin-sdk/context-visibility-runtime";
|
|
49
|
-
import { buildMentionRegexes, implicitMentionKindWhen, normalizeMentionText, resolveInboundMentionDecision } from "openclaw/plugin-sdk/channel-mention-gating";
|
|
50
|
-
import { createConnectedChannelStatusPatch, createTransportActivityStatusPatch } from "openclaw/plugin-sdk/gateway-runtime";
|
|
51
|
-
import { ensureConfiguredBindingRouteReady, resolveConfiguredBindingRoute } from "openclaw/plugin-sdk/conversation-binding-runtime";
|
|
52
|
-
import { resolveAgentIdentity, resolveIdentityNamePrefix as resolveIdentityNamePrefix$1 } from "openclaw/plugin-sdk/agent-runtime";
|
|
53
|
-
import { normalizeGroupActivation, parseActivationCommand } from "openclaw/plugin-sdk/group-activation";
|
|
54
|
-
import { hasControlCommand, isControlCommandMessage, shouldComputeCommandAuthorized } from "openclaw/plugin-sdk/command-detection";
|
|
55
|
-
import { createInternalHookEvent, deriveInboundMessageHookContext, fireAndForgetBoundedHook, toInternalMessageReceivedContext, toPluginMessageContext, toPluginMessageReceivedEvent, triggerInternalHook } from "openclaw/plugin-sdk/hook-runtime";
|
|
56
|
-
import { getGlobalHookRunner } from "openclaw/plugin-sdk/plugin-runtime";
|
|
57
|
-
import { resolveBatchedReplyThreadingPolicy } from "openclaw/plugin-sdk/reply-reference";
|
|
58
|
-
import { LocalMediaAccessError, getDefaultLocalRoots, loadWebMedia, loadWebMediaRaw, optimizeImageToJpeg, optimizeImageToPng } from "openclaw/plugin-sdk/web-media";
|
|
59
|
-
import { createChannelApiRetryRunner } from "openclaw/plugin-sdk/retry-runtime";
|
|
60
|
-
//#region extensions/whatsapp/src/inbound/message-aliases.ts
|
|
61
|
-
function normalizeQuoteSender(sender) {
|
|
62
|
-
if (!sender?.displayName && !sender?.jid && !sender?.e164) return;
|
|
63
|
-
return sender;
|
|
64
|
-
}
|
|
65
|
-
function buildQuoteFromFlatAliases(msg) {
|
|
66
|
-
if (msg.replyTo) return {
|
|
67
|
-
context: msg.replyTo,
|
|
68
|
-
id: msg.replyTo.id,
|
|
69
|
-
body: msg.replyTo.body,
|
|
70
|
-
sender: normalizeQuoteSender({
|
|
71
|
-
displayName: msg.replyTo.sender?.label ?? msg.replyToSender,
|
|
72
|
-
jid: msg.replyTo.sender?.jid ?? msg.replyToSenderJid,
|
|
73
|
-
e164: msg.replyTo.sender?.e164 ?? msg.replyToSenderE164
|
|
74
|
-
})
|
|
75
|
-
};
|
|
76
|
-
if (!msg.replyToId && !msg.replyToBody && !msg.replyToSender && !msg.replyToSenderJid && !msg.replyToSenderE164) return;
|
|
77
|
-
return {
|
|
78
|
-
id: msg.replyToId,
|
|
79
|
-
body: msg.replyToBody,
|
|
80
|
-
sender: normalizeQuoteSender({
|
|
81
|
-
displayName: msg.replyToSender,
|
|
82
|
-
jid: msg.replyToSenderJid,
|
|
83
|
-
e164: msg.replyToSenderE164
|
|
84
|
-
})
|
|
85
|
-
};
|
|
86
|
-
}
|
|
87
|
-
function buildGroupFromFlatAliases(msg) {
|
|
88
|
-
const mentionJids = msg.mentions ?? msg.mentionedJids;
|
|
89
|
-
if (!msg.groupSubject && !msg.groupParticipants?.length && !mentionJids?.length) return;
|
|
90
|
-
return {
|
|
91
|
-
subject: msg.groupSubject,
|
|
92
|
-
participants: msg.groupParticipants,
|
|
93
|
-
mentions: mentionJids?.length ? { jids: mentionJids } : void 0
|
|
94
|
-
};
|
|
95
|
-
}
|
|
96
|
-
function ensureQuote(msg) {
|
|
97
|
-
return msg.quote ??= {};
|
|
98
|
-
}
|
|
99
|
-
function ensureQuoteSender(msg) {
|
|
100
|
-
const quote = ensureQuote(msg);
|
|
101
|
-
return quote.sender ??= {};
|
|
102
|
-
}
|
|
103
|
-
function ensureGroup(msg) {
|
|
104
|
-
return msg.group ??= {};
|
|
105
|
-
}
|
|
106
|
-
function ensureGroupMentions(msg) {
|
|
107
|
-
const group = ensureGroup(msg);
|
|
108
|
-
return group.mentions ??= {};
|
|
109
|
-
}
|
|
110
|
-
function ensureMedia(msg) {
|
|
111
|
-
return msg.payload.media ??= {};
|
|
112
|
-
}
|
|
113
|
-
function setMediaField(msg, key, value) {
|
|
114
|
-
if (value === void 0 && !msg.payload.media) return;
|
|
115
|
-
ensureMedia(msg)[key] = value;
|
|
116
|
-
}
|
|
117
|
-
function defineDeprecatedAccessors(msg, descriptors) {
|
|
118
|
-
Object.defineProperties(msg, Object.fromEntries(Object.entries(descriptors).map(([key, descriptor]) => [key, {
|
|
119
|
-
configurable: true,
|
|
120
|
-
enumerable: true,
|
|
121
|
-
get: descriptor.get,
|
|
122
|
-
set: descriptor.set
|
|
123
|
-
}])));
|
|
124
|
-
return msg;
|
|
125
|
-
}
|
|
126
|
-
function defineDeprecatedAliasAccessors(msg, descriptors) {
|
|
127
|
-
defineDeprecatedAccessors(msg, descriptors);
|
|
128
|
-
return msg;
|
|
129
|
-
}
|
|
130
|
-
function defineDeprecatedAdmissionTopLevelAccessors(msg) {
|
|
131
|
-
let fallbackConversationId = msg.conversationId || msg.from;
|
|
132
|
-
let fallbackAccountId = msg.accountId;
|
|
133
|
-
let fallbackAccessControlPassed = msg.accessControlPassed;
|
|
134
|
-
let fallbackChatType = msg.chatType;
|
|
135
|
-
const conversationId = () => msg.admission?.conversation.id ?? fallbackConversationId;
|
|
136
|
-
const setConversationId = (value) => {
|
|
137
|
-
const next = value;
|
|
138
|
-
fallbackConversationId = next;
|
|
139
|
-
if (msg.admission) {
|
|
140
|
-
msg.admission.conversation.id = next;
|
|
141
|
-
msg.admission.conversation.groupSessionId = resolveWhatsAppGroupConversationId(next);
|
|
142
|
-
}
|
|
143
|
-
};
|
|
144
|
-
return defineDeprecatedAccessors(msg, {
|
|
145
|
-
from: {
|
|
146
|
-
get: conversationId,
|
|
147
|
-
set: setConversationId
|
|
148
|
-
},
|
|
149
|
-
conversationId: {
|
|
150
|
-
get: conversationId,
|
|
151
|
-
set: setConversationId
|
|
152
|
-
},
|
|
153
|
-
accountId: {
|
|
154
|
-
get: () => msg.admission?.accountId ?? fallbackAccountId,
|
|
155
|
-
set: (value) => {
|
|
156
|
-
const next = value;
|
|
157
|
-
fallbackAccountId = next;
|
|
158
|
-
if (msg.admission) {
|
|
159
|
-
msg.admission.accountId = next;
|
|
160
|
-
msg.admission.account.accountId = next;
|
|
161
|
-
}
|
|
162
|
-
}
|
|
163
|
-
},
|
|
164
|
-
accessControlPassed: {
|
|
165
|
-
get: () => msg.admission ? msg.admission.ingress.decision === "allow" : fallbackAccessControlPassed,
|
|
166
|
-
set: (value) => {
|
|
167
|
-
fallbackAccessControlPassed = value;
|
|
168
|
-
}
|
|
169
|
-
},
|
|
170
|
-
chatType: {
|
|
171
|
-
get: () => msg.admission?.conversation.kind ?? fallbackChatType,
|
|
172
|
-
set: (value) => {
|
|
173
|
-
const next = value;
|
|
174
|
-
fallbackChatType = next;
|
|
175
|
-
if (msg.admission) msg.admission.conversation.kind = next;
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
|
-
});
|
|
179
|
-
}
|
|
180
|
-
function withDeprecatedWebInboundMessageFlatAliases(msg) {
|
|
181
|
-
return defineDeprecatedAliasAccessors(defineDeprecatedAdmissionTopLevelAccessors(msg), {
|
|
182
|
-
id: {
|
|
183
|
-
get: () => msg.event.id,
|
|
184
|
-
set: (value) => msg.event.id = value
|
|
185
|
-
},
|
|
186
|
-
to: {
|
|
187
|
-
get: () => msg.platform.recipientJid,
|
|
188
|
-
set: (value) => msg.platform.recipientJid = value
|
|
189
|
-
},
|
|
190
|
-
body: {
|
|
191
|
-
get: () => msg.payload.body,
|
|
192
|
-
set: (value) => msg.payload.body = value
|
|
193
|
-
},
|
|
194
|
-
pushName: {
|
|
195
|
-
get: () => msg.platform.pushName,
|
|
196
|
-
set: (value) => msg.platform.pushName = value
|
|
197
|
-
},
|
|
198
|
-
timestamp: {
|
|
199
|
-
get: () => msg.event.timestamp,
|
|
200
|
-
set: (value) => msg.event.timestamp = value
|
|
201
|
-
},
|
|
202
|
-
chatId: {
|
|
203
|
-
get: () => msg.platform.chatJid,
|
|
204
|
-
set: (value) => msg.platform.chatJid = value
|
|
205
|
-
},
|
|
206
|
-
sender: {
|
|
207
|
-
get: () => msg.platform.sender,
|
|
208
|
-
set: (value) => msg.platform.sender = value
|
|
209
|
-
},
|
|
210
|
-
senderJid: {
|
|
211
|
-
get: () => msg.platform.senderJid,
|
|
212
|
-
set: (value) => msg.platform.senderJid = value
|
|
213
|
-
},
|
|
214
|
-
senderE164: {
|
|
215
|
-
get: () => msg.platform.senderE164,
|
|
216
|
-
set: (value) => msg.platform.senderE164 = value
|
|
217
|
-
},
|
|
218
|
-
senderName: {
|
|
219
|
-
get: () => msg.platform.senderName,
|
|
220
|
-
set: (value) => msg.platform.senderName = value
|
|
221
|
-
},
|
|
222
|
-
replyTo: {
|
|
223
|
-
get: () => msg.quote?.context,
|
|
224
|
-
set: (value) => ensureQuote(msg).context = value
|
|
225
|
-
},
|
|
226
|
-
replyToId: {
|
|
227
|
-
get: () => msg.quote?.id ?? msg.quote?.context?.id,
|
|
228
|
-
set: (value) => ensureQuote(msg).id = value
|
|
229
|
-
},
|
|
230
|
-
replyToBody: {
|
|
231
|
-
get: () => msg.quote?.body ?? msg.quote?.context?.body,
|
|
232
|
-
set: (value) => ensureQuote(msg).body = value
|
|
233
|
-
},
|
|
234
|
-
replyToSender: {
|
|
235
|
-
get: () => msg.quote?.context?.sender?.label ?? msg.quote?.sender?.displayName,
|
|
236
|
-
set: (value) => {
|
|
237
|
-
const sender = ensureQuoteSender(msg);
|
|
238
|
-
sender.displayName = value;
|
|
239
|
-
if (msg.quote?.context?.sender) msg.quote.context.sender.label = value;
|
|
240
|
-
}
|
|
241
|
-
},
|
|
242
|
-
replyToSenderJid: {
|
|
243
|
-
get: () => msg.quote?.context?.sender?.jid ?? msg.quote?.sender?.jid,
|
|
244
|
-
set: (value) => {
|
|
245
|
-
const jid = value;
|
|
246
|
-
ensureQuoteSender(msg).jid = jid;
|
|
247
|
-
if (msg.quote?.context?.sender) msg.quote.context.sender.jid = jid;
|
|
248
|
-
}
|
|
249
|
-
},
|
|
250
|
-
replyToSenderE164: {
|
|
251
|
-
get: () => msg.quote?.context?.sender?.e164 ?? msg.quote?.sender?.e164,
|
|
252
|
-
set: (value) => {
|
|
253
|
-
const e164 = value;
|
|
254
|
-
ensureQuoteSender(msg).e164 = e164;
|
|
255
|
-
if (msg.quote?.context?.sender) msg.quote.context.sender.e164 = e164;
|
|
256
|
-
}
|
|
257
|
-
},
|
|
258
|
-
groupSubject: {
|
|
259
|
-
get: () => msg.group?.subject,
|
|
260
|
-
set: (value) => ensureGroup(msg).subject = value
|
|
261
|
-
},
|
|
262
|
-
groupParticipants: {
|
|
263
|
-
get: () => msg.group?.participants,
|
|
264
|
-
set: (value) => ensureGroup(msg).participants = value
|
|
265
|
-
},
|
|
266
|
-
mentions: {
|
|
267
|
-
get: () => msg.group?.mentions?.jids,
|
|
268
|
-
set: (value) => ensureGroupMentions(msg).jids = value
|
|
269
|
-
},
|
|
270
|
-
mentionedJids: {
|
|
271
|
-
get: () => msg.group?.mentions?.jids,
|
|
272
|
-
set: (value) => ensureGroupMentions(msg).jids = value
|
|
273
|
-
},
|
|
274
|
-
self: {
|
|
275
|
-
get: () => msg.platform.self,
|
|
276
|
-
set: (value) => msg.platform.self = value
|
|
277
|
-
},
|
|
278
|
-
selfJid: {
|
|
279
|
-
get: () => msg.platform.selfJid,
|
|
280
|
-
set: (value) => msg.platform.selfJid = value
|
|
281
|
-
},
|
|
282
|
-
selfLid: {
|
|
283
|
-
get: () => msg.platform.selfLid,
|
|
284
|
-
set: (value) => msg.platform.selfLid = value
|
|
285
|
-
},
|
|
286
|
-
selfE164: {
|
|
287
|
-
get: () => msg.platform.selfE164,
|
|
288
|
-
set: (value) => msg.platform.selfE164 = value
|
|
289
|
-
},
|
|
290
|
-
fromMe: {
|
|
291
|
-
get: () => msg.platform.fromMe,
|
|
292
|
-
set: (value) => msg.platform.fromMe = value
|
|
293
|
-
},
|
|
294
|
-
location: {
|
|
295
|
-
get: () => msg.payload.location,
|
|
296
|
-
set: (value) => msg.payload.location = value
|
|
297
|
-
},
|
|
298
|
-
sendComposing: {
|
|
299
|
-
get: () => msg.platform.sendComposing,
|
|
300
|
-
set: (value) => msg.platform.sendComposing = value
|
|
301
|
-
},
|
|
302
|
-
reply: {
|
|
303
|
-
get: () => msg.platform.reply,
|
|
304
|
-
set: (value) => msg.platform.reply = value
|
|
305
|
-
},
|
|
306
|
-
sendMedia: {
|
|
307
|
-
get: () => msg.platform.sendMedia,
|
|
308
|
-
set: (value) => msg.platform.sendMedia = value
|
|
309
|
-
},
|
|
310
|
-
mediaPath: {
|
|
311
|
-
get: () => msg.payload.media?.path,
|
|
312
|
-
set: (value) => setMediaField(msg, "path", value)
|
|
313
|
-
},
|
|
314
|
-
mediaType: {
|
|
315
|
-
get: () => msg.payload.media?.type,
|
|
316
|
-
set: (value) => setMediaField(msg, "type", value)
|
|
317
|
-
},
|
|
318
|
-
mediaFileName: {
|
|
319
|
-
get: () => msg.payload.media?.fileName,
|
|
320
|
-
set: (value) => setMediaField(msg, "fileName", value)
|
|
321
|
-
},
|
|
322
|
-
mediaUrl: {
|
|
323
|
-
get: () => msg.payload.media?.url,
|
|
324
|
-
set: (value) => setMediaField(msg, "url", value)
|
|
325
|
-
},
|
|
326
|
-
untrustedStructuredContext: {
|
|
327
|
-
get: () => msg.payload.untrustedStructuredContext,
|
|
328
|
-
set: (value) => msg.payload.untrustedStructuredContext = value
|
|
329
|
-
},
|
|
330
|
-
isBatched: {
|
|
331
|
-
get: () => msg.event.isBatched,
|
|
332
|
-
set: (value) => msg.event.isBatched = value
|
|
333
|
-
}
|
|
334
|
-
});
|
|
335
|
-
}
|
|
336
|
-
function normalizeLegacyFlatWebInboundMessage(msg) {
|
|
337
|
-
const media = msg.mediaPath || msg.mediaType || msg.mediaFileName || msg.mediaUrl ? {
|
|
338
|
-
path: msg.mediaPath,
|
|
339
|
-
type: msg.mediaType,
|
|
340
|
-
fileName: msg.mediaFileName,
|
|
341
|
-
url: msg.mediaUrl
|
|
342
|
-
} : void 0;
|
|
343
|
-
return withDeprecatedWebInboundMessageFlatAliases({
|
|
344
|
-
...msg,
|
|
345
|
-
admission: msg.admission ?? buildDeprecatedFlatWhatsAppInboundAdmission(msg),
|
|
346
|
-
event: {
|
|
347
|
-
id: msg.id,
|
|
348
|
-
timestamp: msg.timestamp,
|
|
349
|
-
isBatched: msg.isBatched
|
|
350
|
-
},
|
|
351
|
-
payload: {
|
|
352
|
-
body: msg.body,
|
|
353
|
-
media,
|
|
354
|
-
location: msg.location,
|
|
355
|
-
untrustedStructuredContext: msg.untrustedStructuredContext
|
|
356
|
-
},
|
|
357
|
-
platform: {
|
|
358
|
-
chatJid: msg.chatId,
|
|
359
|
-
recipientJid: msg.to,
|
|
360
|
-
sender: msg.sender,
|
|
361
|
-
senderJid: msg.senderJid,
|
|
362
|
-
senderE164: msg.senderE164,
|
|
363
|
-
senderName: msg.senderName,
|
|
364
|
-
pushName: msg.pushName,
|
|
365
|
-
self: msg.self,
|
|
366
|
-
selfJid: msg.selfJid,
|
|
367
|
-
selfLid: msg.selfLid,
|
|
368
|
-
selfE164: msg.selfE164,
|
|
369
|
-
fromMe: msg.fromMe,
|
|
370
|
-
sendComposing: msg.sendComposing,
|
|
371
|
-
reply: msg.reply,
|
|
372
|
-
sendMedia: msg.sendMedia
|
|
373
|
-
},
|
|
374
|
-
quote: buildQuoteFromFlatAliases(msg),
|
|
375
|
-
group: buildGroupFromFlatAliases(msg)
|
|
376
|
-
});
|
|
377
|
-
}
|
|
378
|
-
function normalizeWebInboundMessage(msg) {
|
|
379
|
-
if (msg.event && msg.payload && msg.platform) return withDeprecatedWebInboundMessageFlatAliases(msg);
|
|
380
|
-
if (msg.event || msg.payload || msg.platform || msg.quote || msg.group) throw new Error("WhatsApp inbound messages must be either legacy flat or canonical nested; partial nested contexts are not supported.");
|
|
381
|
-
return normalizeLegacyFlatWebInboundMessage(msg);
|
|
382
|
-
}
|
|
383
|
-
//#endregion
|
|
384
|
-
//#region extensions/whatsapp/src/inbound/dedupe.ts
|
|
385
|
-
const recentOutboundMessages = createDedupeCache({
|
|
386
|
-
ttlMs: 20 * 6e4,
|
|
387
|
-
maxSize: 5e3
|
|
388
|
-
});
|
|
389
|
-
function buildMessageKey(params) {
|
|
390
|
-
const accountId = params.accountId.trim();
|
|
391
|
-
const remoteJid = params.remoteJid.trim();
|
|
392
|
-
const messageId = params.messageId.trim();
|
|
393
|
-
if (!accountId || !remoteJid || !messageId || messageId === "unknown") return null;
|
|
394
|
-
return `${accountId}:${remoteJid}:${messageId}`;
|
|
395
|
-
}
|
|
396
|
-
function resetWebInboundDedupe() {
|
|
397
|
-
recentOutboundMessages.clear();
|
|
398
|
-
}
|
|
399
|
-
function rememberRecentOutboundMessage(params) {
|
|
400
|
-
const key = buildMessageKey(params);
|
|
401
|
-
if (!key) return;
|
|
402
|
-
recentOutboundMessages.check(key);
|
|
403
|
-
}
|
|
404
|
-
function isRecentOutboundMessage(params) {
|
|
405
|
-
const key = buildMessageKey(params);
|
|
406
|
-
if (!key) return false;
|
|
407
|
-
return recentOutboundMessages.peek(key);
|
|
408
|
-
}
|
|
409
|
-
//#endregion
|
|
410
|
-
//#region extensions/whatsapp/src/inbound/durable-payload.ts
|
|
411
|
-
var WhatsAppIngressPermanentError = class extends Error {
|
|
412
|
-
constructor(reason, message, options) {
|
|
413
|
-
super(message, options);
|
|
414
|
-
this.reason = reason;
|
|
415
|
-
this.name = "WhatsAppIngressPermanentError";
|
|
416
|
-
}
|
|
417
|
-
};
|
|
418
|
-
function serializeWhatsAppDurableInboundMessage(message) {
|
|
419
|
-
const timestamp = message.messageTimestamp;
|
|
420
|
-
let serializedMessage = message;
|
|
421
|
-
if (timestamp != null && typeof timestamp === "object") try {
|
|
422
|
-
const numericTimestamp = Number(timestamp);
|
|
423
|
-
if (Number.isFinite(numericTimestamp)) serializedMessage = {
|
|
424
|
-
...message,
|
|
425
|
-
messageTimestamp: numericTimestamp
|
|
426
|
-
};
|
|
427
|
-
} catch {}
|
|
428
|
-
return JSON.parse(JSON.stringify(serializedMessage, BufferJSON.replacer));
|
|
429
|
-
}
|
|
430
|
-
function deserializeWhatsAppDurableInboundMessage(message) {
|
|
431
|
-
try {
|
|
432
|
-
return JSON.parse(JSON.stringify(message), BufferJSON.reviver);
|
|
433
|
-
} catch (error) {
|
|
434
|
-
throw new WhatsAppIngressPermanentError("invalid-payload", "WhatsApp ingress row contains an invalid serialized message", { cause: error });
|
|
435
|
-
}
|
|
436
|
-
}
|
|
437
|
-
//#endregion
|
|
438
|
-
//#region extensions/whatsapp/src/inbound/durable-receive.ts
|
|
439
|
-
const WHATSAPP_DURABLE_INBOUND_PENDING_MAX_ENTRIES = 450;
|
|
440
|
-
const WHATSAPP_DURABLE_INBOUND_COMPLETED_MAX_ENTRIES = 5e3;
|
|
441
|
-
const WHATSAPP_DURABLE_INBOUND_PENDING_TTL_MS = 720 * 60 * 60 * 1e3;
|
|
442
|
-
const WHATSAPP_DURABLE_INBOUND_COMPLETED_TTL_MS = 10080 * 60 * 1e3;
|
|
443
|
-
const WHATSAPP_DURABLE_INBOUND_PRUNE_INTERVAL_MS = 3600 * 1e3;
|
|
444
|
-
const WHATSAPP_DURABLE_INBOUND_PAYLOAD_VERSION = 1;
|
|
445
|
-
function hashNamespacePart(value) {
|
|
446
|
-
return createHash("sha256").update(value).digest("hex").slice(0, 24);
|
|
447
|
-
}
|
|
448
|
-
function createWhatsAppDurableInboundMessageId(params) {
|
|
449
|
-
return createHash("sha256").update(`${params.remoteJid}\n${params.id}`).digest("hex");
|
|
450
|
-
}
|
|
451
|
-
function inspectWhatsAppIngressMessage(message) {
|
|
452
|
-
const remoteJid = message.key?.remoteJid?.trim();
|
|
453
|
-
const id = message.key?.id?.trim();
|
|
454
|
-
if (!remoteJid || !id) throw new WhatsAppIngressPermanentError("missing-message-key", "WhatsApp ingress message is missing key.remoteJid or key.id");
|
|
455
|
-
return {
|
|
456
|
-
eventId: createWhatsAppDurableInboundMessageId({
|
|
457
|
-
remoteJid,
|
|
458
|
-
id
|
|
459
|
-
}),
|
|
460
|
-
laneKey: remoteJid
|
|
461
|
-
};
|
|
462
|
-
}
|
|
463
|
-
/** Account-scoped queue shared with the pre-drain WhatsApp receive journal. */
|
|
464
|
-
function createWhatsAppDurableInboundQueue(accountId) {
|
|
465
|
-
return getWhatsAppRuntime().state.openChannelIngressQueue({
|
|
466
|
-
accountId: hashNamespacePart(accountId),
|
|
467
|
-
stateDir: getWhatsAppRuntime().state.resolveStateDir()
|
|
468
|
-
});
|
|
469
|
-
}
|
|
470
|
-
/** Raw receive chokepoint: append first, then let the drain normalize and dispatch. */
|
|
471
|
-
async function enqueueWhatsAppDurableInbound(params) {
|
|
472
|
-
const facts = inspectWhatsAppIngressMessage(params.message);
|
|
473
|
-
const receivedAt = params.receivedAt ?? Date.now();
|
|
474
|
-
return await params.queue.enqueue(facts.eventId, {
|
|
475
|
-
message: serializeWhatsAppDurableInboundMessage(params.message),
|
|
476
|
-
upsertType: params.upsertType,
|
|
477
|
-
...params.skipStaleAppend === void 0 ? {} : { skipStaleAppend: params.skipStaleAppend },
|
|
478
|
-
...params.skipRecentOutboundEcho === void 0 ? {} : { skipRecentOutboundEcho: params.skipRecentOutboundEcho },
|
|
479
|
-
receivedAt,
|
|
480
|
-
...params.receiveOrder === void 0 ? {} : { receiveOrder: params.receiveOrder }
|
|
481
|
-
}, {
|
|
482
|
-
receivedAt,
|
|
483
|
-
laneKey: facts.laneKey
|
|
484
|
-
});
|
|
485
|
-
}
|
|
486
|
-
function resolveWhatsAppIngressNonRetryableFailure(error) {
|
|
487
|
-
return error instanceof WhatsAppIngressPermanentError ? {
|
|
488
|
-
reason: error.reason,
|
|
489
|
-
message: error.message
|
|
490
|
-
} : null;
|
|
491
|
-
}
|
|
492
|
-
/** Shared monitor with per-conversation lanes and completion at reply-lane adoption. */
|
|
493
|
-
function createWhatsAppIngressMonitor(params) {
|
|
494
|
-
return createChannelIngressMonitor({
|
|
495
|
-
queue: params.queue,
|
|
496
|
-
inspect: (message) => inspectWhatsAppIngressMessage(message),
|
|
497
|
-
payload: {
|
|
498
|
-
version: WHATSAPP_DURABLE_INBOUND_PAYLOAD_VERSION,
|
|
499
|
-
serialize: (message, { receivedAt }) => ({
|
|
500
|
-
message: serializeWhatsAppDurableInboundMessage(message),
|
|
501
|
-
receivedAt
|
|
502
|
-
}),
|
|
503
|
-
deserialize: (payload) => deserializeWhatsAppDurableInboundMessage(payload.message),
|
|
504
|
-
encode: ({ body }) => body,
|
|
505
|
-
decode: (payload) => ({
|
|
506
|
-
version: WHATSAPP_DURABLE_INBOUND_PAYLOAD_VERSION,
|
|
507
|
-
body: payload
|
|
508
|
-
}),
|
|
509
|
-
createClaimError: (kind) => new WhatsAppIngressPermanentError(kind === "invalid-version" ? "invalid-payload" : "event-id-mismatch", kind === "invalid-version" ? "WhatsApp ingress row has an invalid payload version" : "WhatsApp ingress row identity does not match its transport message key")
|
|
510
|
-
},
|
|
511
|
-
deliver: (message, lifecycle, claim) => params.dispatch(message, claim.payload, lifecycle),
|
|
512
|
-
pollIntervalMs: params.pollIntervalMs,
|
|
513
|
-
retention: {
|
|
514
|
-
pruneIntervalMs: WHATSAPP_DURABLE_INBOUND_PRUNE_INTERVAL_MS,
|
|
515
|
-
pendingTtlMs: WHATSAPP_DURABLE_INBOUND_PENDING_TTL_MS,
|
|
516
|
-
pendingMaxEntries: WHATSAPP_DURABLE_INBOUND_PENDING_MAX_ENTRIES,
|
|
517
|
-
completedTtlMs: WHATSAPP_DURABLE_INBOUND_COMPLETED_TTL_MS,
|
|
518
|
-
completedMaxEntries: WHATSAPP_DURABLE_INBOUND_COMPLETED_MAX_ENTRIES,
|
|
519
|
-
failedTtlMs: WHATSAPP_DURABLE_INBOUND_PENDING_TTL_MS,
|
|
520
|
-
failedMaxEntries: WHATSAPP_DURABLE_INBOUND_PENDING_MAX_ENTRIES
|
|
521
|
-
},
|
|
522
|
-
drain: {
|
|
523
|
-
resolveNonRetryableFailure: resolveWhatsAppIngressNonRetryableFailure,
|
|
524
|
-
deriveLaneKey: (record) => {
|
|
525
|
-
try {
|
|
526
|
-
return inspectWhatsAppIngressMessage(deserializeWhatsAppDurableInboundMessage(record.payload.message)).laneKey;
|
|
527
|
-
} catch {
|
|
528
|
-
return record.id;
|
|
529
|
-
}
|
|
530
|
-
},
|
|
531
|
-
...params.onLog ? { onLog: params.onLog } : {}
|
|
532
|
-
},
|
|
533
|
-
...params.abortSignal ? { abortSignal: params.abortSignal } : {},
|
|
534
|
-
admissionMode: "while-running",
|
|
535
|
-
createStoppedError: () => /* @__PURE__ */ new Error("WhatsApp ingress monitor is stopped."),
|
|
536
|
-
...params.onError ? { onError: params.onError } : {},
|
|
537
|
-
...params.onActivityChange ? { onActivityChange: params.onActivityChange } : {}
|
|
538
|
-
});
|
|
539
|
-
}
|
|
540
|
-
//#endregion
|
|
541
|
-
//#region extensions/whatsapp/src/inbound/ingress-lifecycle.ts
|
|
542
|
-
const ingressLifecycleKey = Symbol("whatsappIngressLifecycle");
|
|
543
|
-
function attachWhatsAppIngressLifecycle(message, lifecycle) {
|
|
544
|
-
if (lifecycle) message[ingressLifecycleKey] = lifecycle;
|
|
545
|
-
return message;
|
|
546
|
-
}
|
|
547
|
-
function resolveWhatsAppIngressLifecycle(message) {
|
|
548
|
-
return message[ingressLifecycleKey];
|
|
549
|
-
}
|
|
550
|
-
//#endregion
|
|
551
|
-
//#region extensions/whatsapp/src/inbound/lifecycle.ts
|
|
552
|
-
function attachEmitterListener(emitter, event, listener) {
|
|
553
|
-
emitter.on(event, listener);
|
|
554
|
-
return () => {
|
|
555
|
-
if (typeof emitter.off === "function") {
|
|
556
|
-
emitter.off(event, listener);
|
|
557
|
-
return;
|
|
558
|
-
}
|
|
559
|
-
if (typeof emitter.removeListener === "function") emitter.removeListener(event, listener);
|
|
560
|
-
};
|
|
561
|
-
}
|
|
562
|
-
function closeInboundMonitorSocket(sock) {
|
|
563
|
-
if (typeof sock.end === "function") {
|
|
564
|
-
sock.end(/* @__PURE__ */ new Error("OpenClaw WhatsApp listener close"));
|
|
565
|
-
return;
|
|
566
|
-
}
|
|
567
|
-
sock.ws?.close?.();
|
|
568
|
-
}
|
|
569
|
-
//#endregion
|
|
570
|
-
//#region extensions/whatsapp/src/inbound/media.ts
|
|
571
|
-
var WhatsAppInboundMediaLimitExceededError = class extends Error {
|
|
572
|
-
constructor(maxBytes) {
|
|
573
|
-
super(`Media exceeds ${Math.round(maxBytes / (1024 * 1024))}MB limit`);
|
|
574
|
-
this.name = "WhatsAppInboundMediaLimitExceededError";
|
|
575
|
-
}
|
|
576
|
-
};
|
|
577
|
-
function unwrapMessage(message) {
|
|
578
|
-
return normalizeMessageContent(message);
|
|
579
|
-
}
|
|
580
|
-
async function downloadInboundMedia(msg, sock, maxBytes = 50 * 1024 * 1024) {
|
|
581
|
-
const message = unwrapMessage(msg.message);
|
|
582
|
-
if (!message) return;
|
|
583
|
-
const mimetype = resolveInboundMediaMimetype(message);
|
|
584
|
-
const fileName = message.documentMessage?.fileName ?? void 0;
|
|
585
|
-
if (!message.imageMessage && !message.videoMessage && !message.documentMessage && !message.audioMessage && !message.stickerMessage) return;
|
|
586
|
-
return {
|
|
587
|
-
saved: await saveMediaStream(await downloadMediaMessage(msg, "stream", {}, {
|
|
588
|
-
reuploadRequest: sock.updateMediaMessage,
|
|
589
|
-
logger: sock.logger
|
|
590
|
-
}), mimetype, "inbound", maxBytes, fileName).catch((err) => {
|
|
591
|
-
if (err instanceof Error && /Media exceeds/i.test(err.message)) throw new WhatsAppInboundMediaLimitExceededError(maxBytes);
|
|
592
|
-
throw err;
|
|
593
|
-
}),
|
|
594
|
-
mimetype,
|
|
595
|
-
fileName
|
|
596
|
-
};
|
|
597
|
-
}
|
|
598
|
-
async function downloadQuotedInboundMedia(msg, sock, maxBytes = 50 * 1024 * 1024) {
|
|
599
|
-
const contextInfo = extractContextInfo(unwrapMessage(msg.message));
|
|
600
|
-
if (!contextInfo?.quotedMessage) return;
|
|
601
|
-
const quotedMessage = contextInfo.quotedMessage;
|
|
602
|
-
return downloadInboundMedia({
|
|
603
|
-
key: {
|
|
604
|
-
id: contextInfo?.stanzaId || void 0,
|
|
605
|
-
remoteJid: contextInfo.remoteJid ?? msg.key?.remoteJid ?? void 0,
|
|
606
|
-
participant: contextInfo?.participant ?? void 0,
|
|
607
|
-
fromMe: false
|
|
608
|
-
},
|
|
609
|
-
message: quotedMessage,
|
|
610
|
-
messageTimestamp: msg.messageTimestamp
|
|
611
|
-
}, sock, maxBytes);
|
|
612
|
-
}
|
|
613
|
-
//#endregion
|
|
614
|
-
//#region extensions/whatsapp/src/inbound/monitor.ts
|
|
615
|
-
const LOGGED_OUT_STATUS = DisconnectReason.loggedOut;
|
|
616
|
-
const RECONNECT_IN_PROGRESS_ERROR = "no active socket - reconnection in progress";
|
|
617
|
-
const GROUP_META_TTL_MS = 300 * 1e3;
|
|
618
|
-
const BAILEYS_MESSAGE_TTL_MS = 600 * 1e3;
|
|
619
|
-
const INBOUND_CLOSE_DRAIN_TIMEOUT_MS = 5e3;
|
|
620
|
-
const WHATSAPP_INGRESS_DRAIN_INTERVAL_MS = 1e3;
|
|
621
|
-
const WHATSAPP_GROUP_METADATA_CACHE_MAX_ENTRIES = 500;
|
|
622
|
-
function resolveGroupMetadataExpiresAt(nowRaw = Date.now()) {
|
|
623
|
-
const now = asDateTimestampMs(nowRaw);
|
|
624
|
-
return now === void 0 ? void 0 : resolveExpiresAtMsFromDurationMs(GROUP_META_TTL_MS, { nowMs: now });
|
|
625
|
-
}
|
|
626
|
-
function parseWhatsAppTimestampSeconds(value) {
|
|
627
|
-
if (value == null) return;
|
|
628
|
-
if (typeof value === "string") return parseStrictFiniteNumber(value);
|
|
629
|
-
const parsed = Number(value);
|
|
630
|
-
return Number.isFinite(parsed) ? parsed : void 0;
|
|
631
|
-
}
|
|
632
|
-
function rememberGroupMetadataCacheEntry(cache, jid, entry) {
|
|
633
|
-
if (asDateTimestampMs(entry.expires) === void 0) {
|
|
634
|
-
cache.delete(jid);
|
|
635
|
-
return;
|
|
636
|
-
}
|
|
637
|
-
if (cache.has(jid)) cache.delete(jid);
|
|
638
|
-
cache.set(jid, entry);
|
|
639
|
-
while (cache.size > WHATSAPP_GROUP_METADATA_CACHE_MAX_ENTRIES) {
|
|
640
|
-
const oldest = cache.keys().next();
|
|
641
|
-
if (oldest.done) break;
|
|
642
|
-
cache.delete(oldest.value);
|
|
643
|
-
}
|
|
644
|
-
}
|
|
645
|
-
function readGroupMetadataCacheEntry(cache, jid) {
|
|
646
|
-
const entry = cache.get(jid);
|
|
647
|
-
if (!entry) return null;
|
|
648
|
-
const now = asDateTimestampMs(Date.now());
|
|
649
|
-
const expires = asDateTimestampMs(entry.expires);
|
|
650
|
-
if (now === void 0 || expires === void 0 || expires <= now) {
|
|
651
|
-
cache.delete(jid);
|
|
652
|
-
return null;
|
|
653
|
-
}
|
|
654
|
-
cache.delete(jid);
|
|
655
|
-
cache.set(jid, entry);
|
|
656
|
-
return entry;
|
|
657
|
-
}
|
|
658
|
-
function rememberWhatsAppBaileysCacheEntry(cache, key, value, ttlMs) {
|
|
659
|
-
if (!cache) return;
|
|
660
|
-
if (cache.has(key)) cache.delete(key);
|
|
661
|
-
cache.set(key, {
|
|
662
|
-
expiresAt: Date.now() + ttlMs,
|
|
663
|
-
value
|
|
664
|
-
});
|
|
665
|
-
while (cache.size > WHATSAPP_GROUP_METADATA_CACHE_MAX_ENTRIES) {
|
|
666
|
-
const oldest = cache.keys().next();
|
|
667
|
-
if (oldest.done) break;
|
|
668
|
-
cache.delete(oldest.value);
|
|
669
|
-
}
|
|
670
|
-
}
|
|
671
|
-
function readWhatsAppBaileysCacheEntry(cache, key) {
|
|
672
|
-
const entry = cache.get(key);
|
|
673
|
-
if (!entry) return;
|
|
674
|
-
if (entry.expiresAt <= Date.now()) {
|
|
675
|
-
cache.delete(key);
|
|
676
|
-
return;
|
|
677
|
-
}
|
|
678
|
-
cache.delete(key);
|
|
679
|
-
cache.set(key, entry);
|
|
680
|
-
return entry.value;
|
|
681
|
-
}
|
|
682
|
-
function logWhatsAppVerbose(enabled, message) {
|
|
683
|
-
if (!enabled) return;
|
|
684
|
-
defaultRuntime.log(message);
|
|
685
|
-
}
|
|
686
|
-
function isDirectUserJid(jid) {
|
|
687
|
-
return /^(\d+)(?::\d+)?@(s\.whatsapp\.net|c\.us|lid|hosted|hosted\.lid)$/i.test(jid.trim());
|
|
688
|
-
}
|
|
689
|
-
function getActiveReachoutTimelock(state) {
|
|
690
|
-
if (state?.isActive !== true) return;
|
|
691
|
-
const endsAt = state.timeEnforcementEnds?.getTime();
|
|
692
|
-
return endsAt === void 0 || !Number.isFinite(endsAt) || endsAt > Date.now() ? state : void 0;
|
|
693
|
-
}
|
|
694
|
-
function formatReachoutTimelockError(state) {
|
|
695
|
-
const details = [state.enforcementType ? `type=${state.enforcementType}` : void 0, state.timeEnforcementEnds instanceof Date && Number.isFinite(state.timeEnforcementEnds.getTime()) ? `until=${state.timeEnforcementEnds.toISOString()}` : void 0].filter(Boolean);
|
|
696
|
-
return `WhatsApp reachout timelock is active; direct messages are temporarily blocked${details.length ? ` (${details.join(", ")})` : ""}`;
|
|
697
|
-
}
|
|
698
|
-
function recordAcceptedInboundActivity(accountId) {
|
|
699
|
-
recordChannelActivity({
|
|
700
|
-
channel: "whatsapp",
|
|
701
|
-
accountId,
|
|
702
|
-
direction: "inbound"
|
|
703
|
-
});
|
|
704
|
-
}
|
|
705
|
-
function isRetryableSendDisconnectError(err) {
|
|
706
|
-
if (isWhatsAppSocketOperationTimeoutError(err)) return false;
|
|
707
|
-
return /closed|reset|timed\s*out|disconnect|no active socket/i.test(formatError(err));
|
|
708
|
-
}
|
|
709
|
-
function shouldClearSocketRefAfterSendFailure(err) {
|
|
710
|
-
return /closed|reset|disconnect|no active socket/i.test(formatError(err));
|
|
711
|
-
}
|
|
712
|
-
async function attachWebInboxToSocket(options) {
|
|
713
|
-
const inboundLogger = getChildLogger({ module: "web-inbound" });
|
|
714
|
-
const inboundConsoleLog = createSubsystemLogger("gateway/channels/whatsapp").child("inbound");
|
|
715
|
-
const sock = options.sock;
|
|
716
|
-
const connectedAtMs = Date.now();
|
|
717
|
-
if (options.socketRef) options.socketRef.current = sock;
|
|
718
|
-
const shouldRetryDisconnect = () => options.shouldRetryDisconnect?.() === true;
|
|
719
|
-
const disconnectRetryPolicy = options.disconnectRetryPolicy ?? DEFAULT_RECONNECT_POLICY;
|
|
720
|
-
const sendRetryMaxAttempts = disconnectRetryPolicy.maxAttempts > 0 ? disconnectRetryPolicy.maxAttempts : DEFAULT_RECONNECT_POLICY.maxAttempts;
|
|
721
|
-
const sendOperationTimeoutMs = resolveWhatsAppSocketOperationTimeoutMs(options.socketTiming.defaultQueryTimeoutMs);
|
|
722
|
-
let onCloseResolve = null;
|
|
723
|
-
const onClose = new Promise((resolve) => {
|
|
724
|
-
onCloseResolve = resolve;
|
|
725
|
-
});
|
|
726
|
-
const resolveClose = (reason) => {
|
|
727
|
-
if (!onCloseResolve) return;
|
|
728
|
-
const resolver = onCloseResolve;
|
|
729
|
-
onCloseResolve = null;
|
|
730
|
-
resolver(reason);
|
|
731
|
-
};
|
|
732
|
-
const presence = options.selfChatMode ? "unavailable" : "available";
|
|
733
|
-
try {
|
|
734
|
-
await createWhatsAppSocketOperationTimeoutAdapter(sock, sendOperationTimeoutMs).sendPresenceUpdate(presence);
|
|
735
|
-
logWhatsAppVerbose(options.verbose, `Sent global '${presence}' presence on connect`);
|
|
736
|
-
} catch (err) {
|
|
737
|
-
logWhatsAppVerbose(options.verbose, `Failed to send '${presence}' presence on connect: ${String(err)}`);
|
|
738
|
-
}
|
|
739
|
-
const selfIdentity = await readWebSelfIdentityForDecision(options.authDir, sock.user);
|
|
740
|
-
if (selfIdentity.outcome === "unstable") throw new WhatsAppAuthUnstableError("WhatsApp auth state is still stabilizing; retrying inbox attach.");
|
|
741
|
-
const self = selfIdentity.identity;
|
|
742
|
-
const getCurrentSock = () => {
|
|
743
|
-
if (!options.socketRef) return sock;
|
|
744
|
-
if (options.socketRef.current) return options.socketRef.current;
|
|
745
|
-
if (!self.e164 && !self.jid && !self.lid) return null;
|
|
746
|
-
const successor = getWhatsAppConnectionController(options.accountId);
|
|
747
|
-
if (!successor) return null;
|
|
748
|
-
const successorIdentity = successor.getSelfIdentity();
|
|
749
|
-
if (!successorIdentity || !identitiesOverlap(self, successorIdentity)) return null;
|
|
750
|
-
return successor.getCurrentSock();
|
|
751
|
-
};
|
|
752
|
-
const durableInboundQueue = options.durableInboundQueue ?? createWhatsAppDurableInboundQueue(options.accountId);
|
|
753
|
-
const inboundDebounceMs = Math.max(0, Math.trunc(options.debounceMs ?? 0));
|
|
754
|
-
const pendingDebounceKeys = /* @__PURE__ */ new Set();
|
|
755
|
-
const activeInboundFlushes = /* @__PURE__ */ new Set();
|
|
756
|
-
const pendingMessageHandlers = /* @__PURE__ */ new Set();
|
|
757
|
-
let durableIngressActive = false;
|
|
758
|
-
const debounceWorkWaiters = /* @__PURE__ */ new Set();
|
|
759
|
-
const notifyDebounceWork = () => {
|
|
760
|
-
if (debounceWorkWaiters.size === 0) return;
|
|
761
|
-
const waiters = [...debounceWorkWaiters];
|
|
762
|
-
debounceWorkWaiters.clear();
|
|
763
|
-
for (const resolve of waiters) resolve();
|
|
764
|
-
};
|
|
765
|
-
const waitForDebounceWorkOrIdle = (handlers) => {
|
|
766
|
-
if (pendingDebounceKeys.size > 0 || activeInboundFlushes.size > 0) return Promise.resolve();
|
|
767
|
-
if (pendingMessageHandlers.size === 0) return Promise.resolve();
|
|
768
|
-
return new Promise((resolve) => {
|
|
769
|
-
const finish = () => {
|
|
770
|
-
debounceWorkWaiters.delete(finish);
|
|
771
|
-
resolve();
|
|
772
|
-
};
|
|
773
|
-
debounceWorkWaiters.add(finish);
|
|
774
|
-
Promise.allSettled(handlers).then(finish);
|
|
775
|
-
});
|
|
776
|
-
};
|
|
777
|
-
let nextReceiveOrder = 0;
|
|
778
|
-
const publishPendingWorkState = (at = Date.now()) => {
|
|
779
|
-
options.onPendingWorkChanged?.(pendingMessageHandlers.size + pendingDebounceKeys.size + activeInboundFlushes.size + (durableIngressActive ? 1 : 0), at);
|
|
780
|
-
};
|
|
781
|
-
const buildInboundDebounceKey = (msg) => {
|
|
782
|
-
const admission = requireWhatsAppInboundAdmission(msg);
|
|
783
|
-
const sender = msg.platform.sender;
|
|
784
|
-
const senderKey = admission.conversation.kind === "group" ? getPrimaryIdentityId(sender ?? null) ?? msg.platform.senderJid ?? msg.platform.senderE164 ?? msg.platform.senderName ?? admission.sender.id : admission.conversation.id;
|
|
785
|
-
if (!senderKey) return null;
|
|
786
|
-
return `${admission.accountId}:${admission.conversation.id}:${senderKey}`;
|
|
787
|
-
};
|
|
788
|
-
const shouldDebounceInboundMessage = (msg) => options.shouldDebounce?.(msg) ?? true;
|
|
789
|
-
const orderDebouncedInboundEntries = (entries) => entries.toSorted((a, b) => {
|
|
790
|
-
const timestampDiff = (a.event.timestamp ?? 0) - (b.event.timestamp ?? 0);
|
|
791
|
-
if (timestampDiff !== 0) return timestampDiff;
|
|
792
|
-
return (a.receiveOrder ?? 0) - (b.receiveOrder ?? 0);
|
|
793
|
-
});
|
|
794
|
-
const buildFlushIngressLifecycle = (entries) => {
|
|
795
|
-
const lifecycles = entries.map((entry) => entry.turnAdoptionLifecycle).filter((lifecycle) => lifecycle !== void 0);
|
|
796
|
-
const [firstLifecycle] = lifecycles;
|
|
797
|
-
if (!firstLifecycle) return {
|
|
798
|
-
lifecycle: void 0,
|
|
799
|
-
settle: async () => {},
|
|
800
|
-
abandon: async () => {}
|
|
801
|
-
};
|
|
802
|
-
let handedOff = false;
|
|
803
|
-
const adoptAll = async () => {
|
|
804
|
-
for (const lifecycle of lifecycles) await lifecycle.onAdopted();
|
|
805
|
-
};
|
|
806
|
-
return {
|
|
807
|
-
lifecycle: {
|
|
808
|
-
abortSignal: lifecycles.length === 1 ? firstLifecycle.abortSignal : AbortSignal.any(lifecycles.map((lifecycle) => lifecycle.abortSignal)),
|
|
809
|
-
onAdopted: async () => {
|
|
810
|
-
handedOff = true;
|
|
811
|
-
await adoptAll();
|
|
812
|
-
},
|
|
813
|
-
onDeferred: () => {
|
|
814
|
-
handedOff = true;
|
|
815
|
-
for (const lifecycle of lifecycles) lifecycle.onDeferred();
|
|
816
|
-
},
|
|
817
|
-
onAdoptionFinalizing: () => {
|
|
818
|
-
for (const lifecycle of lifecycles) lifecycle.onAdoptionFinalizing();
|
|
819
|
-
},
|
|
820
|
-
onAbandoned: async () => {
|
|
821
|
-
handedOff = true;
|
|
822
|
-
await Promise.all(lifecycles.map((lifecycle) => Promise.resolve(lifecycle.onAbandoned())));
|
|
823
|
-
}
|
|
824
|
-
},
|
|
825
|
-
settle: async () => {
|
|
826
|
-
if (!handedOff) await adoptAll();
|
|
827
|
-
},
|
|
828
|
-
abandon: async () => {
|
|
829
|
-
if (!handedOff) {
|
|
830
|
-
handedOff = true;
|
|
831
|
-
await Promise.all(lifecycles.map((lifecycle) => Promise.resolve(lifecycle.onAbandoned())));
|
|
832
|
-
}
|
|
833
|
-
}
|
|
834
|
-
};
|
|
835
|
-
};
|
|
836
|
-
const debouncer = createInboundDebouncer({
|
|
837
|
-
debounceMs: inboundDebounceMs,
|
|
838
|
-
buildKey: (msg) => msg.debounceKey ?? buildInboundDebounceKey(msg),
|
|
839
|
-
shouldDebounce: shouldDebounceInboundMessage,
|
|
840
|
-
onFlush: async (entries) => {
|
|
841
|
-
let finishFlush;
|
|
842
|
-
const flushTask = new Promise((resolve) => {
|
|
843
|
-
finishFlush = resolve;
|
|
844
|
-
});
|
|
845
|
-
activeInboundFlushes.add(flushTask);
|
|
846
|
-
publishPendingWorkState();
|
|
847
|
-
notifyDebounceWork();
|
|
848
|
-
try {
|
|
849
|
-
const orderedEntries = orderDebouncedInboundEntries(entries);
|
|
850
|
-
const last = orderedEntries.at(-1);
|
|
851
|
-
if (!last) return;
|
|
852
|
-
const { lifecycle, settle, abandon } = buildFlushIngressLifecycle(orderedEntries);
|
|
853
|
-
try {
|
|
854
|
-
if (orderedEntries.length === 1) {
|
|
855
|
-
await options.onMessage(attachWhatsAppIngressLifecycle(last, lifecycle));
|
|
856
|
-
await settle();
|
|
857
|
-
await Promise.all(orderedEntries.map((entry) => maybeMarkInboundAsRead(entry.readReceipt)));
|
|
858
|
-
return;
|
|
859
|
-
}
|
|
860
|
-
const mentioned = /* @__PURE__ */ new Set();
|
|
861
|
-
for (const entry of orderedEntries) for (const jid of entry.group?.mentions?.jids ?? []) mentioned.add(jid);
|
|
862
|
-
const combinedBody = orderedEntries.map((entry) => entry.payload.body).filter(Boolean).join("\n");
|
|
863
|
-
const combinedCommandBody = orderedEntries.map((entry) => entry.payload.commandBody ?? entry.payload.body).filter(Boolean).join("\n");
|
|
864
|
-
const combinedMentions = mentioned.size > 0 ? {
|
|
865
|
-
...last.group?.mentions,
|
|
866
|
-
jids: Array.from(mentioned)
|
|
867
|
-
} : last.group?.mentions;
|
|
868
|
-
const combinedGroup = last.group || combinedMentions ? {
|
|
869
|
-
...last.group,
|
|
870
|
-
mentions: combinedMentions
|
|
871
|
-
} : void 0;
|
|
872
|
-
const combinedMessage = attachWhatsAppIngressLifecycle(withDeprecatedWebInboundMessageFlatAliases({
|
|
873
|
-
...last,
|
|
874
|
-
...lifecycle ? { turnAdoptionLifecycle: lifecycle } : {},
|
|
875
|
-
payload: {
|
|
876
|
-
...last.payload,
|
|
877
|
-
body: combinedBody,
|
|
878
|
-
commandBody: combinedCommandBody
|
|
879
|
-
},
|
|
880
|
-
group: combinedGroup,
|
|
881
|
-
event: {
|
|
882
|
-
...last.event,
|
|
883
|
-
isBatched: true
|
|
884
|
-
}
|
|
885
|
-
}), lifecycle);
|
|
886
|
-
await options.onMessage(combinedMessage);
|
|
887
|
-
await settle();
|
|
888
|
-
await Promise.all(orderedEntries.map((entry) => maybeMarkInboundAsRead(entry.readReceipt)));
|
|
889
|
-
} catch (error) {
|
|
890
|
-
await abandon();
|
|
891
|
-
throw error;
|
|
892
|
-
}
|
|
893
|
-
} finally {
|
|
894
|
-
for (const entry of entries) if (entry.debounceKey) pendingDebounceKeys.delete(entry.debounceKey);
|
|
895
|
-
activeInboundFlushes.delete(flushTask);
|
|
896
|
-
finishFlush();
|
|
897
|
-
publishPendingWorkState();
|
|
898
|
-
}
|
|
899
|
-
},
|
|
900
|
-
onError: (err) => {
|
|
901
|
-
inboundLogger.error({ error: String(err) }, "failed handling inbound web message");
|
|
902
|
-
inboundConsoleLog.error(`Failed handling inbound web message: ${String(err)}`);
|
|
903
|
-
}
|
|
904
|
-
});
|
|
905
|
-
const groupMetadataCache = options.groupMetadataCache ?? /* @__PURE__ */ new Map();
|
|
906
|
-
const groupMetaCache = /* @__PURE__ */ new Map();
|
|
907
|
-
const lidLookup = sock.signalRepository?.lidMapping;
|
|
908
|
-
const publishedGroupMetadataJids = /* @__PURE__ */ new Set();
|
|
909
|
-
const invalidatedGroupMetadataJids = /* @__PURE__ */ new Set();
|
|
910
|
-
let groupMetadataCacheClosed = false;
|
|
911
|
-
const resolveInboundJid = async (jid) => resolveJidToE164(jid, {
|
|
912
|
-
authDir: options.authDir,
|
|
913
|
-
lidLookup
|
|
914
|
-
});
|
|
915
|
-
const resolveReactionTargetJids = async (jid) => resolveEquivalentWhatsAppDirectChatJids(jid, {
|
|
916
|
-
authDir: options.authDir,
|
|
917
|
-
lidLookup
|
|
918
|
-
});
|
|
919
|
-
const rememberBaileysMessage = (remoteJid, messageId, message) => {
|
|
920
|
-
if (!options.recentMessageKeys || !remoteJid || !messageId || !message) return;
|
|
921
|
-
rememberWhatsAppBaileysCacheEntry(options.recentMessageKeys, `${remoteJid}:${messageId}`, message, BAILEYS_MESSAGE_TTL_MS);
|
|
922
|
-
};
|
|
923
|
-
const rememberOutboundMessage = (remoteJid, result) => {
|
|
924
|
-
const messageId = typeof result === "object" && result && "key" in result ? result.key?.id ?? "" : "";
|
|
925
|
-
if (!messageId) return;
|
|
926
|
-
rememberRecentOutboundMessage({
|
|
927
|
-
accountId: options.accountId,
|
|
928
|
-
remoteJid,
|
|
929
|
-
messageId
|
|
930
|
-
});
|
|
931
|
-
const message = typeof result === "object" && result && "message" in result ? result.message : void 0;
|
|
932
|
-
rememberBaileysMessage(remoteJid, messageId, message);
|
|
933
|
-
cacheInboundMessageMeta(options.accountId, remoteJid, messageId, {
|
|
934
|
-
fromMe: true,
|
|
935
|
-
body: extractText(message ?? void 0)
|
|
936
|
-
});
|
|
937
|
-
};
|
|
938
|
-
const trackLateAcceptedSend = (jid, promise) => {
|
|
939
|
-
promise.then((result) => {
|
|
940
|
-
rememberOutboundMessage(jid, result);
|
|
941
|
-
}, () => {});
|
|
942
|
-
};
|
|
943
|
-
let reachoutTimeLock;
|
|
944
|
-
let reachoutTimeLockFetch;
|
|
945
|
-
let reachoutTimeLockVersion = 0;
|
|
946
|
-
let verifiedSendReady;
|
|
947
|
-
const rememberReachoutTimeLock = (state) => {
|
|
948
|
-
reachoutTimeLock = state;
|
|
949
|
-
reachoutTimeLockVersion += 1;
|
|
950
|
-
verifiedSendReady = void 0;
|
|
951
|
-
};
|
|
952
|
-
const fetchReachoutTimeLock = async (currentSock) => {
|
|
953
|
-
if (typeof currentSock.fetchAccountReachoutTimelock !== "function") return;
|
|
954
|
-
if (!reachoutTimeLockFetch) reachoutTimeLockFetch = currentSock.fetchAccountReachoutTimelock().then((state) => {
|
|
955
|
-
rememberReachoutTimeLock(state);
|
|
956
|
-
return state;
|
|
957
|
-
}).catch((err) => {
|
|
958
|
-
logWhatsAppVerbose(options.verbose, `Failed fetching WhatsApp reachout timelock before send: ${formatError(err)}`);
|
|
959
|
-
}).finally(() => {
|
|
960
|
-
reachoutTimeLockFetch = void 0;
|
|
961
|
-
});
|
|
962
|
-
return await reachoutTimeLockFetch;
|
|
963
|
-
};
|
|
964
|
-
const rememberVerifiedSendReady = (jid, currentSock) => {
|
|
965
|
-
verifiedSendReady = {
|
|
966
|
-
jid,
|
|
967
|
-
sock: currentSock,
|
|
968
|
-
reachoutTimeLockVersion
|
|
969
|
-
};
|
|
970
|
-
};
|
|
971
|
-
const consumeVerifiedSendReady = (jid, currentSock) => {
|
|
972
|
-
if (verifiedSendReady?.jid !== jid || verifiedSendReady.sock !== currentSock || verifiedSendReady.reachoutTimeLockVersion !== reachoutTimeLockVersion) return false;
|
|
973
|
-
verifiedSendReady = void 0;
|
|
974
|
-
return true;
|
|
975
|
-
};
|
|
976
|
-
const assertCanSendToJid = async (jid, currentSock, readinessOptions) => {
|
|
977
|
-
if (!isDirectUserJid(jid)) return;
|
|
978
|
-
if (readinessOptions?.useVerifiedReady && consumeVerifiedSendReady(jid, currentSock)) return;
|
|
979
|
-
const state = getActiveReachoutTimelock(reachoutTimeLock) ?? await fetchReachoutTimeLock(currentSock);
|
|
980
|
-
const activeState = getActiveReachoutTimelock(state);
|
|
981
|
-
if (activeState) throw new Error(formatReachoutTimelockError(activeState));
|
|
982
|
-
if (readinessOptions?.rememberReady && state) rememberVerifiedSendReady(jid, currentSock);
|
|
983
|
-
};
|
|
984
|
-
const assertCanSendTo = async (to) => {
|
|
985
|
-
const currentSock = getCurrentSock();
|
|
986
|
-
if (!currentSock) throw new Error(RECONNECT_IN_PROGRESS_ERROR);
|
|
987
|
-
const jid = options.authDir ? toWhatsappJidWithLid(to, { authDir: options.authDir }) : toWhatsappJid(to);
|
|
988
|
-
await assertCanSendToJid(jid, currentSock, { rememberReady: true });
|
|
989
|
-
};
|
|
990
|
-
const sendTrackedMessage = async (jid, content, sendOptions) => {
|
|
991
|
-
let lastErr = /* @__PURE__ */ new Error(RECONNECT_IN_PROGRESS_ERROR);
|
|
992
|
-
for (let attempt = 1;; attempt++) {
|
|
993
|
-
const currentSock = getCurrentSock();
|
|
994
|
-
if (currentSock) try {
|
|
995
|
-
await assertCanSendToJid(jid, currentSock, { useVerifiedReady: true });
|
|
996
|
-
const result = await createWhatsAppSocketOperationTimeoutAdapter(currentSock, sendOperationTimeoutMs, { onSendMessageTimeout: ({ jid: timedOutJid, promise }) => {
|
|
997
|
-
trackLateAcceptedSend(timedOutJid, promise);
|
|
998
|
-
} }).sendMessage(jid, content, sendOptions);
|
|
999
|
-
rememberOutboundMessage(jid, result);
|
|
1000
|
-
return result;
|
|
1001
|
-
} catch (err) {
|
|
1002
|
-
if (!shouldRetryDisconnect() || !isRetryableSendDisconnectError(err)) throw err;
|
|
1003
|
-
lastErr = err;
|
|
1004
|
-
if (shouldClearSocketRefAfterSendFailure(err) && options.socketRef?.current === currentSock) options.socketRef.current = null;
|
|
1005
|
-
}
|
|
1006
|
-
else if (!shouldRetryDisconnect()) throw lastErr;
|
|
1007
|
-
if (attempt >= sendRetryMaxAttempts) throw lastErr;
|
|
1008
|
-
const delayMs = computeBackoff(disconnectRetryPolicy, attempt);
|
|
1009
|
-
logWhatsAppVerbose(options.verbose, `Waiting ${delayMs}ms for WhatsApp reconnect before retrying send to ${jid}: ${formatError(lastErr)}`);
|
|
1010
|
-
try {
|
|
1011
|
-
await sleepWithAbort(delayMs, options.disconnectRetryAbortSignal);
|
|
1012
|
-
} catch {
|
|
1013
|
-
throw lastErr;
|
|
1014
|
-
}
|
|
1015
|
-
}
|
|
1016
|
-
};
|
|
1017
|
-
const sendApiSocketOperations = {
|
|
1018
|
-
sendMessage: (jid, content, sendOptions) => sendTrackedMessage(jid, content, sendOptions),
|
|
1019
|
-
sendPresenceUpdate: async (presenceLocal, jid) => {
|
|
1020
|
-
const currentSock = getCurrentSock();
|
|
1021
|
-
if (!currentSock) throw new Error(RECONNECT_IN_PROGRESS_ERROR);
|
|
1022
|
-
return await createWhatsAppSocketOperationTimeoutAdapter(currentSock, sendOperationTimeoutMs).sendPresenceUpdate(presenceLocal, jid);
|
|
1023
|
-
}
|
|
1024
|
-
};
|
|
1025
|
-
const summarizeGroupMeta = async (meta) => {
|
|
1026
|
-
const participantEntries = await Promise.all(meta.participants?.map(async (p) => {
|
|
1027
|
-
const mapped = await resolveInboundJid(p.id);
|
|
1028
|
-
return {
|
|
1029
|
-
display: mapped ?? p.id,
|
|
1030
|
-
mention: {
|
|
1031
|
-
id: p.id,
|
|
1032
|
-
lid: p.lid,
|
|
1033
|
-
phoneNumber: p.phoneNumber,
|
|
1034
|
-
e164: mapped
|
|
1035
|
-
}
|
|
1036
|
-
};
|
|
1037
|
-
}) ?? []);
|
|
1038
|
-
const participants = participantEntries.map((entry) => entry.display).filter(Boolean);
|
|
1039
|
-
const mentionParticipants = participantEntries.map((entry) => entry.mention);
|
|
1040
|
-
return {
|
|
1041
|
-
subject: meta.subject,
|
|
1042
|
-
participants,
|
|
1043
|
-
mentionParticipants,
|
|
1044
|
-
expires: resolveGroupMetadataExpiresAt() ?? 0
|
|
1045
|
-
};
|
|
1046
|
-
};
|
|
1047
|
-
const summarizeGroupMetaForReconnectCache = (meta) => ({
|
|
1048
|
-
subject: meta.subject,
|
|
1049
|
-
expires: resolveGroupMetadataExpiresAt() ?? NaN
|
|
1050
|
-
});
|
|
1051
|
-
const getGroupMeta = async (jid) => {
|
|
1052
|
-
const cached = readGroupMetadataCacheEntry(groupMetaCache, jid);
|
|
1053
|
-
if (cached) return cached;
|
|
1054
|
-
try {
|
|
1055
|
-
const meta = await (getCurrentSock() ?? sock).groupMetadata(jid);
|
|
1056
|
-
rememberWhatsAppBaileysCacheEntry(options.baileysGroupMetaCache, jid, meta, GROUP_META_TTL_MS);
|
|
1057
|
-
publishedGroupMetadataJids.add(jid);
|
|
1058
|
-
const entry = await summarizeGroupMeta(meta);
|
|
1059
|
-
rememberGroupMetadataCacheEntry(groupMetadataCache, jid, {
|
|
1060
|
-
subject: entry.subject,
|
|
1061
|
-
expires: entry.expires
|
|
1062
|
-
});
|
|
1063
|
-
rememberGroupMetadataCacheEntry(groupMetaCache, jid, entry);
|
|
1064
|
-
return entry;
|
|
1065
|
-
} catch (err) {
|
|
1066
|
-
const hydrated = readGroupMetadataCacheEntry(groupMetadataCache, jid);
|
|
1067
|
-
if (hydrated) {
|
|
1068
|
-
rememberGroupMetadataCacheEntry(groupMetaCache, jid, hydrated);
|
|
1069
|
-
logWhatsAppVerbose(options.verbose, `Using cached group metadata for ${jid} after fetch failure: ${String(err)}`);
|
|
1070
|
-
return hydrated;
|
|
1071
|
-
}
|
|
1072
|
-
logWhatsAppVerbose(options.verbose, `Failed to fetch group metadata for ${jid}: ${String(err)}`);
|
|
1073
|
-
return { expires: resolveGroupMetadataExpiresAt() ?? 0 };
|
|
1074
|
-
}
|
|
1075
|
-
};
|
|
1076
|
-
const resolveOutboundMentionsForGroup = async (jid, text) => {
|
|
1077
|
-
if (isJidGroup(jid) !== true || !mayContainWhatsAppOutboundMention(text)) return {
|
|
1078
|
-
text,
|
|
1079
|
-
mentionedJids: []
|
|
1080
|
-
};
|
|
1081
|
-
return resolveWhatsAppOutboundMentions({
|
|
1082
|
-
chatJid: jid,
|
|
1083
|
-
text,
|
|
1084
|
-
participants: (await getGroupMeta(jid)).mentionParticipants
|
|
1085
|
-
});
|
|
1086
|
-
};
|
|
1087
|
-
const applyOutboundMentionsToContent = async (jid, content) => {
|
|
1088
|
-
if ("text" in content && typeof content.text === "string") {
|
|
1089
|
-
const resolved = await resolveOutboundMentionsForGroup(jid, content.text);
|
|
1090
|
-
return addWhatsAppOutboundMentionsToContent({
|
|
1091
|
-
...content,
|
|
1092
|
-
text: resolved.text
|
|
1093
|
-
}, resolved.mentionedJids);
|
|
1094
|
-
}
|
|
1095
|
-
const caption = content.caption;
|
|
1096
|
-
if (typeof caption === "string") {
|
|
1097
|
-
const resolved = await resolveOutboundMentionsForGroup(jid, caption);
|
|
1098
|
-
return addWhatsAppOutboundMentionsToContent({
|
|
1099
|
-
...content,
|
|
1100
|
-
caption: resolved.text
|
|
1101
|
-
}, resolved.mentionedJids);
|
|
1102
|
-
}
|
|
1103
|
-
return content;
|
|
1104
|
-
};
|
|
1105
|
-
const shouldSkipRecentOutboundEcho = (msg) => {
|
|
1106
|
-
const id = msg.key?.id ?? void 0;
|
|
1107
|
-
const remoteJid = msg.key?.remoteJid;
|
|
1108
|
-
if (!msg.key?.fromMe || !id || !remoteJid || !isRecentOutboundMessage({
|
|
1109
|
-
accountId: options.accountId,
|
|
1110
|
-
remoteJid,
|
|
1111
|
-
messageId: id
|
|
1112
|
-
})) return false;
|
|
1113
|
-
logWhatsAppVerbose(options.verbose, `Skipping recent outbound WhatsApp echo ${id} for ${remoteJid}`);
|
|
1114
|
-
return true;
|
|
1115
|
-
};
|
|
1116
|
-
const normalizeInboundMessage = async (msg) => {
|
|
1117
|
-
const id = msg.key?.id ?? void 0;
|
|
1118
|
-
const remoteJid = msg.key?.remoteJid;
|
|
1119
|
-
if (!remoteJid) return null;
|
|
1120
|
-
if (remoteJid.endsWith("@status") || remoteJid.endsWith("@broadcast")) return null;
|
|
1121
|
-
const group = isJidGroup(remoteJid) === true;
|
|
1122
|
-
if (shouldSkipRecentOutboundEcho(msg)) return null;
|
|
1123
|
-
if (!hasInboundUserContent(msg.message ?? void 0)) return null;
|
|
1124
|
-
const participantJid = msg.key?.participant ?? void 0;
|
|
1125
|
-
const from = group ? remoteJid : await resolveInboundJid(remoteJid);
|
|
1126
|
-
if (!from) return null;
|
|
1127
|
-
const senderE164 = group ? participantJid ? await resolveInboundJid(participantJid) : null : from;
|
|
1128
|
-
let groupSubject;
|
|
1129
|
-
let groupParticipants;
|
|
1130
|
-
if (group) {
|
|
1131
|
-
const meta = await getGroupMeta(remoteJid);
|
|
1132
|
-
groupSubject = meta.subject;
|
|
1133
|
-
groupParticipants = meta.participants;
|
|
1134
|
-
}
|
|
1135
|
-
const messageTimestampSeconds = parseWhatsAppTimestampSeconds(msg.messageTimestamp);
|
|
1136
|
-
const messageTimestampMs = messageTimestampSeconds !== void 0 ? messageTimestampSeconds * 1e3 : void 0;
|
|
1137
|
-
const access = await checkInboundAccessControl({
|
|
1138
|
-
cfg: options.loadConfig?.() ?? options.cfg,
|
|
1139
|
-
accountId: options.accountId,
|
|
1140
|
-
from,
|
|
1141
|
-
selfE164: self.e164 ?? null,
|
|
1142
|
-
senderE164,
|
|
1143
|
-
senderJid: participantJid,
|
|
1144
|
-
group,
|
|
1145
|
-
pushName: msg.pushName ?? void 0,
|
|
1146
|
-
isFromMe: Boolean(msg.key?.fromMe),
|
|
1147
|
-
messageTimestampMs,
|
|
1148
|
-
connectedAtMs,
|
|
1149
|
-
verbose: options.verbose,
|
|
1150
|
-
sock: { sendMessage: (jid, content) => sendTrackedMessage(jid, content) },
|
|
1151
|
-
remoteJid
|
|
1152
|
-
});
|
|
1153
|
-
if (!access.allowed) return null;
|
|
1154
|
-
return {
|
|
1155
|
-
id,
|
|
1156
|
-
remoteJid,
|
|
1157
|
-
group,
|
|
1158
|
-
participantJid,
|
|
1159
|
-
from,
|
|
1160
|
-
senderE164,
|
|
1161
|
-
groupSubject,
|
|
1162
|
-
groupParticipants,
|
|
1163
|
-
messageTimestampMs,
|
|
1164
|
-
access
|
|
1165
|
-
};
|
|
1166
|
-
};
|
|
1167
|
-
const buildReadReceiptTarget = (inbound) => inbound.id ? {
|
|
1168
|
-
remoteJid: inbound.remoteJid,
|
|
1169
|
-
id: inbound.id,
|
|
1170
|
-
...inbound.participantJid ? { participant: inbound.participantJid } : {}
|
|
1171
|
-
} : void 0;
|
|
1172
|
-
const maybeMarkInboundAsRead = async (target) => {
|
|
1173
|
-
if (!target || options.sendReadReceipts === false) return;
|
|
1174
|
-
const { id, remoteJid, participant } = target;
|
|
1175
|
-
try {
|
|
1176
|
-
await withWhatsAppSocketOperationTimeout("readMessages", (getCurrentSock() ?? sock).readMessages([{
|
|
1177
|
-
remoteJid,
|
|
1178
|
-
id,
|
|
1179
|
-
participant,
|
|
1180
|
-
fromMe: false
|
|
1181
|
-
}]), sendOperationTimeoutMs);
|
|
1182
|
-
const suffix = participant ? ` (participant ${participant})` : "";
|
|
1183
|
-
logWhatsAppVerbose(options.verbose, `Marked message ${id} as read for ${remoteJid}${suffix}`);
|
|
1184
|
-
} catch (err) {
|
|
1185
|
-
logWhatsAppVerbose(options.verbose, `Failed to mark message ${id} read: ${String(err)}`);
|
|
1186
|
-
}
|
|
1187
|
-
};
|
|
1188
|
-
const maybeLogSkippedSelfChatReadReceipt = (inbound, target) => {
|
|
1189
|
-
if (target?.id && inbound.access.isSelfChat && options.verbose) logWhatsAppVerbose(options.verbose, `Self-chat mode: skipping read receipt for ${target.id}`);
|
|
1190
|
-
};
|
|
1191
|
-
const maybeMarkNonSelfChatReadReceipt = async (inbound, target) => {
|
|
1192
|
-
if (inbound.access.isSelfChat) {
|
|
1193
|
-
maybeLogSkippedSelfChatReadReceipt(inbound, target);
|
|
1194
|
-
return;
|
|
1195
|
-
}
|
|
1196
|
-
await maybeMarkInboundAsRead(target);
|
|
1197
|
-
};
|
|
1198
|
-
const shouldSkipStaleAppend = (msg, upsertType) => {
|
|
1199
|
-
if (upsertType !== "append") return false;
|
|
1200
|
-
const APPEND_RECENT_GRACE_MS = 6e4;
|
|
1201
|
-
const msgTsSeconds = parseWhatsAppTimestampSeconds(msg.messageTimestamp);
|
|
1202
|
-
const msgTsMs = msgTsSeconds !== void 0 ? msgTsSeconds * 1e3 : 0;
|
|
1203
|
-
const nowMs = Date.now();
|
|
1204
|
-
return msgTsMs < (options.appendReplyWindow && nowMs <= options.appendReplyWindow.untilMs ? Math.max(options.appendReplyWindow.afterMs, nowMs - options.appendReplyWindow.maxAgeMs) : connectedAtMs - APPEND_RECENT_GRACE_MS);
|
|
1205
|
-
};
|
|
1206
|
-
const preparedInboundByDurableId = /* @__PURE__ */ new Map();
|
|
1207
|
-
const enrichInboundMessage = async (msg) => {
|
|
1208
|
-
const location = extractLocationData(msg.message ?? void 0);
|
|
1209
|
-
const locationText = location ? formatLocationText(location) : void 0;
|
|
1210
|
-
const contactContext = extractContactContext(msg.message ?? void 0);
|
|
1211
|
-
const externalAdReplyContext = extractExternalAdReplyContext(msg.message ?? void 0);
|
|
1212
|
-
let mediaKind = extractMediaKind(msg.message ?? void 0);
|
|
1213
|
-
let body = extractText(msg.message ?? void 0);
|
|
1214
|
-
if (locationText) body = [body, locationText].filter(Boolean).join("\n").trim();
|
|
1215
|
-
if (!body && !mediaKind) return null;
|
|
1216
|
-
body = body ?? "";
|
|
1217
|
-
const commandBody = body;
|
|
1218
|
-
const replyContext = describeReplyContext(msg.message);
|
|
1219
|
-
let mediaPath;
|
|
1220
|
-
let mediaType = mediaKind ? resolveInboundMediaMimetype(msg.message) : void 0;
|
|
1221
|
-
const nativeMedia = mediaKind ? {
|
|
1222
|
-
contentType: mediaType,
|
|
1223
|
-
kind: mediaKind
|
|
1224
|
-
} : void 0;
|
|
1225
|
-
let mediaFileName;
|
|
1226
|
-
const maxBytes = (typeof options.mediaMaxMb === "number" && options.mediaMaxMb > 0 ? options.mediaMaxMb : 50) * 1024 * 1024;
|
|
1227
|
-
const saveInboundMedia = async (inboundMedia) => {
|
|
1228
|
-
if (!inboundMedia) return;
|
|
1229
|
-
mediaPath = inboundMedia.saved.path;
|
|
1230
|
-
mediaType = inboundMedia.mimetype;
|
|
1231
|
-
mediaFileName = inboundMedia.fileName;
|
|
1232
|
-
};
|
|
1233
|
-
try {
|
|
1234
|
-
await saveInboundMedia(await downloadInboundMedia(msg, sock, maxBytes));
|
|
1235
|
-
} catch (err) {
|
|
1236
|
-
logWhatsAppVerbose(options.verbose, `Inbound media download failed: ${String(err)}`);
|
|
1237
|
-
body = formatInboundMediaUnavailableText({
|
|
1238
|
-
body,
|
|
1239
|
-
notice: "[whatsapp attachment unavailable]"
|
|
1240
|
-
});
|
|
1241
|
-
}
|
|
1242
|
-
if (!mediaPath && !mediaKind && replyContext?.media) try {
|
|
1243
|
-
await saveInboundMedia(await downloadQuotedInboundMedia(msg, sock, maxBytes));
|
|
1244
|
-
mediaKind = replyContext.media.kind ?? void 0;
|
|
1245
|
-
mediaType = mediaType ?? replyContext.media.contentType ?? void 0;
|
|
1246
|
-
} catch (err) {
|
|
1247
|
-
logWhatsAppVerbose(options.verbose, `Quoted media download failed: ${String(err)}`);
|
|
1248
|
-
body = formatInboundMediaUnavailableText({
|
|
1249
|
-
body,
|
|
1250
|
-
notice: "[whatsapp quoted attachment unavailable]"
|
|
1251
|
-
});
|
|
1252
|
-
}
|
|
1253
|
-
return {
|
|
1254
|
-
body,
|
|
1255
|
-
commandBody,
|
|
1256
|
-
location: location ?? void 0,
|
|
1257
|
-
contactContext,
|
|
1258
|
-
externalAdReplyContext,
|
|
1259
|
-
replyContext,
|
|
1260
|
-
mediaPath,
|
|
1261
|
-
mediaType,
|
|
1262
|
-
mediaFileName,
|
|
1263
|
-
mediaKind,
|
|
1264
|
-
nativeMedia
|
|
1265
|
-
};
|
|
1266
|
-
};
|
|
1267
|
-
const enqueueInboundMessage = async (msg, inbound, enriched, durable) => {
|
|
1268
|
-
const chatJid = inbound.remoteJid;
|
|
1269
|
-
const sendComposing = async () => {
|
|
1270
|
-
const currentSock = getCurrentSock();
|
|
1271
|
-
if (!currentSock) return;
|
|
1272
|
-
try {
|
|
1273
|
-
await assertCanSendToJid(chatJid, currentSock);
|
|
1274
|
-
await sendApiSocketOperations.sendPresenceUpdate("composing", chatJid);
|
|
1275
|
-
} catch (err) {
|
|
1276
|
-
logWhatsAppVerbose(options.verbose, `Presence update failed: ${String(err)}`);
|
|
1277
|
-
}
|
|
1278
|
-
};
|
|
1279
|
-
const reply = async (text, optionsResult) => {
|
|
1280
|
-
const resolved = await resolveOutboundMentionsForGroup(chatJid, text);
|
|
1281
|
-
return normalizeWhatsAppSendResult(await sendTrackedMessage(chatJid, addWhatsAppOutboundMentionsToContent({ text: resolved.text }, resolved.mentionedJids), optionsResult), "text");
|
|
1282
|
-
};
|
|
1283
|
-
const sendMedia = async (payload, optionsValue) => {
|
|
1284
|
-
const previewPayload = await addWhatsAppImagePreviewFields(payload);
|
|
1285
|
-
return normalizeWhatsAppSendResult(await sendTrackedMessage(chatJid, await applyOutboundMentionsToContent(chatJid, previewPayload), optionsValue), "media");
|
|
1286
|
-
};
|
|
1287
|
-
const timestamp = inbound.messageTimestampMs;
|
|
1288
|
-
const mentionedJids = extractMentionedJids(msg.message);
|
|
1289
|
-
const senderName = msg.pushName ?? void 0;
|
|
1290
|
-
inboundLogger.info({
|
|
1291
|
-
from: inbound.from,
|
|
1292
|
-
to: self.e164 ?? "me",
|
|
1293
|
-
body: enriched.body,
|
|
1294
|
-
mediaPath: enriched.mediaPath,
|
|
1295
|
-
mediaType: enriched.mediaType,
|
|
1296
|
-
mediaFileName: enriched.mediaFileName,
|
|
1297
|
-
timestamp
|
|
1298
|
-
}, "inbound message");
|
|
1299
|
-
const media = enriched.mediaPath || enriched.mediaType || enriched.mediaFileName || enriched.mediaKind ? {
|
|
1300
|
-
path: enriched.mediaPath,
|
|
1301
|
-
type: enriched.mediaType,
|
|
1302
|
-
fileName: enriched.mediaFileName,
|
|
1303
|
-
kind: enriched.mediaKind
|
|
1304
|
-
} : void 0;
|
|
1305
|
-
const groupMentions = mentionedJids ? { jids: mentionedJids } : void 0;
|
|
1306
|
-
const group = inbound.group && (inbound.groupSubject || inbound.groupParticipants?.length || groupMentions) ? {
|
|
1307
|
-
subject: inbound.groupSubject,
|
|
1308
|
-
participants: inbound.groupParticipants,
|
|
1309
|
-
mentions: groupMentions
|
|
1310
|
-
} : void 0;
|
|
1311
|
-
const untrustedStructuredContext = [
|
|
1312
|
-
...enriched.nativeMedia ? [{
|
|
1313
|
-
label: "WhatsApp media",
|
|
1314
|
-
source: "whatsapp",
|
|
1315
|
-
type: "media",
|
|
1316
|
-
payload: enriched.nativeMedia
|
|
1317
|
-
}] : [],
|
|
1318
|
-
...enriched.contactContext ? [{
|
|
1319
|
-
label: "WhatsApp contact",
|
|
1320
|
-
source: "whatsapp",
|
|
1321
|
-
type: enriched.contactContext.kind,
|
|
1322
|
-
payload: enriched.contactContext
|
|
1323
|
-
}] : [],
|
|
1324
|
-
...enriched.externalAdReplyContext ? [{
|
|
1325
|
-
label: "WhatsApp external ad reply",
|
|
1326
|
-
source: "whatsapp",
|
|
1327
|
-
type: "external_ad_reply",
|
|
1328
|
-
payload: enriched.externalAdReplyContext
|
|
1329
|
-
}] : []
|
|
1330
|
-
];
|
|
1331
|
-
const inboundMessage = withDeprecatedWebInboundMessageFlatAliases({
|
|
1332
|
-
admission: inbound.access.admission,
|
|
1333
|
-
event: {
|
|
1334
|
-
id: inbound.id,
|
|
1335
|
-
timestamp
|
|
1336
|
-
},
|
|
1337
|
-
payload: {
|
|
1338
|
-
body: enriched.body,
|
|
1339
|
-
commandBody: enriched.commandBody,
|
|
1340
|
-
location: enriched.location ?? void 0,
|
|
1341
|
-
untrustedStructuredContext: untrustedStructuredContext.length > 0 ? untrustedStructuredContext : void 0,
|
|
1342
|
-
media
|
|
1343
|
-
},
|
|
1344
|
-
platform: {
|
|
1345
|
-
chatJid: inbound.remoteJid,
|
|
1346
|
-
recipientJid: self.e164 ?? "me",
|
|
1347
|
-
pushName: senderName,
|
|
1348
|
-
sender: resolveComparableIdentity({
|
|
1349
|
-
jid: inbound.participantJid,
|
|
1350
|
-
e164: inbound.senderE164 ?? void 0,
|
|
1351
|
-
name: senderName
|
|
1352
|
-
}),
|
|
1353
|
-
senderJid: inbound.participantJid,
|
|
1354
|
-
senderE164: inbound.senderE164 ?? void 0,
|
|
1355
|
-
senderName,
|
|
1356
|
-
self,
|
|
1357
|
-
selfJid: self.jid ?? void 0,
|
|
1358
|
-
selfLid: self.lid ?? void 0,
|
|
1359
|
-
selfE164: self.e164 ?? void 0,
|
|
1360
|
-
fromMe: Boolean(msg.key?.fromMe),
|
|
1361
|
-
sendComposing,
|
|
1362
|
-
reply,
|
|
1363
|
-
sendMedia
|
|
1364
|
-
},
|
|
1365
|
-
quote: enriched.replyContext ? {
|
|
1366
|
-
context: enriched.replyContext,
|
|
1367
|
-
id: enriched.replyContext.id,
|
|
1368
|
-
body: enriched.replyContext.body,
|
|
1369
|
-
media: enriched.replyContext.media,
|
|
1370
|
-
sender: {
|
|
1371
|
-
displayName: enriched.replyContext.sender?.label ?? void 0,
|
|
1372
|
-
jid: enriched.replyContext.sender?.jid ?? void 0,
|
|
1373
|
-
e164: enriched.replyContext.sender?.e164 ?? void 0
|
|
1374
|
-
}
|
|
1375
|
-
} : void 0,
|
|
1376
|
-
group,
|
|
1377
|
-
turnAdoptionLifecycle: durable.turnAdoptionLifecycle,
|
|
1378
|
-
readReceipt: durable.readReceipt,
|
|
1379
|
-
receiveOrder: durable.receiveOrder
|
|
1380
|
-
});
|
|
1381
|
-
const debounceKey = buildInboundDebounceKey(inboundMessage);
|
|
1382
|
-
if (debounceKey) {
|
|
1383
|
-
inboundMessage.debounceKey = debounceKey;
|
|
1384
|
-
if (inboundDebounceMs > 0 && shouldDebounceInboundMessage(inboundMessage)) {
|
|
1385
|
-
pendingDebounceKeys.add(debounceKey);
|
|
1386
|
-
publishPendingWorkState();
|
|
1387
|
-
notifyDebounceWork();
|
|
1388
|
-
}
|
|
1389
|
-
}
|
|
1390
|
-
if (inboundMessage.event.id) {
|
|
1391
|
-
const admission = requireWhatsAppInboundAdmission(inboundMessage);
|
|
1392
|
-
cacheInboundMessageMeta(admission.accountId, inboundMessage.platform.chatJid, inboundMessage.event.id, {
|
|
1393
|
-
participant: inboundMessage.platform.senderJid,
|
|
1394
|
-
participantE164: admission.conversation.kind === "direct" ? inboundMessage.platform.senderE164 : void 0,
|
|
1395
|
-
body: inboundMessage.payload.body,
|
|
1396
|
-
media: enriched.nativeMedia,
|
|
1397
|
-
fromMe: inboundMessage.platform.fromMe
|
|
1398
|
-
});
|
|
1399
|
-
}
|
|
1400
|
-
await debouncer.enqueue(inboundMessage);
|
|
1401
|
-
};
|
|
1402
|
-
const processDurableInboundMessage = async (msg, context) => {
|
|
1403
|
-
rememberBaileysMessage(msg.key?.remoteJid, msg.key?.id, msg.message);
|
|
1404
|
-
if (context.skipRecentOutboundEcho === true) return "completed";
|
|
1405
|
-
const preparation = context.eventId ? preparedInboundByDurableId.get(context.eventId) : void 0;
|
|
1406
|
-
if (context.eventId) preparedInboundByDurableId.delete(context.eventId);
|
|
1407
|
-
const prepared = await preparation;
|
|
1408
|
-
if (prepared === null) return "completed";
|
|
1409
|
-
const inbound = prepared ?? await normalizeInboundMessage(msg);
|
|
1410
|
-
if (!inbound) return "completed";
|
|
1411
|
-
if (await maybeResolveWhatsAppQuestionReaction({
|
|
1412
|
-
cfg: options.loadConfig?.() ?? options.cfg,
|
|
1413
|
-
accountId: options.accountId,
|
|
1414
|
-
msg,
|
|
1415
|
-
senderId: inbound.senderE164 ?? inbound.from,
|
|
1416
|
-
resolveReactionTargetJids,
|
|
1417
|
-
logDebug: (message) => logWhatsAppVerbose(options.verbose, message)
|
|
1418
|
-
})) return "completed";
|
|
1419
|
-
const readReceipt = buildReadReceiptTarget(inbound);
|
|
1420
|
-
const deliveryReadReceipt = inbound.access.isSelfChat ? void 0 : readReceipt;
|
|
1421
|
-
if (context.skipStaleAppend === true) {
|
|
1422
|
-
await maybeMarkNonSelfChatReadReceipt(inbound, readReceipt);
|
|
1423
|
-
return "completed";
|
|
1424
|
-
}
|
|
1425
|
-
const enriched = await enrichInboundMessage(msg);
|
|
1426
|
-
if (!enriched) {
|
|
1427
|
-
await maybeMarkNonSelfChatReadReceipt(inbound, deliveryReadReceipt);
|
|
1428
|
-
return "completed";
|
|
1429
|
-
}
|
|
1430
|
-
recordAcceptedInboundActivity(options.accountId);
|
|
1431
|
-
await enqueueInboundMessage(msg, inbound, enriched, {
|
|
1432
|
-
readReceipt: deliveryReadReceipt,
|
|
1433
|
-
receiveOrder: context.receiveOrder ?? context.receivedAt,
|
|
1434
|
-
turnAdoptionLifecycle: context.lifecycle
|
|
1435
|
-
});
|
|
1436
|
-
return "deferred";
|
|
1437
|
-
};
|
|
1438
|
-
const durableInboundMonitor = createWhatsAppIngressMonitor({
|
|
1439
|
-
queue: durableInboundQueue,
|
|
1440
|
-
dispatch: async (msg, payload, lifecycle) => {
|
|
1441
|
-
const remoteJid = msg.key?.remoteJid;
|
|
1442
|
-
const id = msg.key?.id;
|
|
1443
|
-
return { kind: await processDurableInboundMessage(msg, {
|
|
1444
|
-
...payload,
|
|
1445
|
-
...remoteJid && id ? { eventId: createWhatsAppDurableInboundMessageId({
|
|
1446
|
-
remoteJid,
|
|
1447
|
-
id
|
|
1448
|
-
}) } : {},
|
|
1449
|
-
lifecycle
|
|
1450
|
-
}) };
|
|
1451
|
-
},
|
|
1452
|
-
pollIntervalMs: WHATSAPP_INGRESS_DRAIN_INTERVAL_MS,
|
|
1453
|
-
onLog: (message) => inboundLogger.warn({ message }, "whatsapp ingress drain"),
|
|
1454
|
-
onError: (error) => inboundLogger.error({ error: formatError(error) }, "whatsapp durable inbound drain failed"),
|
|
1455
|
-
onActivityChange: (active) => {
|
|
1456
|
-
durableIngressActive = active;
|
|
1457
|
-
publishPendingWorkState();
|
|
1458
|
-
}
|
|
1459
|
-
});
|
|
1460
|
-
const handleMessagesUpsert = async (upsert) => {
|
|
1461
|
-
if (upsert.type !== "notify" && upsert.type !== "append") return;
|
|
1462
|
-
for (const msg of upsert.messages ?? []) {
|
|
1463
|
-
rememberBaileysMessage(msg.key?.remoteJid, msg.key?.id, msg.message);
|
|
1464
|
-
const receiveOrder = nextReceiveOrder++;
|
|
1465
|
-
if (await maybeResolveWhatsAppApprovalReaction({
|
|
1466
|
-
cfg: options.loadConfig?.() ?? options.cfg,
|
|
1467
|
-
accountId: options.accountId,
|
|
1468
|
-
msg,
|
|
1469
|
-
selfJid: self.jid,
|
|
1470
|
-
selfLid: self.lid,
|
|
1471
|
-
resolveInboundJid,
|
|
1472
|
-
resolveReactionTargetJids,
|
|
1473
|
-
logVerboseMessage: (message) => logWhatsAppVerbose(options.verbose, message)
|
|
1474
|
-
})) continue;
|
|
1475
|
-
const receivedAt = Date.now();
|
|
1476
|
-
const skipStaleAppend = shouldSkipStaleAppend(msg, upsert.type);
|
|
1477
|
-
const skipRecentOutboundEcho = shouldSkipRecentOutboundEcho(msg);
|
|
1478
|
-
const remoteJid = msg.key?.remoteJid;
|
|
1479
|
-
const id = msg.key?.id;
|
|
1480
|
-
const durableId = remoteJid && id ? createWhatsAppDurableInboundMessageId({
|
|
1481
|
-
remoteJid,
|
|
1482
|
-
id
|
|
1483
|
-
}) : void 0;
|
|
1484
|
-
let resolvePrepared;
|
|
1485
|
-
if (durableId && !preparedInboundByDurableId.has(durableId)) {
|
|
1486
|
-
if (preparedInboundByDurableId.size >= 1e3) {
|
|
1487
|
-
const oldest = preparedInboundByDurableId.keys().next().value;
|
|
1488
|
-
if (oldest !== void 0) preparedInboundByDurableId.delete(oldest);
|
|
1489
|
-
}
|
|
1490
|
-
preparedInboundByDurableId.set(durableId, new Promise((resolve) => {
|
|
1491
|
-
resolvePrepared = resolve;
|
|
1492
|
-
}));
|
|
1493
|
-
}
|
|
1494
|
-
const finishPreparation = (inbound, keepForDrain = false) => {
|
|
1495
|
-
resolvePrepared?.(inbound);
|
|
1496
|
-
if (!keepForDrain && durableId && resolvePrepared) preparedInboundByDurableId.delete(durableId);
|
|
1497
|
-
};
|
|
1498
|
-
let result;
|
|
1499
|
-
let appendError;
|
|
1500
|
-
for (const delayMs of [
|
|
1501
|
-
0,
|
|
1502
|
-
100,
|
|
1503
|
-
300
|
|
1504
|
-
]) {
|
|
1505
|
-
if (delayMs > 0) await new Promise((resolve) => {
|
|
1506
|
-
setTimeout(resolve, delayMs);
|
|
1507
|
-
});
|
|
1508
|
-
try {
|
|
1509
|
-
result = await enqueueWhatsAppDurableInbound({
|
|
1510
|
-
queue: durableInboundQueue,
|
|
1511
|
-
message: msg,
|
|
1512
|
-
upsertType: upsert.type,
|
|
1513
|
-
skipStaleAppend,
|
|
1514
|
-
skipRecentOutboundEcho,
|
|
1515
|
-
receivedAt,
|
|
1516
|
-
receiveOrder
|
|
1517
|
-
});
|
|
1518
|
-
appendError = void 0;
|
|
1519
|
-
break;
|
|
1520
|
-
} catch (error) {
|
|
1521
|
-
appendError = error;
|
|
1522
|
-
}
|
|
1523
|
-
}
|
|
1524
|
-
if (result === void 0) {
|
|
1525
|
-
finishPreparation(void 0);
|
|
1526
|
-
const formattedError = formatError(appendError);
|
|
1527
|
-
inboundLogger.error({ error: formattedError }, "failed persisting durable WhatsApp inbound after retries; message dropped");
|
|
1528
|
-
inboundConsoleLog.error(`Failed persisting durable WhatsApp inbound after retries; message dropped: ${formattedError}`);
|
|
1529
|
-
continue;
|
|
1530
|
-
}
|
|
1531
|
-
if (result.kind === "completed") {
|
|
1532
|
-
finishPreparation(void 0);
|
|
1533
|
-
const inbound = await normalizeInboundMessage(msg);
|
|
1534
|
-
if (inbound) await maybeMarkNonSelfChatReadReceipt(inbound, buildReadReceiptTarget(inbound));
|
|
1535
|
-
} else {
|
|
1536
|
-
if (result.kind === "accepted") try {
|
|
1537
|
-
finishPreparation(skipRecentOutboundEcho ? null : await normalizeInboundMessage(msg), true);
|
|
1538
|
-
} catch (error) {
|
|
1539
|
-
finishPreparation(void 0);
|
|
1540
|
-
throw error;
|
|
1541
|
-
}
|
|
1542
|
-
else finishPreparation(void 0);
|
|
1543
|
-
durableInboundMonitor.requestDrain();
|
|
1544
|
-
}
|
|
1545
|
-
}
|
|
1546
|
-
};
|
|
1547
|
-
const handleMessagesUpsertEvent = (upsert) => {
|
|
1548
|
-
const task = handleMessagesUpsert(upsert).catch((err) => {
|
|
1549
|
-
inboundLogger.error({ error: String(err) }, "messages.upsert handler error");
|
|
1550
|
-
inboundConsoleLog.error(`Messages upsert handler error: ${String(err)}`);
|
|
1551
|
-
});
|
|
1552
|
-
pendingMessageHandlers.add(task);
|
|
1553
|
-
publishPendingWorkState();
|
|
1554
|
-
task.finally(() => {
|
|
1555
|
-
pendingMessageHandlers.delete(task);
|
|
1556
|
-
publishPendingWorkState();
|
|
1557
|
-
});
|
|
1558
|
-
};
|
|
1559
|
-
const drainDebouncedInboundMessages = async () => {
|
|
1560
|
-
while (pendingDebounceKeys.size > 0 || activeInboundFlushes.size > 0) {
|
|
1561
|
-
const debounceKeys = Array.from(pendingDebounceKeys);
|
|
1562
|
-
if (debounceKeys.length > 0) await Promise.all(debounceKeys.map((key) => debouncer.flushKey(key)));
|
|
1563
|
-
const flushes = Array.from(activeInboundFlushes);
|
|
1564
|
-
if (flushes.length > 0) await Promise.allSettled(flushes);
|
|
1565
|
-
await Promise.resolve();
|
|
1566
|
-
}
|
|
1567
|
-
};
|
|
1568
|
-
const drainInboundBeforeSocketClose = async () => {
|
|
1569
|
-
groupMetadataCacheClosed = true;
|
|
1570
|
-
for (;;) {
|
|
1571
|
-
await drainDebouncedInboundMessages();
|
|
1572
|
-
if (pendingMessageHandlers.size === 0) break;
|
|
1573
|
-
const handlers = Array.from(pendingMessageHandlers);
|
|
1574
|
-
await Promise.race([Promise.allSettled(handlers), waitForDebounceWorkOrIdle(handlers)]);
|
|
1575
|
-
if (pendingMessageHandlers.size === 0 && pendingDebounceKeys.size === 0 && activeInboundFlushes.size === 0) break;
|
|
1576
|
-
}
|
|
1577
|
-
await drainDebouncedInboundMessages();
|
|
1578
|
-
for (;;) {
|
|
1579
|
-
await durableInboundMonitor.waitForIdle();
|
|
1580
|
-
if (pendingDebounceKeys.size === 0 && activeInboundFlushes.size === 0) break;
|
|
1581
|
-
await drainDebouncedInboundMessages();
|
|
1582
|
-
}
|
|
1583
|
-
await durableInboundMonitor.stop();
|
|
1584
|
-
};
|
|
1585
|
-
const drainInboundBeforeSocketCloseWithTimeout = async () => {
|
|
1586
|
-
let timeout = null;
|
|
1587
|
-
try {
|
|
1588
|
-
await Promise.race([drainInboundBeforeSocketClose(), new Promise((_, reject) => {
|
|
1589
|
-
timeout = setTimeout(() => {
|
|
1590
|
-
reject(/* @__PURE__ */ new Error(`Timed out draining WhatsApp inbound debounce after ${INBOUND_CLOSE_DRAIN_TIMEOUT_MS}ms`));
|
|
1591
|
-
}, INBOUND_CLOSE_DRAIN_TIMEOUT_MS);
|
|
1592
|
-
timeout.unref?.();
|
|
1593
|
-
})]);
|
|
1594
|
-
} finally {
|
|
1595
|
-
if (timeout) clearTimeout(timeout);
|
|
1596
|
-
durableInboundMonitor.stop();
|
|
1597
|
-
}
|
|
1598
|
-
};
|
|
1599
|
-
const handleConnectionUpdate = (update) => {
|
|
1600
|
-
try {
|
|
1601
|
-
if ("reachoutTimeLock" in update) rememberReachoutTimeLock(update.reachoutTimeLock);
|
|
1602
|
-
if (update.connection === "close") {
|
|
1603
|
-
if (options.socketRef?.current === sock) options.socketRef.current = null;
|
|
1604
|
-
const status = getStatusCode(update.lastDisconnect?.error);
|
|
1605
|
-
resolveClose({
|
|
1606
|
-
status,
|
|
1607
|
-
isLoggedOut: status === LOGGED_OUT_STATUS,
|
|
1608
|
-
error: update.lastDisconnect?.error
|
|
1609
|
-
});
|
|
1610
|
-
}
|
|
1611
|
-
} catch (err) {
|
|
1612
|
-
inboundLogger.error({ error: String(err) }, "connection.update handler error");
|
|
1613
|
-
resolveClose({
|
|
1614
|
-
status: void 0,
|
|
1615
|
-
isLoggedOut: false,
|
|
1616
|
-
error: err
|
|
1617
|
-
});
|
|
1618
|
-
}
|
|
1619
|
-
};
|
|
1620
|
-
const attachSockListener = (event, listener) => attachEmitterListener(sock.ev, event, listener);
|
|
1621
|
-
const detachMessagesUpsert = attachSockListener("messages.upsert", handleMessagesUpsertEvent);
|
|
1622
|
-
const detachConnectionUpdate = attachSockListener("connection.update", handleConnectionUpdate);
|
|
1623
|
-
const isFullGroupMetadataUpdate = (update) => typeof update.id === "string" && typeof update.subject === "string" && Array.isArray(update.participants);
|
|
1624
|
-
const rememberFullGroupMetadataUpdate = (jid, meta) => {
|
|
1625
|
-
if (groupMetadataCacheClosed) return;
|
|
1626
|
-
rememberWhatsAppBaileysCacheEntry(options.baileysGroupMetaCache, jid, meta, GROUP_META_TTL_MS);
|
|
1627
|
-
publishedGroupMetadataJids.add(jid);
|
|
1628
|
-
invalidatedGroupMetadataJids.delete(jid);
|
|
1629
|
-
rememberGroupMetadataCacheEntry(groupMetadataCache, jid, summarizeGroupMetaForReconnectCache(meta));
|
|
1630
|
-
groupMetaCache.delete(jid);
|
|
1631
|
-
};
|
|
1632
|
-
const forgetFullGroupMetadata = (jid) => {
|
|
1633
|
-
options.baileysGroupMetaCache?.delete(jid);
|
|
1634
|
-
groupMetadataCache.delete(jid);
|
|
1635
|
-
groupMetaCache.delete(jid);
|
|
1636
|
-
publishedGroupMetadataJids.delete(jid);
|
|
1637
|
-
invalidatedGroupMetadataJids.add(jid);
|
|
1638
|
-
};
|
|
1639
|
-
const detachGroupsUpsert = attachSockListener("groups.upsert", ((groups) => {
|
|
1640
|
-
for (const group of groups) if (group.id) rememberFullGroupMetadataUpdate(group.id, group);
|
|
1641
|
-
}));
|
|
1642
|
-
const detachGroupsUpdate = attachSockListener("groups.update", ((updates) => {
|
|
1643
|
-
for (const update of updates) {
|
|
1644
|
-
if (!update.id) continue;
|
|
1645
|
-
if (isFullGroupMetadataUpdate(update)) {
|
|
1646
|
-
rememberFullGroupMetadataUpdate(update.id, update);
|
|
1647
|
-
continue;
|
|
1648
|
-
}
|
|
1649
|
-
forgetFullGroupMetadata(update.id);
|
|
1650
|
-
}
|
|
1651
|
-
}));
|
|
1652
|
-
const detachGroupParticipantsUpdate = attachSockListener("group-participants.update", ((update) => {
|
|
1653
|
-
forgetFullGroupMetadata(update.id);
|
|
1654
|
-
}));
|
|
1655
|
-
durableInboundMonitor.start();
|
|
1656
|
-
(async () => {
|
|
1657
|
-
try {
|
|
1658
|
-
const groups = await sock.groupFetchAllParticipating();
|
|
1659
|
-
if (groupMetadataCacheClosed) return;
|
|
1660
|
-
for (const [jid, meta] of Object.entries(groups ?? {})) if (meta && !publishedGroupMetadataJids.has(jid) && !invalidatedGroupMetadataJids.has(jid)) {
|
|
1661
|
-
rememberGroupMetadataCacheEntry(groupMetadataCache, jid, summarizeGroupMetaForReconnectCache(meta));
|
|
1662
|
-
rememberWhatsAppBaileysCacheEntry(options.baileysGroupMetaCache, jid, meta, GROUP_META_TTL_MS);
|
|
1663
|
-
publishedGroupMetadataJids.add(jid);
|
|
1664
|
-
}
|
|
1665
|
-
logWhatsAppVerbose(options.verbose, `Hydrated ${Object.keys(groups ?? {}).length} participating groups on connect`);
|
|
1666
|
-
} catch (err) {
|
|
1667
|
-
const error = String(err);
|
|
1668
|
-
inboundLogger.warn({ error }, "failed hydrating participating groups on connect");
|
|
1669
|
-
inboundConsoleLog.warn(`Failed hydrating participating groups on connect: ${error}`);
|
|
1670
|
-
logWhatsAppVerbose(options.verbose, `Failed to hydrate participating groups on connect: ${error}`);
|
|
1671
|
-
}
|
|
1672
|
-
})();
|
|
1673
|
-
const sendApi = createWebSendApi({
|
|
1674
|
-
sock: sendApiSocketOperations,
|
|
1675
|
-
defaultAccountId: options.accountId,
|
|
1676
|
-
resolveOutboundMentions: ({ jid, text }) => resolveOutboundMentionsForGroup(jid, text),
|
|
1677
|
-
authDir: options.authDir
|
|
1678
|
-
});
|
|
1679
|
-
return {
|
|
1680
|
-
close: async () => {
|
|
1681
|
-
try {
|
|
1682
|
-
detachMessagesUpsert();
|
|
1683
|
-
detachConnectionUpdate();
|
|
1684
|
-
detachGroupsUpsert();
|
|
1685
|
-
detachGroupsUpdate();
|
|
1686
|
-
detachGroupParticipantsUpdate();
|
|
1687
|
-
await drainInboundBeforeSocketCloseWithTimeout();
|
|
1688
|
-
} catch (err) {
|
|
1689
|
-
logWhatsAppVerbose(options.verbose, `Inbound close drain failed: ${String(err)}`);
|
|
1690
|
-
}
|
|
1691
|
-
try {
|
|
1692
|
-
closeInboundMonitorSocket(sock);
|
|
1693
|
-
} catch (err) {
|
|
1694
|
-
logWhatsAppVerbose(options.verbose, `Socket close failed: ${String(err)}`);
|
|
1695
|
-
}
|
|
1696
|
-
},
|
|
1697
|
-
onClose,
|
|
1698
|
-
signalClose: (reason) => {
|
|
1699
|
-
resolveClose(reason ?? {
|
|
1700
|
-
status: void 0,
|
|
1701
|
-
isLoggedOut: false,
|
|
1702
|
-
error: "closed"
|
|
1703
|
-
});
|
|
1704
|
-
},
|
|
1705
|
-
assertSendReady: assertCanSendTo,
|
|
1706
|
-
sendComposingTo: sendApi.sendComposingTo,
|
|
1707
|
-
sendMessage: sendApi.sendMessage,
|
|
1708
|
-
sendPoll: sendApi.sendPoll,
|
|
1709
|
-
sendReaction: sendApi.sendReaction
|
|
1710
|
-
};
|
|
1711
|
-
}
|
|
1712
|
-
async function monitorWebInbox(options) {
|
|
1713
|
-
const socketTiming = options.socketTiming ?? resolveWhatsAppSocketTiming();
|
|
1714
|
-
const recentMessageKeys = options.recentMessageKeys ?? /* @__PURE__ */ new Map();
|
|
1715
|
-
const baileysGroupMetaCache = options.baileysGroupMetaCache ?? /* @__PURE__ */ new Map();
|
|
1716
|
-
const sock = await createWaSocket(false, options.verbose, {
|
|
1717
|
-
authDir: options.authDir,
|
|
1718
|
-
...socketTiming,
|
|
1719
|
-
getMessage: async (key) => key.id && key.remoteJid ? readWhatsAppBaileysCacheEntry(recentMessageKeys, `${key.remoteJid}:${key.id}`) : void 0,
|
|
1720
|
-
cachedGroupMetadata: async (jid) => {
|
|
1721
|
-
const meta = readWhatsAppBaileysCacheEntry(baileysGroupMetaCache, jid);
|
|
1722
|
-
return meta?.participants?.length ? meta : void 0;
|
|
1723
|
-
}
|
|
1724
|
-
});
|
|
1725
|
-
try {
|
|
1726
|
-
await waitForWaConnection(sock, { timeoutMs: socketTiming.connectTimeoutMs });
|
|
1727
|
-
} catch (err) {
|
|
1728
|
-
closeInboundMonitorSocket(sock);
|
|
1729
|
-
throw err;
|
|
1730
|
-
}
|
|
1731
|
-
const shouldDebounce = options.shouldDebounce;
|
|
1732
|
-
const normalizeAdmittedWebInboundMessage = (msg) => requireAdmittedWhatsAppInboundMessage(normalizeWebInboundMessage(msg));
|
|
1733
|
-
return attachWebInboxToSocket({
|
|
1734
|
-
...options,
|
|
1735
|
-
onMessage: async (msg) => {
|
|
1736
|
-
await options.onMessage(normalizeAdmittedWebInboundMessage(msg));
|
|
1737
|
-
},
|
|
1738
|
-
shouldDebounce: shouldDebounce ? (msg) => shouldDebounce(normalizeAdmittedWebInboundMessage(msg)) : void 0,
|
|
1739
|
-
socketTiming,
|
|
1740
|
-
sock,
|
|
1741
|
-
recentMessageKeys,
|
|
1742
|
-
baileysGroupMetaCache
|
|
1743
|
-
});
|
|
1744
|
-
}
|
|
1745
|
-
//#endregion
|
|
1746
|
-
//#region extensions/whatsapp/src/auto-reply/loggers.ts
|
|
1747
|
-
const whatsappLog = createSubsystemLogger("gateway/channels/whatsapp");
|
|
1748
|
-
const whatsappInboundLog = whatsappLog.child("inbound");
|
|
1749
|
-
const whatsappOutboundLog = whatsappLog.child("outbound");
|
|
1750
|
-
const whatsappHeartbeatLog = whatsappLog.child("heartbeat");
|
|
1751
|
-
//#endregion
|
|
1752
|
-
//#region extensions/whatsapp/src/auto-reply/mentions.ts
|
|
1753
|
-
function buildMentionConfig(cfg, agentId, options) {
|
|
1754
|
-
return {
|
|
1755
|
-
mentionRegexes: buildMentionRegexes(cfg, agentId, options),
|
|
1756
|
-
allowFrom: cfg.channels?.whatsapp?.allowFrom
|
|
1757
|
-
};
|
|
1758
|
-
}
|
|
1759
|
-
function resolveMentionTargets(msg, authDir) {
|
|
1760
|
-
return {
|
|
1761
|
-
normalizedMentions: getMentionIdentities(msg, authDir),
|
|
1762
|
-
self: getSelfIdentity(msg, authDir)
|
|
1763
|
-
};
|
|
1764
|
-
}
|
|
1765
|
-
function isBotMentionedFromTargets(msg, mentionCfg, targets) {
|
|
1766
|
-
const clean = (text) => normalizeMentionText(text);
|
|
1767
|
-
const explicitSelfChatOverride = typeof mentionCfg.isSelfChat === "boolean";
|
|
1768
|
-
const isGroupConversation = requireWhatsAppInboundAdmission(msg).conversation.kind === "group";
|
|
1769
|
-
const isSelfChat = explicitSelfChatOverride ? Boolean(mentionCfg.isSelfChat) : isSelfChatMode(targets.self.e164, mentionCfg.allowFrom) && !isGroupConversation;
|
|
1770
|
-
const hasMentions = targets.normalizedMentions.length > 0;
|
|
1771
|
-
const hasNativeMentionsOutsideSelfChat = hasMentions && !isSelfChat;
|
|
1772
|
-
if (hasNativeMentionsOutsideSelfChat) {
|
|
1773
|
-
for (const mention of targets.normalizedMentions) if (identitiesOverlap(targets.self, mention)) return true;
|
|
1774
|
-
} else if (hasMentions && isSelfChat) {}
|
|
1775
|
-
const bodyClean = clean(msg.payload.body);
|
|
1776
|
-
if (mentionCfg.mentionRegexes.some((re) => re.test(bodyClean))) return true;
|
|
1777
|
-
if (hasNativeMentionsOutsideSelfChat) return false;
|
|
1778
|
-
if (targets.self.e164) {
|
|
1779
|
-
const selfDigits = targets.self.e164.replace(/\D/g, "");
|
|
1780
|
-
if (selfDigits) {
|
|
1781
|
-
if (bodyClean.replace(/[^\d]/g, "").includes(selfDigits)) return true;
|
|
1782
|
-
const bodyNoSpace = msg.payload.body.replace(/[\s-]/g, "");
|
|
1783
|
-
if (new RegExp(`\\+?${selfDigits}`, "i").test(bodyNoSpace)) return true;
|
|
1784
|
-
}
|
|
1785
|
-
}
|
|
1786
|
-
return false;
|
|
1787
|
-
}
|
|
1788
|
-
function debugMention(msg, mentionCfg, authDir) {
|
|
1789
|
-
const mentionTargets = resolveMentionTargets(msg, authDir);
|
|
1790
|
-
return {
|
|
1791
|
-
wasMentioned: isBotMentionedFromTargets(msg, mentionCfg, mentionTargets),
|
|
1792
|
-
details: {
|
|
1793
|
-
from: requireWhatsAppInboundAdmission(msg).conversation.id,
|
|
1794
|
-
body: msg.payload.body,
|
|
1795
|
-
bodyClean: normalizeMentionText(msg.payload.body),
|
|
1796
|
-
mentionedJids: msg.group?.mentions?.jids ?? null,
|
|
1797
|
-
normalizedMentionedJids: mentionTargets.normalizedMentions.length ? mentionTargets.normalizedMentions.map((identity) => getComparableIdentityValues(identity)) : null,
|
|
1798
|
-
selfJid: msg.platform.self?.jid ?? msg.platform.selfJid ?? null,
|
|
1799
|
-
selfLid: msg.platform.self?.lid ?? msg.platform.selfLid ?? null,
|
|
1800
|
-
selfE164: msg.platform.self?.e164 ?? msg.platform.selfE164 ?? null,
|
|
1801
|
-
resolvedSelf: mentionTargets.self
|
|
1802
|
-
}
|
|
1803
|
-
};
|
|
1804
|
-
}
|
|
1805
|
-
function resolveOwnerList(mentionCfg, selfE164) {
|
|
1806
|
-
const allowFrom = mentionCfg.allowFrom;
|
|
1807
|
-
return (Array.isArray(allowFrom) && allowFrom.length > 0 ? allowFrom : selfE164 ? [selfE164] : []).filter((entry) => Boolean(entry && entry !== "*")).map((entry) => normalizeE164(entry)).filter((entry) => Boolean(entry));
|
|
1808
|
-
}
|
|
1809
|
-
//#endregion
|
|
1810
|
-
//#region extensions/whatsapp/src/auto-reply/monitor-state.ts
|
|
1811
|
-
function cloneStatus(status) {
|
|
1812
|
-
return {
|
|
1813
|
-
...status,
|
|
1814
|
-
lastDisconnect: status.lastDisconnect ? { ...status.lastDisconnect } : null
|
|
1815
|
-
};
|
|
1816
|
-
}
|
|
1817
|
-
function isTerminalHealthState(healthState) {
|
|
1818
|
-
return healthState === "conflict" || healthState === "logged-out" || healthState === "stopped";
|
|
1819
|
-
}
|
|
1820
|
-
function createWebChannelStatusController(statusSink) {
|
|
1821
|
-
let lastDisconnectWasWatchdogRecovery = false;
|
|
1822
|
-
const status = {
|
|
1823
|
-
running: true,
|
|
1824
|
-
connected: false,
|
|
1825
|
-
reconnectAttempts: 0,
|
|
1826
|
-
lastConnectedAt: null,
|
|
1827
|
-
lastDisconnect: null,
|
|
1828
|
-
lastInboundAt: null,
|
|
1829
|
-
lastMessageAt: null,
|
|
1830
|
-
lastEventAt: null,
|
|
1831
|
-
lastError: null,
|
|
1832
|
-
busy: false,
|
|
1833
|
-
lastRunActivityAt: null,
|
|
1834
|
-
healthState: "starting"
|
|
1835
|
-
};
|
|
1836
|
-
const emit = () => {
|
|
1837
|
-
statusSink?.(cloneStatus(status));
|
|
1838
|
-
};
|
|
1839
|
-
return {
|
|
1840
|
-
emit,
|
|
1841
|
-
snapshot: () => status,
|
|
1842
|
-
noteConnected(at = Date.now()) {
|
|
1843
|
-
Object.assign(status, createConnectedChannelStatusPatch(at));
|
|
1844
|
-
Object.assign(status, createTransportActivityStatusPatch(at));
|
|
1845
|
-
if (lastDisconnectWasWatchdogRecovery) {
|
|
1846
|
-
status.lastDisconnect = null;
|
|
1847
|
-
status.reconnectAttempts = 0;
|
|
1848
|
-
lastDisconnectWasWatchdogRecovery = false;
|
|
1849
|
-
}
|
|
1850
|
-
status.lastError = null;
|
|
1851
|
-
status.healthState = "healthy";
|
|
1852
|
-
status.terminalDisconnect = void 0;
|
|
1853
|
-
emit();
|
|
1854
|
-
},
|
|
1855
|
-
noteInbound(at = Date.now()) {
|
|
1856
|
-
status.lastInboundAt = at;
|
|
1857
|
-
status.lastMessageAt = at;
|
|
1858
|
-
status.lastEventAt = at;
|
|
1859
|
-
Object.assign(status, createTransportActivityStatusPatch(at));
|
|
1860
|
-
if (status.connected) status.healthState = "healthy";
|
|
1861
|
-
emit();
|
|
1862
|
-
},
|
|
1863
|
-
noteTransportActivity(at = Date.now()) {
|
|
1864
|
-
if (status.lastTransportActivityAt === at) return;
|
|
1865
|
-
Object.assign(status, createTransportActivityStatusPatch(at));
|
|
1866
|
-
emit();
|
|
1867
|
-
},
|
|
1868
|
-
noteBusy(busy, at = Date.now()) {
|
|
1869
|
-
if (status.busy === busy && status.lastRunActivityAt === at) return;
|
|
1870
|
-
status.busy = busy;
|
|
1871
|
-
status.lastRunActivityAt = at;
|
|
1872
|
-
if (status.connected && busy) status.healthState = "healthy";
|
|
1873
|
-
emit();
|
|
1874
|
-
},
|
|
1875
|
-
noteWatchdogStale(at = Date.now()) {
|
|
1876
|
-
status.lastEventAt = at;
|
|
1877
|
-
if (status.connected) status.healthState = "stale";
|
|
1878
|
-
emit();
|
|
1879
|
-
},
|
|
1880
|
-
noteReconnectAttempts(reconnectAttempts) {
|
|
1881
|
-
status.reconnectAttempts = reconnectAttempts;
|
|
1882
|
-
emit();
|
|
1883
|
-
},
|
|
1884
|
-
noteClose(params) {
|
|
1885
|
-
const at = params.at ?? Date.now();
|
|
1886
|
-
lastDisconnectWasWatchdogRecovery = params.watchdogRecovery === true;
|
|
1887
|
-
status.connected = false;
|
|
1888
|
-
status.lastEventAt = at;
|
|
1889
|
-
status.lastDisconnect = {
|
|
1890
|
-
at,
|
|
1891
|
-
status: params.statusCode,
|
|
1892
|
-
error: params.error,
|
|
1893
|
-
loggedOut: Boolean(params.loggedOut)
|
|
1894
|
-
};
|
|
1895
|
-
status.lastError = params.error ?? null;
|
|
1896
|
-
status.reconnectAttempts = params.reconnectAttempts;
|
|
1897
|
-
status.healthState = params.healthState;
|
|
1898
|
-
emit();
|
|
1899
|
-
},
|
|
1900
|
-
markStopped(at = Date.now()) {
|
|
1901
|
-
status.running = false;
|
|
1902
|
-
status.connected = false;
|
|
1903
|
-
status.lastEventAt = at;
|
|
1904
|
-
status.terminalDisconnect = status.healthState === "logged-out" || status.healthState === "conflict";
|
|
1905
|
-
if (!isTerminalHealthState(status.healthState)) status.healthState = "stopped";
|
|
1906
|
-
emit();
|
|
1907
|
-
}
|
|
1908
|
-
};
|
|
1909
|
-
}
|
|
1910
|
-
//#endregion
|
|
1911
|
-
//#region extensions/whatsapp/src/auto-reply/monitor/echo.ts
|
|
1912
|
-
function createEchoTracker(params) {
|
|
1913
|
-
const recentlySent = /* @__PURE__ */ new Set();
|
|
1914
|
-
const maxItems = Math.max(1, params.maxItems ?? 100);
|
|
1915
|
-
const buildCombinedKey = (p) => `combined:${p.sessionKey}:${p.combinedBody}`;
|
|
1916
|
-
const trim = () => {
|
|
1917
|
-
while (recentlySent.size > maxItems) {
|
|
1918
|
-
const firstKey = recentlySent.values().next().value;
|
|
1919
|
-
if (!firstKey) break;
|
|
1920
|
-
recentlySent.delete(firstKey);
|
|
1921
|
-
}
|
|
1922
|
-
};
|
|
1923
|
-
const rememberText = (text, opts) => {
|
|
1924
|
-
if (!text) return;
|
|
1925
|
-
recentlySent.add(text);
|
|
1926
|
-
if (opts.combinedBody && opts.combinedBodySessionKey) recentlySent.add(buildCombinedKey({
|
|
1927
|
-
sessionKey: opts.combinedBodySessionKey,
|
|
1928
|
-
combinedBody: opts.combinedBody
|
|
1929
|
-
}));
|
|
1930
|
-
if (opts.logVerboseMessage) params.logVerbose?.(`Added to echo detection set (size now: ${recentlySent.size}): ${truncateUtf16Safe(text, 50)}...`);
|
|
1931
|
-
trim();
|
|
1932
|
-
};
|
|
1933
|
-
return {
|
|
1934
|
-
rememberText,
|
|
1935
|
-
has: (key) => recentlySent.has(key),
|
|
1936
|
-
forget: (key) => {
|
|
1937
|
-
recentlySent.delete(key);
|
|
1938
|
-
},
|
|
1939
|
-
buildCombinedKey
|
|
1940
|
-
};
|
|
1941
|
-
}
|
|
1942
|
-
//#endregion
|
|
1943
|
-
//#region extensions/whatsapp/src/auto-reply/monitor/listener-log.ts
|
|
1944
|
-
function formatWhatsAppInboundListeningLog(account) {
|
|
1945
|
-
if (account.groupPolicy === "disabled") return "Listening for WhatsApp inbound messages (DM + groups disabled by groupPolicy).";
|
|
1946
|
-
if (account.groupPolicy === "allowlist" && !account.hasGroupAllowFrom) return "Listening for WhatsApp inbound messages (DM + group inbound blocked by empty groupPolicy allowlist).";
|
|
1947
|
-
const groups = account.groups ?? {};
|
|
1948
|
-
if (Object.keys(groups).length === 0) return `Listening for WhatsApp inbound messages (DM + all groups; ${account.groupPolicy === "allowlist" ? "sender allowlist configured" : "no group allowlist configured"}).`;
|
|
1949
|
-
if (Object.hasOwn(groups, "*")) return "Listening for WhatsApp inbound messages (DM + all groups; wildcard configured).";
|
|
1950
|
-
const explicitGroupCount = Object.keys(groups).length;
|
|
1951
|
-
return `Listening for WhatsApp inbound messages (DM + ${explicitGroupCount} configured ${explicitGroupCount === 1 ? "group" : "groups"}).`;
|
|
1952
|
-
}
|
|
1953
|
-
//#endregion
|
|
1954
|
-
//#region extensions/whatsapp/src/auto-reply/monitor/ack-emoji.ts
|
|
1955
|
-
const DEFAULT_WHATSAPP_ACK_REACTION = "👀";
|
|
1956
|
-
function resolveWhatsAppAckEmoji(params) {
|
|
1957
|
-
if (!params.ackConfig) return "";
|
|
1958
|
-
return (typeof params.ackConfig === "string" ? params.ackConfig : params.ackConfig.emoji)?.trim() || resolveAgentIdentityEmoji(params.cfg, params.agentId) || DEFAULT_WHATSAPP_ACK_REACTION;
|
|
1959
|
-
}
|
|
1960
|
-
function resolveAgentIdentityEmoji(cfg, agentId) {
|
|
1961
|
-
return resolveAgentIdentity(cfg, agentId)?.emoji?.trim() || void 0;
|
|
1962
|
-
}
|
|
1963
|
-
//#endregion
|
|
1964
|
-
//#region extensions/whatsapp/src/auto-reply/monitor/group-activation.ts
|
|
1965
|
-
function hasNamedWhatsAppAccounts(cfg) {
|
|
1966
|
-
return Object.keys(cfg.channels?.whatsapp?.accounts ?? {}).some((accountId) => normalizeAccountId$1(accountId) !== DEFAULT_ACCOUNT_ID$1);
|
|
1967
|
-
}
|
|
1968
|
-
function isActivationOnlyEntry(entry) {
|
|
1969
|
-
return entry?.groupActivation !== void 0 && typeof entry?.sessionId !== "string" && typeof entry?.updatedAt !== "number";
|
|
1970
|
-
}
|
|
1971
|
-
/** Resolves group activation for a WhatsApp conversation and backfills scoped session metadata. */
|
|
1972
|
-
async function resolveGroupActivationFor(params) {
|
|
1973
|
-
const sessionScope = {
|
|
1974
|
-
storePath: resolveStorePath(params.cfg.session?.store, { agentId: params.agentId }),
|
|
1975
|
-
agentId: params.agentId
|
|
1976
|
-
};
|
|
1977
|
-
const legacySessionKey = resolveWhatsAppLegacyGroupSessionKey({
|
|
1978
|
-
sessionKey: params.sessionKey,
|
|
1979
|
-
accountId: params.accountId
|
|
1980
|
-
});
|
|
1981
|
-
const legacyEntry = legacySessionKey ? getSessionEntry({
|
|
1982
|
-
...sessionScope,
|
|
1983
|
-
sessionKey: legacySessionKey
|
|
1984
|
-
}) : void 0;
|
|
1985
|
-
const scopedEntry = getSessionEntry({
|
|
1986
|
-
...sessionScope,
|
|
1987
|
-
sessionKey: params.sessionKey
|
|
1988
|
-
});
|
|
1989
|
-
const activation = (normalizeAccountId$1(params.accountId) === DEFAULT_ACCOUNT_ID$1 && hasNamedWhatsAppAccounts(params.cfg) && isActivationOnlyEntry(scopedEntry) ? void 0 : scopedEntry?.groupActivation) ?? legacyEntry?.groupActivation;
|
|
1990
|
-
if (activation !== void 0 && scopedEntry?.groupActivation === void 0) {
|
|
1991
|
-
if (scopedEntry) await patchSessionEntry({
|
|
1992
|
-
...sessionScope,
|
|
1993
|
-
sessionKey: params.sessionKey,
|
|
1994
|
-
replaceEntry: true,
|
|
1995
|
-
update: (entry) => {
|
|
1996
|
-
if (entry.groupActivation !== void 0) return null;
|
|
1997
|
-
return {
|
|
1998
|
-
...entry,
|
|
1999
|
-
groupActivation: activation
|
|
2000
|
-
};
|
|
2001
|
-
}
|
|
2002
|
-
});
|
|
2003
|
-
}
|
|
2004
|
-
const defaultActivation = !resolveWhatsAppInboundPolicy({
|
|
2005
|
-
cfg: params.cfg,
|
|
2006
|
-
accountId: params.accountId
|
|
2007
|
-
}).resolveConversationRequireMention(params.conversationId) ? "always" : "mention";
|
|
2008
|
-
return normalizeGroupActivation(activation) ?? defaultActivation;
|
|
2009
|
-
}
|
|
2010
|
-
//#endregion
|
|
2011
|
-
//#region extensions/whatsapp/src/auto-reply/monitor/reaction-participant.ts
|
|
2012
|
-
function resolveReactionParticipant(msg) {
|
|
2013
|
-
const sender = getSenderIdentity(msg);
|
|
2014
|
-
return sender.jid ?? sender.lid ?? void 0;
|
|
2015
|
-
}
|
|
2016
|
-
//#endregion
|
|
2017
|
-
//#region extensions/whatsapp/src/auto-reply/monitor/ack-reaction.ts
|
|
2018
|
-
async function maybeSendAckReaction(params) {
|
|
2019
|
-
if (!params.msg.event.id) return null;
|
|
2020
|
-
const admission = requireWhatsAppInboundAdmission(params.msg);
|
|
2021
|
-
const accountId = admission.accountId;
|
|
2022
|
-
if (resolveWhatsAppReactionLevel({
|
|
2023
|
-
cfg: params.cfg,
|
|
2024
|
-
accountId
|
|
2025
|
-
}).level === "off") return null;
|
|
2026
|
-
const ackConfig = params.cfg.messages?.ackReaction;
|
|
2027
|
-
const scope = params.cfg.messages?.ackReactionScope ?? "group-mentions";
|
|
2028
|
-
if (scope === "off" || scope === "none") return null;
|
|
2029
|
-
const emoji = resolveWhatsAppAckEmoji({
|
|
2030
|
-
cfg: params.cfg,
|
|
2031
|
-
agentId: params.agentId,
|
|
2032
|
-
ackConfig
|
|
2033
|
-
});
|
|
2034
|
-
const directEnabled = scope === "all" || scope === "direct";
|
|
2035
|
-
const groupMode = scope === "all" || scope === "group-all" ? "always" : scope === "direct" ? "never" : "mentions";
|
|
2036
|
-
const isGroup = admission.conversation.kind === "group";
|
|
2037
|
-
const conversationIdForCheck = admission.conversation.id;
|
|
2038
|
-
const activation = isGroup ? await resolveGroupActivationFor({
|
|
2039
|
-
cfg: params.cfg,
|
|
2040
|
-
accountId,
|
|
2041
|
-
agentId: params.agentId,
|
|
2042
|
-
sessionKey: params.sessionKey,
|
|
2043
|
-
conversationId: conversationIdForCheck
|
|
2044
|
-
}) : null;
|
|
2045
|
-
const shouldSendReaction = () => shouldAckReactionForWhatsApp({
|
|
2046
|
-
emoji,
|
|
2047
|
-
isDirect: admission.conversation.kind === "direct",
|
|
2048
|
-
isGroup,
|
|
2049
|
-
directEnabled,
|
|
2050
|
-
groupMode,
|
|
2051
|
-
wasMentioned: (params.msg.groupMention?.wasMentioned ?? params.msg.wasMentioned) === true,
|
|
2052
|
-
groupActivated: activation === "always"
|
|
2053
|
-
});
|
|
2054
|
-
if (!shouldSendReaction()) return null;
|
|
2055
|
-
params.info({
|
|
2056
|
-
chatId: params.msg.platform.chatJid,
|
|
2057
|
-
messageId: params.msg.event.id,
|
|
2058
|
-
emoji
|
|
2059
|
-
}, "sending ack reaction");
|
|
2060
|
-
const participant = resolveReactionParticipant(params.msg);
|
|
2061
|
-
const reactionOptions = {
|
|
2062
|
-
verbose: params.verbose,
|
|
2063
|
-
fromMe: false,
|
|
2064
|
-
...participant ? { participant } : {},
|
|
2065
|
-
accountId,
|
|
2066
|
-
cfg: params.cfg
|
|
2067
|
-
};
|
|
2068
|
-
return createAckReactionHandle({
|
|
2069
|
-
ackReactionValue: emoji,
|
|
2070
|
-
send: () => sendReactionWhatsApp(params.msg.platform.chatJid, params.msg.event.id, emoji, reactionOptions),
|
|
2071
|
-
remove: () => sendReactionWhatsApp(params.msg.platform.chatJid, params.msg.event.id, "", reactionOptions),
|
|
2072
|
-
onSendError: (err) => {
|
|
2073
|
-
params.warn({
|
|
2074
|
-
error: formatError(err),
|
|
2075
|
-
chatId: params.msg.platform.chatJid,
|
|
2076
|
-
messageId: params.msg.event.id
|
|
2077
|
-
}, "failed to send ack reaction");
|
|
2078
|
-
logVerbose(`WhatsApp ack reaction failed for chat ${params.msg.platform.chatJid}: ${formatError(err)}`);
|
|
2079
|
-
}
|
|
2080
|
-
});
|
|
2081
|
-
}
|
|
2082
|
-
//#endregion
|
|
2083
|
-
//#region extensions/whatsapp/src/auto-reply/monitor/broadcast.ts
|
|
2084
|
-
function buildBroadcastRouteKeys(params) {
|
|
2085
|
-
const admission = requireWhatsAppInboundAdmission(params.msg);
|
|
2086
|
-
const sessionKey = buildAgentSessionKey({
|
|
2087
|
-
agentId: params.agentId,
|
|
2088
|
-
channel: "whatsapp",
|
|
2089
|
-
accountId: params.route.accountId,
|
|
2090
|
-
peer: {
|
|
2091
|
-
kind: admission.conversation.kind,
|
|
2092
|
-
id: params.peerId
|
|
2093
|
-
},
|
|
2094
|
-
dmScope: params.cfg.session?.dmScope,
|
|
2095
|
-
identityLinks: params.cfg.session?.identityLinks
|
|
2096
|
-
});
|
|
2097
|
-
const mainSessionKey = buildAgentMainSessionKey({
|
|
2098
|
-
agentId: params.agentId,
|
|
2099
|
-
mainKey: DEFAULT_MAIN_KEY
|
|
2100
|
-
});
|
|
2101
|
-
return {
|
|
2102
|
-
sessionKey,
|
|
2103
|
-
mainSessionKey,
|
|
2104
|
-
lastRoutePolicy: deriveLastRoutePolicy({
|
|
2105
|
-
sessionKey,
|
|
2106
|
-
mainSessionKey
|
|
2107
|
-
})
|
|
2108
|
-
};
|
|
2109
|
-
}
|
|
2110
|
-
async function maybeBroadcastMessage(params) {
|
|
2111
|
-
const broadcastAgents = params.cfg.broadcast?.[params.peerId];
|
|
2112
|
-
if (!broadcastAgents || !Array.isArray(broadcastAgents)) return false;
|
|
2113
|
-
if (broadcastAgents.length === 0) return false;
|
|
2114
|
-
const strategy = params.cfg.broadcast?.strategy || "parallel";
|
|
2115
|
-
whatsappInboundLog.info(`Broadcasting message to ${broadcastAgents.length} agents (${strategy})`);
|
|
2116
|
-
const agentIds = params.cfg.agents?.list?.map((agent) => normalizeAgentId(agent.id));
|
|
2117
|
-
const hasKnownAgents = (agentIds?.length ?? 0) > 0;
|
|
2118
|
-
const isGroupConversation = requireWhatsAppInboundAdmission(params.msg).conversation.kind === "group";
|
|
2119
|
-
const groupHistorySnapshot = isGroupConversation ? params.groupHistories.get(params.groupHistoryKey) ?? [] : void 0;
|
|
2120
|
-
const processForAgent = async (agentId) => {
|
|
2121
|
-
const normalizedAgentId = normalizeAgentId(agentId);
|
|
2122
|
-
if (hasKnownAgents && !agentIds?.includes(normalizedAgentId)) {
|
|
2123
|
-
whatsappInboundLog.warn(`Broadcast agent ${agentId} not found in agents.list; skipping`);
|
|
2124
|
-
return false;
|
|
2125
|
-
}
|
|
2126
|
-
const routeKeys = buildBroadcastRouteKeys({
|
|
2127
|
-
cfg: params.cfg,
|
|
2128
|
-
msg: params.msg,
|
|
2129
|
-
route: params.route,
|
|
2130
|
-
peerId: params.peerId,
|
|
2131
|
-
agentId: normalizedAgentId
|
|
2132
|
-
});
|
|
2133
|
-
const baseAgentRoute = {
|
|
2134
|
-
...params.route,
|
|
2135
|
-
agentId: normalizedAgentId,
|
|
2136
|
-
...routeKeys
|
|
2137
|
-
};
|
|
2138
|
-
const agentRoute = isGroupConversation ? resolveWhatsAppGroupSessionRoute(baseAgentRoute) : baseAgentRoute;
|
|
2139
|
-
try {
|
|
2140
|
-
const opts = {
|
|
2141
|
-
groupHistory: groupHistorySnapshot,
|
|
2142
|
-
suppressGroupHistoryClear: true
|
|
2143
|
-
};
|
|
2144
|
-
if (params.preflightAudioTranscript !== void 0) opts.preflightAudioTranscript = params.preflightAudioTranscript;
|
|
2145
|
-
if (params.ackAlreadySent === true) opts.ackAlreadySent = true;
|
|
2146
|
-
if (params.ackReaction !== void 0) opts.ackReaction = params.ackReaction;
|
|
2147
|
-
return await params.processMessage(params.msg, agentRoute, params.groupHistoryKey, opts);
|
|
2148
|
-
} catch (err) {
|
|
2149
|
-
whatsappInboundLog.error(`Broadcast agent ${agentId} failed: ${formatError(err)}`);
|
|
2150
|
-
return false;
|
|
2151
|
-
}
|
|
2152
|
-
};
|
|
2153
|
-
if (strategy === "sequential") for (const agentId of broadcastAgents) await processForAgent(agentId);
|
|
2154
|
-
else await Promise.allSettled(broadcastAgents.map(processForAgent));
|
|
2155
|
-
if (isGroupConversation) params.groupHistories.set(params.groupHistoryKey, []);
|
|
2156
|
-
return true;
|
|
2157
|
-
}
|
|
2158
|
-
//#endregion
|
|
2159
|
-
//#region extensions/whatsapp/src/auto-reply/monitor/commands.ts
|
|
2160
|
-
function stripMentionsForCommand(text, mentionRegexes, selfE164) {
|
|
2161
|
-
let result = text;
|
|
2162
|
-
for (const re of mentionRegexes) result = result.replace(re, " ");
|
|
2163
|
-
if (selfE164) {
|
|
2164
|
-
const digits = selfE164.replace(/\D/g, "");
|
|
2165
|
-
if (digits) {
|
|
2166
|
-
const pattern = new RegExp(`\\+?${digits}`, "g");
|
|
2167
|
-
result = result.replace(pattern, " ");
|
|
2168
|
-
}
|
|
2169
|
-
}
|
|
2170
|
-
return result.replace(/\s+/g, " ").trim();
|
|
2171
|
-
}
|
|
2172
|
-
//#endregion
|
|
2173
|
-
//#region extensions/whatsapp/src/auto-reply/monitor/group-members.ts
|
|
2174
|
-
function appendNormalizedUnique(entries, seen, ordered) {
|
|
2175
|
-
for (const entry of entries) {
|
|
2176
|
-
const normalized = normalizeE164(entry) ?? entry;
|
|
2177
|
-
if (!normalized || seen.has(normalized)) continue;
|
|
2178
|
-
seen.add(normalized);
|
|
2179
|
-
ordered.push(normalized);
|
|
2180
|
-
}
|
|
2181
|
-
}
|
|
2182
|
-
function noteGroupMember(groupMemberNames, conversationId, e164, name) {
|
|
2183
|
-
if (!e164 || !name) return;
|
|
2184
|
-
const key = normalizeE164(e164) ?? e164;
|
|
2185
|
-
if (!key) return;
|
|
2186
|
-
let roster = groupMemberNames.get(conversationId);
|
|
2187
|
-
if (!roster) {
|
|
2188
|
-
roster = /* @__PURE__ */ new Map();
|
|
2189
|
-
groupMemberNames.set(conversationId, roster);
|
|
2190
|
-
}
|
|
2191
|
-
roster.set(key, name);
|
|
2192
|
-
}
|
|
2193
|
-
function formatGroupMembers(params) {
|
|
2194
|
-
const { participants, roster, fallbackE164 } = params;
|
|
2195
|
-
const seen = /* @__PURE__ */ new Set();
|
|
2196
|
-
const ordered = [];
|
|
2197
|
-
if (participants?.length) appendNormalizedUnique(participants, seen, ordered);
|
|
2198
|
-
if (roster) appendNormalizedUnique(roster.keys(), seen, ordered);
|
|
2199
|
-
if (ordered.length === 0 && fallbackE164) {
|
|
2200
|
-
const normalized = normalizeE164(fallbackE164) ?? fallbackE164;
|
|
2201
|
-
if (normalized) ordered.push(normalized);
|
|
2202
|
-
}
|
|
2203
|
-
if (ordered.length === 0) return;
|
|
2204
|
-
return ordered.map((entry) => {
|
|
2205
|
-
const name = roster?.get(entry);
|
|
2206
|
-
return name ? `${name} (${entry})` : entry;
|
|
2207
|
-
}).join(", ");
|
|
2208
|
-
}
|
|
2209
|
-
//#endregion
|
|
2210
|
-
//#region extensions/whatsapp/src/auto-reply/monitor/group-gating.ts
|
|
2211
|
-
const groupDropWarned = createDedupeCache({
|
|
2212
|
-
ttlMs: 0,
|
|
2213
|
-
maxSize: 100
|
|
2214
|
-
});
|
|
2215
|
-
function shouldWarnForGroupDrop(warnKey) {
|
|
2216
|
-
return !groupDropWarned.check(warnKey);
|
|
2217
|
-
}
|
|
2218
|
-
function isOwnerSender(baseMentionConfig, msg, authDir) {
|
|
2219
|
-
const sender = normalizeE164(getSenderIdentity(msg, authDir).e164 ?? "");
|
|
2220
|
-
if (!sender) return false;
|
|
2221
|
-
return resolveOwnerList(baseMentionConfig, getSelfIdentity(msg, authDir).e164 ?? void 0).includes(sender);
|
|
2222
|
-
}
|
|
2223
|
-
function recordPendingGroupHistoryEntry(params) {
|
|
2224
|
-
const senderIdentity = getSenderIdentity(params.msg);
|
|
2225
|
-
const sender = senderIdentity.name && senderIdentity.e164 ? `${senderIdentity.name} (${senderIdentity.e164})` : senderIdentity.name ?? senderIdentity.e164 ?? getPrimaryIdentityId(senderIdentity) ?? "Unknown";
|
|
2226
|
-
createChannelHistoryWindow({ historyMap: params.groupHistories }).record({
|
|
2227
|
-
historyKey: params.groupHistoryKey,
|
|
2228
|
-
limit: params.groupHistoryLimit,
|
|
2229
|
-
entry: {
|
|
2230
|
-
sender,
|
|
2231
|
-
body: params.body ?? params.msg.payload.body,
|
|
2232
|
-
timestamp: params.msg.event.timestamp,
|
|
2233
|
-
id: params.msg.event.id,
|
|
2234
|
-
senderJid: senderIdentity.jid ?? params.msg.platform.senderJid,
|
|
2235
|
-
...params.body === void 0 && params.msg.payload.media ? { media: [{
|
|
2236
|
-
path: params.msg.payload.media.path,
|
|
2237
|
-
url: params.msg.payload.media.url ?? params.msg.payload.media.path,
|
|
2238
|
-
contentType: params.msg.payload.media.type,
|
|
2239
|
-
kind: params.msg.payload.media.kind ?? void 0
|
|
2240
|
-
}] } : {}
|
|
2241
|
-
}
|
|
2242
|
-
});
|
|
2243
|
-
}
|
|
2244
|
-
function skipGroupMessageAndStoreHistory(params, verboseMessage, body) {
|
|
2245
|
-
params.logVerbose(verboseMessage);
|
|
2246
|
-
recordPendingGroupHistoryEntry({
|
|
2247
|
-
msg: params.msg,
|
|
2248
|
-
body,
|
|
2249
|
-
groupHistories: params.groupHistories,
|
|
2250
|
-
groupHistoryKey: params.groupHistoryKey,
|
|
2251
|
-
groupHistoryLimit: params.groupHistoryLimit
|
|
2252
|
-
});
|
|
2253
|
-
return { shouldProcess: false };
|
|
2254
|
-
}
|
|
2255
|
-
async function applyGroupGating(params) {
|
|
2256
|
-
const sender = getSenderIdentity(params.msg);
|
|
2257
|
-
const self = getSelfIdentity(params.msg, params.authDir);
|
|
2258
|
-
const admission = requireWhatsAppInboundAdmission(params.msg);
|
|
2259
|
-
const conversationId = admission.conversation.id;
|
|
2260
|
-
const inboundPolicy = resolveWhatsAppInboundPolicy({
|
|
2261
|
-
cfg: params.cfg,
|
|
2262
|
-
accountId: admission.accountId,
|
|
2263
|
-
selfE164: self.e164 ?? null
|
|
2264
|
-
});
|
|
2265
|
-
const conversationGroupPolicy = inboundPolicy.resolveConversationGroupPolicy(conversationId);
|
|
2266
|
-
if (conversationGroupPolicy.allowlistEnabled && !conversationGroupPolicy.allowed) {
|
|
2267
|
-
const accountId = inboundPolicy.account.accountId;
|
|
2268
|
-
if (shouldWarnForGroupDrop(`${accountId}:${conversationId}`)) {
|
|
2269
|
-
const groupsPath = resolveWhatsAppGroupsConfigPath({
|
|
2270
|
-
cfg: params.cfg,
|
|
2271
|
-
accountId
|
|
2272
|
-
});
|
|
2273
|
-
params.replyLogger.warn({
|
|
2274
|
-
conversationId,
|
|
2275
|
-
accountId,
|
|
2276
|
-
groupsPath
|
|
2277
|
-
}, `WhatsApp group ${conversationId} not in ${groupsPath} — inbound dropped. Add the group JID to ${groupsPath} (or add "*" there to admit all groups). Sender authorization still applies.`);
|
|
2278
|
-
}
|
|
2279
|
-
params.logVerbose(`Dropping message from unregistered WhatsApp group ${conversationId}. Add the group JID to channels.whatsapp.groups, or add "*" there to admit all groups. Sender authorization still applies.`);
|
|
2280
|
-
return { shouldProcess: false };
|
|
2281
|
-
}
|
|
2282
|
-
noteGroupMember(params.groupMemberNames, params.groupHistoryKey, sender.e164 ?? void 0, sender.name ?? void 0);
|
|
2283
|
-
const baseMentionConfig = {
|
|
2284
|
-
...params.baseMentionConfig,
|
|
2285
|
-
allowFrom: inboundPolicy.configuredAllowFrom
|
|
2286
|
-
};
|
|
2287
|
-
const mentionConfig = {
|
|
2288
|
-
...buildMentionConfig(params.cfg, params.agentId, {
|
|
2289
|
-
provider: "whatsapp",
|
|
2290
|
-
conversationId,
|
|
2291
|
-
providerPolicy: params.providerMentionPatterns
|
|
2292
|
-
}),
|
|
2293
|
-
allowFrom: inboundPolicy.configuredAllowFrom
|
|
2294
|
-
};
|
|
2295
|
-
const mentionMsg = params.mentionText !== void 0 ? {
|
|
2296
|
-
...params.msg,
|
|
2297
|
-
payload: {
|
|
2298
|
-
...params.msg.payload,
|
|
2299
|
-
body: params.mentionText
|
|
2300
|
-
}
|
|
2301
|
-
} : {
|
|
2302
|
-
...params.msg,
|
|
2303
|
-
payload: {
|
|
2304
|
-
...params.msg.payload,
|
|
2305
|
-
body: params.msg.payload.commandBody ?? params.msg.payload.body
|
|
2306
|
-
}
|
|
2307
|
-
};
|
|
2308
|
-
const commandBody = stripMentionsForCommand(mentionMsg.payload.body, mentionConfig.mentionRegexes, self.e164);
|
|
2309
|
-
const activationCommand = parseActivationCommand(commandBody);
|
|
2310
|
-
const owner = isOwnerSender(baseMentionConfig, params.msg, params.authDir);
|
|
2311
|
-
const shouldBypassMention = owner && hasControlCommand(commandBody, params.cfg);
|
|
2312
|
-
if (activationCommand.hasCommand && !owner) return skipGroupMessageAndStoreHistory(params, `Ignoring /activation from non-owner in group ${conversationId}`);
|
|
2313
|
-
const mentionDebug = debugMention(mentionMsg, mentionConfig, params.authDir);
|
|
2314
|
-
params.replyLogger.debug({
|
|
2315
|
-
conversationId,
|
|
2316
|
-
wasMentioned: mentionDebug.wasMentioned,
|
|
2317
|
-
...mentionDebug.details
|
|
2318
|
-
}, "group mention debug");
|
|
2319
|
-
const wasMentioned = mentionDebug.wasMentioned;
|
|
2320
|
-
const requireMention = await resolveGroupActivationFor({
|
|
2321
|
-
cfg: params.cfg,
|
|
2322
|
-
accountId: inboundPolicy.account.accountId,
|
|
2323
|
-
agentId: params.agentId,
|
|
2324
|
-
sessionKey: params.sessionKey,
|
|
2325
|
-
conversationId
|
|
2326
|
-
}) !== "always";
|
|
2327
|
-
const replyContext = getReplyContext(params.msg, params.authDir);
|
|
2328
|
-
const mentionDecision = resolveInboundMentionDecision({
|
|
2329
|
-
facts: {
|
|
2330
|
-
canDetectMention: true,
|
|
2331
|
-
wasMentioned,
|
|
2332
|
-
implicitMentionKinds: implicitMentionKindWhen("quoted_bot", !(params.selfChatMode === true && identitiesOverlap(self, sender)) && identitiesOverlap(self, replyContext?.sender))
|
|
2333
|
-
},
|
|
2334
|
-
policy: {
|
|
2335
|
-
isGroup: true,
|
|
2336
|
-
requireMention,
|
|
2337
|
-
allowTextCommands: false,
|
|
2338
|
-
hasControlCommand: false,
|
|
2339
|
-
commandAuthorized: false
|
|
2340
|
-
}
|
|
2341
|
-
});
|
|
2342
|
-
const effectiveWasMentioned = mentionDecision.effectiveWasMentioned || shouldBypassMention;
|
|
2343
|
-
params.msg.groupMention = {
|
|
2344
|
-
wasMentioned: effectiveWasMentioned,
|
|
2345
|
-
requireMention
|
|
2346
|
-
};
|
|
2347
|
-
if (!shouldBypassMention && requireMention && mentionDecision.shouldSkip) {
|
|
2348
|
-
if (params.deferMissingMention === true) {
|
|
2349
|
-
params.logVerbose(`Deferring group mention skip until audio preflight completes in ${conversationId}`);
|
|
2350
|
-
return {
|
|
2351
|
-
shouldProcess: false,
|
|
2352
|
-
needsMentionText: true
|
|
2353
|
-
};
|
|
2354
|
-
}
|
|
2355
|
-
return skipGroupMessageAndStoreHistory(params, `Group message stored for context (no mention detected) in ${conversationId}: ${mentionMsg.payload.body}`, params.mentionText);
|
|
2356
|
-
}
|
|
2357
|
-
return { shouldProcess: true };
|
|
2358
|
-
}
|
|
2359
|
-
//#endregion
|
|
2360
|
-
//#region extensions/whatsapp/src/auto-reply/monitor/last-route.ts
|
|
2361
|
-
function trackBackgroundTask(backgroundTasks, task) {
|
|
2362
|
-
backgroundTasks.add(task);
|
|
2363
|
-
const cleanup = () => {
|
|
2364
|
-
backgroundTasks.delete(task);
|
|
2365
|
-
};
|
|
2366
|
-
task.then(cleanup, cleanup);
|
|
2367
|
-
}
|
|
2368
|
-
function updateLastRouteInBackground(params) {
|
|
2369
|
-
const storePath = resolveStorePath$1(params.cfg.session?.store, { agentId: params.storeAgentId });
|
|
2370
|
-
const task = updateLastRoute({
|
|
2371
|
-
storePath,
|
|
2372
|
-
sessionKey: params.sessionKey,
|
|
2373
|
-
deliveryContext: {
|
|
2374
|
-
channel: params.channel,
|
|
2375
|
-
to: params.to,
|
|
2376
|
-
accountId: params.accountId
|
|
2377
|
-
},
|
|
2378
|
-
ctx: params.ctx
|
|
2379
|
-
}).catch((err) => {
|
|
2380
|
-
params.warn({
|
|
2381
|
-
error: formatError(err),
|
|
2382
|
-
storePath,
|
|
2383
|
-
sessionKey: params.sessionKey,
|
|
2384
|
-
to: params.to
|
|
2385
|
-
}, "failed updating last route");
|
|
2386
|
-
});
|
|
2387
|
-
trackBackgroundTask(params.backgroundTasks, task);
|
|
2388
|
-
}
|
|
2389
|
-
//#endregion
|
|
2390
|
-
//#region extensions/whatsapp/src/auto-reply/monitor/peer.ts
|
|
2391
|
-
function resolvePeerId(msg) {
|
|
2392
|
-
const admission = requireWhatsAppInboundAdmission(msg);
|
|
2393
|
-
if (admission.conversation.kind === "group") return admission.conversation.id;
|
|
2394
|
-
const sender = getSenderIdentity(msg);
|
|
2395
|
-
if (sender.e164) return normalizeE164(sender.e164) ?? sender.e164;
|
|
2396
|
-
const conversationId = admission.conversation.id;
|
|
2397
|
-
if (conversationId.includes("@")) return jidToE164(conversationId) ?? conversationId;
|
|
2398
|
-
return normalizeE164(conversationId) ?? conversationId;
|
|
2399
|
-
}
|
|
2400
|
-
//#endregion
|
|
2401
|
-
//#region extensions/whatsapp/src/system-prompt.ts
|
|
2402
|
-
function resolveWhatsAppGroupSystemPrompt(params) {
|
|
2403
|
-
if (!params.groupId) return;
|
|
2404
|
-
const groups = params.accountConfig?.groups;
|
|
2405
|
-
const specific = groups?.[params.groupId];
|
|
2406
|
-
if (specific != null && specific.systemPrompt != null) return specific.systemPrompt.trim() || void 0;
|
|
2407
|
-
const wildcard = groups?.["*"]?.systemPrompt;
|
|
2408
|
-
return wildcard != null ? wildcard.trim() || void 0 : void 0;
|
|
2409
|
-
}
|
|
2410
|
-
function resolveWhatsAppDirectSystemPrompt(params) {
|
|
2411
|
-
if (!params.peerId) return;
|
|
2412
|
-
const direct = params.accountConfig?.direct;
|
|
2413
|
-
const specific = direct?.[params.peerId];
|
|
2414
|
-
if (specific != null && specific.systemPrompt != null) return specific.systemPrompt.trim() || void 0;
|
|
2415
|
-
const wildcard = direct?.["*"]?.systemPrompt;
|
|
2416
|
-
return wildcard != null ? wildcard.trim() || void 0 : void 0;
|
|
2417
|
-
}
|
|
2418
|
-
//#endregion
|
|
2419
|
-
//#region extensions/whatsapp/src/outbound-retry.ts
|
|
2420
|
-
const WHATSAPP_OUTBOUND_MAX_ATTEMPTS = 3;
|
|
2421
|
-
const WHATSAPP_OUTBOUND_MIN_DELAY_MS = 500;
|
|
2422
|
-
const WHATSAPP_OUTBOUND_MAX_DELAY_MS = 1e3;
|
|
2423
|
-
const WHATSAPP_RETRYABLE_OUTBOUND_ERROR_PATTERN = /closed|reset|timed\s*out|disconnect/i;
|
|
2424
|
-
var WhatsAppOutboundRetryError = class extends Error {
|
|
2425
|
-
constructor(original) {
|
|
2426
|
-
super(formatError(original), { cause: original });
|
|
2427
|
-
this.original = original;
|
|
2428
|
-
}
|
|
2429
|
-
};
|
|
2430
|
-
function isRetryableWhatsAppOutboundError(error) {
|
|
2431
|
-
if (isWhatsAppSocketOperationTimeoutError(error)) return false;
|
|
2432
|
-
return WHATSAPP_RETRYABLE_OUTBOUND_ERROR_PATTERN.test(formatError(error));
|
|
2433
|
-
}
|
|
2434
|
-
async function sendWhatsAppOutboundWithRetry(params) {
|
|
2435
|
-
const runWithRetry = createChannelApiRetryRunner({
|
|
2436
|
-
retry: {
|
|
2437
|
-
attempts: WHATSAPP_OUTBOUND_MAX_ATTEMPTS,
|
|
2438
|
-
minDelayMs: WHATSAPP_OUTBOUND_MIN_DELAY_MS,
|
|
2439
|
-
maxDelayMs: WHATSAPP_OUTBOUND_MAX_DELAY_MS,
|
|
2440
|
-
jitter: 0
|
|
2441
|
-
},
|
|
2442
|
-
strictShouldRetry: true,
|
|
2443
|
-
retryAfterMs: () => void 0,
|
|
2444
|
-
shouldRetry: (error, attempt) => {
|
|
2445
|
-
if (!(error instanceof WhatsAppOutboundRetryError) || !isRetryableWhatsAppOutboundError(error.original)) return false;
|
|
2446
|
-
params.onRetry?.({
|
|
2447
|
-
attempt,
|
|
2448
|
-
maxAttempts: WHATSAPP_OUTBOUND_MAX_ATTEMPTS,
|
|
2449
|
-
backoffMs: Math.min(WHATSAPP_OUTBOUND_MIN_DELAY_MS * 2 ** (attempt - 1), WHATSAPP_OUTBOUND_MAX_DELAY_MS),
|
|
2450
|
-
error: error.original,
|
|
2451
|
-
errorText: formatError(error.original)
|
|
2452
|
-
});
|
|
2453
|
-
return true;
|
|
2454
|
-
}
|
|
2455
|
-
});
|
|
2456
|
-
try {
|
|
2457
|
-
return await runWithRetry(async () => {
|
|
2458
|
-
try {
|
|
2459
|
-
return await params.send();
|
|
2460
|
-
} catch (error) {
|
|
2461
|
-
throw new WhatsAppOutboundRetryError(error);
|
|
2462
|
-
}
|
|
2463
|
-
});
|
|
2464
|
-
} catch (error) {
|
|
2465
|
-
if (error instanceof WhatsAppOutboundRetryError) throw error.original;
|
|
2466
|
-
throw error;
|
|
2467
|
-
}
|
|
2468
|
-
}
|
|
2469
|
-
//#endregion
|
|
2470
|
-
//#region extensions/whatsapp/src/auto-reply/util.ts
|
|
2471
|
-
function elide(text, limit = 400) {
|
|
2472
|
-
if (!text) return text;
|
|
2473
|
-
if (text.length <= limit) return text;
|
|
2474
|
-
const truncated = truncateUtf16Safe(text, limit);
|
|
2475
|
-
return `${truncated}… (truncated ${text.length - truncated.length} chars)`;
|
|
2476
|
-
}
|
|
2477
|
-
function markWhatsAppVisibleDeliveryError(error) {
|
|
2478
|
-
if (typeof error === "object" && error !== null && !Array.isArray(error)) try {
|
|
2479
|
-
Object.assign(error, {
|
|
2480
|
-
sentBeforeError: true,
|
|
2481
|
-
visibleReplySent: true
|
|
2482
|
-
});
|
|
2483
|
-
return error;
|
|
2484
|
-
} catch {}
|
|
2485
|
-
const visibleError = new Error("visible WhatsApp reply delivery failed", { cause: error });
|
|
2486
|
-
Object.assign(visibleError, {
|
|
2487
|
-
sentBeforeError: true,
|
|
2488
|
-
visibleReplySent: true
|
|
2489
|
-
});
|
|
2490
|
-
return visibleError;
|
|
2491
|
-
}
|
|
2492
|
-
function isLikelyWhatsAppCryptoError(reason) {
|
|
2493
|
-
const formatReason = (value) => {
|
|
2494
|
-
if (value == null) return "";
|
|
2495
|
-
if (typeof value === "string") return value;
|
|
2496
|
-
if (value instanceof Error) return `${value.message}\n${value.stack ?? ""}`;
|
|
2497
|
-
if (typeof value === "object") try {
|
|
2498
|
-
return JSON.stringify(value);
|
|
2499
|
-
} catch {
|
|
2500
|
-
return Object.prototype.toString.call(value);
|
|
2501
|
-
}
|
|
2502
|
-
if (typeof value === "number") return String(value);
|
|
2503
|
-
if (typeof value === "boolean") return String(value);
|
|
2504
|
-
if (typeof value === "bigint") return String(value);
|
|
2505
|
-
if (typeof value === "symbol") return value.description ?? value.toString();
|
|
2506
|
-
if (typeof value === "function") return value.name ? `[function ${value.name}]` : "[function]";
|
|
2507
|
-
return Object.prototype.toString.call(value);
|
|
2508
|
-
};
|
|
2509
|
-
const haystack = normalizeLowercaseStringOrEmpty(reason instanceof Error ? `${reason.message}\n${reason.stack ?? ""}` : formatReason(reason));
|
|
2510
|
-
if (!(haystack.includes("unsupported state or unable to authenticate data") || haystack.includes("bad mac"))) return false;
|
|
2511
|
-
return haystack.includes("baileys") || haystack.includes("noise-handler") || haystack.includes("aesdecryptgcm");
|
|
2512
|
-
}
|
|
2513
|
-
//#endregion
|
|
2514
|
-
//#region extensions/whatsapp/src/auto-reply/deliver-reply.ts
|
|
2515
|
-
function resolveWhatsAppReceiptKind(results) {
|
|
2516
|
-
if (results.length > 0 && results.every((result) => result.kind === "text")) return "text";
|
|
2517
|
-
if (results.length > 0 && results.every((result) => result.kind === "media")) return "media";
|
|
2518
|
-
return "unknown";
|
|
2519
|
-
}
|
|
2520
|
-
function createWhatsAppReplyDeliveryReceipt(results) {
|
|
2521
|
-
const receiptResultsById = /* @__PURE__ */ new Map();
|
|
2522
|
-
for (const result of results) {
|
|
2523
|
-
if (result.receipt?.parts.length) {
|
|
2524
|
-
for (const part of result.receipt.parts) receiptResultsById.set(part.platformMessageId, {
|
|
2525
|
-
...part.raw ?? {
|
|
2526
|
-
channel: "whatsapp",
|
|
2527
|
-
messageId: part.platformMessageId
|
|
2528
|
-
},
|
|
2529
|
-
meta: {
|
|
2530
|
-
...part.raw?.meta,
|
|
2531
|
-
kind: result.kind,
|
|
2532
|
-
providerAccepted: result.providerAccepted
|
|
2533
|
-
}
|
|
2534
|
-
});
|
|
2535
|
-
continue;
|
|
2536
|
-
}
|
|
2537
|
-
for (const messageId of listWhatsAppSendResultMessageIds(result)) receiptResultsById.set(messageId, {
|
|
2538
|
-
channel: "whatsapp",
|
|
2539
|
-
messageId,
|
|
2540
|
-
meta: {
|
|
2541
|
-
kind: result.kind,
|
|
2542
|
-
providerAccepted: result.providerAccepted
|
|
2543
|
-
}
|
|
2544
|
-
});
|
|
2545
|
-
}
|
|
2546
|
-
return createMessageReceiptFromOutboundResults({
|
|
2547
|
-
results: [...receiptResultsById.values()],
|
|
2548
|
-
kind: resolveWhatsAppReceiptKind(results)
|
|
2549
|
-
});
|
|
2550
|
-
}
|
|
2551
|
-
async function deliverWebReply(params) {
|
|
2552
|
-
const { replyResult, msg, maxMediaBytes, textLimit, replyLogger, connectionId, skipLog } = params;
|
|
2553
|
-
const admission = requireWhatsAppInboundAdmission(msg);
|
|
2554
|
-
const conversationId = admission.conversation.id;
|
|
2555
|
-
const isGroupConversation = admission.conversation.kind === "group";
|
|
2556
|
-
const replyStarted = Date.now();
|
|
2557
|
-
const sendResults = [];
|
|
2558
|
-
const rememberSendResult = (result) => {
|
|
2559
|
-
if (result) sendResults.push(result);
|
|
2560
|
-
};
|
|
2561
|
-
const finishDelivery = () => {
|
|
2562
|
-
const receipt = createWhatsAppReplyDeliveryReceipt(sendResults);
|
|
2563
|
-
return {
|
|
2564
|
-
results: sendResults,
|
|
2565
|
-
receipt,
|
|
2566
|
-
providerAccepted: sendResults.some((result) => result.providerAccepted)
|
|
2567
|
-
};
|
|
2568
|
-
};
|
|
2569
|
-
if (isReasoningReplyPayload(replyResult)) {
|
|
2570
|
-
whatsappOutboundLog.debug(`Suppressed reasoning payload to ${conversationId}`);
|
|
2571
|
-
return finishDelivery();
|
|
2572
|
-
}
|
|
2573
|
-
const tableMode = params.tableMode ?? "code";
|
|
2574
|
-
const chunkMode = params.chunkMode ?? "length";
|
|
2575
|
-
const normalizedReply = params.normalizedReplyResult ?? normalizeWhatsAppOutboundPayload(replyResult, { normalizeText: normalizeWhatsAppPayloadTextPreservingIndentation });
|
|
2576
|
-
const textChunks = markdownToWhatsAppChunks(normalizedReply.text ?? "", textLimit, tableMode, chunkMode);
|
|
2577
|
-
const mediaList = normalizedReply.mediaUrls ?? [];
|
|
2578
|
-
const getQuote = () => {
|
|
2579
|
-
if (!replyResult.replyToId) return;
|
|
2580
|
-
const cached = lookupInboundMessageMeta(admission.accountId, msg.platform.chatJid, replyResult.replyToId);
|
|
2581
|
-
return buildQuotedMessageOptions({
|
|
2582
|
-
messageId: replyResult.replyToId,
|
|
2583
|
-
remoteJid: msg.platform.chatJid,
|
|
2584
|
-
fromMe: cached?.fromMe ?? false,
|
|
2585
|
-
participant: cached?.participant ?? (isGroupConversation ? msg.platform.senderJid : void 0),
|
|
2586
|
-
messageText: cached?.body ?? "",
|
|
2587
|
-
media: cached?.media
|
|
2588
|
-
});
|
|
2589
|
-
};
|
|
2590
|
-
const sendWithRetry = async (fn, label) => {
|
|
2591
|
-
try {
|
|
2592
|
-
return await sendWhatsAppOutboundWithRetry({
|
|
2593
|
-
send: fn,
|
|
2594
|
-
onRetry: ({ attempt, maxAttempts: retryMaxAttempts, backoffMs, errorText }) => {
|
|
2595
|
-
logVerbose(`Retrying ${label} to ${conversationId} after failure (${attempt}/${retryMaxAttempts - 1}) in ${backoffMs}ms: ${errorText}`);
|
|
2596
|
-
}
|
|
2597
|
-
});
|
|
2598
|
-
} catch (error) {
|
|
2599
|
-
if (sendResults.some((result) => result.providerAccepted)) throw markWhatsAppVisibleDeliveryError(error);
|
|
2600
|
-
throw error;
|
|
2601
|
-
}
|
|
2602
|
-
};
|
|
2603
|
-
if (mediaList.length === 0 && textChunks.length) {
|
|
2604
|
-
const totalChunks = textChunks.length;
|
|
2605
|
-
for (const [index, chunk] of textChunks.entries()) {
|
|
2606
|
-
const chunkStarted = Date.now();
|
|
2607
|
-
const quote = getQuote();
|
|
2608
|
-
rememberSendResult(await sendWithRetry(() => msg.platform.reply(chunk, quote), "text"));
|
|
2609
|
-
if (!skipLog) {
|
|
2610
|
-
const durationMs = Date.now() - chunkStarted;
|
|
2611
|
-
whatsappOutboundLog.debug(`Sent chunk ${index + 1}/${totalChunks} to ${conversationId} (${durationMs.toFixed(0)}ms)`);
|
|
2612
|
-
}
|
|
2613
|
-
}
|
|
2614
|
-
const delivery = finishDelivery();
|
|
2615
|
-
const logPayload = {
|
|
2616
|
-
correlationId: msg.event.id ?? newConnectionId(),
|
|
2617
|
-
connectionId: connectionId ?? null,
|
|
2618
|
-
to: conversationId,
|
|
2619
|
-
from: msg.platform.recipientJid,
|
|
2620
|
-
text: elide(replyResult.text, 240),
|
|
2621
|
-
mediaUrl: null,
|
|
2622
|
-
mediaSizeBytes: null,
|
|
2623
|
-
mediaKind: null,
|
|
2624
|
-
durationMs: Date.now() - replyStarted
|
|
2625
|
-
};
|
|
2626
|
-
if (delivery.providerAccepted) replyLogger.info(logPayload, "auto-reply sent (text)");
|
|
2627
|
-
else replyLogger.warn(logPayload, "auto-reply text was not accepted by WhatsApp provider");
|
|
2628
|
-
return delivery;
|
|
2629
|
-
}
|
|
2630
|
-
const remainingText = [...textChunks];
|
|
2631
|
-
await sendMediaWithLeadingCaption({
|
|
2632
|
-
mediaUrls: mediaList,
|
|
2633
|
-
caption: remainingText.shift() || "",
|
|
2634
|
-
send: async ({ mediaUrl, caption }) => {
|
|
2635
|
-
const media = await prepareWhatsAppOutboundMedia(await loadWebMedia(mediaUrl, {
|
|
2636
|
-
maxBytes: maxMediaBytes,
|
|
2637
|
-
localRoots: params.mediaLocalRoots
|
|
2638
|
-
}), mediaUrl);
|
|
2639
|
-
if (shouldLogVerbose()) {
|
|
2640
|
-
logVerbose(`Web auto-reply media size: ${(media.buffer.length / (1024 * 1024)).toFixed(2)}MB`);
|
|
2641
|
-
logVerbose(`Web auto-reply media source: ${mediaUrl} (kind ${media.kind})`);
|
|
2642
|
-
}
|
|
2643
|
-
if (media.kind === "image") {
|
|
2644
|
-
const quote = getQuote();
|
|
2645
|
-
rememberSendResult(await sendWithRetry(() => msg.platform.sendMedia({
|
|
2646
|
-
image: media.buffer,
|
|
2647
|
-
caption,
|
|
2648
|
-
mimetype: media.mimetype
|
|
2649
|
-
}, quote), "media:image"));
|
|
2650
|
-
} else if (media.kind === "audio") {
|
|
2651
|
-
const quote = getQuote();
|
|
2652
|
-
rememberSendResult(await sendWithRetry(() => msg.platform.sendMedia({
|
|
2653
|
-
audio: media.buffer,
|
|
2654
|
-
ptt: true,
|
|
2655
|
-
mimetype: media.mimetype
|
|
2656
|
-
}, quote), "media:audio"));
|
|
2657
|
-
if (caption) rememberSendResult(await sendWithRetry(() => msg.platform.reply(caption, quote), "media:audio-text"));
|
|
2658
|
-
} else if (media.kind === "video") {
|
|
2659
|
-
const quote = getQuote();
|
|
2660
|
-
rememberSendResult(await sendWithRetry(() => msg.platform.sendMedia({
|
|
2661
|
-
video: media.buffer,
|
|
2662
|
-
caption,
|
|
2663
|
-
mimetype: media.mimetype
|
|
2664
|
-
}, quote), "media:video"));
|
|
2665
|
-
} else {
|
|
2666
|
-
const quote = getQuote();
|
|
2667
|
-
rememberSendResult(await sendWithRetry(() => msg.platform.sendMedia({
|
|
2668
|
-
document: media.buffer,
|
|
2669
|
-
fileName: media.fileName,
|
|
2670
|
-
caption,
|
|
2671
|
-
mimetype: media.mimetype
|
|
2672
|
-
}, quote), "media:document"));
|
|
2673
|
-
}
|
|
2674
|
-
whatsappOutboundLog.info(`Sent media reply to ${conversationId} (${(media.buffer.length / (1024 * 1024)).toFixed(2)}MB)`);
|
|
2675
|
-
replyLogger.info({
|
|
2676
|
-
correlationId: msg.event.id ?? newConnectionId(),
|
|
2677
|
-
connectionId: connectionId ?? null,
|
|
2678
|
-
to: conversationId,
|
|
2679
|
-
from: msg.platform.recipientJid,
|
|
2680
|
-
text: caption ?? null,
|
|
2681
|
-
mediaUrl,
|
|
2682
|
-
mediaSizeBytes: media.buffer.length,
|
|
2683
|
-
mediaKind: media.kind,
|
|
2684
|
-
durationMs: Date.now() - replyStarted
|
|
2685
|
-
}, "auto-reply sent (media)");
|
|
2686
|
-
},
|
|
2687
|
-
onError: async ({ error, mediaUrl, caption, isFirst }) => {
|
|
2688
|
-
whatsappOutboundLog.error(`Failed sending web media to ${conversationId}: ${formatError(error)}`);
|
|
2689
|
-
replyLogger.warn({
|
|
2690
|
-
err: error,
|
|
2691
|
-
mediaUrl
|
|
2692
|
-
}, "failed to send web media reply");
|
|
2693
|
-
if (!isFirst) {
|
|
2694
|
-
whatsappOutboundLog.warn(`Trailing media failed; sent warning to ${conversationId}`);
|
|
2695
|
-
rememberSendResult(await sendWithRetry(() => msg.platform.reply("⚠️ Media unavailable.", getQuote()), "media:fallback-unavailable"));
|
|
2696
|
-
return;
|
|
2697
|
-
}
|
|
2698
|
-
const fallbackText = [caption ?? "", "⚠️ Media failed."].filter(Boolean).join("\n");
|
|
2699
|
-
if (!fallbackText) return;
|
|
2700
|
-
whatsappOutboundLog.warn(`Media skipped; sent text-only to ${conversationId}`);
|
|
2701
|
-
rememberSendResult(await sendWithRetry(() => msg.platform.reply(fallbackText, getQuote()), "media:fallback-text"));
|
|
2702
|
-
}
|
|
2703
|
-
});
|
|
2704
|
-
for (const chunk of remainingText) rememberSendResult(await sendWithRetry(() => msg.platform.reply(chunk, getQuote()), "media:text"));
|
|
2705
|
-
return finishDelivery();
|
|
2706
|
-
}
|
|
2707
|
-
//#endregion
|
|
2708
|
-
//#region extensions/whatsapp/src/auto-reply/monitor/inbound-context.ts
|
|
2709
|
-
function isWhatsAppSupplementalSenderAllowed(params) {
|
|
2710
|
-
if (params.allowFrom.includes("*")) return true;
|
|
2711
|
-
const senderValues = new Set(getComparableIdentityValues(resolveComparableIdentity(params.sender, params.authDir)));
|
|
2712
|
-
if (senderValues.size === 0) return false;
|
|
2713
|
-
for (const entry of params.allowFrom) {
|
|
2714
|
-
const rawEntry = entry.trim();
|
|
2715
|
-
if (!rawEntry) continue;
|
|
2716
|
-
const normalizedEntry = normalizeE164(rawEntry);
|
|
2717
|
-
if (normalizedEntry && senderValues.has(normalizedEntry) || senderValues.has(rawEntry)) return true;
|
|
2718
|
-
}
|
|
2719
|
-
return false;
|
|
2720
|
-
}
|
|
2721
|
-
function resolveVisibleWhatsAppGroupHistory(params) {
|
|
2722
|
-
return filterSupplementalContextItems({
|
|
2723
|
-
items: params.history,
|
|
2724
|
-
mode: params.mode,
|
|
2725
|
-
kind: "history",
|
|
2726
|
-
isSenderAllowed: (entry) => resolveInboundSupplementalSenderAllowed({
|
|
2727
|
-
isGroup: true,
|
|
2728
|
-
groupPolicy: params.groupPolicy,
|
|
2729
|
-
allowFrom: params.groupAllowFrom,
|
|
2730
|
-
isSenderAllowed: (allowFrom) => isWhatsAppSupplementalSenderAllowed({
|
|
2731
|
-
allowFrom,
|
|
2732
|
-
authDir: params.authDir,
|
|
2733
|
-
sender: entry.senderJid ? { jid: entry.senderJid } : null
|
|
2734
|
-
})
|
|
2735
|
-
})
|
|
2736
|
-
}).items;
|
|
2737
|
-
}
|
|
2738
|
-
function resolveVisibleWhatsAppReplyContext(params) {
|
|
2739
|
-
const replyTo = getReplyContext(params.msg, params.authDir);
|
|
2740
|
-
if (!replyTo) return null;
|
|
2741
|
-
const admission = requireWhatsAppInboundAdmission(params.msg);
|
|
2742
|
-
const previewBody = [replyTo.body, formatMediaPlaceholderText(replyTo.media ? [replyTo.media] : [])].filter(Boolean).join("\n");
|
|
2743
|
-
const senderAllowed = resolveInboundSupplementalSenderAllowed({
|
|
2744
|
-
isGroup: admission.conversation.kind === "group",
|
|
2745
|
-
groupPolicy: params.groupPolicy,
|
|
2746
|
-
allowFrom: params.groupAllowFrom,
|
|
2747
|
-
isSenderAllowed: (allowFrom) => isWhatsAppSupplementalSenderAllowed({
|
|
2748
|
-
allowFrom,
|
|
2749
|
-
authDir: params.authDir,
|
|
2750
|
-
sender: replyTo.sender
|
|
2751
|
-
})
|
|
2752
|
-
});
|
|
2753
|
-
const visible = filterChannelInboundQuoteContext(params.mode, {
|
|
2754
|
-
id: replyTo.id,
|
|
2755
|
-
body: previewBody,
|
|
2756
|
-
sender: replyTo.sender?.label ?? void 0,
|
|
2757
|
-
senderAllowed
|
|
2758
|
-
});
|
|
2759
|
-
return visible ? {
|
|
2760
|
-
...replyTo,
|
|
2761
|
-
body: visible.body ?? ""
|
|
2762
|
-
} : null;
|
|
2763
|
-
}
|
|
2764
|
-
//#endregion
|
|
2765
|
-
//#region extensions/whatsapp/src/auto-reply/monitor/inbound-dispatch.ts
|
|
2766
|
-
function normalizeErrForLog(err) {
|
|
2767
|
-
if (err instanceof Error) return {
|
|
2768
|
-
...Object.fromEntries(Object.entries(err)),
|
|
2769
|
-
type: err.name,
|
|
2770
|
-
message: err.message,
|
|
2771
|
-
stack: err.stack
|
|
2772
|
-
};
|
|
2773
|
-
return err;
|
|
2774
|
-
}
|
|
2775
|
-
function whatsAppReplyDeliveryVisibility(visibleReplySent) {
|
|
2776
|
-
return { visibleReplySent };
|
|
2777
|
-
}
|
|
2778
|
-
function whatsAppReplyDeliveryVisibilityFromDurableResult(result) {
|
|
2779
|
-
return whatsAppReplyDeliveryVisibility(result.visibleReplySent === true);
|
|
2780
|
-
}
|
|
2781
|
-
function readTrimmedString(value) {
|
|
2782
|
-
return typeof value === "string" ? value.trim() : "";
|
|
2783
|
-
}
|
|
2784
|
-
function markWhatsAppReplyDeliveryErrorVisibleAfterFlush(error, flushResult) {
|
|
2785
|
-
return flushResult.delivered > 0 ? markWhatsAppVisibleDeliveryError(error) : error;
|
|
2786
|
-
}
|
|
2787
|
-
function logWhatsAppReplyDeliveryError(params) {
|
|
2788
|
-
const admission = requireWhatsAppInboundAdmission(params.msg);
|
|
2789
|
-
params.replyLogger.error({
|
|
2790
|
-
err: normalizeErrForLog(params.err),
|
|
2791
|
-
replyKind: params.info.kind,
|
|
2792
|
-
correlationId: params.msg.event.id ?? null,
|
|
2793
|
-
connectionId: params.connectionId,
|
|
2794
|
-
conversationId: admission.conversation.id,
|
|
2795
|
-
chatId: params.msg.platform.chatJid ?? null,
|
|
2796
|
-
to: admission.conversation.id,
|
|
2797
|
-
from: params.msg.platform.recipientJid ?? null
|
|
2798
|
-
}, "auto-reply delivery failed");
|
|
2799
|
-
}
|
|
2800
|
-
function resolveWhatsAppDurableReplyToId(params) {
|
|
2801
|
-
if (params.payload.replyToId === null) return null;
|
|
2802
|
-
const explicitPayloadReplyToId = readTrimmedString(params.payload.replyToId);
|
|
2803
|
-
if (explicitPayloadReplyToId) return explicitPayloadReplyToId;
|
|
2804
|
-
const hasVisibleInboundReplyTarget = Boolean(readTrimmedString(params.context.ReplyToId)) || Boolean(readTrimmedString(params.context.ReplyToIdFull));
|
|
2805
|
-
const currentInboundMessageId = readTrimmedString(params.msg.event.id);
|
|
2806
|
-
if (params.info.kind === "final" && hasVisibleInboundReplyTarget && currentInboundMessageId) return currentInboundMessageId;
|
|
2807
|
-
return null;
|
|
2808
|
-
}
|
|
2809
|
-
function resolveWhatsAppDisableBlockStreaming(cfg) {
|
|
2810
|
-
const enabled = resolveChannelStreamingBlockEnabled(cfg.channels?.whatsapp);
|
|
2811
|
-
return typeof enabled === "boolean" ? !enabled : void 0;
|
|
2812
|
-
}
|
|
2813
|
-
function resolveWhatsAppDeliverablePayload(payload, info) {
|
|
2814
|
-
if (payload.isReasoning === true || payload.isCompactionNotice === true) return null;
|
|
2815
|
-
if (payload.isError === true) return null;
|
|
2816
|
-
if (info.kind === "tool") {
|
|
2817
|
-
if (!resolveSendableOutboundReplyParts(payload).hasMedia) return null;
|
|
2818
|
-
return {
|
|
2819
|
-
...payload,
|
|
2820
|
-
text: void 0
|
|
2821
|
-
};
|
|
2822
|
-
}
|
|
2823
|
-
return payload;
|
|
2824
|
-
}
|
|
2825
|
-
function getWhatsAppPayloadMediaUrls(payload) {
|
|
2826
|
-
return new Set(normalizeStringEntries([...Array.isArray(payload.mediaUrls) ? payload.mediaUrls : [], ...typeof payload.mediaUrl === "string" ? [payload.mediaUrl] : []]));
|
|
2827
|
-
}
|
|
2828
|
-
function hasWhatsAppMediaUrlOverlap(left, right) {
|
|
2829
|
-
for (const url of left) if (right.has(url)) return true;
|
|
2830
|
-
return false;
|
|
2831
|
-
}
|
|
2832
|
-
function shouldDeferWhatsAppMediaOnlyPayload(params) {
|
|
2833
|
-
return params.info.kind !== "final" && params.reply.hasMedia && !params.reply.text.trim() && params.mediaUrls.size > 0;
|
|
2834
|
-
}
|
|
2835
|
-
function createWhatsAppMediaOnlyReplyCoalescer(params) {
|
|
2836
|
-
const pendingMediaOnlyPayloads = [];
|
|
2837
|
-
const flushExceptDuplicateMedia = async (mediaUrls) => {
|
|
2838
|
-
const flushResult = {
|
|
2839
|
-
delivered: 0,
|
|
2840
|
-
droppedDuplicateMedia: 0
|
|
2841
|
-
};
|
|
2842
|
-
const pending = pendingMediaOnlyPayloads.splice(0);
|
|
2843
|
-
for (const candidate of pending) {
|
|
2844
|
-
if (mediaUrls && hasWhatsAppMediaUrlOverlap(candidate.mediaUrls, mediaUrls)) {
|
|
2845
|
-
flushResult.droppedDuplicateMedia += 1;
|
|
2846
|
-
continue;
|
|
2847
|
-
}
|
|
2848
|
-
try {
|
|
2849
|
-
if ((await params.deliver(candidate)).visibleReplySent) flushResult.delivered += 1;
|
|
2850
|
-
} catch (error) {
|
|
2851
|
-
throw markWhatsAppReplyDeliveryErrorVisibleAfterFlush(error, flushResult);
|
|
2852
|
-
}
|
|
2853
|
-
}
|
|
2854
|
-
return flushResult;
|
|
2855
|
-
};
|
|
2856
|
-
return {
|
|
2857
|
-
defer(pending) {
|
|
2858
|
-
pendingMediaOnlyPayloads.push(pending);
|
|
2859
|
-
},
|
|
2860
|
-
flushExceptDuplicateMedia,
|
|
2861
|
-
flushAll: () => flushExceptDuplicateMedia()
|
|
2862
|
-
};
|
|
2863
|
-
}
|
|
2864
|
-
function logWhatsAppMediaOnlyFlushResult(result) {
|
|
2865
|
-
if (!shouldLogVerbose$1()) return;
|
|
2866
|
-
if (result.droppedDuplicateMedia > 0) logVerbose$1(`Dropped ${result.droppedDuplicateMedia} deferred media-only WhatsApp reply payload(s) superseded by captioned media`);
|
|
2867
|
-
if (result.delivered > 0) logVerbose$1(`Flushed ${result.delivered} deferred media-only WhatsApp reply payload(s)`);
|
|
2868
|
-
}
|
|
2869
|
-
function resolveWhatsAppResponsePrefix(params) {
|
|
2870
|
-
const configuredResponsePrefix = params.cfg.messages?.responsePrefix;
|
|
2871
|
-
return params.pipelineResponsePrefix ?? (configuredResponsePrefix === "auto" ? resolveIdentityNamePrefix$1(params.cfg, params.agentId) : configuredResponsePrefix) ?? (params.isSelfChat ? resolveIdentityNamePrefix$1(params.cfg, params.agentId) : void 0);
|
|
2872
|
-
}
|
|
2873
|
-
async function buildWhatsAppInboundContext(params) {
|
|
2874
|
-
const admission = requireWhatsAppInboundAdmission(params.msg);
|
|
2875
|
-
const conversationId = admission.conversation.id;
|
|
2876
|
-
const conversationKind = admission.conversation.kind;
|
|
2877
|
-
const wasMentioned = params.msg.groupMention?.wasMentioned ?? params.msg.wasMentioned;
|
|
2878
|
-
const inboundHistory = conversationKind === "group" ? buildInboundHistoryFromEntries({
|
|
2879
|
-
entries: (params.groupHistory ?? []).map((entry) => ({
|
|
2880
|
-
sender: entry.sender,
|
|
2881
|
-
body: entry.body,
|
|
2882
|
-
timestamp: entry.timestamp,
|
|
2883
|
-
messageId: entry.id,
|
|
2884
|
-
media: entry.media
|
|
2885
|
-
})),
|
|
2886
|
-
limit: params.groupHistory?.length ?? 1
|
|
2887
|
-
}) : void 0;
|
|
2888
|
-
const media = toInboundMediaFacts(params.msg.payload.media ? [{
|
|
2889
|
-
path: params.msg.payload.media?.path,
|
|
2890
|
-
url: params.msg.payload.media?.url ?? params.msg.payload.media?.path,
|
|
2891
|
-
contentType: params.msg.payload.media?.type,
|
|
2892
|
-
kind: params.msg.payload.media?.kind
|
|
2893
|
-
}] : void 0, { transcribed: (_entry, index) => params.mediaTranscribedIndexes?.includes(index) === true });
|
|
2894
|
-
return buildChannelInboundEventContext({
|
|
2895
|
-
channel: "whatsapp",
|
|
2896
|
-
supplemental: {
|
|
2897
|
-
quote: params.visibleReplyTo ? {
|
|
2898
|
-
id: params.visibleReplyTo.id,
|
|
2899
|
-
body: params.visibleReplyTo.body,
|
|
2900
|
-
sender: params.visibleReplyTo.sender?.label ?? void 0
|
|
2901
|
-
} : void 0,
|
|
2902
|
-
groupSystemPrompt: params.groupSystemPrompt,
|
|
2903
|
-
untrustedContext: params.msg.payload.untrustedStructuredContext
|
|
2904
|
-
},
|
|
2905
|
-
media,
|
|
2906
|
-
messageId: params.msg.event.id,
|
|
2907
|
-
timestamp: params.msg.event.timestamp,
|
|
2908
|
-
from: conversationId,
|
|
2909
|
-
sender: {
|
|
2910
|
-
id: params.sender.id ?? params.sender.e164,
|
|
2911
|
-
name: params.sender.name
|
|
2912
|
-
},
|
|
2913
|
-
conversation: {
|
|
2914
|
-
kind: conversationKind,
|
|
2915
|
-
id: conversationId,
|
|
2916
|
-
label: conversationId
|
|
2917
|
-
},
|
|
2918
|
-
route: {
|
|
2919
|
-
agentId: params.route.agentId,
|
|
2920
|
-
dmScope: params.route.dmScope,
|
|
2921
|
-
accountId: params.route.accountId,
|
|
2922
|
-
routeSessionKey: params.route.sessionKey
|
|
2923
|
-
},
|
|
2924
|
-
reply: {
|
|
2925
|
-
to: params.msg.platform.recipientJid,
|
|
2926
|
-
originatingTo: conversationId
|
|
2927
|
-
},
|
|
2928
|
-
message: {
|
|
2929
|
-
body: params.combinedBody,
|
|
2930
|
-
bodyForAgent: params.bodyForAgent ?? params.msg.payload.body,
|
|
2931
|
-
inboundHistory,
|
|
2932
|
-
rawBody: params.rawBody ?? params.msg.payload.body,
|
|
2933
|
-
commandBody: params.command?.body ?? params.msg.payload.body
|
|
2934
|
-
},
|
|
2935
|
-
sessionTranscript: { historyLimit: conversationKind === "group" ? params.groupHistoryLimit ?? params.groupHistory?.length ?? 0 : 0 },
|
|
2936
|
-
access: {
|
|
2937
|
-
...wasMentioned !== void 0 ? { mentions: {
|
|
2938
|
-
canDetectMention: conversationKind === "group",
|
|
2939
|
-
wasMentioned,
|
|
2940
|
-
requireMention: params.msg.groupMention?.requireMention
|
|
2941
|
-
} } : {},
|
|
2942
|
-
commands: { authorized: params.command?.authorized === true }
|
|
2943
|
-
},
|
|
2944
|
-
command: params.command,
|
|
2945
|
-
extra: {
|
|
2946
|
-
Transcript: params.transcript,
|
|
2947
|
-
GroupSubject: params.msg.group?.subject,
|
|
2948
|
-
GroupMembers: formatGroupMembers({
|
|
2949
|
-
participants: params.msg.group?.participants,
|
|
2950
|
-
roster: params.groupMemberRoster,
|
|
2951
|
-
fallbackE164: params.sender.e164
|
|
2952
|
-
}),
|
|
2953
|
-
SenderE164: params.sender.e164,
|
|
2954
|
-
ReplyThreading: params.replyThreading,
|
|
2955
|
-
SuppressMessageReceivedHooks: params.suppressMessageReceivedHooks,
|
|
2956
|
-
...params.msg.payload.location ? toLocationContext(params.msg.payload.location) : {}
|
|
2957
|
-
}
|
|
2958
|
-
});
|
|
2959
|
-
}
|
|
2960
|
-
function resolveWhatsAppDmRouteTarget(params) {
|
|
2961
|
-
const admission = requireWhatsAppInboundAdmission(params.msg);
|
|
2962
|
-
const conversationId = admission.conversation.id;
|
|
2963
|
-
if (admission.conversation.kind === "group") return;
|
|
2964
|
-
if (params.senderE164) return params.normalizeE164(params.senderE164) ?? void 0;
|
|
2965
|
-
if (conversationId.includes("@")) return jidToE164(conversationId) ?? void 0;
|
|
2966
|
-
return params.normalizeE164(conversationId) ?? void 0;
|
|
2967
|
-
}
|
|
2968
|
-
function updateWhatsAppMainLastRoute(params) {
|
|
2969
|
-
const shouldUpdateMainLastRoute = !params.pinnedMainDmRecipient || params.pinnedMainDmRecipient === params.dmRouteTarget;
|
|
2970
|
-
const inboundLastRouteSessionKey = resolveInboundLastRouteSessionKey({
|
|
2971
|
-
route: params.route,
|
|
2972
|
-
sessionKey: params.route.sessionKey
|
|
2973
|
-
});
|
|
2974
|
-
if (params.dmRouteTarget && inboundLastRouteSessionKey === params.route.mainSessionKey && shouldUpdateMainLastRoute) {
|
|
2975
|
-
params.updateLastRoute({
|
|
2976
|
-
cfg: params.cfg,
|
|
2977
|
-
backgroundTasks: params.backgroundTasks,
|
|
2978
|
-
storeAgentId: params.route.agentId,
|
|
2979
|
-
sessionKey: params.route.mainSessionKey,
|
|
2980
|
-
channel: "whatsapp",
|
|
2981
|
-
to: params.dmRouteTarget,
|
|
2982
|
-
accountId: params.route.accountId,
|
|
2983
|
-
ctx: params.ctx,
|
|
2984
|
-
warn: params.warn
|
|
2985
|
-
});
|
|
2986
|
-
return;
|
|
2987
|
-
}
|
|
2988
|
-
if (params.dmRouteTarget && inboundLastRouteSessionKey === params.route.mainSessionKey && params.pinnedMainDmRecipient) logVerbose$1(`Skipping main-session last route update for ${params.dmRouteTarget} (pinned owner ${params.pinnedMainDmRecipient})`);
|
|
2989
|
-
}
|
|
2990
|
-
function createWhatsAppReplyPlan(params) {
|
|
2991
|
-
const admission = requireWhatsAppInboundAdmission(params.msg);
|
|
2992
|
-
const ingressLifecycle = resolveWhatsAppIngressLifecycle(params.msg);
|
|
2993
|
-
const conversationId = admission.conversation.id;
|
|
2994
|
-
const conversationKind = admission.conversation.kind;
|
|
2995
|
-
const statusReactionController = params.statusReactionController ?? null;
|
|
2996
|
-
const textLimit = params.maxMediaTextChunkLimit ?? resolveTextChunkLimit(params.cfg, "whatsapp");
|
|
2997
|
-
const chunkMode = resolveChunkMode(params.cfg, "whatsapp", params.route.accountId);
|
|
2998
|
-
const tableMode = resolveMarkdownTableMode$1({
|
|
2999
|
-
cfg: params.cfg,
|
|
3000
|
-
channel: "whatsapp",
|
|
3001
|
-
accountId: params.route.accountId
|
|
3002
|
-
});
|
|
3003
|
-
const mediaLocalRoots = getAgentScopedMediaLocalRoots(params.cfg, params.route.agentId);
|
|
3004
|
-
const sourceReplyDeliveryMode = params.context.ChatType === "group" || params.context.ChatType === "channel" ? resolveChannelMessageSourceReplyDeliveryMode({
|
|
3005
|
-
cfg: params.cfg,
|
|
3006
|
-
ctx: params.context
|
|
3007
|
-
}) : void 0;
|
|
3008
|
-
const sourceRepliesAreToolOnly = sourceReplyDeliveryMode === "message_tool_only";
|
|
3009
|
-
const disableBlockStreaming = sourceRepliesAreToolOnly ? true : resolveWhatsAppDisableBlockStreaming(params.cfg);
|
|
3010
|
-
let didSendReply = false;
|
|
3011
|
-
let didLogHeartbeatStrip = false;
|
|
3012
|
-
const deliverNormalizedPayload = async (normalizedDeliveryPayload, info) => {
|
|
3013
|
-
const reply = resolveSendableOutboundReplyParts(normalizedDeliveryPayload);
|
|
3014
|
-
if (!reply.hasMedia && !reply.text.trim()) return whatsAppReplyDeliveryVisibility(false);
|
|
3015
|
-
if (!(await params.deliverReply({
|
|
3016
|
-
replyResult: normalizedDeliveryPayload,
|
|
3017
|
-
normalizedReplyResult: normalizedDeliveryPayload,
|
|
3018
|
-
msg: params.msg,
|
|
3019
|
-
mediaLocalRoots,
|
|
3020
|
-
maxMediaBytes: params.maxMediaBytes,
|
|
3021
|
-
textLimit,
|
|
3022
|
-
chunkMode,
|
|
3023
|
-
replyLogger: params.replyLogger,
|
|
3024
|
-
connectionId: params.connectionId,
|
|
3025
|
-
skipLog: false,
|
|
3026
|
-
tableMode
|
|
3027
|
-
})).providerAccepted) {
|
|
3028
|
-
params.replyLogger.warn({
|
|
3029
|
-
correlationId: params.msg.event.id ?? null,
|
|
3030
|
-
connectionId: params.connectionId,
|
|
3031
|
-
conversationId,
|
|
3032
|
-
chatId: params.msg.platform.chatJid,
|
|
3033
|
-
to: conversationId,
|
|
3034
|
-
from: params.msg.platform.recipientJid,
|
|
3035
|
-
replyKind: info.kind
|
|
3036
|
-
}, "auto-reply was not accepted by WhatsApp provider");
|
|
3037
|
-
return whatsAppReplyDeliveryVisibility(false);
|
|
3038
|
-
}
|
|
3039
|
-
didSendReply = true;
|
|
3040
|
-
const shouldLog = normalizedDeliveryPayload.text ? true : void 0;
|
|
3041
|
-
params.rememberSentText(normalizedDeliveryPayload.text, {
|
|
3042
|
-
combinedBody: params.context.Body,
|
|
3043
|
-
combinedBodySessionKey: params.route.sessionKey,
|
|
3044
|
-
logVerboseMessage: shouldLog
|
|
3045
|
-
});
|
|
3046
|
-
const fromDisplay = conversationId;
|
|
3047
|
-
if (shouldLogVerbose$1()) logVerbose$1(`Reply body: ${normalizedDeliveryPayload.text != null ? reply.text : "<media>"}${reply.hasMedia ? " (media)" : ""} -> ${fromDisplay}`);
|
|
3048
|
-
return whatsAppReplyDeliveryVisibility(true);
|
|
3049
|
-
};
|
|
3050
|
-
const mediaOnlyCoalescer = createWhatsAppMediaOnlyReplyCoalescer({ deliver: async (pending) => {
|
|
3051
|
-
return await deliverNormalizedPayload(pending.payload, pending.info);
|
|
3052
|
-
} });
|
|
3053
|
-
return {
|
|
3054
|
-
afterRecord: () => {
|
|
3055
|
-
if (statusReactionController) statusReactionController.setThinking();
|
|
3056
|
-
},
|
|
3057
|
-
dispatcherOptions: {
|
|
3058
|
-
...params.replyPipeline,
|
|
3059
|
-
onHeartbeatStrip: () => {
|
|
3060
|
-
if (!didLogHeartbeatStrip) {
|
|
3061
|
-
didLogHeartbeatStrip = true;
|
|
3062
|
-
logVerbose$1("Stripped stray HEARTBEAT_OK token from web reply");
|
|
3063
|
-
}
|
|
3064
|
-
},
|
|
3065
|
-
onSettled: async () => {
|
|
3066
|
-
const flushResult = await mediaOnlyCoalescer.flushAll();
|
|
3067
|
-
logWhatsAppMediaOnlyFlushResult(flushResult);
|
|
3068
|
-
return whatsAppReplyDeliveryVisibility(flushResult.delivered > 0);
|
|
3069
|
-
},
|
|
3070
|
-
onReplyStart: params.msg.platform.sendComposing
|
|
3071
|
-
},
|
|
3072
|
-
delivery: {
|
|
3073
|
-
deliver: async (payload, info) => {
|
|
3074
|
-
const deliveryPayload = resolveWhatsAppDeliverablePayload(payload, info);
|
|
3075
|
-
if (!deliveryPayload) return whatsAppReplyDeliveryVisibility(false);
|
|
3076
|
-
const normalizedOutboundPayload = normalizeWhatsAppOutboundPayload(deliveryPayload, { normalizeText: normalizeWhatsAppPayloadTextPreservingIndentation });
|
|
3077
|
-
const normalizedDeliveryPayload = deliveryPayload.text === void 0 ? {
|
|
3078
|
-
...normalizedOutboundPayload,
|
|
3079
|
-
text: void 0
|
|
3080
|
-
} : normalizedOutboundPayload;
|
|
3081
|
-
const reply = resolveSendableOutboundReplyParts(normalizedDeliveryPayload);
|
|
3082
|
-
if (!reply.hasMedia && !reply.text.trim()) return whatsAppReplyDeliveryVisibility(false);
|
|
3083
|
-
if (!reply.hasMedia) {
|
|
3084
|
-
const flushResult = await mediaOnlyCoalescer.flushAll();
|
|
3085
|
-
logWhatsAppMediaOnlyFlushResult(flushResult);
|
|
3086
|
-
try {
|
|
3087
|
-
const durable = await deliverInboundReplyWithMessageSendContext({
|
|
3088
|
-
cfg: params.cfg,
|
|
3089
|
-
channel: "whatsapp",
|
|
3090
|
-
accountId: params.route.accountId,
|
|
3091
|
-
agentId: params.route.agentId,
|
|
3092
|
-
ctxPayload: params.context,
|
|
3093
|
-
payload: normalizedDeliveryPayload,
|
|
3094
|
-
info,
|
|
3095
|
-
to: conversationId,
|
|
3096
|
-
replyToId: resolveWhatsAppDurableReplyToId({
|
|
3097
|
-
context: params.context,
|
|
3098
|
-
info,
|
|
3099
|
-
msg: params.msg,
|
|
3100
|
-
payload: normalizedDeliveryPayload
|
|
3101
|
-
}),
|
|
3102
|
-
formatting: {
|
|
3103
|
-
textLimit,
|
|
3104
|
-
tableMode,
|
|
3105
|
-
chunkMode
|
|
3106
|
-
}
|
|
3107
|
-
});
|
|
3108
|
-
if (durable.status === "failed") {
|
|
3109
|
-
if (durable.sentBeforeError === true) throw markWhatsAppVisibleDeliveryError(durable.error);
|
|
3110
|
-
throw durable.error;
|
|
3111
|
-
}
|
|
3112
|
-
if (durable.status === "handled_visible") {
|
|
3113
|
-
didSendReply = true;
|
|
3114
|
-
const shouldLog = normalizedDeliveryPayload.text ? true : void 0;
|
|
3115
|
-
params.rememberSentText(normalizedDeliveryPayload.text, {
|
|
3116
|
-
combinedBody: params.context.Body,
|
|
3117
|
-
combinedBodySessionKey: params.route.sessionKey,
|
|
3118
|
-
logVerboseMessage: shouldLog
|
|
3119
|
-
});
|
|
3120
|
-
return whatsAppReplyDeliveryVisibilityFromDurableResult(durable.delivery);
|
|
3121
|
-
}
|
|
3122
|
-
if (durable.status === "handled_no_send") return flushResult.delivered > 0 ? whatsAppReplyDeliveryVisibility(true) : whatsAppReplyDeliveryVisibilityFromDurableResult(durable.delivery);
|
|
3123
|
-
const deliveryResult = await deliverNormalizedPayload(normalizedDeliveryPayload, info);
|
|
3124
|
-
return flushResult.delivered > 0 && !deliveryResult.visibleReplySent ? whatsAppReplyDeliveryVisibility(true) : deliveryResult;
|
|
3125
|
-
} catch (error) {
|
|
3126
|
-
throw markWhatsAppReplyDeliveryErrorVisibleAfterFlush(error, flushResult);
|
|
3127
|
-
}
|
|
3128
|
-
}
|
|
3129
|
-
const mediaUrls = getWhatsAppPayloadMediaUrls(normalizedDeliveryPayload);
|
|
3130
|
-
if (shouldDeferWhatsAppMediaOnlyPayload({
|
|
3131
|
-
info,
|
|
3132
|
-
mediaUrls,
|
|
3133
|
-
reply
|
|
3134
|
-
})) {
|
|
3135
|
-
mediaOnlyCoalescer.defer({
|
|
3136
|
-
info,
|
|
3137
|
-
mediaUrls,
|
|
3138
|
-
payload: normalizedDeliveryPayload
|
|
3139
|
-
});
|
|
3140
|
-
return whatsAppReplyDeliveryVisibility(false);
|
|
3141
|
-
}
|
|
3142
|
-
const flushResult = await mediaOnlyCoalescer.flushExceptDuplicateMedia(mediaUrls);
|
|
3143
|
-
logWhatsAppMediaOnlyFlushResult(flushResult);
|
|
3144
|
-
try {
|
|
3145
|
-
const deliveryResult = await deliverNormalizedPayload(normalizedDeliveryPayload, info);
|
|
3146
|
-
return flushResult.delivered > 0 && !deliveryResult.visibleReplySent ? whatsAppReplyDeliveryVisibility(true) : deliveryResult;
|
|
3147
|
-
} catch (error) {
|
|
3148
|
-
throw markWhatsAppReplyDeliveryErrorVisibleAfterFlush(error, flushResult);
|
|
3149
|
-
}
|
|
3150
|
-
},
|
|
3151
|
-
onError: (err, info) => {
|
|
3152
|
-
logWhatsAppReplyDeliveryError({
|
|
3153
|
-
err,
|
|
3154
|
-
info,
|
|
3155
|
-
connectionId: params.connectionId,
|
|
3156
|
-
msg: params.msg,
|
|
3157
|
-
replyLogger: params.replyLogger
|
|
3158
|
-
});
|
|
3159
|
-
}
|
|
3160
|
-
},
|
|
3161
|
-
replyOptions: {
|
|
3162
|
-
...ingressLifecycle ? bindIngressLifecycleToReplyOptions(ingressLifecycle) : {},
|
|
3163
|
-
suppressTyping: sourceRepliesAreToolOnly && conversationKind === "group" && !(params.msg.groupMention?.wasMentioned ?? params.msg.wasMentioned),
|
|
3164
|
-
disableBlockStreaming,
|
|
3165
|
-
...sourceReplyDeliveryMode ? { sourceReplyDeliveryMode } : {},
|
|
3166
|
-
onModelSelected: params.onModelSelected,
|
|
3167
|
-
...statusReactionController ? {
|
|
3168
|
-
onToolStart: async (payload) => {
|
|
3169
|
-
const toolName = payload.name?.trim();
|
|
3170
|
-
if (toolName) await statusReactionController.setTool(toolName);
|
|
3171
|
-
},
|
|
3172
|
-
onCompactionStart: async () => {
|
|
3173
|
-
await statusReactionController.setCompacting();
|
|
3174
|
-
},
|
|
3175
|
-
onCompactionEnd: async () => {
|
|
3176
|
-
statusReactionController.cancelPending();
|
|
3177
|
-
await statusReactionController.setThinking();
|
|
3178
|
-
}
|
|
3179
|
-
} : {}
|
|
3180
|
-
},
|
|
3181
|
-
replyResolver: params.replyResolver,
|
|
3182
|
-
finalize: (dispatchResult) => {
|
|
3183
|
-
const didQueueVisibleReply = hasVisibleInboundReplyDispatch(dispatchResult);
|
|
3184
|
-
const didDeliverVisibleReply = didSendReply || dispatchResult.observedReplyDelivery === true;
|
|
3185
|
-
if (!didQueueVisibleReply) {
|
|
3186
|
-
if (statusReactionController) finalizeWhatsAppStatusReaction({
|
|
3187
|
-
controller: statusReactionController,
|
|
3188
|
-
outcome: "error"
|
|
3189
|
-
});
|
|
3190
|
-
if (params.shouldClearGroupHistory) params.groupHistories.set(params.groupHistoryKey, []);
|
|
3191
|
-
logVerbose$1("Skipping auto-reply: silent token or no text/media returned from resolver");
|
|
3192
|
-
return false;
|
|
3193
|
-
}
|
|
3194
|
-
if (statusReactionController) finalizeWhatsAppStatusReaction({
|
|
3195
|
-
controller: statusReactionController,
|
|
3196
|
-
outcome: didDeliverVisibleReply ? "done" : "error"
|
|
3197
|
-
});
|
|
3198
|
-
if (params.shouldClearGroupHistory) params.groupHistories.set(params.groupHistoryKey, []);
|
|
3199
|
-
return didDeliverVisibleReply;
|
|
3200
|
-
}
|
|
3201
|
-
};
|
|
3202
|
-
}
|
|
3203
|
-
async function finalizeWhatsAppStatusReaction(params) {
|
|
3204
|
-
if (params.outcome === "done") await params.controller.setDone();
|
|
3205
|
-
else await params.controller.setError();
|
|
3206
|
-
await params.controller.restoreInitial();
|
|
3207
|
-
}
|
|
3208
|
-
//#endregion
|
|
3209
|
-
//#region extensions/whatsapp/src/auto-reply/monitor/message-line.runtime.ts
|
|
3210
|
-
function normalizeAgentId$1(agentId) {
|
|
3211
|
-
return agentId.trim().toLowerCase() || "main";
|
|
3212
|
-
}
|
|
3213
|
-
function resolveIdentityNamePrefix(cfg, agentId) {
|
|
3214
|
-
const normalizedAgentId = normalizeAgentId$1(agentId);
|
|
3215
|
-
const identityName = cfg.agents?.list?.find((agent) => normalizeAgentId$1(agent.id ?? "") === normalizedAgentId)?.identity?.name?.trim();
|
|
3216
|
-
return identityName ? `[${identityName}]` : void 0;
|
|
3217
|
-
}
|
|
3218
|
-
function resolveMessagePrefix(cfg, agentId, opts) {
|
|
3219
|
-
const configured = opts?.configured;
|
|
3220
|
-
if (configured !== void 0) return configured;
|
|
3221
|
-
if (opts?.hasAllowFrom === true) return "";
|
|
3222
|
-
return resolveIdentityNamePrefix(cfg, agentId) ?? opts?.fallback ?? "[openclaw]";
|
|
3223
|
-
}
|
|
3224
|
-
//#endregion
|
|
3225
|
-
//#region extensions/whatsapp/src/auto-reply/monitor/message-line.ts
|
|
3226
|
-
function formatReplyTarget(replyTo) {
|
|
3227
|
-
if (!replyTo?.body) return null;
|
|
3228
|
-
return `[Replying to ${replyTo.sender?.label ?? replyTo.sender?.e164 ?? "unknown sender"}${replyTo.id ? ` id:${replyTo.id}` : ""}]\n${replyTo.body}\n[/Replying]`;
|
|
3229
|
-
}
|
|
3230
|
-
function formatReplyContext(msg) {
|
|
3231
|
-
return formatReplyTarget(getReplyContext(msg));
|
|
3232
|
-
}
|
|
3233
|
-
function buildInboundLine(params) {
|
|
3234
|
-
const { cfg, msg, agentId, previousTimestamp, envelope } = params;
|
|
3235
|
-
const messagePrefix = resolveMessagePrefix(cfg, agentId, {
|
|
3236
|
-
configured: cfg.channels?.whatsapp?.responsePrefix,
|
|
3237
|
-
hasAllowFrom: (cfg.channels?.whatsapp?.allowFrom?.length ?? 0) > 0
|
|
3238
|
-
});
|
|
3239
|
-
const admission = requireWhatsAppInboundAdmission(msg);
|
|
3240
|
-
const conversationId = admission.conversation.id;
|
|
3241
|
-
const conversationKind = admission.conversation.kind;
|
|
3242
|
-
const prefixStr = messagePrefix ? `${messagePrefix} ` : "";
|
|
3243
|
-
const replyContext = params.visibleReplyTo === void 0 ? formatReplyContext(msg) : formatReplyTarget(params.visibleReplyTo);
|
|
3244
|
-
const baseLine = `${prefixStr}${msg.payload.body}${replyContext ? `\n\n${replyContext}` : ""}`;
|
|
3245
|
-
const sender = getSenderIdentity(msg);
|
|
3246
|
-
return formatInboundEnvelope({
|
|
3247
|
-
channel: "WhatsApp",
|
|
3248
|
-
from: conversationKind === "group" ? conversationId : conversationId.replace(/^whatsapp:/, ""),
|
|
3249
|
-
timestamp: msg.event.timestamp,
|
|
3250
|
-
body: baseLine,
|
|
3251
|
-
chatType: conversationKind,
|
|
3252
|
-
sender: {
|
|
3253
|
-
name: sender.name ?? void 0,
|
|
3254
|
-
e164: sender.e164 ?? void 0,
|
|
3255
|
-
id: getPrimaryIdentityId(sender) ?? void 0
|
|
3256
|
-
},
|
|
3257
|
-
previousTimestamp,
|
|
3258
|
-
envelope,
|
|
3259
|
-
fromMe: msg.platform.fromMe
|
|
3260
|
-
});
|
|
3261
|
-
}
|
|
3262
|
-
//#endregion
|
|
3263
|
-
//#region extensions/whatsapp/src/auto-reply/monitor/status-reaction.ts
|
|
3264
|
-
async function createWhatsAppStatusReactionController(params) {
|
|
3265
|
-
if (!params.msg.event.id) return null;
|
|
3266
|
-
if ((params.cfg.messages?.statusReactions)?.enabled !== true) return null;
|
|
3267
|
-
const admission = requireWhatsAppInboundAdmission(params.msg);
|
|
3268
|
-
const accountId = admission.accountId;
|
|
3269
|
-
if (resolveWhatsAppReactionLevel({
|
|
3270
|
-
cfg: params.cfg,
|
|
3271
|
-
accountId
|
|
3272
|
-
}).level === "off") return null;
|
|
3273
|
-
const ackConfig = params.cfg.messages?.ackReaction;
|
|
3274
|
-
const scope = params.cfg.messages?.ackReactionScope ?? "group-mentions";
|
|
3275
|
-
if (scope === "off" || scope === "none") return null;
|
|
3276
|
-
const ackEmoji = resolveWhatsAppAckEmoji({
|
|
3277
|
-
cfg: params.cfg,
|
|
3278
|
-
agentId: params.agentId,
|
|
3279
|
-
ackConfig
|
|
3280
|
-
});
|
|
3281
|
-
if (!ackEmoji) return null;
|
|
3282
|
-
const directEnabled = scope === "all" || scope === "direct";
|
|
3283
|
-
const groupMode = scope === "all" || scope === "group-all" ? "always" : scope === "direct" ? "never" : "mentions";
|
|
3284
|
-
const isGroup = admission.conversation.kind === "group";
|
|
3285
|
-
const conversationIdForCheck = admission.conversation.id;
|
|
3286
|
-
const activation = isGroup ? await resolveGroupActivationFor({
|
|
3287
|
-
cfg: params.cfg,
|
|
3288
|
-
accountId,
|
|
3289
|
-
agentId: params.agentId,
|
|
3290
|
-
sessionKey: params.sessionKey,
|
|
3291
|
-
conversationId: conversationIdForCheck
|
|
3292
|
-
}) : null;
|
|
3293
|
-
if (!shouldAckReactionForWhatsApp({
|
|
3294
|
-
emoji: ackEmoji,
|
|
3295
|
-
isDirect: admission.conversation.kind === "direct",
|
|
3296
|
-
isGroup,
|
|
3297
|
-
directEnabled,
|
|
3298
|
-
groupMode,
|
|
3299
|
-
wasMentioned: (params.msg.groupMention?.wasMentioned ?? params.msg.wasMentioned) === true,
|
|
3300
|
-
groupActivated: activation === "always"
|
|
3301
|
-
})) return null;
|
|
3302
|
-
const participant = resolveReactionParticipant(params.msg);
|
|
3303
|
-
const reactionOptions = {
|
|
3304
|
-
verbose: params.verbose,
|
|
3305
|
-
fromMe: false,
|
|
3306
|
-
...participant ? { participant } : {},
|
|
3307
|
-
accountId,
|
|
3308
|
-
cfg: params.cfg
|
|
3309
|
-
};
|
|
3310
|
-
const chatId = params.msg.platform.chatJid;
|
|
3311
|
-
const msgId = params.msg.event.id;
|
|
3312
|
-
return createStatusReactionController({
|
|
3313
|
-
enabled: true,
|
|
3314
|
-
adapter: {
|
|
3315
|
-
setReaction: async (emoji) => {
|
|
3316
|
-
await sendReactionWhatsApp(chatId, msgId, emoji, reactionOptions);
|
|
3317
|
-
},
|
|
3318
|
-
clearReaction: async () => {
|
|
3319
|
-
await sendReactionWhatsApp(chatId, msgId, "", reactionOptions);
|
|
3320
|
-
}
|
|
3321
|
-
},
|
|
3322
|
-
initialEmoji: ackEmoji,
|
|
3323
|
-
emojis: void 0,
|
|
3324
|
-
onError: (err) => {
|
|
3325
|
-
logVerbose(`WhatsApp status-reaction error for chat ${chatId}/${msgId}: ${String(err)}`);
|
|
3326
|
-
}
|
|
3327
|
-
});
|
|
3328
|
-
}
|
|
3329
|
-
//#endregion
|
|
3330
|
-
//#region extensions/whatsapp/src/auto-reply/monitor/process-message.ts
|
|
3331
|
-
const WHATSAPP_MESSAGE_RECEIVED_HOOK_LIMITS = {
|
|
3332
|
-
maxConcurrency: 8,
|
|
3333
|
-
maxQueue: 128,
|
|
3334
|
-
timeoutMs: 2e3
|
|
3335
|
-
};
|
|
3336
|
-
function readWhatsAppMessageReceivedHookOptIn(value) {
|
|
3337
|
-
if (!value || typeof value !== "object") return;
|
|
3338
|
-
const pluginHooks = value.pluginHooks;
|
|
3339
|
-
if (pluginHooks?.messageReceived === void 0) return;
|
|
3340
|
-
return pluginHooks.messageReceived;
|
|
3341
|
-
}
|
|
3342
|
-
function shouldEmitWhatsAppMessageReceivedHooks(params) {
|
|
3343
|
-
const channelConfig = params.cfg.channels?.whatsapp;
|
|
3344
|
-
return readWhatsAppMessageReceivedHookOptIn(params.accountId && channelConfig?.accounts ? channelConfig.accounts[params.accountId] : void 0) ?? readWhatsAppMessageReceivedHookOptIn(channelConfig) ?? false;
|
|
3345
|
-
}
|
|
3346
|
-
function emitWhatsAppMessageReceivedHooks(params) {
|
|
3347
|
-
const canonical = deriveInboundMessageHookContext(params.ctx);
|
|
3348
|
-
const hookRunner = getGlobalHookRunner();
|
|
3349
|
-
if (hookRunner?.hasHooks("message_received")) fireAndForgetBoundedHook(() => hookRunner.runMessageReceived(toPluginMessageReceivedEvent(canonical), toPluginMessageContext(canonical)), "whatsapp: message_received plugin hook failed", void 0, WHATSAPP_MESSAGE_RECEIVED_HOOK_LIMITS);
|
|
3350
|
-
fireAndForgetBoundedHook(() => triggerInternalHook(createInternalHookEvent("message", "received", params.sessionKey, toInternalMessageReceivedContext(canonical))), "whatsapp: message_received internal hook failed", void 0, WHATSAPP_MESSAGE_RECEIVED_HOOK_LIMITS);
|
|
3351
|
-
}
|
|
3352
|
-
function emitWhatsAppMessageReceivedHooksIfEnabled(params) {
|
|
3353
|
-
if (!shouldEmitWhatsAppMessageReceivedHooks({
|
|
3354
|
-
cfg: params.cfg,
|
|
3355
|
-
accountId: params.accountId
|
|
3356
|
-
})) return;
|
|
3357
|
-
emitWhatsAppMessageReceivedHooks({
|
|
3358
|
-
ctx: params.ctx,
|
|
3359
|
-
sessionKey: params.sessionKey
|
|
3360
|
-
});
|
|
3361
|
-
}
|
|
3362
|
-
function resolvePinnedMainDmRecipient(params) {
|
|
3363
|
-
return resolvePinnedMainDmOwnerFromAllowlist({
|
|
3364
|
-
dmScope: params.cfg.session?.dmScope,
|
|
3365
|
-
allowFrom: params.allowFrom,
|
|
3366
|
-
normalizeEntry: (entry) => normalizeE164(entry)
|
|
3367
|
-
});
|
|
3368
|
-
}
|
|
3369
|
-
async function processMessage(params) {
|
|
3370
|
-
const admission = requireWhatsAppInboundAdmission(params.msg);
|
|
3371
|
-
if (admission.ingress.admission !== "dispatch" && admission.ingress.admission !== "observe") return false;
|
|
3372
|
-
const conversationId = admission.conversation.id;
|
|
3373
|
-
const conversationKind = admission.conversation.kind;
|
|
3374
|
-
const self = getSelfIdentity(params.msg);
|
|
3375
|
-
const inboundPolicy = resolveWhatsAppInboundPolicy({
|
|
3376
|
-
cfg: params.cfg,
|
|
3377
|
-
accountId: params.route.accountId ?? admission.accountId,
|
|
3378
|
-
selfE164: self.e164 ?? null
|
|
3379
|
-
});
|
|
3380
|
-
const account = inboundPolicy.account;
|
|
3381
|
-
const contextVisibilityMode = resolveChannelContextVisibilityMode({
|
|
3382
|
-
cfg: params.cfg,
|
|
3383
|
-
channel: "whatsapp",
|
|
3384
|
-
accountId: account.accountId
|
|
3385
|
-
});
|
|
3386
|
-
const { storePath, envelopeOptions, previousTimestamp } = resolveInboundSessionEnvelopeContext({
|
|
3387
|
-
cfg: params.cfg,
|
|
3388
|
-
agentId: params.route.agentId,
|
|
3389
|
-
sessionKey: params.route.sessionKey
|
|
3390
|
-
});
|
|
3391
|
-
let audioTranscript = params.preflightAudioTranscript ?? void 0;
|
|
3392
|
-
const hasAudioBody = (params.msg.payload.media?.kind === "audio" || params.msg.payload.media?.type?.startsWith("audio/") === true) && !params.msg.payload.body.trim();
|
|
3393
|
-
if (params.preflightAudioTranscript === void 0 && hasAudioBody && params.msg.payload.media?.path) try {
|
|
3394
|
-
const { transcribeFirstAudio } = await import("./audio-preflight.runtime-C_glQhZY.js");
|
|
3395
|
-
audioTranscript = await transcribeFirstAudio({
|
|
3396
|
-
ctx: {
|
|
3397
|
-
media: [{
|
|
3398
|
-
path: params.msg.payload.media.path,
|
|
3399
|
-
contentType: params.msg.payload.media.type,
|
|
3400
|
-
kind: params.msg.payload.media.kind ?? void 0
|
|
3401
|
-
}],
|
|
3402
|
-
From: conversationId,
|
|
3403
|
-
To: params.msg.platform.recipientJid,
|
|
3404
|
-
Provider: "whatsapp",
|
|
3405
|
-
Surface: "whatsapp",
|
|
3406
|
-
OriginatingChannel: "whatsapp",
|
|
3407
|
-
OriginatingTo: conversationId,
|
|
3408
|
-
AccountId: params.route.accountId
|
|
3409
|
-
},
|
|
3410
|
-
cfg: params.cfg
|
|
3411
|
-
});
|
|
3412
|
-
} catch {
|
|
3413
|
-
if (shouldLogVerbose$1()) logVerbose$1("whatsapp: audio preflight transcription failed, keeping structured audio");
|
|
3414
|
-
}
|
|
3415
|
-
const msgForAgent = audioTranscript !== void 0 ? {
|
|
3416
|
-
...params.msg,
|
|
3417
|
-
payload: {
|
|
3418
|
-
...params.msg.payload,
|
|
3419
|
-
body: audioTranscript
|
|
3420
|
-
}
|
|
3421
|
-
} : params.msg;
|
|
3422
|
-
const visibleReplyTo = resolveVisibleWhatsAppReplyContext({
|
|
3423
|
-
msg: params.msg,
|
|
3424
|
-
authDir: account.authDir,
|
|
3425
|
-
mode: contextVisibilityMode,
|
|
3426
|
-
groupPolicy: inboundPolicy.groupPolicy,
|
|
3427
|
-
groupAllowFrom: inboundPolicy.groupAllowFrom
|
|
3428
|
-
});
|
|
3429
|
-
let combinedBody = buildInboundLine({
|
|
3430
|
-
cfg: params.cfg,
|
|
3431
|
-
msg: msgForAgent,
|
|
3432
|
-
agentId: params.route.agentId,
|
|
3433
|
-
previousTimestamp,
|
|
3434
|
-
envelope: envelopeOptions,
|
|
3435
|
-
visibleReplyTo
|
|
3436
|
-
});
|
|
3437
|
-
let shouldClearGroupHistory = false;
|
|
3438
|
-
const visibleGroupHistory = conversationKind === "group" ? resolveVisibleWhatsAppGroupHistory({
|
|
3439
|
-
history: params.groupHistory ?? params.groupHistories.get(params.groupHistoryKey) ?? [],
|
|
3440
|
-
mode: contextVisibilityMode,
|
|
3441
|
-
groupPolicy: inboundPolicy.groupPolicy,
|
|
3442
|
-
groupAllowFrom: inboundPolicy.groupAllowFrom,
|
|
3443
|
-
authDir: account.authDir
|
|
3444
|
-
}) : void 0;
|
|
3445
|
-
if (conversationKind === "group") {
|
|
3446
|
-
const history = visibleGroupHistory ?? [];
|
|
3447
|
-
if (history.length > 0) combinedBody = buildHistoryContextFromEntries({
|
|
3448
|
-
entries: history.map((m) => ({
|
|
3449
|
-
sender: m.sender,
|
|
3450
|
-
body: m.body,
|
|
3451
|
-
timestamp: m.timestamp,
|
|
3452
|
-
media: m.media
|
|
3453
|
-
})),
|
|
3454
|
-
currentMessage: combinedBody,
|
|
3455
|
-
excludeLast: false,
|
|
3456
|
-
formatEntry: (entry) => {
|
|
3457
|
-
return formatInboundEnvelope$1({
|
|
3458
|
-
channel: "WhatsApp",
|
|
3459
|
-
from: conversationId,
|
|
3460
|
-
timestamp: entry.timestamp,
|
|
3461
|
-
body: [entry.body, formatMediaPlaceholderText(entry.media ?? [])].filter(Boolean).join("\n"),
|
|
3462
|
-
chatType: "group",
|
|
3463
|
-
senderLabel: entry.sender,
|
|
3464
|
-
envelope: envelopeOptions
|
|
3465
|
-
});
|
|
3466
|
-
}
|
|
3467
|
-
});
|
|
3468
|
-
shouldClearGroupHistory = !(params.suppressGroupHistoryClear ?? false);
|
|
3469
|
-
}
|
|
3470
|
-
const combinedEchoKey = params.buildCombinedEchoKey({
|
|
3471
|
-
sessionKey: params.route.sessionKey,
|
|
3472
|
-
combinedBody
|
|
3473
|
-
});
|
|
3474
|
-
if (params.echoHas(combinedEchoKey)) {
|
|
3475
|
-
logVerbose$1("Skipping auto-reply: detected echo for combined message");
|
|
3476
|
-
params.echoForget(combinedEchoKey);
|
|
3477
|
-
return false;
|
|
3478
|
-
}
|
|
3479
|
-
const statusReactionController = params.statusReactionController ?? (params.cfg.messages?.statusReactions?.enabled === true && !params.ackAlreadySent ? await createWhatsAppStatusReactionController({
|
|
3480
|
-
cfg: params.cfg,
|
|
3481
|
-
msg: params.msg,
|
|
3482
|
-
agentId: params.route.agentId,
|
|
3483
|
-
sessionKey: params.route.sessionKey,
|
|
3484
|
-
verbose: params.verbose
|
|
3485
|
-
}) : null);
|
|
3486
|
-
if (statusReactionController && !params.statusReactionController) statusReactionController.setQueued();
|
|
3487
|
-
let ackReaction = params.ackReaction ?? null;
|
|
3488
|
-
if (!statusReactionController && !ackReaction && params.ackAlreadySent !== true) ackReaction = await maybeSendAckReaction({
|
|
3489
|
-
cfg: params.cfg,
|
|
3490
|
-
msg: params.msg,
|
|
3491
|
-
agentId: params.route.agentId,
|
|
3492
|
-
sessionKey: params.route.sessionKey,
|
|
3493
|
-
verbose: params.verbose,
|
|
3494
|
-
info: params.replyLogger.info.bind(params.replyLogger),
|
|
3495
|
-
warn: params.replyLogger.warn.bind(params.replyLogger)
|
|
3496
|
-
});
|
|
3497
|
-
const correlationId = params.msg.event.id ?? newConnectionId();
|
|
3498
|
-
params.replyLogger.info({
|
|
3499
|
-
connectionId: params.connectionId,
|
|
3500
|
-
correlationId,
|
|
3501
|
-
from: conversationId,
|
|
3502
|
-
to: params.msg.platform.recipientJid,
|
|
3503
|
-
body: elide(combinedBody, 240),
|
|
3504
|
-
mediaType: params.msg.payload.media?.type ?? null,
|
|
3505
|
-
mediaPath: params.msg.payload.media?.path ?? null
|
|
3506
|
-
}, "inbound web message");
|
|
3507
|
-
const fromDisplay = conversationId;
|
|
3508
|
-
const kindLabel = params.msg.payload.media?.type ? `, ${params.msg.payload.media?.type}` : "";
|
|
3509
|
-
whatsappInboundLog.info(`Inbound message ${fromDisplay} -> ${params.msg.platform.recipientJid} (${conversationKind}${kindLabel}, ${combinedBody.length} chars)`);
|
|
3510
|
-
if (shouldLogVerbose$1()) whatsappInboundLog.debug(`Inbound body: ${elide(combinedBody, 400)}`);
|
|
3511
|
-
const sender = getSenderIdentity(params.msg);
|
|
3512
|
-
const commandBody = params.msg.payload.commandBody ?? params.msg.payload.body;
|
|
3513
|
-
const dmRouteTarget = resolveWhatsAppDmRouteTarget({
|
|
3514
|
-
msg: params.msg,
|
|
3515
|
-
senderE164: sender.e164 ?? void 0,
|
|
3516
|
-
normalizeE164
|
|
3517
|
-
});
|
|
3518
|
-
const shouldCheckCommandAuth = shouldComputeCommandAuthorized(commandBody, params.cfg);
|
|
3519
|
-
const isTextCommand = isControlCommandMessage(commandBody, params.cfg);
|
|
3520
|
-
const commandAuthorized = shouldCheckCommandAuth ? await resolveWhatsAppCommandAuthorized({
|
|
3521
|
-
cfg: params.cfg,
|
|
3522
|
-
msg: params.msg,
|
|
3523
|
-
policy: inboundPolicy,
|
|
3524
|
-
authDir: account.authDir
|
|
3525
|
-
}) : void 0;
|
|
3526
|
-
const { onModelSelected, ...replyPipeline } = createChannelMessageReplyPipeline({
|
|
3527
|
-
cfg: params.cfg,
|
|
3528
|
-
agentId: params.route.agentId,
|
|
3529
|
-
channel: "whatsapp",
|
|
3530
|
-
accountId: params.route.accountId
|
|
3531
|
-
});
|
|
3532
|
-
const responsePrefix = resolveWhatsAppResponsePrefix({
|
|
3533
|
-
cfg: params.cfg,
|
|
3534
|
-
agentId: params.route.agentId,
|
|
3535
|
-
isSelfChat: conversationKind !== "group" && inboundPolicy.isSelfChat,
|
|
3536
|
-
pipelineResponsePrefix: replyPipeline.responsePrefix
|
|
3537
|
-
});
|
|
3538
|
-
const replyThreading = resolveBatchedReplyThreadingPolicy(account.replyToMode ?? "off", params.msg.event.isBatched === true);
|
|
3539
|
-
const conversationSystemPrompt = conversationKind === "group" ? resolveWhatsAppGroupSystemPrompt({
|
|
3540
|
-
accountConfig: account,
|
|
3541
|
-
groupId: conversationId
|
|
3542
|
-
}) : resolveWhatsAppDirectSystemPrompt({
|
|
3543
|
-
accountConfig: account,
|
|
3544
|
-
peerId: dmRouteTarget ?? conversationId
|
|
3545
|
-
});
|
|
3546
|
-
const ctxPayload = await buildWhatsAppInboundContext({
|
|
3547
|
-
bodyForAgent: msgForAgent.payload.body,
|
|
3548
|
-
combinedBody,
|
|
3549
|
-
command: {
|
|
3550
|
-
kind: isTextCommand ? "text-slash" : "normal",
|
|
3551
|
-
body: commandBody,
|
|
3552
|
-
authorized: commandAuthorized
|
|
3553
|
-
},
|
|
3554
|
-
groupHistory: visibleGroupHistory,
|
|
3555
|
-
groupHistoryLimit: params.groupHistoryLimit,
|
|
3556
|
-
groupMemberRoster: params.groupMemberNames.get(params.groupHistoryKey),
|
|
3557
|
-
groupSystemPrompt: conversationSystemPrompt,
|
|
3558
|
-
msg: params.msg,
|
|
3559
|
-
rawBody: commandBody,
|
|
3560
|
-
route: params.route,
|
|
3561
|
-
sender: {
|
|
3562
|
-
id: getPrimaryIdentityId(sender) ?? void 0,
|
|
3563
|
-
name: sender.name ?? void 0,
|
|
3564
|
-
e164: sender.e164 ?? void 0
|
|
3565
|
-
},
|
|
3566
|
-
...audioTranscript !== void 0 ? { transcript: audioTranscript } : {},
|
|
3567
|
-
...audioTranscript !== void 0 ? { mediaTranscribedIndexes: [0] } : {},
|
|
3568
|
-
replyThreading,
|
|
3569
|
-
visibleReplyTo: visibleReplyTo ?? void 0,
|
|
3570
|
-
suppressMessageReceivedHooks: true
|
|
3571
|
-
});
|
|
3572
|
-
emitWhatsAppMessageReceivedHooksIfEnabled({
|
|
3573
|
-
cfg: params.cfg,
|
|
3574
|
-
ctx: ctxPayload,
|
|
3575
|
-
accountId: params.route.accountId,
|
|
3576
|
-
sessionKey: params.route.sessionKey
|
|
3577
|
-
});
|
|
3578
|
-
const pinnedMainDmRecipient = resolvePinnedMainDmRecipient({
|
|
3579
|
-
cfg: params.cfg,
|
|
3580
|
-
allowFrom: inboundPolicy.configuredAllowFrom
|
|
3581
|
-
});
|
|
3582
|
-
updateWhatsAppMainLastRoute({
|
|
3583
|
-
backgroundTasks: params.backgroundTasks,
|
|
3584
|
-
cfg: params.cfg,
|
|
3585
|
-
ctx: ctxPayload,
|
|
3586
|
-
dmRouteTarget,
|
|
3587
|
-
pinnedMainDmRecipient,
|
|
3588
|
-
route: params.route,
|
|
3589
|
-
updateLastRoute: updateLastRouteInBackground,
|
|
3590
|
-
warn: params.replyLogger.warn.bind(params.replyLogger)
|
|
3591
|
-
});
|
|
3592
|
-
let finalizeReply;
|
|
3593
|
-
const turnResult = await runChannelInboundEvent({
|
|
3594
|
-
channel: "whatsapp",
|
|
3595
|
-
accountId: params.route.accountId,
|
|
3596
|
-
raw: params.msg,
|
|
3597
|
-
adapter: {
|
|
3598
|
-
ingest: () => ({
|
|
3599
|
-
id: params.msg.event.id ?? `${conversationId}:${Date.now()}`,
|
|
3600
|
-
timestamp: params.msg.event.timestamp,
|
|
3601
|
-
rawText: ctxPayload.RawBody ?? "",
|
|
3602
|
-
textForAgent: ctxPayload.BodyForAgent,
|
|
3603
|
-
textForCommands: ctxPayload.CommandBody,
|
|
3604
|
-
raw: params.msg
|
|
3605
|
-
}),
|
|
3606
|
-
preflight: () => {
|
|
3607
|
-
const reason = admission.ingress.reasonCode;
|
|
3608
|
-
if (admission.ingress.admission === "dispatch") return { admission: {
|
|
3609
|
-
kind: "dispatch",
|
|
3610
|
-
reason
|
|
3611
|
-
} };
|
|
3612
|
-
if (admission.ingress.admission === "observe") return { admission: {
|
|
3613
|
-
kind: "observeOnly",
|
|
3614
|
-
reason
|
|
3615
|
-
} };
|
|
3616
|
-
if (admission.ingress.admission === "skip") return { admission: {
|
|
3617
|
-
kind: "handled",
|
|
3618
|
-
reason
|
|
3619
|
-
} };
|
|
3620
|
-
return { admission: {
|
|
3621
|
-
kind: "drop",
|
|
3622
|
-
reason,
|
|
3623
|
-
recordHistory: false
|
|
3624
|
-
} };
|
|
3625
|
-
},
|
|
3626
|
-
resolveTurn: () => {
|
|
3627
|
-
const { finalize, ...replyPlan } = createWhatsAppReplyPlan({
|
|
3628
|
-
cfg: params.cfg,
|
|
3629
|
-
connectionId: params.connectionId,
|
|
3630
|
-
context: ctxPayload,
|
|
3631
|
-
deliverReply: deliverWebReply,
|
|
3632
|
-
groupHistories: params.groupHistories,
|
|
3633
|
-
groupHistoryKey: params.groupHistoryKey,
|
|
3634
|
-
maxMediaBytes: params.maxMediaBytes,
|
|
3635
|
-
maxMediaTextChunkLimit: params.maxMediaTextChunkLimit,
|
|
3636
|
-
msg: params.msg,
|
|
3637
|
-
onModelSelected,
|
|
3638
|
-
rememberSentText: params.rememberSentText,
|
|
3639
|
-
replyLogger: params.replyLogger,
|
|
3640
|
-
replyPipeline: {
|
|
3641
|
-
...replyPipeline,
|
|
3642
|
-
responsePrefix
|
|
3643
|
-
},
|
|
3644
|
-
replyResolver: params.replyResolver,
|
|
3645
|
-
route: params.route,
|
|
3646
|
-
shouldClearGroupHistory,
|
|
3647
|
-
statusReactionController
|
|
3648
|
-
});
|
|
3649
|
-
finalizeReply = finalize;
|
|
3650
|
-
return {
|
|
3651
|
-
cfg: params.cfg,
|
|
3652
|
-
channel: "whatsapp",
|
|
3653
|
-
accountId: params.route.accountId,
|
|
3654
|
-
route: {
|
|
3655
|
-
agentId: params.route.agentId,
|
|
3656
|
-
sessionKey: params.route.sessionKey
|
|
3657
|
-
},
|
|
3658
|
-
ctxPayload,
|
|
3659
|
-
record: {
|
|
3660
|
-
onRecordError: (err) => {
|
|
3661
|
-
params.replyLogger.warn({
|
|
3662
|
-
error: formatError(err),
|
|
3663
|
-
storePath,
|
|
3664
|
-
sessionKey: params.route.sessionKey
|
|
3665
|
-
}, "failed updating session meta");
|
|
3666
|
-
},
|
|
3667
|
-
trackSessionMetaTask: (task) => {
|
|
3668
|
-
trackBackgroundTask(params.backgroundTasks, task);
|
|
3669
|
-
}
|
|
3670
|
-
},
|
|
3671
|
-
...replyPlan
|
|
3672
|
-
};
|
|
3673
|
-
}
|
|
3674
|
-
}
|
|
3675
|
-
});
|
|
3676
|
-
const didSendReply = turnResult.dispatched ? finalizeReply?.(turnResult.dispatchResult) ?? false : false;
|
|
3677
|
-
removeAckReactionHandleAfterReply({
|
|
3678
|
-
removeAfterReply: false,
|
|
3679
|
-
ackReaction,
|
|
3680
|
-
onError: (err) => {
|
|
3681
|
-
logAckFailure({
|
|
3682
|
-
log: logVerbose$1,
|
|
3683
|
-
channel: "whatsapp",
|
|
3684
|
-
target: `${params.msg.platform.chatJid ?? conversationId}/${params.msg.event.id ?? "unknown"}`,
|
|
3685
|
-
error: err
|
|
3686
|
-
});
|
|
3687
|
-
}
|
|
3688
|
-
});
|
|
3689
|
-
return didSendReply;
|
|
3690
|
-
}
|
|
3691
|
-
//#endregion
|
|
3692
|
-
//#region extensions/whatsapp/src/auto-reply/monitor/on-message.ts
|
|
3693
|
-
function createWebOnMessageHandler(params) {
|
|
3694
|
-
const hasExplicitlyPassedInboundAccess = (msg) => msg.admission ? msg.admission.ingress.decision === "allow" : msg.accessControlPassed === true;
|
|
3695
|
-
const withDirectSenderPeer = (msg, peerId) => {
|
|
3696
|
-
if (requireWhatsAppInboundAdmission(msg).conversation.kind === "group" || msg.platform.sender?.e164 || msg.platform.senderE164 || !peerId.startsWith("+")) return msg;
|
|
3697
|
-
const normalized = normalizeE164(peerId);
|
|
3698
|
-
if (!normalized) return msg;
|
|
3699
|
-
return requireAdmittedWhatsAppInboundMessage(withDeprecatedWebInboundMessageFlatAliases({
|
|
3700
|
-
...msg,
|
|
3701
|
-
platform: {
|
|
3702
|
-
...msg.platform,
|
|
3703
|
-
sender: {
|
|
3704
|
-
...msg.platform.sender,
|
|
3705
|
-
e164: normalized
|
|
3706
|
-
},
|
|
3707
|
-
senderE164: normalized
|
|
3708
|
-
}
|
|
3709
|
-
}));
|
|
3710
|
-
};
|
|
3711
|
-
const processForRoute = async (cfg, msg, route, groupHistoryKey, opts) => {
|
|
3712
|
-
const processParams = {
|
|
3713
|
-
cfg,
|
|
3714
|
-
msg,
|
|
3715
|
-
route,
|
|
3716
|
-
groupHistoryKey,
|
|
3717
|
-
groupHistories: params.groupHistories,
|
|
3718
|
-
groupHistoryLimit: params.groupHistoryLimit,
|
|
3719
|
-
groupMemberNames: params.groupMemberNames,
|
|
3720
|
-
connectionId: params.connectionId,
|
|
3721
|
-
verbose: params.verbose,
|
|
3722
|
-
maxMediaBytes: params.maxMediaBytes,
|
|
3723
|
-
replyResolver: params.replyResolver,
|
|
3724
|
-
replyLogger: params.replyLogger,
|
|
3725
|
-
backgroundTasks: params.backgroundTasks,
|
|
3726
|
-
rememberSentText: params.echoTracker.rememberText,
|
|
3727
|
-
echoHas: params.echoTracker.has,
|
|
3728
|
-
echoForget: params.echoTracker.forget,
|
|
3729
|
-
buildCombinedEchoKey: params.echoTracker.buildCombinedKey
|
|
3730
|
-
};
|
|
3731
|
-
if (opts?.groupHistory !== void 0) processParams.groupHistory = opts.groupHistory;
|
|
3732
|
-
if (opts?.suppressGroupHistoryClear !== void 0) processParams.suppressGroupHistoryClear = opts.suppressGroupHistoryClear;
|
|
3733
|
-
if (opts?.preflightAudioTranscript !== void 0) processParams.preflightAudioTranscript = opts.preflightAudioTranscript;
|
|
3734
|
-
if (opts?.ackAlreadySent === true) processParams.ackAlreadySent = true;
|
|
3735
|
-
if (opts?.ackReaction !== void 0) processParams.ackReaction = opts.ackReaction;
|
|
3736
|
-
if (opts?.statusReactionController !== void 0) processParams.statusReactionController = opts.statusReactionController;
|
|
3737
|
-
return processMessage(processParams);
|
|
3738
|
-
};
|
|
3739
|
-
return async (rawMsg) => {
|
|
3740
|
-
const canRunDirectEarlyAudioPreflight = hasExplicitlyPassedInboundAccess(rawMsg);
|
|
3741
|
-
const normalizedMsg = requireAdmittedWhatsAppInboundMessage(normalizeWebInboundMessage(rawMsg));
|
|
3742
|
-
const cfg = params.loadConfig?.() ?? params.cfg;
|
|
3743
|
-
const peerId = resolvePeerId(normalizedMsg);
|
|
3744
|
-
const msg = withDirectSenderPeer(normalizedMsg, peerId);
|
|
3745
|
-
const admission = requireWhatsAppInboundAdmission(msg);
|
|
3746
|
-
if (admission.ingress.admission !== "dispatch" && admission.ingress.admission !== "observe") return;
|
|
3747
|
-
const conversationId = admission.conversation.id;
|
|
3748
|
-
const conversationKind = admission.conversation.kind;
|
|
3749
|
-
const baseRoute = resolveAgentRoute({
|
|
3750
|
-
cfg,
|
|
3751
|
-
channel: "whatsapp",
|
|
3752
|
-
accountId: admission.accountId,
|
|
3753
|
-
peer: {
|
|
3754
|
-
kind: conversationKind,
|
|
3755
|
-
id: peerId
|
|
3756
|
-
}
|
|
3757
|
-
});
|
|
3758
|
-
const baseConversationRoute = conversationKind === "group" ? resolveWhatsAppGroupSessionRoute(baseRoute) : baseRoute;
|
|
3759
|
-
const routeAccountId = baseConversationRoute.accountId ?? admission.accountId;
|
|
3760
|
-
const account = resolveWhatsAppAccount({
|
|
3761
|
-
cfg,
|
|
3762
|
-
accountId: routeAccountId
|
|
3763
|
-
});
|
|
3764
|
-
const baseMentionConfig = buildMentionConfig(cfg);
|
|
3765
|
-
if (conversationId === msg.platform.recipientJid) logVerbose(`📱 Same-phone mode detected (from === to: ${conversationId})`);
|
|
3766
|
-
if (params.echoTracker.has(msg.payload.body)) {
|
|
3767
|
-
logVerbose("Skipping auto-reply: detected echo (message matches recently sent text)");
|
|
3768
|
-
params.echoTracker.forget(msg.payload.body);
|
|
3769
|
-
return;
|
|
3770
|
-
}
|
|
3771
|
-
const configuredRoute = resolveConfiguredBindingRoute({
|
|
3772
|
-
cfg,
|
|
3773
|
-
route: baseConversationRoute,
|
|
3774
|
-
channel: "whatsapp",
|
|
3775
|
-
accountId: routeAccountId,
|
|
3776
|
-
conversationId: peerId
|
|
3777
|
-
});
|
|
3778
|
-
const route = configuredRoute.route;
|
|
3779
|
-
const groupHistoryKey = conversationKind === "group" ? buildGroupHistoryKey({
|
|
3780
|
-
channel: "whatsapp",
|
|
3781
|
-
accountId: route.accountId,
|
|
3782
|
-
peerKind: "group",
|
|
3783
|
-
peerId
|
|
3784
|
-
}) : route.sessionKey;
|
|
3785
|
-
let preflightAudioTranscript;
|
|
3786
|
-
const hasAudioBody = (msg.payload.media?.kind === "audio" || msg.payload.media?.type?.startsWith("audio/") === true) && !msg.payload.body.trim();
|
|
3787
|
-
const canRunEarlyAudioPreflight = conversationKind === "group" || canRunDirectEarlyAudioPreflight;
|
|
3788
|
-
let ackAlreadySent = false;
|
|
3789
|
-
let ackReaction = null;
|
|
3790
|
-
let statusReactionController = null;
|
|
3791
|
-
let recordAcceptedConfiguredGroupRoute = null;
|
|
3792
|
-
const clearPreDispatchReaction = async () => {
|
|
3793
|
-
try {
|
|
3794
|
-
if (statusReactionController) {
|
|
3795
|
-
const controller = statusReactionController;
|
|
3796
|
-
statusReactionController = null;
|
|
3797
|
-
controller.cancelPending();
|
|
3798
|
-
await controller.clear();
|
|
3799
|
-
return;
|
|
3800
|
-
}
|
|
3801
|
-
if (ackReaction && await ackReaction.ackReactionPromise) await ackReaction.remove();
|
|
3802
|
-
} catch (err) {
|
|
3803
|
-
params.replyLogger.warn({ error: String(err) }, "whatsapp: failed to clear pre-dispatch reaction after pre-dispatch rejection");
|
|
3804
|
-
}
|
|
3805
|
-
};
|
|
3806
|
-
const transcribeAudioOnce = async () => {
|
|
3807
|
-
if (preflightAudioTranscript !== void 0 || !hasAudioBody || !msg.payload.media?.path) return;
|
|
3808
|
-
try {
|
|
3809
|
-
const { transcribeFirstAudio } = await import("./audio-preflight.runtime-C_glQhZY.js");
|
|
3810
|
-
preflightAudioTranscript = await transcribeFirstAudio({
|
|
3811
|
-
ctx: {
|
|
3812
|
-
media: [{
|
|
3813
|
-
path: msg.payload.media.path,
|
|
3814
|
-
contentType: msg.payload.media.type,
|
|
3815
|
-
kind: msg.payload.media.kind ?? void 0
|
|
3816
|
-
}],
|
|
3817
|
-
From: conversationId,
|
|
3818
|
-
To: msg.platform.recipientJid,
|
|
3819
|
-
Provider: "whatsapp",
|
|
3820
|
-
Surface: "whatsapp",
|
|
3821
|
-
OriginatingChannel: "whatsapp",
|
|
3822
|
-
OriginatingTo: conversationId,
|
|
3823
|
-
AccountId: route.accountId
|
|
3824
|
-
},
|
|
3825
|
-
cfg
|
|
3826
|
-
}) ?? null;
|
|
3827
|
-
} catch {
|
|
3828
|
-
preflightAudioTranscript = null;
|
|
3829
|
-
}
|
|
3830
|
-
};
|
|
3831
|
-
const runAudioPreflightOnce = async () => {
|
|
3832
|
-
if (preflightAudioTranscript !== void 0 || !canRunEarlyAudioPreflight || !hasAudioBody || !msg.payload.media?.path) return;
|
|
3833
|
-
if (cfg.messages?.statusReactions?.enabled === true) {
|
|
3834
|
-
statusReactionController = await createWhatsAppStatusReactionController({
|
|
3835
|
-
cfg,
|
|
3836
|
-
msg,
|
|
3837
|
-
agentId: route.agentId,
|
|
3838
|
-
sessionKey: route.sessionKey,
|
|
3839
|
-
verbose: params.verbose
|
|
3840
|
-
});
|
|
3841
|
-
if (statusReactionController) await statusReactionController.setQueued();
|
|
3842
|
-
} else {
|
|
3843
|
-
ackReaction = await maybeSendAckReaction({
|
|
3844
|
-
cfg,
|
|
3845
|
-
msg,
|
|
3846
|
-
agentId: route.agentId,
|
|
3847
|
-
sessionKey: route.sessionKey,
|
|
3848
|
-
verbose: params.verbose,
|
|
3849
|
-
info: params.replyLogger.info.bind(params.replyLogger),
|
|
3850
|
-
warn: params.replyLogger.warn.bind(params.replyLogger)
|
|
3851
|
-
});
|
|
3852
|
-
ackAlreadySent = ackReaction !== null;
|
|
3853
|
-
}
|
|
3854
|
-
await transcribeAudioOnce();
|
|
3855
|
-
};
|
|
3856
|
-
if (conversationKind === "group") {
|
|
3857
|
-
const sender = getSenderIdentity(msg);
|
|
3858
|
-
const metaCtx = {
|
|
3859
|
-
From: conversationId,
|
|
3860
|
-
To: msg.platform.recipientJid,
|
|
3861
|
-
SessionKey: route.sessionKey,
|
|
3862
|
-
AccountId: route.accountId,
|
|
3863
|
-
ChatType: conversationKind,
|
|
3864
|
-
ConversationLabel: conversationId,
|
|
3865
|
-
GroupSubject: msg.group?.subject,
|
|
3866
|
-
SenderName: sender.name ?? void 0,
|
|
3867
|
-
SenderId: getPrimaryIdentityId(sender) ?? void 0,
|
|
3868
|
-
SenderE164: sender.e164 ?? void 0,
|
|
3869
|
-
Provider: "whatsapp",
|
|
3870
|
-
Surface: "whatsapp",
|
|
3871
|
-
OriginatingChannel: "whatsapp",
|
|
3872
|
-
OriginatingTo: conversationId
|
|
3873
|
-
};
|
|
3874
|
-
const recordGroupRoute = () => updateLastRouteInBackground({
|
|
3875
|
-
cfg,
|
|
3876
|
-
backgroundTasks: params.backgroundTasks,
|
|
3877
|
-
storeAgentId: route.agentId,
|
|
3878
|
-
sessionKey: route.sessionKey,
|
|
3879
|
-
channel: "whatsapp",
|
|
3880
|
-
to: conversationId,
|
|
3881
|
-
accountId: route.accountId,
|
|
3882
|
-
ctx: metaCtx,
|
|
3883
|
-
warn: params.replyLogger.warn.bind(params.replyLogger)
|
|
3884
|
-
});
|
|
3885
|
-
recordAcceptedConfiguredGroupRoute = recordGroupRoute;
|
|
3886
|
-
let gating = await applyGroupGating({
|
|
3887
|
-
cfg,
|
|
3888
|
-
msg,
|
|
3889
|
-
deferMissingMention: hasAudioBody && Boolean(msg.payload.media?.path),
|
|
3890
|
-
groupHistoryKey,
|
|
3891
|
-
agentId: route.agentId,
|
|
3892
|
-
sessionKey: route.sessionKey,
|
|
3893
|
-
baseMentionConfig,
|
|
3894
|
-
providerMentionPatterns: account.mentionPatterns,
|
|
3895
|
-
authDir: account.authDir,
|
|
3896
|
-
selfChatMode: account.selfChatMode,
|
|
3897
|
-
groupHistories: params.groupHistories,
|
|
3898
|
-
groupHistoryLimit: params.groupHistoryLimit,
|
|
3899
|
-
groupMemberNames: params.groupMemberNames,
|
|
3900
|
-
logVerbose,
|
|
3901
|
-
replyLogger: params.replyLogger
|
|
3902
|
-
});
|
|
3903
|
-
if (!gating.shouldProcess && "needsMentionText" in gating && gating.needsMentionText === true) {
|
|
3904
|
-
await runAudioPreflightOnce();
|
|
3905
|
-
gating = await applyGroupGating({
|
|
3906
|
-
cfg,
|
|
3907
|
-
msg,
|
|
3908
|
-
...typeof preflightAudioTranscript === "string" ? { mentionText: preflightAudioTranscript } : {},
|
|
3909
|
-
groupHistoryKey,
|
|
3910
|
-
agentId: route.agentId,
|
|
3911
|
-
sessionKey: route.sessionKey,
|
|
3912
|
-
baseMentionConfig,
|
|
3913
|
-
providerMentionPatterns: account.mentionPatterns,
|
|
3914
|
-
authDir: account.authDir,
|
|
3915
|
-
selfChatMode: account.selfChatMode,
|
|
3916
|
-
groupHistories: params.groupHistories,
|
|
3917
|
-
groupHistoryLimit: params.groupHistoryLimit,
|
|
3918
|
-
groupMemberNames: params.groupMemberNames,
|
|
3919
|
-
logVerbose,
|
|
3920
|
-
replyLogger: params.replyLogger
|
|
3921
|
-
});
|
|
3922
|
-
}
|
|
3923
|
-
if (!gating.shouldProcess) {
|
|
3924
|
-
await clearPreDispatchReaction();
|
|
3925
|
-
return;
|
|
3926
|
-
}
|
|
3927
|
-
}
|
|
3928
|
-
if (configuredRoute.bindingResolution) {
|
|
3929
|
-
const ensured = await ensureConfiguredBindingRouteReady({
|
|
3930
|
-
cfg,
|
|
3931
|
-
bindingResolution: configuredRoute.bindingResolution
|
|
3932
|
-
});
|
|
3933
|
-
if (!ensured.ok) {
|
|
3934
|
-
params.replyLogger.warn(`whatsapp: configured ACP binding unavailable for conversation ${configuredRoute.bindingResolution.record.conversation.conversationId}: ${ensured.error}`);
|
|
3935
|
-
await clearPreDispatchReaction();
|
|
3936
|
-
return;
|
|
3937
|
-
}
|
|
3938
|
-
}
|
|
3939
|
-
if (recordAcceptedConfiguredGroupRoute && !configuredRoute.bindingResolution) {
|
|
3940
|
-
recordAcceptedConfiguredGroupRoute();
|
|
3941
|
-
recordAcceptedConfiguredGroupRoute = null;
|
|
3942
|
-
}
|
|
3943
|
-
await runAudioPreflightOnce();
|
|
3944
|
-
const hasBroadcastTargets = !configuredRoute.bindingResolution && Array.isArray(cfg.broadcast?.[peerId]) && cfg.broadcast[peerId].length > 0;
|
|
3945
|
-
if (hasBroadcastTargets && statusReactionController) await clearPreDispatchReaction();
|
|
3946
|
-
if (hasBroadcastTargets && !canRunEarlyAudioPreflight) await transcribeAudioOnce();
|
|
3947
|
-
if (!configuredRoute.bindingResolution && await maybeBroadcastMessage({
|
|
3948
|
-
cfg,
|
|
3949
|
-
msg,
|
|
3950
|
-
peerId,
|
|
3951
|
-
route,
|
|
3952
|
-
groupHistoryKey,
|
|
3953
|
-
groupHistories: params.groupHistories,
|
|
3954
|
-
...preflightAudioTranscript !== void 0 ? { preflightAudioTranscript } : {},
|
|
3955
|
-
...ackAlreadySent && conversationKind !== "group" ? { ackAlreadySent: true } : {},
|
|
3956
|
-
...ackReaction && conversationKind !== "group" ? { ackReaction } : {},
|
|
3957
|
-
...statusReactionController && conversationKind !== "group" ? { ackAlreadySent: true } : {},
|
|
3958
|
-
processMessage: (m, r, k, opts) => processForRoute(cfg, m, r, k, opts)
|
|
3959
|
-
})) return;
|
|
3960
|
-
recordAcceptedConfiguredGroupRoute?.();
|
|
3961
|
-
await processForRoute(cfg, msg, route, groupHistoryKey, {
|
|
3962
|
-
...preflightAudioTranscript !== void 0 ? { preflightAudioTranscript } : {},
|
|
3963
|
-
...ackAlreadySent ? { ackAlreadySent: true } : {},
|
|
3964
|
-
...ackReaction ? { ackReaction } : {},
|
|
3965
|
-
...statusReactionController ? { statusReactionController } : {}
|
|
3966
|
-
});
|
|
3967
|
-
};
|
|
3968
|
-
}
|
|
3969
|
-
//#endregion
|
|
3970
|
-
//#region extensions/whatsapp/src/auto-reply/monitor.ts
|
|
3971
|
-
function isNonRetryableWebCloseStatus(statusCode) {
|
|
3972
|
-
return statusCode === 440;
|
|
3973
|
-
}
|
|
3974
|
-
const loadReplyResolverRuntime = createLazyRuntimeModule(() => import("./reply-resolver.runtime-Ded8D58Y.js"));
|
|
3975
|
-
function resolveWebMonitorConfigSnapshot(params) {
|
|
3976
|
-
const account = resolveWhatsAppAccount({
|
|
3977
|
-
cfg: params.cfg,
|
|
3978
|
-
accountId: params.accountId
|
|
3979
|
-
});
|
|
3980
|
-
return {
|
|
3981
|
-
cfg: {
|
|
3982
|
-
...params.cfg,
|
|
3983
|
-
channels: {
|
|
3984
|
-
...params.cfg.channels,
|
|
3985
|
-
whatsapp: {
|
|
3986
|
-
...params.cfg.channels?.whatsapp,
|
|
3987
|
-
responsePrefix: account.messagePrefix,
|
|
3988
|
-
allowFrom: account.allowFrom,
|
|
3989
|
-
groupAllowFrom: account.groupAllowFrom,
|
|
3990
|
-
groupPolicy: account.groupPolicy,
|
|
3991
|
-
textChunkLimit: account.textChunkLimit,
|
|
3992
|
-
streaming: account.streaming,
|
|
3993
|
-
mediaMaxMb: account.mediaMaxMb,
|
|
3994
|
-
groups: account.groups
|
|
3995
|
-
}
|
|
3996
|
-
}
|
|
3997
|
-
},
|
|
3998
|
-
account
|
|
3999
|
-
};
|
|
4000
|
-
}
|
|
4001
|
-
function normalizeReconnectAccountId(accountId) {
|
|
4002
|
-
return (accountId ?? "").trim() || "default";
|
|
4003
|
-
}
|
|
4004
|
-
function isNoListenerReconnectError(lastError) {
|
|
4005
|
-
return typeof lastError === "string" && /No active WhatsApp Web listener/i.test(lastError);
|
|
4006
|
-
}
|
|
4007
|
-
function resolveExplicitWhatsAppDebounceOverride(params) {
|
|
4008
|
-
const channel = params.sourceCfg?.channels?.whatsapp;
|
|
4009
|
-
if (!channel) return;
|
|
4010
|
-
const accountId = normalizeReconnectAccountId(params.accountId);
|
|
4011
|
-
const accountDebounce = resolveAccountEntry(channel.accounts, accountId)?.debounceMs;
|
|
4012
|
-
if (accountDebounce !== void 0) return accountDebounce;
|
|
4013
|
-
if (accountId !== "default") {
|
|
4014
|
-
const defaultAccountDebounce = resolveAccountEntry(channel.accounts, "default")?.debounceMs;
|
|
4015
|
-
if (defaultAccountDebounce !== void 0) return defaultAccountDebounce;
|
|
4016
|
-
}
|
|
4017
|
-
return channel.debounceMs;
|
|
4018
|
-
}
|
|
4019
|
-
function isRetryableAuthUnstableError(error) {
|
|
4020
|
-
return error instanceof WhatsAppAuthUnstableError || typeof error === "object" && error !== null && "code" in error && error.code === "whatsapp-auth-unstable";
|
|
4021
|
-
}
|
|
4022
|
-
const DEFAULT_TRANSPORT_TIMEOUT_MS = 300 * 1e3;
|
|
4023
|
-
const WHATSAPP_RECONNECT_CATCH_UP_MAX_MS = 20 * 6e4;
|
|
4024
|
-
async function monitorWebChannel(verbose, listenerFactory = attachWebInboxToSocket, keepAlive = true, replyResolver, runtime = defaultRuntime, abortSignal, tuning = {}) {
|
|
4025
|
-
const activeReplyResolver = replyResolver ?? (await loadReplyResolverRuntime()).getReplyFromConfig;
|
|
4026
|
-
const runId = newConnectionId();
|
|
4027
|
-
const replyLogger = getChildLogger$1({
|
|
4028
|
-
module: "web-auto-reply",
|
|
4029
|
-
runId
|
|
4030
|
-
});
|
|
4031
|
-
const heartbeatLogger = getChildLogger$1({
|
|
4032
|
-
module: "web-heartbeat",
|
|
4033
|
-
runId
|
|
4034
|
-
});
|
|
4035
|
-
const reconnectLogger = getChildLogger$1({
|
|
4036
|
-
module: "web-reconnect",
|
|
4037
|
-
runId
|
|
4038
|
-
});
|
|
4039
|
-
const baseCfg = getRuntimeConfig$1();
|
|
4040
|
-
const sourceCfg = getRuntimeConfigSourceSnapshot();
|
|
4041
|
-
const { cfg, account } = resolveWebMonitorConfigSnapshot({
|
|
4042
|
-
cfg: baseCfg,
|
|
4043
|
-
accountId: tuning.accountId
|
|
4044
|
-
});
|
|
4045
|
-
const loadCurrentMonitorConfig = () => resolveWebMonitorConfigSnapshot({
|
|
4046
|
-
cfg: getRuntimeConfig$1(),
|
|
4047
|
-
accountId: account.accountId
|
|
4048
|
-
}).cfg;
|
|
4049
|
-
const maxMediaBytes = resolveWhatsAppMediaMaxBytes(account);
|
|
4050
|
-
const heartbeatSeconds = resolveHeartbeatSeconds(cfg, tuning.heartbeatSeconds);
|
|
4051
|
-
const reconnectPolicy = resolveReconnectPolicy(cfg, tuning.reconnect);
|
|
4052
|
-
const socketTiming = resolveWhatsAppSocketTiming(tuning.socketTiming);
|
|
4053
|
-
const baseMentionConfig = buildMentionConfig(cfg);
|
|
4054
|
-
const groupHistoryLimit = account.historyLimit ?? cfg.channels?.whatsapp?.historyLimit ?? cfg.messages?.groupChat?.historyLimit ?? DEFAULT_GROUP_HISTORY_LIMIT;
|
|
4055
|
-
const groupHistories = /* @__PURE__ */ new Map();
|
|
4056
|
-
const groupMemberNames = /* @__PURE__ */ new Map();
|
|
4057
|
-
const groupMetadataCache = /* @__PURE__ */ new Map();
|
|
4058
|
-
const recentMessageKeys = /* @__PURE__ */ new Map();
|
|
4059
|
-
const baileysGroupMetaCache = /* @__PURE__ */ new Map();
|
|
4060
|
-
const echoTracker = createEchoTracker({
|
|
4061
|
-
maxItems: 100,
|
|
4062
|
-
logVerbose
|
|
4063
|
-
});
|
|
4064
|
-
const sleep = tuning.sleep ?? ((ms, signal) => sleepWithAbort(ms, signal ?? abortSignal));
|
|
4065
|
-
const stopRequested = () => abortSignal?.aborted === true;
|
|
4066
|
-
const currentMaxListeners = process.getMaxListeners?.() ?? 10;
|
|
4067
|
-
if (process.setMaxListeners && currentMaxListeners < 50) process.setMaxListeners(50);
|
|
4068
|
-
let sigintStop = false;
|
|
4069
|
-
const handleSigint = () => {
|
|
4070
|
-
sigintStop = true;
|
|
4071
|
-
};
|
|
4072
|
-
process.once("SIGINT", handleSigint);
|
|
4073
|
-
const transportTimeoutMs = tuning.transportTimeoutMs ?? DEFAULT_TRANSPORT_TIMEOUT_MS;
|
|
4074
|
-
const messageTimeoutMs = tuning.messageTimeoutMs ?? 1800 * 1e3;
|
|
4075
|
-
const reconnectCatchUpWindowMs = Math.min(Math.max(messageTimeoutMs, 6e4), WHATSAPP_RECONNECT_CATCH_UP_MAX_MS);
|
|
4076
|
-
const watchdogCheckMs = tuning.watchdogCheckMs ?? 60 * 1e3;
|
|
4077
|
-
const controller = new WhatsAppConnectionController({
|
|
4078
|
-
accountId: account.accountId,
|
|
4079
|
-
authDir: account.authDir,
|
|
4080
|
-
verbose,
|
|
4081
|
-
keepAlive,
|
|
4082
|
-
heartbeatSeconds,
|
|
4083
|
-
transportTimeoutMs,
|
|
4084
|
-
messageTimeoutMs,
|
|
4085
|
-
watchdogCheckMs,
|
|
4086
|
-
reconnectPolicy,
|
|
4087
|
-
socketTiming,
|
|
4088
|
-
abortSignal,
|
|
4089
|
-
sleep,
|
|
4090
|
-
isNonRetryableStatus: isNonRetryableWebCloseStatus
|
|
4091
|
-
});
|
|
4092
|
-
const statusController = createWebChannelStatusController(tuning.statusSink);
|
|
4093
|
-
statusController.emit();
|
|
4094
|
-
try {
|
|
4095
|
-
while (true) {
|
|
4096
|
-
if (stopRequested()) break;
|
|
4097
|
-
const connectionId = newConnectionId();
|
|
4098
|
-
const inboundDebounceMs = resolveInboundDebounceMs({
|
|
4099
|
-
cfg,
|
|
4100
|
-
channel: "whatsapp",
|
|
4101
|
-
overrideMs: resolveExplicitWhatsAppDebounceOverride({
|
|
4102
|
-
cfg,
|
|
4103
|
-
sourceCfg,
|
|
4104
|
-
accountId: account.accountId
|
|
4105
|
-
})
|
|
4106
|
-
});
|
|
4107
|
-
const shouldDebounce = (msg) => {
|
|
4108
|
-
const normalized = normalizeWebInboundMessage(msg);
|
|
4109
|
-
return shouldDebounceTextInbound({
|
|
4110
|
-
text: normalized.payload.commandBody ?? normalized.payload.body,
|
|
4111
|
-
cfg,
|
|
4112
|
-
hasMedia: Boolean(normalized.payload.media?.path || normalized.payload.media?.type),
|
|
4113
|
-
allowDebounce: !(normalized.payload.location || normalized.quote?.id || normalized.quote?.body)
|
|
4114
|
-
});
|
|
4115
|
-
};
|
|
4116
|
-
let connection;
|
|
4117
|
-
try {
|
|
4118
|
-
connection = await controller.openConnection({
|
|
4119
|
-
connectionId,
|
|
4120
|
-
getMessage: async (key) => key.id && key.remoteJid ? readWhatsAppBaileysCacheEntry(recentMessageKeys, `${key.remoteJid}:${key.id}`) : void 0,
|
|
4121
|
-
cachedGroupMetadata: async (jid) => {
|
|
4122
|
-
const meta = readWhatsAppBaileysCacheEntry(baileysGroupMetaCache, jid);
|
|
4123
|
-
return meta?.participants?.length ? meta : void 0;
|
|
4124
|
-
},
|
|
4125
|
-
createListener: async ({ sock, connection: connectionLocal }) => {
|
|
4126
|
-
const onMessage = createWebOnMessageHandler({
|
|
4127
|
-
cfg,
|
|
4128
|
-
loadConfig: loadCurrentMonitorConfig,
|
|
4129
|
-
verbose,
|
|
4130
|
-
connectionId,
|
|
4131
|
-
maxMediaBytes,
|
|
4132
|
-
groupHistoryLimit,
|
|
4133
|
-
groupHistories,
|
|
4134
|
-
groupMemberNames,
|
|
4135
|
-
echoTracker,
|
|
4136
|
-
backgroundTasks: connectionLocal.backgroundTasks,
|
|
4137
|
-
replyResolver: activeReplyResolver,
|
|
4138
|
-
replyLogger,
|
|
4139
|
-
baseMentionConfig,
|
|
4140
|
-
account
|
|
4141
|
-
});
|
|
4142
|
-
return await (listenerFactory ?? attachWebInboxToSocket)({
|
|
4143
|
-
cfg,
|
|
4144
|
-
loadConfig: loadCurrentMonitorConfig,
|
|
4145
|
-
verbose,
|
|
4146
|
-
accountId: account.accountId,
|
|
4147
|
-
authDir: account.authDir,
|
|
4148
|
-
mediaMaxMb: account.mediaMaxMb,
|
|
4149
|
-
selfChatMode: account.selfChatMode,
|
|
4150
|
-
sendReadReceipts: account.sendReadReceipts,
|
|
4151
|
-
socketTiming,
|
|
4152
|
-
debounceMs: inboundDebounceMs,
|
|
4153
|
-
appendReplyWindow: connectionLocal.openedAfterRecentInbound ? {
|
|
4154
|
-
afterMs: connectionLocal.startedAt - reconnectCatchUpWindowMs,
|
|
4155
|
-
untilMs: connectionLocal.startedAt + reconnectCatchUpWindowMs,
|
|
4156
|
-
maxAgeMs: reconnectCatchUpWindowMs
|
|
4157
|
-
} : void 0,
|
|
4158
|
-
shouldDebounce,
|
|
4159
|
-
socketRef: controller.socketRef,
|
|
4160
|
-
shouldRetryDisconnect: () => !sigintStop && controller.shouldRetryDisconnect(),
|
|
4161
|
-
disconnectRetryPolicy: reconnectPolicy,
|
|
4162
|
-
disconnectRetryAbortSignal: controller.getDisconnectRetryAbortSignal(),
|
|
4163
|
-
groupMetadataCache,
|
|
4164
|
-
recentMessageKeys,
|
|
4165
|
-
baileysGroupMetaCache,
|
|
4166
|
-
onMessage: async (msg) => {
|
|
4167
|
-
const normalized = normalizeWebInboundMessage(msg);
|
|
4168
|
-
const inboundAt = Date.now();
|
|
4169
|
-
controller.noteInbound(inboundAt);
|
|
4170
|
-
statusController.noteInbound(inboundAt);
|
|
4171
|
-
await onMessage(normalized);
|
|
4172
|
-
},
|
|
4173
|
-
onPendingWorkChanged: (pendingWorkCount, at) => {
|
|
4174
|
-
statusController.noteBusy(pendingWorkCount > 0, at);
|
|
4175
|
-
},
|
|
4176
|
-
sock
|
|
4177
|
-
});
|
|
4178
|
-
},
|
|
4179
|
-
onHeartbeat: (snapshot) => {
|
|
4180
|
-
const authAgeMs = getWebAuthAgeMs(account.authDir);
|
|
4181
|
-
const minutesSinceLastMessage = snapshot.lastInboundAt ? Math.floor((Date.now() - snapshot.lastInboundAt) / 6e4) : null;
|
|
4182
|
-
const logData = {
|
|
4183
|
-
connectionId: snapshot.connectionId,
|
|
4184
|
-
reconnectAttempts: snapshot.reconnectAttempts,
|
|
4185
|
-
messagesHandled: snapshot.handledMessages,
|
|
4186
|
-
lastInboundAt: snapshot.lastInboundAt,
|
|
4187
|
-
lastTransportActivityAt: snapshot.lastTransportActivityAt,
|
|
4188
|
-
authAgeMs,
|
|
4189
|
-
uptimeMs: snapshot.uptimeMs,
|
|
4190
|
-
...minutesSinceLastMessage !== null && minutesSinceLastMessage > 30 ? { minutesSinceLastMessage } : {}
|
|
4191
|
-
};
|
|
4192
|
-
statusController.noteTransportActivity(snapshot.lastTransportActivityAt);
|
|
4193
|
-
if (minutesSinceLastMessage && minutesSinceLastMessage > 30) heartbeatLogger.warn(logData, "⚠️ web gateway heartbeat - no messages in 30+ minutes");
|
|
4194
|
-
else heartbeatLogger.info(logData, "web gateway heartbeat");
|
|
4195
|
-
},
|
|
4196
|
-
onWatchdogTimeout: (snapshot) => {
|
|
4197
|
-
const now = Date.now();
|
|
4198
|
-
const transportSilentMs = now - snapshot.lastTransportActivityAt;
|
|
4199
|
-
const appBaselineAt = snapshot.lastInboundAt ?? snapshot.startedAt;
|
|
4200
|
-
const minutesSinceTransportActivity = Math.floor(transportSilentMs / 6e4);
|
|
4201
|
-
const minutesSinceAppActivity = Math.floor((now - appBaselineAt) / 6e4);
|
|
4202
|
-
const watchdogReason = transportSilentMs > transportTimeoutMs ? "transport-inactive" : "app-silent";
|
|
4203
|
-
statusController.noteWatchdogStale();
|
|
4204
|
-
heartbeatLogger.warn({
|
|
4205
|
-
connectionId: snapshot.connectionId,
|
|
4206
|
-
watchdogReason,
|
|
4207
|
-
minutesSinceTransportActivity,
|
|
4208
|
-
minutesSinceAppActivity,
|
|
4209
|
-
lastInboundAt: snapshot.lastInboundAt ? new Date(snapshot.lastInboundAt) : null,
|
|
4210
|
-
lastTransportActivityAt: new Date(snapshot.lastTransportActivityAt),
|
|
4211
|
-
messagesHandled: snapshot.handledMessages
|
|
4212
|
-
}, "WhatsApp watchdog timeout detected - forcing reconnect");
|
|
4213
|
-
whatsappHeartbeatLog.warn(`WhatsApp watchdog timeout (${watchdogReason}) - restarting connection`);
|
|
4214
|
-
}
|
|
4215
|
-
});
|
|
4216
|
-
} catch (error) {
|
|
4217
|
-
const setupDecision = controller.resolveSetupErrorDecision(error);
|
|
4218
|
-
if (setupDecision === "aborted") {
|
|
4219
|
-
await controller.shutdown();
|
|
4220
|
-
break;
|
|
4221
|
-
}
|
|
4222
|
-
if (setupDecision) {
|
|
4223
|
-
statusController.noteReconnectAttempts(setupDecision.reconnectAttempts);
|
|
4224
|
-
statusController.noteClose({
|
|
4225
|
-
statusCode: setupDecision.normalized.statusCode,
|
|
4226
|
-
error: formatError(error),
|
|
4227
|
-
reconnectAttempts: setupDecision.reconnectAttempts,
|
|
4228
|
-
healthState: setupDecision.healthState
|
|
4229
|
-
});
|
|
4230
|
-
if (setupDecision.action === "stop") {
|
|
4231
|
-
reconnectLogger.warn({
|
|
4232
|
-
connectionId,
|
|
4233
|
-
status: setupDecision.normalized.statusLabel,
|
|
4234
|
-
reconnectAttempts: setupDecision.reconnectAttempts,
|
|
4235
|
-
maxAttempts: reconnectPolicy.maxAttempts
|
|
4236
|
-
}, "web reconnect: setup status error; max attempts reached");
|
|
4237
|
-
if (setupDecision.healthState === "logged-out") runtime.error(`WhatsApp session logged out during setup. Run \`${formatCliCommand("openclaw channels login --channel whatsapp")}\` to relink.`);
|
|
4238
|
-
else if (setupDecision.healthState === "conflict") runtime.error(`WhatsApp Web connection closed during setup (status ${setupDecision.normalized.statusLabel}: session conflict). Resolve conflicting WhatsApp Web sessions, then restart the channel. To force a fresh QR, run \`${formatCliCommand("openclaw channels logout --channel whatsapp")}\` before \`${formatCliCommand("openclaw channels login --channel whatsapp")}\`. Stopping web monitoring.`);
|
|
4239
|
-
else runtime.error(`WhatsApp Web connection closed during setup (status ${setupDecision.normalized.statusLabel}) after ${setupDecision.reconnectAttempts}/${reconnectPolicy.maxAttempts} attempts. Relink with \`${formatCliCommand("openclaw channels login --channel whatsapp")}\` if the issue persists.`);
|
|
4240
|
-
await controller.shutdown();
|
|
4241
|
-
break;
|
|
4242
|
-
}
|
|
4243
|
-
reconnectLogger.info({
|
|
4244
|
-
connectionId,
|
|
4245
|
-
status: setupDecision.normalized.statusLabel,
|
|
4246
|
-
reconnectAttempts: setupDecision.reconnectAttempts,
|
|
4247
|
-
delayMs: setupDecision.delayMs
|
|
4248
|
-
}, "web reconnect: setup status error; retrying");
|
|
4249
|
-
runtime.error(`WhatsApp Web connection closed during setup (status ${setupDecision.normalized.statusLabel}). Retry ${setupDecision.reconnectAttempts}/${reconnectPolicy.maxAttempts || "∞"} in ${formatDurationPrecise(setupDecision.delayMs ?? 0)}.`);
|
|
4250
|
-
try {
|
|
4251
|
-
await controller.waitBeforeRetry(setupDecision.delayMs ?? 0);
|
|
4252
|
-
} catch {
|
|
4253
|
-
break;
|
|
4254
|
-
}
|
|
4255
|
-
continue;
|
|
4256
|
-
}
|
|
4257
|
-
if (!isRetryableAuthUnstableError(error)) throw error;
|
|
4258
|
-
const retryDecision = controller.consumeReconnectAttempt();
|
|
4259
|
-
statusController.noteReconnectAttempts(retryDecision.reconnectAttempts);
|
|
4260
|
-
statusController.noteClose({
|
|
4261
|
-
error: error.message,
|
|
4262
|
-
reconnectAttempts: retryDecision.reconnectAttempts,
|
|
4263
|
-
healthState: retryDecision.healthState
|
|
4264
|
-
});
|
|
4265
|
-
if (retryDecision.action === "stop") {
|
|
4266
|
-
reconnectLogger.warn({
|
|
4267
|
-
connectionId,
|
|
4268
|
-
reconnectAttempts: retryDecision.reconnectAttempts,
|
|
4269
|
-
maxAttempts: reconnectPolicy.maxAttempts
|
|
4270
|
-
}, "web reconnect: auth state stayed unstable; max attempts reached");
|
|
4271
|
-
runtime.error(`WhatsApp auth state is still stabilizing after ${retryDecision.reconnectAttempts}/${reconnectPolicy.maxAttempts} attempts. Stopping web monitoring.`);
|
|
4272
|
-
await controller.shutdown();
|
|
4273
|
-
break;
|
|
4274
|
-
}
|
|
4275
|
-
reconnectLogger.info({
|
|
4276
|
-
connectionId,
|
|
4277
|
-
reconnectAttempts: retryDecision.reconnectAttempts,
|
|
4278
|
-
delayMs: retryDecision.delayMs
|
|
4279
|
-
}, "web reconnect: auth state still stabilizing during inbox attach; retrying");
|
|
4280
|
-
runtime.error(`WhatsApp auth state is still stabilizing. Retry ${retryDecision.reconnectAttempts}/${reconnectPolicy.maxAttempts || "∞"} for inbox attach in ${formatDurationPrecise(retryDecision.delayMs ?? 0)}.`);
|
|
4281
|
-
try {
|
|
4282
|
-
await controller.waitBeforeRetry(retryDecision.delayMs ?? 0);
|
|
4283
|
-
} catch {
|
|
4284
|
-
break;
|
|
4285
|
-
}
|
|
4286
|
-
continue;
|
|
4287
|
-
}
|
|
4288
|
-
statusController.noteConnected();
|
|
4289
|
-
const approvalContextLease = registerChannelRuntimeContext({
|
|
4290
|
-
channelRuntime: tuning.channelRuntime,
|
|
4291
|
-
channelId: "whatsapp",
|
|
4292
|
-
accountId: account.accountId,
|
|
4293
|
-
capability: CHANNEL_APPROVAL_NATIVE_RUNTIME_CONTEXT_CAPABILITY,
|
|
4294
|
-
context: { accountId: account.accountId },
|
|
4295
|
-
abortSignal
|
|
4296
|
-
});
|
|
4297
|
-
controller.setUnhandledRejectionCleanup(registerUnhandledRejectionHandler((reason) => {
|
|
4298
|
-
if (!isLikelyWhatsAppCryptoError(reason)) return false;
|
|
4299
|
-
const errorStr = formatError(reason);
|
|
4300
|
-
reconnectLogger.warn({
|
|
4301
|
-
connectionId: connection.connectionId,
|
|
4302
|
-
error: errorStr
|
|
4303
|
-
}, "web reconnect: unhandled rejection from WhatsApp socket; forcing reconnect");
|
|
4304
|
-
controller.forceClose({
|
|
4305
|
-
status: 499,
|
|
4306
|
-
isLoggedOut: false,
|
|
4307
|
-
error: reason
|
|
4308
|
-
});
|
|
4309
|
-
return true;
|
|
4310
|
-
}));
|
|
4311
|
-
const { e164: selfE164 } = readWebSelfId(account.authDir);
|
|
4312
|
-
const connectRoute = resolveAgentRoute({
|
|
4313
|
-
cfg,
|
|
4314
|
-
channel: "whatsapp",
|
|
4315
|
-
accountId: account.accountId
|
|
4316
|
-
});
|
|
4317
|
-
enqueueSystemEvent(`WhatsApp gateway connected${selfE164 ? ` as ${selfE164}` : ""}.`, { sessionKey: connectRoute.sessionKey });
|
|
4318
|
-
const normalizedAccountId = normalizeReconnectAccountId(account.accountId);
|
|
4319
|
-
drainPendingDeliveries({
|
|
4320
|
-
drainKey: `whatsapp:${normalizedAccountId}`,
|
|
4321
|
-
logLabel: "WhatsApp reconnect drain",
|
|
4322
|
-
cfg,
|
|
4323
|
-
log: reconnectLogger,
|
|
4324
|
-
selectEntry: (entry) => ({
|
|
4325
|
-
match: entry.channel === "whatsapp" && normalizeReconnectAccountId(entry.accountId) === normalizedAccountId,
|
|
4326
|
-
bypassBackoff: isNoListenerReconnectError(entry.lastError)
|
|
4327
|
-
})
|
|
4328
|
-
}).catch((err) => {
|
|
4329
|
-
reconnectLogger.warn({
|
|
4330
|
-
connectionId: connection.connectionId,
|
|
4331
|
-
error: String(err)
|
|
4332
|
-
}, "reconnect drain failed");
|
|
4333
|
-
});
|
|
4334
|
-
const periodicDrainInterval = setInterval(() => {
|
|
4335
|
-
drainPendingDeliveries({
|
|
4336
|
-
drainKey: `whatsapp:${normalizedAccountId}`,
|
|
4337
|
-
logLabel: "WhatsApp periodic drain",
|
|
4338
|
-
cfg,
|
|
4339
|
-
log: reconnectLogger,
|
|
4340
|
-
selectEntry: (entry) => ({
|
|
4341
|
-
match: entry.channel === "whatsapp" && normalizeReconnectAccountId(entry.accountId) === normalizedAccountId,
|
|
4342
|
-
bypassBackoff: false
|
|
4343
|
-
})
|
|
4344
|
-
}).catch((err) => {
|
|
4345
|
-
reconnectLogger.warn({
|
|
4346
|
-
connectionId: connection.connectionId,
|
|
4347
|
-
error: String(err)
|
|
4348
|
-
}, "periodic drain failed");
|
|
4349
|
-
});
|
|
4350
|
-
}, 3e4);
|
|
4351
|
-
const inboundPolicy = resolveWhatsAppInboundPolicy({
|
|
4352
|
-
cfg,
|
|
4353
|
-
accountId: account.accountId,
|
|
4354
|
-
selfE164: selfE164 ?? null
|
|
4355
|
-
});
|
|
4356
|
-
whatsappLog.info(formatWhatsAppInboundListeningLog({
|
|
4357
|
-
groups: inboundPolicy.account.groups,
|
|
4358
|
-
groupPolicy: inboundPolicy.groupPolicy,
|
|
4359
|
-
hasGroupAllowFrom: inboundPolicy.groupAllowFrom.length > 0
|
|
4360
|
-
}));
|
|
4361
|
-
if (process.stdout.isTTY || process.stderr.isTTY) whatsappLog.raw("Ctrl+C to stop.");
|
|
4362
|
-
if (!keepAlive) {
|
|
4363
|
-
clearInterval(periodicDrainInterval);
|
|
4364
|
-
approvalContextLease?.dispose();
|
|
4365
|
-
await controller.shutdown();
|
|
4366
|
-
return;
|
|
4367
|
-
}
|
|
4368
|
-
const reason = await controller.waitForClose().finally(() => {
|
|
4369
|
-
clearInterval(periodicDrainInterval);
|
|
4370
|
-
approvalContextLease?.dispose();
|
|
4371
|
-
});
|
|
4372
|
-
if (stopRequested() || sigintStop || reason === "aborted") {
|
|
4373
|
-
await controller.shutdown();
|
|
4374
|
-
break;
|
|
4375
|
-
}
|
|
4376
|
-
const decision = controller.resolveCloseDecision(reason);
|
|
4377
|
-
if (decision === "aborted") {
|
|
4378
|
-
await controller.shutdown();
|
|
4379
|
-
break;
|
|
4380
|
-
}
|
|
4381
|
-
statusController.noteReconnectAttempts(controller.getReconnectAttempts());
|
|
4382
|
-
reconnectLogger.info({
|
|
4383
|
-
connectionId: connection.connectionId,
|
|
4384
|
-
status: decision.normalized.statusLabel,
|
|
4385
|
-
loggedOut: decision.normalized.isLoggedOut,
|
|
4386
|
-
reconnectAttempts: decision.reconnectAttempts,
|
|
4387
|
-
error: decision.normalized.errorText
|
|
4388
|
-
}, "web reconnect: connection closed");
|
|
4389
|
-
enqueueSystemEvent(`WhatsApp gateway disconnected (status ${decision.normalized.statusLabel})`, { sessionKey: connectRoute.sessionKey });
|
|
4390
|
-
if (decision.action === "stop") {
|
|
4391
|
-
await controller.closeCurrentConnection();
|
|
4392
|
-
statusController.noteClose({
|
|
4393
|
-
statusCode: decision.normalized.statusCode,
|
|
4394
|
-
loggedOut: decision.normalized.isLoggedOut,
|
|
4395
|
-
error: decision.normalized.errorText,
|
|
4396
|
-
reconnectAttempts: decision.reconnectAttempts,
|
|
4397
|
-
healthState: decision.healthState
|
|
4398
|
-
});
|
|
4399
|
-
if (decision.healthState === "logged-out") runtime.error(`WhatsApp session logged out. Run \`${formatCliCommand("openclaw channels login --channel whatsapp")}\` to relink.`);
|
|
4400
|
-
else if (decision.healthState === "conflict") {
|
|
4401
|
-
reconnectLogger.warn({
|
|
4402
|
-
connectionId: connection.connectionId,
|
|
4403
|
-
status: decision.normalized.statusLabel,
|
|
4404
|
-
error: decision.normalized.errorText
|
|
4405
|
-
}, "web reconnect: non-retryable close status; stopping monitor");
|
|
4406
|
-
runtime.error(`WhatsApp Web connection closed (status ${decision.normalized.statusLabel}: session conflict). Resolve conflicting WhatsApp Web sessions, then restart the channel. To force a fresh QR, run \`${formatCliCommand("openclaw channels logout --channel whatsapp")}\` before \`${formatCliCommand("openclaw channels login --channel whatsapp")}\`. Stopping web monitoring.`);
|
|
4407
|
-
} else {
|
|
4408
|
-
reconnectLogger.warn({
|
|
4409
|
-
connectionId: connection.connectionId,
|
|
4410
|
-
status: decision.normalized.statusLabel,
|
|
4411
|
-
reconnectAttempts: decision.reconnectAttempts,
|
|
4412
|
-
maxAttempts: reconnectPolicy.maxAttempts
|
|
4413
|
-
}, "web reconnect: max attempts reached; continuing in degraded mode");
|
|
4414
|
-
runtime.error(`WhatsApp Web reconnect: max attempts reached (${decision.reconnectAttempts}/${reconnectPolicy.maxAttempts}). Stopping web monitoring.`);
|
|
4415
|
-
}
|
|
4416
|
-
await controller.shutdown();
|
|
4417
|
-
break;
|
|
4418
|
-
}
|
|
4419
|
-
const isWatchdogRecoveryReconnect = decision.normalized.error === WHATSAPP_WATCHDOG_TIMEOUT_ERROR;
|
|
4420
|
-
statusController.noteClose({
|
|
4421
|
-
statusCode: decision.normalized.statusCode,
|
|
4422
|
-
error: decision.normalized.errorText,
|
|
4423
|
-
reconnectAttempts: decision.reconnectAttempts,
|
|
4424
|
-
healthState: decision.healthState,
|
|
4425
|
-
watchdogRecovery: isWatchdogRecoveryReconnect
|
|
4426
|
-
});
|
|
4427
|
-
reconnectLogger.info({
|
|
4428
|
-
connectionId: connection.connectionId,
|
|
4429
|
-
status: decision.normalized.statusLabel,
|
|
4430
|
-
reconnectAttempts: decision.reconnectAttempts,
|
|
4431
|
-
maxAttempts: reconnectPolicy.maxAttempts || "unlimited",
|
|
4432
|
-
delayMs: decision.delayMs
|
|
4433
|
-
}, "web reconnect: scheduling retry");
|
|
4434
|
-
const reconnectMessage = isWatchdogRecoveryReconnect ? `WhatsApp Web watchdog is recovering a stale connection (status ${decision.normalized.statusLabel}). Retry ${decision.reconnectAttempts}/${reconnectPolicy.maxAttempts || "∞"} in ${formatDurationPrecise(decision.delayMs ?? 0)}.` : `WhatsApp Web connection closed (status ${decision.normalized.statusLabel}). Retry ${decision.reconnectAttempts}/${reconnectPolicy.maxAttempts || "∞"} in ${formatDurationPrecise(decision.delayMs ?? 0)}… (${decision.normalized.errorText})`;
|
|
4435
|
-
if (isWatchdogRecoveryReconnect) runtime.log(warn(reconnectMessage));
|
|
4436
|
-
else runtime.error(reconnectMessage);
|
|
4437
|
-
await controller.closeCurrentConnection();
|
|
4438
|
-
try {
|
|
4439
|
-
await controller.waitBeforeRetry(decision.delayMs ?? 0);
|
|
4440
|
-
} catch {
|
|
4441
|
-
break;
|
|
4442
|
-
}
|
|
4443
|
-
}
|
|
4444
|
-
} finally {
|
|
4445
|
-
statusController.markStopped();
|
|
4446
|
-
process.removeListener("SIGINT", handleSigint);
|
|
4447
|
-
await controller.shutdown();
|
|
4448
|
-
}
|
|
4449
|
-
}
|
|
4450
|
-
//#endregion
|
|
4451
|
-
export { loadWebMediaRaw as a, monitorWebInbox as c, loadWebMedia as i, resetWebInboundDedupe as l, LocalMediaAccessError as n, optimizeImageToJpeg as o, getDefaultLocalRoots as r, optimizeImageToPng as s, monitorWebChannel as t };
|