@openclaw/whatsapp 2026.7.2-beta.7 → 2026.7.34
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 → .setup/access-control-C0jumQuO.mjs} +5 -4
- package/dist/.setup/account-config-6PTOSfaI.mjs +47 -0
- package/dist/{accounts-CSqLvCY5.js → .setup/accounts-Dw16pdNl.mjs} +9 -47
- package/dist/{action-runtime-BzfDFPbH.js → .setup/action-runtime-DLK_9v4r.mjs} +3 -3
- package/dist/{active-listener-BEjWsCNM.js → .setup/active-listener-CloPBx0S.mjs} +3 -3
- package/dist/{agent-tools-login-DE9MU98T.js → .setup/agent-tools-login-DINqgaYo.mjs} +19 -7
- package/dist/{approval-handler.runtime-DrA59QSA.js → .setup/approval-handler.runtime-DtJZbu3y.mjs} +14 -20
- package/dist/{approval-resolver-DoeBBt22.js → .setup/approval-resolver-DF-lu8k5.mjs} +1 -2
- package/dist/{auth-store-DcEpIOmE.js → .setup/auth-store-BZKGa0tW.mjs} +25 -29
- package/dist/{channel-Dg62olhy.js → .setup/channel-9WGjBznd.mjs} +117 -132
- package/dist/{channel-react-action-J_YtyMGX.js → .setup/channel-react-action-mvIbAFhn.mjs} +15 -12
- package/dist/{channel.runtime-BP0xNmLi.js → .setup/channel.runtime-DmmMgRJQ.mjs} +6 -6
- package/dist/.setup/channel.setup-ByBYSeLd.mjs +22 -0
- package/dist/.setup/config-schema-mBX2nmn1.mjs +47 -0
- package/dist/{connection-controller-BOB2MVKY.js → .setup/connection-controller-Dt62u6fI.mjs} +29 -226
- package/dist/.setup/connection-controller-registry-TSX_udJp.mjs +22 -0
- package/dist/{constants-HU41RHGI.js → .setup/constants-C7m81BNe.mjs} +1 -1
- package/dist/.setup/directory-config-B7Obxrq2.mjs +37 -0
- package/dist/.setup/doctor-By3SB4lm.mjs +48 -0
- package/dist/{group-session-key-DVMZlO3x.js → .setup/group-session-key-CEwPRRRK.mjs} +5 -38
- package/dist/{identity-CPrT5aEU.js → .setup/identity-CDB1bT-p.mjs} +2 -2
- package/dist/.setup/legacy-session-surface-api-B2szjq4r.mjs +2 -0
- package/dist/.setup/legacy-state-migrations-api-DXCxufZz.mjs +3 -0
- package/dist/{login-CvY2Dhch.js → .setup/login-7b3M0iBp.mjs} +12 -51
- package/dist/{login-qr-Bncpb6js.js → .setup/login-qr-CbyA4QX5.mjs} +47 -23
- package/dist/{monitor-CfkaUSL2.js → .setup/monitor-Dh6Di_YO.mjs} +1451 -1843
- package/dist/.setup/normalize-eddWWsNV.mjs +2 -0
- package/dist/{normalize-target-CugRyONv.js → .setup/normalize-target-bVWjgftN.mjs} +10 -18
- package/dist/{resolve-outbound-target-1GqbT1uX.js → .setup/resolve-outbound-target-oI7VpU4w.mjs} +1 -1
- package/dist/.setup/runtime-BfAdAEYT.mjs +8 -0
- package/dist/.setup/send-BQjMC41n.mjs +777 -0
- package/dist/{send-api-7wk6eQyW.js → .setup/send-api-BiAkPLr3.mjs} +155 -105
- package/dist/{session-errors-JuazczrA.js → .setup/session-errors-BAj9D2La.mjs} +1 -2
- package/dist/.setup/session-vUI41Jel.mjs +252 -0
- package/dist/.setup/session.runtime-B-V3rXP6.mjs +12 -0
- package/dist/{shared-CAxd15bp.js → .setup/setup-core--FfzntMG.mjs} +94 -63
- package/dist/{setup-finalize-BZucx24W.js → .setup/setup-finalize-DCruIciL.mjs} +17 -46
- package/dist/.setup/setup-plugin-api-B6ck_20D.mjs +3 -0
- package/dist/{setup-surface-BkVcd769.js → .setup/setup-surface-Zvj2cLzz.mjs} +4 -4
- package/dist/.setup/socket-timing-DhbVFjah.mjs +77 -0
- package/dist/{state-migrations-CAMTrs2U.js → .setup/state-migrations-D_BmQUR9.mjs} +8 -1
- package/dist/.setup/targets-runtime-C-GiVn6Y.mjs +188 -0
- package/dist/.setup/text-runtime-CUrq1mFq.mjs +4 -0
- package/dist/action-runtime-api.js +1 -1
- package/dist/action-runtime.runtime.js +1 -1
- package/dist/{call-tool-api.js → agent-tools-api.js} +26 -11
- package/dist/api.js +27 -17
- package/dist/auth-presence.js +1 -1
- package/dist/channel-config-api.js +1 -1
- package/dist/channel-plugin-api.js +1 -1
- package/dist/constants.js +2 -0
- package/dist/contract-api.js +5 -5
- package/dist/directory-contract-api.js +1 -1
- package/dist/doctor-contract-api.js +5 -46
- package/dist/index.js +4 -4
- package/dist/legacy-session-surface-api.js +1 -1
- package/dist/legacy-state-migrations-api.js +1 -1
- package/dist/light-runtime-api.js +4 -4
- package/dist/login-qr-runtime.js +1 -1
- package/dist/runtime-api.js +14 -14
- package/dist/runtime-setter-api.js +1 -1
- package/dist/security-contract-api.js +1 -1
- package/dist/setup-entry.js +4 -3
- package/dist/setup-plugin-api.js +1 -1
- package/dist/targets.js +2 -0
- package/node_modules/audio-decode/node_modules/@thi.ng/bitstream/package.json +4 -4
- package/node_modules/audio-decode/node_modules/@thi.ng/errors/package.json +4 -4
- package/node_modules/audio-decode/node_modules/audio-type/package.json +2 -3
- package/node_modules/baileys/node_modules/@protobufjs/aspromise/LICENSE +26 -0
- package/node_modules/baileys/node_modules/@protobufjs/aspromise/README.md +13 -0
- package/node_modules/baileys/node_modules/{protobufjs/src/util/aspromise.d.ts → @protobufjs/aspromise/index.d.ts} +13 -13
- package/node_modules/baileys/node_modules/{protobufjs/src/util/aspromise.js → @protobufjs/aspromise/index.js} +52 -52
- package/node_modules/baileys/node_modules/@protobufjs/aspromise/package.json +21 -0
- package/node_modules/baileys/node_modules/@protobufjs/aspromise/tests/index.js +130 -0
- package/node_modules/baileys/node_modules/@protobufjs/base64/LICENSE +26 -0
- package/node_modules/baileys/node_modules/@protobufjs/base64/README.md +19 -0
- package/node_modules/baileys/node_modules/{protobufjs/src/util/base64.d.ts → @protobufjs/base64/index.d.ts} +32 -32
- package/node_modules/baileys/node_modules/{protobufjs/src/util/base64.js → @protobufjs/base64/index.js} +139 -146
- package/node_modules/baileys/node_modules/@protobufjs/base64/package.json +21 -0
- package/node_modules/baileys/node_modules/@protobufjs/base64/tests/index.js +46 -0
- package/node_modules/baileys/node_modules/@protobufjs/codegen/LICENSE +26 -0
- package/node_modules/baileys/node_modules/@protobufjs/codegen/README.md +49 -0
- package/node_modules/baileys/node_modules/{protobufjs/src/util/codegen.d.ts → @protobufjs/codegen/index.d.ts} +31 -31
- package/node_modules/baileys/node_modules/{protobufjs/src/util/codegen.js → @protobufjs/codegen/index.js} +112 -118
- package/node_modules/baileys/node_modules/@protobufjs/codegen/package.json +13 -0
- package/node_modules/baileys/node_modules/@protobufjs/codegen/tests/index.js +13 -0
- package/node_modules/baileys/node_modules/@protobufjs/eventemitter/CHANGELOG.md +8 -0
- package/node_modules/baileys/node_modules/@protobufjs/eventemitter/LICENSE +26 -0
- package/node_modules/baileys/node_modules/@protobufjs/eventemitter/README.md +22 -0
- package/node_modules/baileys/node_modules/{protobufjs/src/util/eventemitter.d.ts → @protobufjs/eventemitter/index.d.ts} +45 -45
- package/node_modules/baileys/node_modules/{protobufjs/src/util/eventemitter.js → @protobufjs/eventemitter/index.js} +86 -86
- package/node_modules/baileys/node_modules/@protobufjs/eventemitter/package.json +21 -0
- package/node_modules/baileys/node_modules/@protobufjs/eventemitter/tests/index.js +83 -0
- package/node_modules/baileys/node_modules/@protobufjs/fetch/CHANGELOG.md +8 -0
- package/node_modules/baileys/node_modules/@protobufjs/fetch/LICENSE +26 -0
- package/node_modules/baileys/node_modules/@protobufjs/fetch/README.md +13 -0
- package/node_modules/baileys/node_modules/{protobufjs/src/util/fetch.d.ts → @protobufjs/fetch/index.d.ts} +56 -56
- package/node_modules/baileys/node_modules/{protobufjs/src/util/fetch.js → @protobufjs/fetch/index.js} +112 -112
- package/node_modules/baileys/node_modules/@protobufjs/fetch/package.json +27 -0
- package/node_modules/baileys/node_modules/@protobufjs/fetch/tests/data/file.txt +1 -0
- package/node_modules/baileys/node_modules/@protobufjs/fetch/tests/index.js +158 -0
- package/node_modules/baileys/node_modules/@protobufjs/fetch/util/fs.js +11 -0
- package/node_modules/baileys/node_modules/@protobufjs/float/LICENSE +26 -0
- package/node_modules/baileys/node_modules/@protobufjs/float/README.md +102 -0
- package/node_modules/baileys/node_modules/@protobufjs/float/bench/index.js +87 -0
- package/node_modules/baileys/node_modules/@protobufjs/float/bench/suite.js +46 -0
- package/node_modules/baileys/node_modules/{protobufjs/src/util/float.js → @protobufjs/float/index.js} +335 -335
- package/node_modules/baileys/node_modules/@protobufjs/float/package.json +26 -0
- package/node_modules/baileys/node_modules/@protobufjs/float/tests/index.js +100 -0
- package/node_modules/baileys/node_modules/@protobufjs/inquire/CHANGELOG.md +8 -0
- package/node_modules/baileys/node_modules/@protobufjs/inquire/LICENSE +26 -0
- package/node_modules/baileys/node_modules/@protobufjs/inquire/README.md +13 -0
- package/node_modules/baileys/node_modules/@protobufjs/inquire/index.d.ts +10 -0
- package/node_modules/baileys/node_modules/@protobufjs/inquire/index.js +38 -0
- package/node_modules/baileys/node_modules/@protobufjs/inquire/package.json +21 -0
- package/node_modules/baileys/node_modules/@protobufjs/inquire/tests/data/array.js +1 -0
- package/node_modules/baileys/node_modules/@protobufjs/inquire/tests/data/emptyArray.js +1 -0
- package/node_modules/baileys/node_modules/@protobufjs/inquire/tests/data/emptyObject.js +1 -0
- package/node_modules/baileys/node_modules/@protobufjs/inquire/tests/data/object.js +1 -0
- package/node_modules/baileys/node_modules/@protobufjs/inquire/tests/index.js +20 -0
- package/node_modules/baileys/node_modules/@protobufjs/path/LICENSE +26 -0
- package/node_modules/baileys/node_modules/@protobufjs/path/README.md +19 -0
- package/node_modules/baileys/node_modules/{protobufjs/src/util/path.d.ts → @protobufjs/path/index.d.ts} +22 -22
- package/node_modules/baileys/node_modules/{protobufjs/src/util/path.js → @protobufjs/path/index.js} +65 -100
- package/node_modules/baileys/node_modules/@protobufjs/path/package.json +21 -0
- package/node_modules/baileys/node_modules/@protobufjs/path/tests/index.js +60 -0
- package/node_modules/baileys/node_modules/@protobufjs/pool/.npmignore +3 -0
- package/node_modules/baileys/node_modules/@protobufjs/pool/LICENSE +26 -0
- package/node_modules/baileys/node_modules/@protobufjs/pool/README.md +13 -0
- package/node_modules/baileys/node_modules/{protobufjs/src/util/pool.d.ts → @protobufjs/pool/index.d.ts} +32 -32
- package/node_modules/baileys/node_modules/{protobufjs/src/util/pool.js → @protobufjs/pool/index.js} +48 -48
- package/node_modules/baileys/node_modules/@protobufjs/pool/package.json +21 -0
- package/node_modules/baileys/node_modules/@protobufjs/pool/tests/index.js +33 -0
- package/node_modules/baileys/node_modules/@protobufjs/utf8/LICENSE +26 -0
- package/node_modules/baileys/node_modules/@protobufjs/utf8/README.md +20 -0
- package/node_modules/baileys/node_modules/{protobufjs/src/util/utf8.d.ts → @protobufjs/utf8/index.d.ts} +24 -24
- package/node_modules/baileys/node_modules/{protobufjs/src/util/utf8.js → @protobufjs/utf8/index.js} +104 -190
- package/node_modules/baileys/node_modules/@protobufjs/utf8/package.json +21 -0
- package/node_modules/baileys/node_modules/@protobufjs/utf8/tests/data/surrogate_pair_bug.txt +207 -0
- package/node_modules/baileys/node_modules/@protobufjs/utf8/tests/data/utf8.txt +216 -0
- package/node_modules/baileys/node_modules/@protobufjs/utf8/tests/index.js +74 -0
- package/node_modules/baileys/node_modules/@types/node/LICENSE +21 -0
- package/node_modules/baileys/node_modules/@types/node/README.md +15 -0
- package/node_modules/baileys/node_modules/@types/node/assert/strict.d.ts +68 -0
- package/node_modules/baileys/node_modules/@types/node/assert.d.ts +1077 -0
- package/node_modules/baileys/node_modules/@types/node/async_hooks.d.ts +711 -0
- package/node_modules/baileys/node_modules/@types/node/buffer.buffer.d.ts +466 -0
- package/node_modules/baileys/node_modules/@types/node/buffer.d.ts +1799 -0
- package/node_modules/baileys/node_modules/@types/node/child_process.d.ts +1362 -0
- package/node_modules/baileys/node_modules/@types/node/cluster.d.ts +432 -0
- package/node_modules/baileys/node_modules/@types/node/console.d.ts +93 -0
- package/node_modules/baileys/node_modules/@types/node/constants.d.ts +14 -0
- package/node_modules/baileys/node_modules/@types/node/crypto.d.ts +3954 -0
- package/node_modules/baileys/node_modules/@types/node/dgram.d.ts +537 -0
- package/node_modules/baileys/node_modules/@types/node/diagnostics_channel.d.ts +794 -0
- package/node_modules/baileys/node_modules/@types/node/dns/promises.d.ts +497 -0
- package/node_modules/baileys/node_modules/@types/node/dns.d.ts +876 -0
- package/node_modules/baileys/node_modules/@types/node/domain.d.ts +150 -0
- package/node_modules/baileys/node_modules/@types/node/events.d.ts +1008 -0
- package/node_modules/baileys/node_modules/@types/node/ffi.d.ts +486 -0
- package/node_modules/baileys/node_modules/@types/node/fs/promises.d.ts +1471 -0
- package/node_modules/baileys/node_modules/@types/node/fs.d.ts +4786 -0
- package/node_modules/baileys/node_modules/@types/node/globals.d.ts +150 -0
- package/node_modules/baileys/node_modules/@types/node/globals.typedarray.d.ts +101 -0
- package/node_modules/baileys/node_modules/@types/node/http.d.ts +2172 -0
- package/node_modules/baileys/node_modules/@types/node/http2.d.ts +2489 -0
- package/node_modules/baileys/node_modules/@types/node/https.d.ts +400 -0
- package/node_modules/baileys/node_modules/@types/node/index.d.ts +115 -0
- package/node_modules/baileys/node_modules/@types/node/inspector/promises.d.ts +35 -0
- package/node_modules/baileys/node_modules/@types/node/inspector.d.ts +264 -0
- package/node_modules/baileys/node_modules/@types/node/inspector.generated.d.ts +4406 -0
- package/node_modules/baileys/node_modules/@types/node/module.d.ts +726 -0
- package/node_modules/baileys/node_modules/@types/node/net.d.ts +970 -0
- package/node_modules/baileys/node_modules/@types/node/os.d.ts +498 -0
- package/node_modules/baileys/node_modules/@types/node/package.json +155 -0
- package/node_modules/baileys/node_modules/@types/node/path/posix.d.ts +8 -0
- package/node_modules/baileys/node_modules/@types/node/path/win32.d.ts +8 -0
- package/node_modules/baileys/node_modules/@types/node/path.d.ts +178 -0
- package/node_modules/baileys/node_modules/@types/node/perf_hooks.d.ts +604 -0
- package/node_modules/baileys/node_modules/@types/node/process.d.ts +2217 -0
- package/node_modules/baileys/node_modules/@types/node/punycode.d.ts +89 -0
- package/node_modules/baileys/node_modules/@types/node/querystring.d.ts +139 -0
- package/node_modules/baileys/node_modules/@types/node/quic.d.ts +978 -0
- package/node_modules/baileys/node_modules/@types/node/readline/promises.d.ts +158 -0
- package/node_modules/baileys/node_modules/@types/node/readline.d.ts +508 -0
- package/node_modules/baileys/node_modules/@types/node/repl.d.ts +420 -0
- package/node_modules/baileys/node_modules/@types/node/sea.d.ts +47 -0
- package/node_modules/baileys/node_modules/@types/node/sqlite.d.ts +1123 -0
- package/node_modules/baileys/node_modules/@types/node/stream/consumers.d.ts +114 -0
- package/node_modules/baileys/node_modules/@types/node/stream/iter.d.ts +451 -0
- package/node_modules/baileys/node_modules/@types/node/stream/promises.d.ts +211 -0
- package/node_modules/baileys/node_modules/@types/node/stream/web.d.ts +300 -0
- package/node_modules/baileys/node_modules/@types/node/stream.d.ts +1806 -0
- package/node_modules/baileys/node_modules/@types/node/string_decoder.d.ts +27 -0
- package/node_modules/baileys/node_modules/@types/node/test/reporters.d.ts +59 -0
- package/node_modules/baileys/node_modules/@types/node/test.d.ts +2389 -0
- package/node_modules/baileys/node_modules/@types/node/timers/promises.d.ts +93 -0
- package/node_modules/baileys/node_modules/@types/node/timers.d.ts +149 -0
- package/node_modules/baileys/node_modules/@types/node/tls.d.ts +1193 -0
- package/node_modules/baileys/node_modules/@types/node/trace_events.d.ts +103 -0
- package/node_modules/baileys/node_modules/@types/node/ts5.6/buffer.buffer.d.ts +462 -0
- package/node_modules/baileys/node_modules/@types/node/ts5.6/compatibility/float16array.d.ts +71 -0
- package/node_modules/baileys/node_modules/@types/node/ts5.6/globals.typedarray.d.ts +36 -0
- package/node_modules/baileys/node_modules/@types/node/ts5.6/index.d.ts +117 -0
- package/node_modules/baileys/node_modules/@types/node/ts5.7/compatibility/float16array.d.ts +72 -0
- package/node_modules/baileys/node_modules/@types/node/ts5.7/index.d.ts +117 -0
- package/node_modules/baileys/node_modules/@types/node/tty.d.ts +225 -0
- package/node_modules/baileys/node_modules/@types/node/url.d.ts +556 -0
- package/node_modules/baileys/node_modules/@types/node/util/types.d.ts +558 -0
- package/node_modules/baileys/node_modules/@types/node/util.d.ts +1677 -0
- package/node_modules/baileys/node_modules/@types/node/v8.d.ts +1062 -0
- package/node_modules/baileys/node_modules/@types/node/vm.d.ts +1136 -0
- package/node_modules/baileys/node_modules/@types/node/wasi.d.ts +131 -0
- package/node_modules/baileys/node_modules/@types/node/web-globals/abortcontroller.d.ts +59 -0
- package/node_modules/baileys/node_modules/@types/node/web-globals/blob.d.ts +23 -0
- package/node_modules/baileys/node_modules/@types/node/web-globals/console.d.ts +9 -0
- package/node_modules/baileys/node_modules/@types/node/web-globals/crypto.d.ts +39 -0
- package/node_modules/baileys/node_modules/@types/node/web-globals/domexception.d.ts +83 -0
- package/node_modules/baileys/node_modules/@types/node/web-globals/encoding.d.ts +11 -0
- package/node_modules/baileys/node_modules/@types/node/web-globals/events.d.ts +106 -0
- package/node_modules/baileys/node_modules/@types/node/web-globals/fetch.d.ts +69 -0
- package/node_modules/baileys/node_modules/@types/node/web-globals/importmeta.d.ts +13 -0
- package/node_modules/baileys/node_modules/@types/node/web-globals/messaging.d.ts +23 -0
- package/node_modules/baileys/node_modules/@types/node/web-globals/navigator.d.ts +25 -0
- package/node_modules/baileys/node_modules/@types/node/web-globals/performance.d.ts +45 -0
- package/node_modules/baileys/node_modules/@types/node/web-globals/storage.d.ts +24 -0
- package/node_modules/baileys/node_modules/@types/node/web-globals/streams.d.ts +115 -0
- package/node_modules/baileys/node_modules/@types/node/web-globals/timers.d.ts +44 -0
- package/node_modules/baileys/node_modules/@types/node/web-globals/url.d.ts +24 -0
- package/node_modules/baileys/node_modules/@types/node/worker_threads.d.ts +669 -0
- package/node_modules/baileys/node_modules/@types/node/zlib/iter.d.ts +131 -0
- package/node_modules/baileys/node_modules/@types/node/zlib.d.ts +589 -0
- package/node_modules/baileys/node_modules/lru-cache/dist/commonjs/browser/index.d.ts.map +1 -1
- package/node_modules/baileys/node_modules/lru-cache/dist/commonjs/browser/index.js +4 -11
- package/node_modules/baileys/node_modules/lru-cache/dist/commonjs/browser/index.js.map +1 -1
- package/node_modules/baileys/node_modules/lru-cache/dist/commonjs/browser/index.min.js +1 -1
- package/node_modules/baileys/node_modules/lru-cache/dist/commonjs/browser/index.min.js.map +3 -3
- package/node_modules/baileys/node_modules/lru-cache/dist/commonjs/index.d.ts.map +1 -1
- package/node_modules/baileys/node_modules/lru-cache/dist/commonjs/index.js +4 -11
- package/node_modules/baileys/node_modules/lru-cache/dist/commonjs/index.js.map +1 -1
- package/node_modules/baileys/node_modules/lru-cache/dist/commonjs/index.min.js +1 -1
- package/node_modules/baileys/node_modules/lru-cache/dist/commonjs/index.min.js.map +3 -3
- package/node_modules/baileys/node_modules/lru-cache/dist/commonjs/node/index.d.ts.map +1 -1
- package/node_modules/baileys/node_modules/lru-cache/dist/commonjs/node/index.js +4 -11
- package/node_modules/baileys/node_modules/lru-cache/dist/commonjs/node/index.js.map +1 -1
- package/node_modules/baileys/node_modules/lru-cache/dist/commonjs/node/index.min.js +1 -1
- package/node_modules/baileys/node_modules/lru-cache/dist/commonjs/node/index.min.js.map +3 -3
- package/node_modules/baileys/node_modules/lru-cache/dist/esm/browser/index.d.ts.map +1 -1
- package/node_modules/baileys/node_modules/lru-cache/dist/esm/browser/index.js +4 -11
- package/node_modules/baileys/node_modules/lru-cache/dist/esm/browser/index.js.map +1 -1
- package/node_modules/baileys/node_modules/lru-cache/dist/esm/browser/index.min.js +1 -1
- package/node_modules/baileys/node_modules/lru-cache/dist/esm/browser/index.min.js.map +3 -3
- package/node_modules/baileys/node_modules/lru-cache/dist/esm/index.d.ts.map +1 -1
- package/node_modules/baileys/node_modules/lru-cache/dist/esm/index.js +4 -11
- package/node_modules/baileys/node_modules/lru-cache/dist/esm/index.js.map +1 -1
- package/node_modules/baileys/node_modules/lru-cache/dist/esm/index.min.js +1 -1
- package/node_modules/baileys/node_modules/lru-cache/dist/esm/index.min.js.map +3 -3
- package/node_modules/baileys/node_modules/lru-cache/dist/esm/node/index.d.ts.map +1 -1
- package/node_modules/baileys/node_modules/lru-cache/dist/esm/node/index.js +4 -11
- package/node_modules/baileys/node_modules/lru-cache/dist/esm/node/index.js.map +1 -1
- package/node_modules/baileys/node_modules/lru-cache/dist/esm/node/index.min.js +1 -1
- package/node_modules/baileys/node_modules/lru-cache/dist/esm/node/index.min.js.map +3 -3
- package/node_modules/baileys/node_modules/lru-cache/package.json +1 -1
- package/node_modules/baileys/node_modules/music-metadata/lib/common/Util.d.ts +1 -1
- package/node_modules/baileys/node_modules/music-metadata/lib/common/Util.js +1 -7
- package/node_modules/baileys/node_modules/music-metadata/lib/id3v2/FrameHeader.js +3 -23
- package/node_modules/baileys/node_modules/music-metadata/lib/id3v2/FrameParser.js +2 -2
- package/node_modules/baileys/node_modules/music-metadata/lib/id3v2/ID3v2Token.js +1 -1
- package/node_modules/baileys/node_modules/music-metadata/lib/mp4/AtomToken.js +13 -38
- package/node_modules/baileys/node_modules/music-metadata/lib/mpeg/MpegParser.js +1 -1
- package/node_modules/baileys/node_modules/music-metadata/package.json +6 -6
- package/node_modules/baileys/node_modules/p-queue/dist/index.js +27 -37
- package/node_modules/baileys/node_modules/p-queue/package.json +1 -1
- package/node_modules/baileys/node_modules/protobufjs/README.md +553 -266
- package/node_modules/baileys/node_modules/protobufjs/dist/light/protobuf.js +1985 -3177
- package/node_modules/baileys/node_modules/protobufjs/dist/light/protobuf.js.map +1 -1
- package/node_modules/baileys/node_modules/protobufjs/dist/light/protobuf.min.js +3 -3
- package/node_modules/baileys/node_modules/protobufjs/dist/light/protobuf.min.js.map +1 -1
- package/node_modules/baileys/node_modules/protobufjs/dist/minimal/protobuf.js +1244 -1966
- package/node_modules/baileys/node_modules/protobufjs/dist/minimal/protobuf.js.map +1 -1
- package/node_modules/baileys/node_modules/protobufjs/dist/minimal/protobuf.min.js +3 -3
- package/node_modules/baileys/node_modules/protobufjs/dist/minimal/protobuf.min.js.map +1 -1
- package/node_modules/baileys/node_modules/protobufjs/dist/protobuf.js +2005 -3330
- package/node_modules/baileys/node_modules/protobufjs/dist/protobuf.js.map +1 -1
- package/node_modules/baileys/node_modules/protobufjs/dist/protobuf.min.js +3 -3
- package/node_modules/baileys/node_modules/protobufjs/dist/protobuf.min.js.map +1 -1
- package/node_modules/baileys/node_modules/protobufjs/ext/descriptor/README.md +70 -3
- package/node_modules/baileys/node_modules/protobufjs/ext/descriptor/index.d.ts +193 -0
- package/node_modules/baileys/node_modules/protobufjs/ext/descriptor/index.js +1185 -1
- package/node_modules/baileys/node_modules/protobufjs/ext/descriptor/test.js +54 -0
- package/node_modules/baileys/node_modules/protobufjs/google/api/annotations.json +1 -3
- package/node_modules/baileys/node_modules/protobufjs/google/api/http.json +1 -2
- package/node_modules/baileys/node_modules/protobufjs/google/protobuf/api.json +6 -12
- package/node_modules/baileys/node_modules/protobufjs/google/protobuf/descriptor.json +87 -170
- package/node_modules/baileys/node_modules/protobufjs/google/protobuf/descriptor.proto +8 -0
- package/node_modules/baileys/node_modules/protobufjs/google/protobuf/source_context.json +1 -2
- package/node_modules/baileys/node_modules/protobufjs/google/protobuf/type.json +7 -14
- package/node_modules/baileys/node_modules/protobufjs/index.d.ts +703 -1066
- package/node_modules/baileys/node_modules/protobufjs/package.json +52 -25
- package/node_modules/baileys/node_modules/protobufjs/scripts/postinstall.js +32 -0
- package/node_modules/baileys/node_modules/protobufjs/src/common.js +8 -14
- package/node_modules/baileys/node_modules/protobufjs/src/converter.js +51 -85
- package/node_modules/baileys/node_modules/protobufjs/src/decoder.js +61 -205
- package/node_modules/baileys/node_modules/protobufjs/src/encoder.js +7 -27
- package/node_modules/baileys/node_modules/protobufjs/src/enum.js +5 -18
- package/node_modules/baileys/node_modules/protobufjs/src/field.js +19 -71
- package/node_modules/baileys/node_modules/protobufjs/src/index-light.js +29 -29
- package/node_modules/baileys/node_modules/protobufjs/src/index-minimal.js +13 -12
- package/node_modules/baileys/node_modules/protobufjs/src/index.js +6 -6
- package/node_modules/baileys/node_modules/protobufjs/src/mapfield.js +8 -26
- package/node_modules/baileys/node_modules/protobufjs/src/message.js +11 -5
- package/node_modules/baileys/node_modules/protobufjs/src/method.js +7 -30
- package/node_modules/baileys/node_modules/protobufjs/src/namespace.js +10 -26
- package/node_modules/baileys/node_modules/protobufjs/src/object.js +31 -41
- package/node_modules/baileys/node_modules/protobufjs/src/oneof.js +1 -12
- package/node_modules/baileys/node_modules/protobufjs/src/parse.js +47 -169
- package/node_modules/baileys/node_modules/protobufjs/src/reader.js +50 -412
- package/node_modules/baileys/node_modules/protobufjs/src/reader_buffer.js +5 -31
- package/node_modules/baileys/node_modules/protobufjs/src/root.js +4 -16
- package/node_modules/baileys/node_modules/protobufjs/src/rpc/service.js +5 -18
- package/node_modules/baileys/node_modules/protobufjs/src/service.js +2 -15
- package/node_modules/baileys/node_modules/protobufjs/src/tokenize.js +1 -6
- package/node_modules/baileys/node_modules/protobufjs/src/type.js +36 -80
- package/node_modules/baileys/node_modules/protobufjs/src/typescript.jsdoc +15 -0
- package/node_modules/baileys/node_modules/protobufjs/src/util/longbits.js +6 -10
- package/node_modules/baileys/node_modules/protobufjs/src/util/minimal.js +54 -71
- package/node_modules/baileys/node_modules/protobufjs/src/util.js +17 -51
- package/node_modules/baileys/node_modules/protobufjs/src/verifier.js +14 -19
- package/node_modules/baileys/node_modules/protobufjs/src/wrappers.js +3 -2
- package/node_modules/baileys/node_modules/protobufjs/src/writer.js +191 -424
- package/node_modules/baileys/node_modules/protobufjs/src/writer_buffer.js +26 -41
- package/node_modules/baileys/node_modules/protobufjs/tsconfig.json +5 -3
- package/node_modules/baileys/node_modules/undici-types/LICENSE +21 -0
- package/node_modules/baileys/node_modules/undici-types/README.md +6 -0
- package/node_modules/baileys/node_modules/undici-types/agent.d.ts +30 -0
- package/node_modules/baileys/node_modules/undici-types/api.d.ts +43 -0
- package/node_modules/baileys/node_modules/undici-types/balanced-pool.d.ts +30 -0
- package/node_modules/baileys/node_modules/undici-types/cache-interceptor.d.ts +179 -0
- package/node_modules/baileys/node_modules/undici-types/cache.d.ts +36 -0
- package/node_modules/baileys/node_modules/undici-types/client-stats.d.ts +15 -0
- package/node_modules/baileys/node_modules/undici-types/client.d.ts +129 -0
- package/node_modules/baileys/node_modules/undici-types/connector.d.ts +36 -0
- package/node_modules/baileys/node_modules/undici-types/content-type.d.ts +21 -0
- package/node_modules/baileys/node_modules/undici-types/cookies.d.ts +30 -0
- package/node_modules/baileys/node_modules/undici-types/diagnostics-channel.d.ts +74 -0
- package/node_modules/baileys/node_modules/undici-types/dispatcher.d.ts +253 -0
- package/node_modules/baileys/node_modules/undici-types/dispatcher1-wrapper.d.ts +7 -0
- package/node_modules/baileys/node_modules/undici-types/env-http-proxy-agent.d.ts +22 -0
- package/node_modules/baileys/node_modules/undici-types/errors.d.ts +177 -0
- package/node_modules/baileys/node_modules/undici-types/eventsource.d.ts +66 -0
- package/node_modules/baileys/node_modules/undici-types/fetch.d.ts +231 -0
- package/node_modules/baileys/node_modules/undici-types/formdata.d.ts +108 -0
- package/node_modules/baileys/node_modules/undici-types/global-dispatcher.d.ts +9 -0
- package/node_modules/baileys/node_modules/undici-types/global-origin.d.ts +7 -0
- package/node_modules/baileys/node_modules/undici-types/h2c-client.d.ts +73 -0
- package/node_modules/baileys/node_modules/undici-types/handlers.d.ts +14 -0
- package/node_modules/baileys/node_modules/undici-types/header.d.ts +165 -0
- package/node_modules/baileys/node_modules/undici-types/index.d.ts +93 -0
- package/node_modules/baileys/node_modules/undici-types/interceptors.d.ts +80 -0
- package/node_modules/baileys/node_modules/undici-types/mock-agent.d.ts +68 -0
- package/node_modules/baileys/node_modules/undici-types/mock-call-history.d.ts +111 -0
- package/node_modules/baileys/node_modules/undici-types/mock-client.d.ts +27 -0
- package/node_modules/baileys/node_modules/undici-types/mock-errors.d.ts +12 -0
- package/node_modules/baileys/node_modules/undici-types/mock-interceptor.d.ts +94 -0
- package/node_modules/baileys/node_modules/undici-types/mock-pool.d.ts +27 -0
- package/node_modules/baileys/node_modules/undici-types/package.json +55 -0
- package/node_modules/baileys/node_modules/undici-types/patch.d.ts +29 -0
- package/node_modules/baileys/node_modules/undici-types/pool-stats.d.ts +19 -0
- package/node_modules/baileys/node_modules/undici-types/pool.d.ts +39 -0
- package/node_modules/baileys/node_modules/undici-types/proxy-agent.d.ts +29 -0
- package/node_modules/baileys/node_modules/undici-types/readable.d.ts +68 -0
- package/node_modules/baileys/node_modules/undici-types/retry-agent.d.ts +8 -0
- package/node_modules/baileys/node_modules/undici-types/retry-handler.d.ts +125 -0
- package/node_modules/baileys/node_modules/undici-types/round-robin-pool.d.ts +39 -0
- package/node_modules/baileys/node_modules/undici-types/snapshot-agent.d.ts +113 -0
- package/node_modules/baileys/node_modules/undici-types/socks5-proxy-agent.d.ts +25 -0
- package/node_modules/baileys/node_modules/undici-types/util.d.ts +18 -0
- package/node_modules/baileys/node_modules/undici-types/utility.d.ts +7 -0
- package/node_modules/baileys/node_modules/undici-types/webidl.d.ts +346 -0
- package/node_modules/baileys/node_modules/undici-types/websocket.d.ts +188 -0
- package/node_modules/baileys/node_modules/ws/lib/permessage-deflate.js +3 -1
- package/node_modules/baileys/node_modules/ws/package.json +1 -1
- package/node_modules/typebox/build/compile/validator.d.mts +4 -1
- package/node_modules/typebox/build/guard/guard.d.mts +1 -1
- package/node_modules/typebox/build/guard/guard.mjs +2 -5
- package/node_modules/typebox/build/guard/string.mjs +4 -16
- package/node_modules/typebox/build/schema/engine/_functions.mjs +15 -34
- package/node_modules/typebox/build/type/action/readonly_object.d.mts +0 -5
- package/node_modules/typebox/build/type/action/readonly_object.mjs +0 -8
- package/node_modules/typebox/build/typebox.d.mts +1 -1
- package/node_modules/typebox/build/typebox.mjs +1 -1
- package/node_modules/typebox/package.json +1 -1
- package/node_modules/typebox/readme.md +32 -29
- package/openclaw.plugin.json +239 -214
- package/package.json +11 -21
- package/dist/approval-reactions-Cu66aYdq.js +0 -373
- package/dist/channel.setup-pMwNVkCA.js +0 -19
- package/dist/config-schema-BQP5YCeK.js +0 -50
- package/dist/connection-controller-runtime-context-DG0tuYuw.js +0 -23
- package/dist/directory-config-DalGrfGN.js +0 -196
- package/dist/doctor-CwzVXKoE.js +0 -10
- package/dist/normalize-C7Hkc_vE.js +0 -2
- package/dist/question-reactions-CRsnyoMK.js +0 -142
- package/dist/runtime-BLlToOi6.js +0 -21
- package/dist/send-D37ddk22.js +0 -436
- package/dist/session.runtime-Nsqaehbd.js +0 -16
- package/dist/socket-close-DridEuzz.js +0 -622
- package/dist/targets-runtime-TMk0lGuy.js +0 -299
- package/dist/text-runtime-CaKLhowd.js +0 -4
- package/node_modules/baileys/node_modules/protobufjs/ext/README.md +0 -70
- package/node_modules/baileys/node_modules/protobufjs/ext/descriptor.d.ts +0 -87
- package/node_modules/baileys/node_modules/protobufjs/ext/descriptor.generated.d.ts +0 -417
- package/node_modules/baileys/node_modules/protobufjs/ext/descriptor.js +0 -1356
- package/node_modules/baileys/node_modules/protobufjs/ext/protojson.LICENSE +0 -201
- package/node_modules/baileys/node_modules/protobufjs/ext/protojson.d.ts +0 -20
- package/node_modules/baileys/node_modules/protobufjs/ext/protojson.generated.d.ts +0 -49
- package/node_modules/baileys/node_modules/protobufjs/ext/protojson.js +0 -951
- package/node_modules/baileys/node_modules/protobufjs/ext/textformat.d.ts +0 -19
- package/node_modules/baileys/node_modules/protobufjs/ext/textformat.generated.d.ts +0 -33
- package/node_modules/baileys/node_modules/protobufjs/ext/textformat.js +0 -1276
- package/node_modules/baileys/node_modules/protobufjs/google/protobuf/compiler/plugin.json +0 -126
- package/node_modules/baileys/node_modules/protobufjs/google/protobuf/compiler/plugin.proto +0 -47
- package/node_modules/baileys/node_modules/protobufjs/src/typescript.js +0 -25
- /package/dist/{account-ids-CB5SOWjc.js → .setup/account-ids-CB5SOWjc.mjs} +0 -0
- /package/dist/{audio-preflight.runtime-C_glQhZY.js → .setup/audio-preflight.runtime-C_glQhZY.mjs} +0 -0
- /package/dist/{command-policy-BIOSHySD.js → .setup/command-policy-BIOSHySD.mjs} +0 -0
- /package/dist/{creds-files-B1kSWtBg.js → .setup/creds-files-B1kSWtBg.mjs} +0 -0
- /package/dist/{group-config-path-BGyzT9Lg.js → .setup/group-config-path-BGyzT9Lg.mjs} +0 -0
- /package/dist/{group-session-contract-DDnZSsJ1.js → .setup/group-session-contract-DDnZSsJ1.mjs} +0 -0
- /package/dist/{reply-resolver.runtime-Ded8D58Y.js → .setup/reply-resolver.runtime-Ded8D58Y.mjs} +0 -0
- /package/dist/{rolldown-runtime-D7D4PA-g.js → .setup/rolldown-runtime-D7D4PA-g.mjs} +0 -0
- /package/dist/{security-contract-nAzD945y.js → .setup/security-contract-nAzD945y.mjs} +0 -0
- /package/dist/{session-contract-DMTm6Q_L.js → .setup/session-contract-DMTm6Q_L.mjs} +0 -0
- /package/node_modules/baileys/node_modules/{protobufjs/src/util/float.d.ts → @protobufjs/float/index.d.ts} +0 -0
|
@@ -1,76 +1,60 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { a as normalizeWhatsAppAllowFromEntries } from "./normalize-target-
|
|
4
|
-
import { t as WhatsAppChannelConfigSchema } from "./config-schema-
|
|
5
|
-
import { n as whatsappDoctor } from "./doctor-
|
|
6
|
-
import { t as resolveWhatsAppConfigPath } from "./group-config-path-BGyzT9Lg.
|
|
7
|
-
import { t as resolveLegacyGroupSessionKey } from "./group-session-contract-DDnZSsJ1.
|
|
8
|
-
import { n as unsupportedSecretRefSurfacePatterns, t as collectUnsupportedSecretRefConfigCandidates } from "./security-contract-nAzD945y.
|
|
9
|
-
import { n as deriveLegacySessionChatType, r as isLegacyGroupSessionKey, t as canonicalizeLegacySessionKey } from "./session-contract-DMTm6Q_L.
|
|
1
|
+
import { r as resolveDefaultWhatsAppAccountId, t as listAccountIds } from "./account-ids-CB5SOWjc.mjs";
|
|
2
|
+
import { a as resolveWhatsAppAccount, n as hasAnyWhatsAppAuth } from "./accounts-Dw16pdNl.mjs";
|
|
3
|
+
import { a as normalizeWhatsAppAllowFromEntries } from "./normalize-target-bVWjgftN.mjs";
|
|
4
|
+
import { t as WhatsAppChannelConfigSchema } from "./config-schema-mBX2nmn1.mjs";
|
|
5
|
+
import { n as whatsappDoctor } from "./doctor-By3SB4lm.mjs";
|
|
6
|
+
import { t as resolveWhatsAppConfigPath } from "./group-config-path-BGyzT9Lg.mjs";
|
|
7
|
+
import { t as resolveLegacyGroupSessionKey } from "./group-session-contract-DDnZSsJ1.mjs";
|
|
8
|
+
import { n as unsupportedSecretRefSurfacePatterns, t as collectUnsupportedSecretRefConfigCandidates } from "./security-contract-nAzD945y.mjs";
|
|
9
|
+
import { n as deriveLegacySessionChatType, r as isLegacyGroupSessionKey, t as canonicalizeLegacySessionKey } from "./session-contract-DMTm6Q_L.mjs";
|
|
10
10
|
import { normalizeUniqueStringEntries } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
11
11
|
import { normalizeE164 } from "openclaw/plugin-sdk/account-resolution";
|
|
12
12
|
import { createChannelPluginBase } from "openclaw/plugin-sdk/core";
|
|
13
13
|
import { DEFAULT_ACCOUNT_ID } from "openclaw/plugin-sdk/account-id";
|
|
14
|
-
import {
|
|
15
|
-
import { buildChannelGroupsScopeTree, collectOpenGroupPolicyRouteAllowlistWarnings, createAllowlistProviderGroupPolicyWarningCollector, resolveScopeRequireMention, resolveScopeToolsPolicy } from "openclaw/plugin-sdk/channel-policy";
|
|
16
|
-
import { defineChannelSetupContract } from "openclaw/plugin-sdk/channel-setup";
|
|
17
|
-
import { createPatchedAccountSetupAdapter } from "openclaw/plugin-sdk/setup";
|
|
14
|
+
import { collectOpenGroupPolicyRouteAllowlistWarnings, createAllowlistProviderGroupPolicyWarningCollector, resolveChannelGroupRequireMention, resolveChannelGroupToolsPolicy } from "openclaw/plugin-sdk/channel-policy";
|
|
18
15
|
import { describeAccountSnapshot } from "openclaw/plugin-sdk/account-helpers";
|
|
19
16
|
import { adaptScopedAccountAccessor, createScopedChannelConfigAdapter, createScopedDmSecurityResolver } from "openclaw/plugin-sdk/channel-config-helpers";
|
|
20
17
|
import { createDelegatedSetupWizardProxy } from "openclaw/plugin-sdk/setup-runtime";
|
|
21
18
|
import { readChannelAllowFromStore } from "openclaw/plugin-sdk/channel-pairing";
|
|
22
|
-
|
|
23
|
-
const loadWhatsAppAuthStore = createLazyRuntimeModule(() => import("./auth-store-DcEpIOmE.js").then((n) => n.i));
|
|
24
|
-
async function readWhatsAppAccountLinkState(authDir) {
|
|
25
|
-
const state = await (await loadWhatsAppAuthStore()).readWebAuthState(authDir);
|
|
26
|
-
return state === "unstable" ? "unknown" : state;
|
|
27
|
-
}
|
|
28
|
-
const loadWhatsAppChannelRuntime = createLazyRuntimeModule(async () => {
|
|
29
|
-
await loadWhatsAppAuthStore();
|
|
30
|
-
return await import("./channel.runtime-BP0xNmLi.js");
|
|
31
|
-
});
|
|
32
|
-
//#endregion
|
|
19
|
+
import { applyAccountNameToChannelSection, migrateBaseNameToDefaultAccount, normalizeAccountId as normalizeAccountId$1 } from "openclaw/plugin-sdk/setup";
|
|
33
20
|
//#region extensions/whatsapp/src/config-accessors.ts
|
|
34
21
|
function formatWhatsAppConfigAllowFromEntries(allowFrom) {
|
|
35
22
|
return normalizeWhatsAppAllowFromEntries(allowFrom);
|
|
36
23
|
}
|
|
37
24
|
//#endregion
|
|
38
|
-
//#region extensions/whatsapp/src/group-
|
|
39
|
-
|
|
40
|
-
|
|
25
|
+
//#region extensions/whatsapp/src/group-intro.ts
|
|
26
|
+
const WHATSAPP_GROUP_INTRO_HINT = "WhatsApp IDs: SenderId is the participant JID (group participant id).";
|
|
27
|
+
function resolveWhatsAppGroupIntroHint() {
|
|
28
|
+
return WHATSAPP_GROUP_INTRO_HINT;
|
|
29
|
+
}
|
|
30
|
+
function resolveWhatsAppMentionStripRegexes(ctx) {
|
|
31
|
+
const selfE164 = (ctx.To ?? "").replace(/^whatsapp:/i, "");
|
|
32
|
+
if (!selfE164) return [];
|
|
33
|
+
const escaped = selfE164.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
34
|
+
return [new RegExp(escaped, "g"), new RegExp(`@${escaped}`, "g")];
|
|
41
35
|
}
|
|
36
|
+
//#endregion
|
|
37
|
+
//#region extensions/whatsapp/src/group-policy.ts
|
|
42
38
|
function resolveWhatsAppGroupRequireMention(params) {
|
|
43
|
-
return
|
|
44
|
-
|
|
45
|
-
|
|
39
|
+
return resolveChannelGroupRequireMention({
|
|
40
|
+
cfg: params.cfg,
|
|
41
|
+
channel: "whatsapp",
|
|
42
|
+
groupId: params.groupId,
|
|
43
|
+
accountId: params.accountId
|
|
46
44
|
});
|
|
47
45
|
}
|
|
48
46
|
function resolveWhatsAppGroupToolPolicy(params) {
|
|
49
|
-
return
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
47
|
+
return resolveChannelGroupToolsPolicy({
|
|
48
|
+
cfg: params.cfg,
|
|
49
|
+
channel: "whatsapp",
|
|
50
|
+
groupId: params.groupId,
|
|
51
|
+
accountId: params.accountId,
|
|
52
|
+
senderId: params.senderId,
|
|
53
|
+
senderName: params.senderName,
|
|
54
|
+
senderUsername: params.senderUsername,
|
|
55
|
+
senderE164: params.senderE164
|
|
54
56
|
});
|
|
55
57
|
}
|
|
56
|
-
const whatsappSetupAdapter = {
|
|
57
|
-
...createPatchedAccountSetupAdapter({
|
|
58
|
-
channelKey: "whatsapp",
|
|
59
|
-
alwaysUseAccounts: true,
|
|
60
|
-
buildPatch: (input) => input.authDir ? { authDir: input.authDir } : {}
|
|
61
|
-
}),
|
|
62
|
-
singleAccountKeysToMove: ["authDir"]
|
|
63
|
-
};
|
|
64
|
-
const whatsappSetupContract = defineChannelSetupContract({
|
|
65
|
-
fields: { authDir: {
|
|
66
|
-
kind: "string",
|
|
67
|
-
cli: {
|
|
68
|
-
flags: "--auth-dir <path>",
|
|
69
|
-
description: "WhatsApp auth directory override"
|
|
70
|
-
}
|
|
71
|
-
} },
|
|
72
|
-
legacyAdapter: whatsappSetupAdapter
|
|
73
|
-
});
|
|
74
58
|
//#endregion
|
|
75
59
|
//#region extensions/whatsapp/src/security-fix.ts
|
|
76
60
|
function applyGroupAllowFromFromStore(params) {
|
|
@@ -96,7 +80,8 @@ function applyGroupAllowFromFromStore(params) {
|
|
|
96
80
|
return changed ? next : params.cfg;
|
|
97
81
|
}
|
|
98
82
|
async function applyWhatsAppSecurityConfigFixes(params) {
|
|
99
|
-
const
|
|
83
|
+
const fromStore = await readChannelAllowFromStore("whatsapp", params.env, DEFAULT_ACCOUNT_ID).catch(() => []);
|
|
84
|
+
const normalized = normalizeUniqueStringEntries(fromStore);
|
|
100
85
|
if (normalized.length === 0) return {
|
|
101
86
|
config: params.cfg,
|
|
102
87
|
changes: []
|
|
@@ -114,8 +99,11 @@ async function applyWhatsAppSecurityConfigFixes(params) {
|
|
|
114
99
|
//#endregion
|
|
115
100
|
//#region extensions/whatsapp/src/shared.ts
|
|
116
101
|
const WHATSAPP_CHANNEL = "whatsapp";
|
|
102
|
+
async function loadWhatsAppChannelRuntime() {
|
|
103
|
+
return await import("./channel.runtime-DmmMgRJQ.mjs");
|
|
104
|
+
}
|
|
117
105
|
async function loadWhatsAppSetupSurface() {
|
|
118
|
-
return await import("./setup-surface-
|
|
106
|
+
return await import("./setup-surface-Zvj2cLzz.mjs");
|
|
119
107
|
}
|
|
120
108
|
const whatsappSetupWizardProxy = createWhatsAppSetupWizardProxy(async () => (await loadWhatsAppSetupSurface()).whatsappSetupWizard);
|
|
121
109
|
const whatsappConfigAdapter = createScopedChannelConfigAdapter({
|
|
@@ -219,7 +207,7 @@ function createWhatsAppPluginBase(params) {
|
|
|
219
207
|
docsLabel: "whatsapp",
|
|
220
208
|
blurb: "works with your own number; recommend a separate phone + eSIM.",
|
|
221
209
|
systemImage: "message",
|
|
222
|
-
|
|
210
|
+
showConfigured: false,
|
|
223
211
|
quickstartAllowFrom: true,
|
|
224
212
|
forceAccountBinding: true,
|
|
225
213
|
preferSessionLookupForAnnounceTarget: true
|
|
@@ -241,7 +229,7 @@ function createWhatsAppPluginBase(params) {
|
|
|
241
229
|
},
|
|
242
230
|
reload: {
|
|
243
231
|
configPrefixes: [
|
|
244
|
-
"
|
|
232
|
+
"web",
|
|
245
233
|
"channels.whatsapp.accounts",
|
|
246
234
|
"channels.whatsapp.selfChatMode"
|
|
247
235
|
],
|
|
@@ -251,17 +239,16 @@ function createWhatsAppPluginBase(params) {
|
|
|
251
239
|
configSchema: WhatsAppChannelConfigSchema,
|
|
252
240
|
config: {
|
|
253
241
|
...whatsappConfigAdapter,
|
|
254
|
-
isEnabled: (account) => account.enabled,
|
|
242
|
+
isEnabled: (account, cfg) => account.enabled && cfg.web?.enabled !== false,
|
|
255
243
|
disabledReason: () => "disabled",
|
|
256
244
|
isConfigured: params.isConfigured,
|
|
257
|
-
isLinked: params.isLinked,
|
|
258
245
|
hasPersistedAuthState: ({ cfg }) => hasAnyWhatsAppAuth(cfg),
|
|
259
|
-
unconfiguredReason: () => "not
|
|
260
|
-
unlinkedReason: () => "not linked",
|
|
246
|
+
unconfiguredReason: () => "not linked",
|
|
261
247
|
describeAccount: (account) => describeAccountSnapshot({
|
|
262
248
|
account,
|
|
263
249
|
configured: Boolean(account.authDir),
|
|
264
250
|
extra: {
|
|
251
|
+
linked: Boolean(account.authDir),
|
|
265
252
|
dmPolicy: account.dmPolicy,
|
|
266
253
|
allowFrom: account.allowFrom
|
|
267
254
|
}
|
|
@@ -274,7 +261,6 @@ function createWhatsAppPluginBase(params) {
|
|
|
274
261
|
},
|
|
275
262
|
doctor: whatsappDoctor,
|
|
276
263
|
setup: params.setup,
|
|
277
|
-
...params.setupContract ? { setupContract: params.setupContract } : {},
|
|
278
264
|
groups: params.groups
|
|
279
265
|
});
|
|
280
266
|
return {
|
|
@@ -304,4 +290,49 @@ function createWhatsAppPluginBase(params) {
|
|
|
304
290
|
};
|
|
305
291
|
}
|
|
306
292
|
//#endregion
|
|
307
|
-
|
|
293
|
+
//#region extensions/whatsapp/src/setup-core.ts
|
|
294
|
+
const channel = "whatsapp";
|
|
295
|
+
const whatsappSetupAdapter = {
|
|
296
|
+
resolveAccountId: ({ accountId }) => normalizeAccountId$1(accountId),
|
|
297
|
+
applyAccountName: ({ cfg, accountId, name }) => applyAccountNameToChannelSection({
|
|
298
|
+
cfg,
|
|
299
|
+
channelKey: channel,
|
|
300
|
+
accountId,
|
|
301
|
+
name,
|
|
302
|
+
alwaysUseAccounts: true
|
|
303
|
+
}),
|
|
304
|
+
applyAccountConfig: ({ cfg, accountId, input }) => {
|
|
305
|
+
const namedConfig = applyAccountNameToChannelSection({
|
|
306
|
+
cfg,
|
|
307
|
+
channelKey: channel,
|
|
308
|
+
accountId,
|
|
309
|
+
name: input.name,
|
|
310
|
+
alwaysUseAccounts: true
|
|
311
|
+
});
|
|
312
|
+
const next = migrateBaseNameToDefaultAccount({
|
|
313
|
+
cfg: namedConfig,
|
|
314
|
+
channelKey: channel,
|
|
315
|
+
alwaysUseAccounts: true
|
|
316
|
+
});
|
|
317
|
+
const entry = {
|
|
318
|
+
...next.channels?.whatsapp?.accounts?.[accountId],
|
|
319
|
+
...input.authDir ? { authDir: input.authDir } : {},
|
|
320
|
+
enabled: true
|
|
321
|
+
};
|
|
322
|
+
return {
|
|
323
|
+
...next,
|
|
324
|
+
channels: {
|
|
325
|
+
...next.channels,
|
|
326
|
+
whatsapp: {
|
|
327
|
+
...next.channels?.whatsapp,
|
|
328
|
+
accounts: {
|
|
329
|
+
...next.channels?.whatsapp?.accounts,
|
|
330
|
+
[accountId]: entry
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
};
|
|
335
|
+
}
|
|
336
|
+
};
|
|
337
|
+
//#endregion
|
|
338
|
+
export { resolveWhatsAppGroupRequireMention as a, resolveWhatsAppMentionStripRegexes as c, whatsappSetupWizardProxy as i, formatWhatsAppConfigAllowFromEntries as l, createWhatsAppPluginBase as n, resolveWhatsAppGroupToolPolicy as o, loadWhatsAppChannelRuntime as r, resolveWhatsAppGroupIntroHint as s, whatsappSetupAdapter as t };
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { r as
|
|
3
|
-
import {
|
|
4
|
-
import { a as normalizeWhatsAppAllowFromEntries, o as normalizeWhatsAppAllowFromEntry } from "./normalize-target-
|
|
5
|
-
import {
|
|
6
|
-
import { DEFAULT_ACCOUNT_ID, createSetupTranslator, splitSetupEntries } from "openclaw/plugin-sdk/setup";
|
|
1
|
+
import { r as resolveDefaultWhatsAppAccountId } from "./account-ids-CB5SOWjc.mjs";
|
|
2
|
+
import { r as hasWebCredsSync } from "./creds-files-B1kSWtBg.mjs";
|
|
3
|
+
import { a as resolveWhatsAppAccount, o as resolveWhatsAppAuthDir } from "./accounts-Dw16pdNl.mjs";
|
|
4
|
+
import { a as normalizeWhatsAppAllowFromEntries, o as normalizeWhatsAppAllowFromEntry } from "./normalize-target-bVWjgftN.mjs";
|
|
5
|
+
import { t as whatsappSetupAdapter } from "./setup-core--FfzntMG.mjs";
|
|
7
6
|
import { formatCliCommand, formatDocsLink } from "openclaw/plugin-sdk/setup-tools";
|
|
7
|
+
import { DEFAULT_ACCOUNT_ID, createSetupTranslator, splitSetupEntries } from "openclaw/plugin-sdk/setup";
|
|
8
8
|
//#region extensions/whatsapp/src/setup-finalize.ts
|
|
9
9
|
const t = createSetupTranslator();
|
|
10
10
|
function trimPromptText(value) {
|
|
@@ -94,7 +94,7 @@ async function detectWhatsAppLinked(cfg, accountId) {
|
|
|
94
94
|
async function promptWhatsAppOwnerAllowFrom(params) {
|
|
95
95
|
const { prompter, existingAllowFrom } = params;
|
|
96
96
|
await prompter.note(t("wizard.whatsapp.ownerNumberNote"), t("wizard.whatsapp.numberTitle"));
|
|
97
|
-
const
|
|
97
|
+
const entry = await prompter.text({
|
|
98
98
|
message: t("wizard.whatsapp.personalNumberPrompt"),
|
|
99
99
|
placeholder: "+15555550123",
|
|
100
100
|
initialValue: existingAllowFrom[0],
|
|
@@ -103,7 +103,8 @@ async function promptWhatsAppOwnerAllowFrom(params) {
|
|
|
103
103
|
if (!raw) return t("common.required");
|
|
104
104
|
if (!normalizeWhatsAppAllowFromEntry(raw)) return `Invalid number: ${raw}`;
|
|
105
105
|
}
|
|
106
|
-
})
|
|
106
|
+
});
|
|
107
|
+
const normalized = normalizeWhatsAppAllowFromEntry(trimPromptText(entry));
|
|
107
108
|
if (!normalized) throw new Error("Invalid WhatsApp owner number (expected E.164 after validation).");
|
|
108
109
|
return {
|
|
109
110
|
normalized,
|
|
@@ -271,15 +272,6 @@ async function finalizeWhatsAppSetup(params) {
|
|
|
271
272
|
cfg: next,
|
|
272
273
|
accountId
|
|
273
274
|
});
|
|
274
|
-
if (params.options?.deferDeviceLinkToClient) {
|
|
275
|
-
next = await promptWhatsAppDmAccess({
|
|
276
|
-
cfg: next,
|
|
277
|
-
accountId,
|
|
278
|
-
forceAllowFrom: params.forceAllowFrom,
|
|
279
|
-
prompter: params.prompter
|
|
280
|
-
});
|
|
281
|
-
return { cfg: next };
|
|
282
|
-
}
|
|
283
275
|
if (!linked) await params.prompter.note([
|
|
284
276
|
t("wizard.whatsapp.scanQr"),
|
|
285
277
|
t("wizard.whatsapp.credentialsStored", { authDir }),
|
|
@@ -288,35 +280,14 @@ async function finalizeWhatsAppSetup(params) {
|
|
|
288
280
|
if (await params.prompter.confirm({
|
|
289
281
|
message: linked ? t("wizard.whatsapp.relinkPrompt") : t("wizard.whatsapp.linkNowPrompt"),
|
|
290
282
|
initialValue: !linked
|
|
291
|
-
})) {
|
|
292
|
-
const
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
};
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
} catch (error) {
|
|
300
|
-
await reportLoginFailure(error);
|
|
301
|
-
}
|
|
302
|
-
if (loginWeb) {
|
|
303
|
-
let persistenceGuardFailure;
|
|
304
|
-
const beforeCredentialPersistence = params.options?.beforePersistentEffect ? async () => {
|
|
305
|
-
try {
|
|
306
|
-
await params.options?.beforePersistentEffect?.();
|
|
307
|
-
} catch (error) {
|
|
308
|
-
persistenceGuardFailure = { error };
|
|
309
|
-
throw error;
|
|
310
|
-
}
|
|
311
|
-
} : void 0;
|
|
312
|
-
try {
|
|
313
|
-
await loginWeb(false, void 0, params.runtime, accountId, { beforeCredentialPersistence });
|
|
314
|
-
} catch (error) {
|
|
315
|
-
if (persistenceGuardFailure) throw persistenceGuardFailure.error;
|
|
316
|
-
await reportLoginFailure(error);
|
|
317
|
-
}
|
|
318
|
-
}
|
|
319
|
-
} else if (!linked) await params.prompter.note(t("wizard.whatsapp.linkLater", { command: formatCliCommand("openclaw channels login") }), "WhatsApp");
|
|
283
|
+
})) try {
|
|
284
|
+
const { loginWeb } = await import("./login-7b3M0iBp.mjs").then((n) => n.n);
|
|
285
|
+
await loginWeb(false, void 0, params.runtime, accountId);
|
|
286
|
+
} catch (error) {
|
|
287
|
+
params.runtime.error(`WhatsApp login failed: ${String(error)}`);
|
|
288
|
+
await params.prompter.note(t("wizard.channels.docs", { link: formatDocsLink("/whatsapp", "whatsapp") }), t("wizard.whatsapp.helpTitle"));
|
|
289
|
+
}
|
|
290
|
+
else if (!linked) await params.prompter.note(t("wizard.whatsapp.linkLater", { command: formatCliCommand("openclaw channels login") }), "WhatsApp");
|
|
320
291
|
next = await promptWhatsAppDmAccess({
|
|
321
292
|
cfg: next,
|
|
322
293
|
accountId,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { a as formatWhatsAppWebAuthStatusState, h as readWebAuthState } from "./auth-store-
|
|
1
|
+
import { t as listAccountIds } from "./account-ids-CB5SOWjc.mjs";
|
|
2
|
+
import { o as resolveWhatsAppAuthDir } from "./accounts-Dw16pdNl.mjs";
|
|
3
|
+
import { a as formatWhatsAppWebAuthStatusState, h as readWebAuthState } from "./auth-store-BZKGa0tW.mjs";
|
|
4
4
|
import { DEFAULT_ACCOUNT_ID, createSetupTranslator, setSetupChannelEnabled } from "openclaw/plugin-sdk/setup";
|
|
5
5
|
//#region extensions/whatsapp/src/setup-surface.ts
|
|
6
6
|
const t = createSetupTranslator();
|
|
@@ -36,7 +36,7 @@ const whatsappSetupWizard = {
|
|
|
36
36
|
},
|
|
37
37
|
resolveShouldPromptAccountIds: ({ shouldPromptAccountIds }) => shouldPromptAccountIds,
|
|
38
38
|
credentials: [],
|
|
39
|
-
finalize: async (params) => await (await import("./setup-finalize-
|
|
39
|
+
finalize: async (params) => await (await import("./setup-finalize-DCruIciL.mjs")).finalizeWhatsAppSetup(params),
|
|
40
40
|
disable: (cfg) => setSetupChannelEnabled(cfg, channel, false),
|
|
41
41
|
onAccountRecorded: (accountId, options) => {
|
|
42
42
|
options?.onAccountId?.(channel, accountId);
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { resolveTimerTimeoutMs } from "openclaw/plugin-sdk/number-runtime";
|
|
2
|
+
//#region extensions/whatsapp/src/socket-timing.ts
|
|
3
|
+
const socketSendMessageQueueTails = /* @__PURE__ */ new WeakMap();
|
|
4
|
+
const DEFAULT_WHATSAPP_SOCKET_TIMING = {
|
|
5
|
+
keepAliveIntervalMs: 25e3,
|
|
6
|
+
connectTimeoutMs: 6e4,
|
|
7
|
+
defaultQueryTimeoutMs: 6e4
|
|
8
|
+
};
|
|
9
|
+
var WhatsAppSocketOperationTimeoutError = class extends Error {
|
|
10
|
+
constructor(operation, timeoutMs) {
|
|
11
|
+
super(`WhatsApp socket ${operation} timed out after ${timeoutMs}ms; delivery state is unknown`);
|
|
12
|
+
this.operation = operation;
|
|
13
|
+
this.timeoutMs = timeoutMs;
|
|
14
|
+
this.deliveryState = "unknown";
|
|
15
|
+
this.name = "WhatsAppSocketOperationTimeoutError";
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
function positiveInteger(value) {
|
|
19
|
+
return typeof value === "number" && Number.isInteger(value) && value > 0 ? value : void 0;
|
|
20
|
+
}
|
|
21
|
+
function resolveWhatsAppSocketTiming(cfg, overrides) {
|
|
22
|
+
const configured = cfg.web?.whatsapp;
|
|
23
|
+
return {
|
|
24
|
+
keepAliveIntervalMs: positiveInteger(overrides?.keepAliveIntervalMs) ?? positiveInteger(configured?.keepAliveIntervalMs) ?? DEFAULT_WHATSAPP_SOCKET_TIMING.keepAliveIntervalMs,
|
|
25
|
+
connectTimeoutMs: positiveInteger(overrides?.connectTimeoutMs) ?? positiveInteger(configured?.connectTimeoutMs) ?? DEFAULT_WHATSAPP_SOCKET_TIMING.connectTimeoutMs,
|
|
26
|
+
defaultQueryTimeoutMs: positiveInteger(overrides?.defaultQueryTimeoutMs) ?? positiveInteger(configured?.defaultQueryTimeoutMs) ?? DEFAULT_WHATSAPP_SOCKET_TIMING.defaultQueryTimeoutMs
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
function isWhatsAppSocketOperationTimeoutError(error) {
|
|
30
|
+
return error instanceof WhatsAppSocketOperationTimeoutError;
|
|
31
|
+
}
|
|
32
|
+
function resolveWhatsAppSocketOperationTimeoutMs(timeoutMs) {
|
|
33
|
+
return resolveTimerTimeoutMs(timeoutMs, DEFAULT_WHATSAPP_SOCKET_TIMING.defaultQueryTimeoutMs);
|
|
34
|
+
}
|
|
35
|
+
async function runSerializedSocketSendMessage(sock, run) {
|
|
36
|
+
const result = (socketSendMessageQueueTails.get(sock) ?? Promise.resolve()).then(run);
|
|
37
|
+
const tail = result.then(() => void 0, () => void 0);
|
|
38
|
+
socketSendMessageQueueTails.set(sock, tail);
|
|
39
|
+
tail.then(() => {
|
|
40
|
+
if (socketSendMessageQueueTails.get(sock) === tail) socketSendMessageQueueTails.delete(sock);
|
|
41
|
+
});
|
|
42
|
+
return await result;
|
|
43
|
+
}
|
|
44
|
+
async function withWhatsAppSocketOperationTimeout(operation, promise, timeoutMs, onTimeout) {
|
|
45
|
+
const resolvedTimeoutMs = resolveWhatsAppSocketOperationTimeoutMs(timeoutMs);
|
|
46
|
+
let timeout = null;
|
|
47
|
+
try {
|
|
48
|
+
return await Promise.race([promise, new Promise((_, reject) => {
|
|
49
|
+
timeout = setTimeout(() => {
|
|
50
|
+
onTimeout?.();
|
|
51
|
+
reject(new WhatsAppSocketOperationTimeoutError(operation, resolvedTimeoutMs));
|
|
52
|
+
}, resolvedTimeoutMs);
|
|
53
|
+
timeout.unref?.();
|
|
54
|
+
})]);
|
|
55
|
+
} finally {
|
|
56
|
+
if (timeout) clearTimeout(timeout);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
function createWhatsAppSocketOperationTimeoutAdapter(sock, timeoutMs, hooks) {
|
|
60
|
+
const operationTimeoutMs = resolveWhatsAppSocketOperationTimeoutMs(timeoutMs);
|
|
61
|
+
return {
|
|
62
|
+
sendMessage: (jid, content, options) => {
|
|
63
|
+
return runSerializedSocketSendMessage(sock, () => {
|
|
64
|
+
const send = options ? sock.sendMessage(jid, content, options) : sock.sendMessage(jid, content);
|
|
65
|
+
return withWhatsAppSocketOperationTimeout("sendMessage", send, operationTimeoutMs, hooks?.onSendMessageTimeout ? () => hooks.onSendMessageTimeout?.({
|
|
66
|
+
jid,
|
|
67
|
+
promise: send
|
|
68
|
+
}) : void 0);
|
|
69
|
+
});
|
|
70
|
+
},
|
|
71
|
+
sendPresenceUpdate: (presence, jid) => {
|
|
72
|
+
return withWhatsAppSocketOperationTimeout("sendPresenceUpdate", jid === void 0 ? sock.sendPresenceUpdate(presence) : sock.sendPresenceUpdate(presence, jid), operationTimeoutMs);
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
//#endregion
|
|
77
|
+
export { resolveWhatsAppSocketTiming as a, resolveWhatsAppSocketOperationTimeoutMs as i, createWhatsAppSocketOperationTimeoutAdapter as n, withWhatsAppSocketOperationTimeout as o, isWhatsAppSocketOperationTimeoutError as r, DEFAULT_WHATSAPP_SOCKET_TIMING as t };
|
|
@@ -1,8 +1,15 @@
|
|
|
1
1
|
import fs from "node:fs";
|
|
2
2
|
import path from "node:path";
|
|
3
|
-
import {
|
|
3
|
+
import { statRegularFileSync } from "openclaw/plugin-sdk/security-runtime";
|
|
4
4
|
import { DEFAULT_ACCOUNT_ID } from "openclaw/plugin-sdk/account-id";
|
|
5
5
|
//#region extensions/whatsapp/src/state-migrations.ts
|
|
6
|
+
function fileExists(pathValue) {
|
|
7
|
+
try {
|
|
8
|
+
return !statRegularFileSync(pathValue).missing;
|
|
9
|
+
} catch {
|
|
10
|
+
return false;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
6
13
|
function isLegacyWhatsAppAuthFile(name) {
|
|
7
14
|
if (name === "creds.json" || name === "creds.json.bak") return true;
|
|
8
15
|
if (!name.endsWith(".json")) return false;
|
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
import fs from "node:fs";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
import { normalizeE164 } from "openclaw/plugin-sdk/account-resolution";
|
|
4
|
+
import { logVerbose, shouldLogVerbose } from "openclaw/plugin-sdk/runtime-env";
|
|
5
|
+
import { CONFIG_DIR, escapeRegExp, resolveUserPath as resolveUserPath$1 } from "openclaw/plugin-sdk/text-utility-runtime";
|
|
6
|
+
//#region extensions/whatsapp/src/targets-runtime.ts
|
|
7
|
+
const WHATSAPP_FENCE_PLACEHOLDER = "\0FENCE";
|
|
8
|
+
const WHATSAPP_INLINE_CODE_PLACEHOLDER = "\0CODE";
|
|
9
|
+
const WHATSAPP_PLACEHOLDER_TERMINATOR = "\0";
|
|
10
|
+
function assertWebChannel(input) {
|
|
11
|
+
if (input !== "web") throw new Error("Web channel must be 'web'");
|
|
12
|
+
}
|
|
13
|
+
function isSelfChatMode(selfE164, allowFrom) {
|
|
14
|
+
if (!selfE164) return false;
|
|
15
|
+
if (!Array.isArray(allowFrom) || allowFrom.length === 0) return false;
|
|
16
|
+
const normalizedSelf = normalizeE164(selfE164);
|
|
17
|
+
return allowFrom.some((n) => {
|
|
18
|
+
if (n === "*") return false;
|
|
19
|
+
try {
|
|
20
|
+
return normalizeE164(String(n)) === normalizedSelf;
|
|
21
|
+
} catch {
|
|
22
|
+
return false;
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
function toWhatsappJid(number) {
|
|
27
|
+
const withoutPrefix = number.replace(/^whatsapp:/i, "").trim();
|
|
28
|
+
if (withoutPrefix.includes("@")) return withoutPrefix;
|
|
29
|
+
return `${normalizeE164(withoutPrefix).replace(/\D/g, "")}@s.whatsapp.net`;
|
|
30
|
+
}
|
|
31
|
+
function toWhatsappJidWithLid(number, opts) {
|
|
32
|
+
const stripped = number.replace(/^whatsapp:/i, "").trim();
|
|
33
|
+
if (stripped.includes("@")) return stripped;
|
|
34
|
+
const phoneDigits = normalizeE164(stripped).replace(/\D/g, "");
|
|
35
|
+
const lid = readLidForwardMapping({
|
|
36
|
+
phoneDigits,
|
|
37
|
+
opts
|
|
38
|
+
});
|
|
39
|
+
return lid ? `${lid}@lid` : `${phoneDigits}@s.whatsapp.net`;
|
|
40
|
+
}
|
|
41
|
+
function addUniqueString(target, value) {
|
|
42
|
+
const normalized = value?.trim();
|
|
43
|
+
if (normalized && !target.includes(normalized)) target.push(normalized);
|
|
44
|
+
}
|
|
45
|
+
async function tryLookupMappedJid(lookup) {
|
|
46
|
+
if (!lookup) return null;
|
|
47
|
+
try {
|
|
48
|
+
return await lookup() ?? null;
|
|
49
|
+
} catch (err) {
|
|
50
|
+
if (shouldLogVerbose()) logVerbose(`LID mapping lookup failed: ${String(err)}`);
|
|
51
|
+
return null;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
const DIRECT_PN_JID_RE = /^(\d+)(?::\d+)?@(s\.whatsapp\.net|hosted)$/i;
|
|
55
|
+
const DIRECT_LID_JID_RE = /^(\d+)(?::\d+)?@(lid|hosted\.lid)$/i;
|
|
56
|
+
function addEquivalentDirectChatCandidate(target, jid) {
|
|
57
|
+
addUniqueString(target, jid);
|
|
58
|
+
const pnMatch = jid?.match(DIRECT_PN_JID_RE);
|
|
59
|
+
if (pnMatch) {
|
|
60
|
+
addUniqueString(target, `${pnMatch[1]}@${pnMatch[2]}`);
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
const lidMatch = jid?.match(DIRECT_LID_JID_RE);
|
|
64
|
+
if (lidMatch) addUniqueString(target, `${lidMatch[1]}@${lidMatch[2]}`);
|
|
65
|
+
}
|
|
66
|
+
async function resolveEquivalentWhatsAppDirectChatJids(jid, opts) {
|
|
67
|
+
const normalized = jid?.trim();
|
|
68
|
+
if (!normalized) return [];
|
|
69
|
+
const candidates = [];
|
|
70
|
+
addEquivalentDirectChatCandidate(candidates, normalized);
|
|
71
|
+
const pnMatch = normalized.match(DIRECT_PN_JID_RE);
|
|
72
|
+
if (pnMatch) {
|
|
73
|
+
addEquivalentDirectChatCandidate(candidates, await tryLookupMappedJid(() => opts?.lidLookup?.getLIDForPN?.(normalized)));
|
|
74
|
+
const mappedLocalLid = readLidForwardMapping({
|
|
75
|
+
phoneDigits: pnMatch[1],
|
|
76
|
+
opts
|
|
77
|
+
});
|
|
78
|
+
const localLidDomain = pnMatch[2].toLowerCase() === "hosted" ? "hosted.lid" : "lid";
|
|
79
|
+
addUniqueString(candidates, mappedLocalLid ? `${mappedLocalLid}@${localLidDomain}` : null);
|
|
80
|
+
return candidates;
|
|
81
|
+
}
|
|
82
|
+
const lidMatch = normalized.match(DIRECT_LID_JID_RE);
|
|
83
|
+
if (lidMatch) {
|
|
84
|
+
addEquivalentDirectChatCandidate(candidates, await tryLookupMappedJid(() => opts?.lidLookup?.getPNForLID?.(normalized)));
|
|
85
|
+
const e164 = jidToE164(normalized, {
|
|
86
|
+
...opts,
|
|
87
|
+
logMissing: false
|
|
88
|
+
});
|
|
89
|
+
addUniqueString(candidates, e164 && lidMatch[2].toLowerCase() === "hosted.lid" ? `${e164.replace(/\D/g, "")}@hosted` : e164 ? toWhatsappJid(e164) : null);
|
|
90
|
+
}
|
|
91
|
+
return candidates;
|
|
92
|
+
}
|
|
93
|
+
function resolveLidMappingDirs(params) {
|
|
94
|
+
const dirs = /* @__PURE__ */ new Set();
|
|
95
|
+
const addDir = (dir) => {
|
|
96
|
+
if (!dir) return;
|
|
97
|
+
dirs.add(resolveUserPath$1(dir));
|
|
98
|
+
};
|
|
99
|
+
addDir(params.opts?.authDir);
|
|
100
|
+
for (const dir of params.opts?.lidMappingDirs ?? []) addDir(dir);
|
|
101
|
+
addDir(CONFIG_DIR);
|
|
102
|
+
addDir(path.join(CONFIG_DIR, "credentials"));
|
|
103
|
+
return [...dirs];
|
|
104
|
+
}
|
|
105
|
+
function readLidReverseMapping(params) {
|
|
106
|
+
const mappingFilename = `lid-mapping-${params.lid}_reverse.json`;
|
|
107
|
+
const mappingDirs = resolveLidMappingDirs({ opts: params.opts });
|
|
108
|
+
for (const dir of mappingDirs) {
|
|
109
|
+
const mappingPath = path.join(dir, mappingFilename);
|
|
110
|
+
try {
|
|
111
|
+
const data = fs.readFileSync(mappingPath, "utf8");
|
|
112
|
+
const phone = JSON.parse(data);
|
|
113
|
+
if (phone === null || phone === void 0) continue;
|
|
114
|
+
return normalizeE164(String(phone));
|
|
115
|
+
} catch {}
|
|
116
|
+
}
|
|
117
|
+
return null;
|
|
118
|
+
}
|
|
119
|
+
function readLidForwardMapping(params) {
|
|
120
|
+
const mappingFilename = `lid-mapping-${params.phoneDigits}.json`;
|
|
121
|
+
const mappingDirs = resolveLidMappingDirs({ opts: params.opts });
|
|
122
|
+
for (const dir of mappingDirs) {
|
|
123
|
+
const mappingPath = path.join(dir, mappingFilename);
|
|
124
|
+
try {
|
|
125
|
+
const data = fs.readFileSync(mappingPath, "utf8");
|
|
126
|
+
const lid = JSON.parse(data);
|
|
127
|
+
if (lid === null || lid === void 0) continue;
|
|
128
|
+
const digits = String(lid).replace(/\D/g, "");
|
|
129
|
+
if (digits) return digits;
|
|
130
|
+
} catch {}
|
|
131
|
+
}
|
|
132
|
+
return null;
|
|
133
|
+
}
|
|
134
|
+
function jidToE164(jid, opts) {
|
|
135
|
+
const match = jid.match(/^(\d+)(?::\d+)?@(s\.whatsapp\.net|hosted)$/);
|
|
136
|
+
if (match) return `+${match[1]}`;
|
|
137
|
+
const lidMatch = jid.match(/^(\d+)(?::\d+)?@(lid|hosted\.lid)$/);
|
|
138
|
+
if (!lidMatch) return null;
|
|
139
|
+
const phone = readLidReverseMapping({
|
|
140
|
+
lid: lidMatch[1],
|
|
141
|
+
opts
|
|
142
|
+
});
|
|
143
|
+
if (phone) return phone;
|
|
144
|
+
if (opts?.logMissing ?? shouldLogVerbose()) logVerbose(`LID mapping not found for ${lidMatch[1]}; skipping inbound message`);
|
|
145
|
+
return null;
|
|
146
|
+
}
|
|
147
|
+
async function resolveJidToE164(jid, opts) {
|
|
148
|
+
if (!jid) return null;
|
|
149
|
+
const direct = jidToE164(jid, opts);
|
|
150
|
+
if (direct) return direct;
|
|
151
|
+
if (!/(@lid|@hosted\.lid)$/.test(jid) || !opts?.lidLookup?.getPNForLID) return null;
|
|
152
|
+
try {
|
|
153
|
+
const pnJid = await opts.lidLookup.getPNForLID(jid);
|
|
154
|
+
if (!pnJid) return null;
|
|
155
|
+
return jidToE164(pnJid, opts);
|
|
156
|
+
} catch (err) {
|
|
157
|
+
if (shouldLogVerbose()) logVerbose(`LID mapping lookup failed for ${jid}: ${String(err)}`);
|
|
158
|
+
return null;
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
function markdownToWhatsApp(text) {
|
|
162
|
+
if (!text) return text;
|
|
163
|
+
const fences = [];
|
|
164
|
+
let result = text.replace(/```[\s\S]*?```/g, (match) => {
|
|
165
|
+
fences.push(match);
|
|
166
|
+
return `${WHATSAPP_FENCE_PLACEHOLDER}${fences.length - 1}${WHATSAPP_PLACEHOLDER_TERMINATOR}`;
|
|
167
|
+
});
|
|
168
|
+
const inlineCodes = [];
|
|
169
|
+
result = result.replace(/`[^`\n]+`/g, (match) => {
|
|
170
|
+
inlineCodes.push(match);
|
|
171
|
+
return `${WHATSAPP_INLINE_CODE_PLACEHOLDER}${inlineCodes.length - 1}${WHATSAPP_PLACEHOLDER_TERMINATOR}`;
|
|
172
|
+
});
|
|
173
|
+
result = result.replace(/\*\*\*(.+?)\*\*\*/g, "*_$1_*");
|
|
174
|
+
result = result.replace(/___(.+?)___/g, "*_$1_*");
|
|
175
|
+
result = result.replace(/\*\*_(.+?)_\*\*/g, "*_$1_*");
|
|
176
|
+
result = result.replace(/__\*(.+?)\*__/g, "*_$1_*");
|
|
177
|
+
result = result.replace(/_\*\*(.+?)\*\*_/g, "*_$1_*");
|
|
178
|
+
result = result.replace(/\*__(.+?)__\*/g, "*_$1_*");
|
|
179
|
+
result = result.replace(/\*\*(.+?)\*\*/g, "*$1*");
|
|
180
|
+
result = result.replace(/__(.+?)__/g, "*$1*");
|
|
181
|
+
result = result.replace(/~~(.+?)~~/g, "~$1~");
|
|
182
|
+
const terminator = escapeRegExp(WHATSAPP_PLACEHOLDER_TERMINATOR);
|
|
183
|
+
result = result.replace(new RegExp(`${escapeRegExp(WHATSAPP_INLINE_CODE_PLACEHOLDER)}(\\d+)${terminator}`, "g"), (_, idx) => inlineCodes[Number(idx)] ?? "");
|
|
184
|
+
result = result.replace(new RegExp(`${escapeRegExp(WHATSAPP_FENCE_PLACEHOLDER)}(\\d+)${terminator}`, "g"), (_, idx) => fences[Number(idx)] ?? "");
|
|
185
|
+
return result;
|
|
186
|
+
}
|
|
187
|
+
//#endregion
|
|
188
|
+
export { resolveEquivalentWhatsAppDirectChatJids as a, toWhatsappJidWithLid as c, markdownToWhatsApp as i, isSelfChatMode as n, resolveJidToE164 as o, jidToE164 as r, toWhatsappJid as s, assertWebChannel as t };
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import "./targets-runtime-C-GiVn6Y.mjs";
|
|
2
|
+
import { convertMarkdownTables, sanitizeAssistantVisibleText, sanitizeAssistantVisibleTextWithProfile, stripToolCallXmlTags } from "openclaw/plugin-sdk/text-chunking";
|
|
3
|
+
import { normalizeE164, resolveUserPath as resolveUserPath$1, sleep } from "openclaw/plugin-sdk/text-utility-runtime";
|
|
4
|
+
export { sanitizeAssistantVisibleTextWithProfile as a, sanitizeAssistantVisibleText as i, normalizeE164 as n, sleep as o, resolveUserPath$1 as r, stripToolCallXmlTags as s, convertMarkdownTables as t };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as handleWhatsAppAction } from "
|
|
1
|
+
import { t as handleWhatsAppAction } from "./.setup/action-runtime-DLK_9v4r.mjs";
|
|
2
2
|
export { handleWhatsAppAction };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as handleWhatsAppAction } from "
|
|
1
|
+
import { t as handleWhatsAppAction } from "./.setup/action-runtime-DLK_9v4r.mjs";
|
|
2
2
|
export { handleWhatsAppAction };
|