@openclaw/whatsapp 2026.8.1-beta.2 → 2026.8.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{accounts-BX2fZUyR.js → accounts-CeKQbu_s.js} +9 -26
- package/dist/{action-runtime-B4e3XFOY.js → action-runtime-YA_Yvunu.js} +2 -2
- package/dist/action-runtime-api.js +1 -1
- package/dist/action-runtime.runtime.js +1 -1
- package/dist/{call-tool-api.js → agent-tools-api.js} +11 -4
- package/dist/{agent-tools-login-BjRpD-JQ.js → agent-tools-login-B-2qZPzc.js} +12 -3
- package/dist/api.js +7 -7
- package/dist/{approval-handler.runtime-fgGZhALv.js → approval-handler.runtime-C7jZ8rsD.js} +3 -3
- package/dist/{approval-reactions-CmtJCxe_.js → approval-reactions-rpaNVHzZ.js} +11 -15
- package/dist/{auth-store-B_DQIdzp.js → auth-store-CtpBqH5S.js} +3 -6
- package/dist/{channel-DJVQHz_V.js → channel-Dx09AAmX.js} +11 -13
- package/dist/channel-plugin-api.js +1 -1
- package/dist/{channel-react-action-d6OacTNj.js → channel-react-action-n9a8Hk5i.js} +14 -12
- package/dist/{channel.runtime-RxuNGZ7w.js → channel.runtime-D_PjmeMT.js} +4 -4
- package/dist/{channel.setup-Cmvd967u.js → channel.setup-CRJQiWbh.js} +1 -1
- package/dist/{connection-controller-CUyZgGpf.js → connection-controller-CIYuBJrs.js} +2 -2
- package/dist/{directory-config-Pc4f07wB.js → directory-config-Ci8Jjsw4.js} +3 -3
- package/dist/directory-contract-api.js +1 -1
- package/dist/{group-session-key-DmFc_Cqi.js → group-session-key-CH9jJIVQ.js} +1 -1
- package/dist/index.js +4 -4
- package/dist/light-runtime-api.js +2 -2
- package/dist/{login-D6_rfxTZ.js → login-1u5WcfTn.js} +4 -4
- package/dist/{login-qr-B0VyVSqQ.js → login-qr-B_1sr0hk.js} +38 -17
- package/dist/login-qr-runtime.js +1 -1
- package/dist/{monitor-BCe5Mm-1.js → monitor-CySzv38g.js} +156 -564
- package/dist/{question-reactions-D3eAeB0i.js → question-reactions-B9D6MHXZ.js} +1 -1
- package/dist/runtime-api.js +8 -8
- package/dist/{send-prK8F7Vj.js → send-C3S-NqyO.js} +24 -10
- package/dist/{send-api-DimZST3E.js → send-api-C-FFC1p_.js} +46 -36
- package/dist/{setup-finalize-D3n71Uyx.js → setup-finalize-CRzMpx84.js} +4 -4
- package/dist/setup-plugin-api.js +1 -1
- package/dist/{setup-surface-BCZszf3l.js → setup-surface-ym4doiv3.js} +3 -3
- package/dist/{shared-Dp9M3ZPX.js → shared-D3B14d45.js} +12 -6
- package/dist/{socket-close-09FojDO2.js → socket-close-2T0_jZTN.js} +1 -1
- package/node_modules/baileys/lib/Defaults/index.js +1 -1
- package/node_modules/baileys/lib/Socket/business.d.ts.map +1 -1
- package/node_modules/baileys/lib/Socket/chats.d.ts +1 -0
- package/node_modules/baileys/lib/Socket/chats.d.ts.map +1 -1
- package/node_modules/baileys/lib/Socket/chats.js +10 -5
- package/node_modules/baileys/lib/Socket/chats.js.map +1 -1
- package/node_modules/baileys/lib/Socket/communities.d.ts.map +1 -1
- package/node_modules/baileys/lib/Socket/groups.d.ts.map +1 -1
- package/node_modules/baileys/lib/Socket/index.d.ts.map +1 -1
- package/node_modules/baileys/lib/Socket/messages-recv.d.ts.map +1 -1
- package/node_modules/baileys/lib/Socket/messages-send.d.ts.map +1 -1
- package/node_modules/baileys/lib/Socket/newsletter.d.ts.map +1 -1
- package/node_modules/baileys/lib/Socket/socket.d.ts.map +1 -1
- package/node_modules/baileys/lib/Socket/socket.js +3 -0
- package/node_modules/baileys/lib/Socket/socket.js.map +1 -1
- package/node_modules/baileys/lib/Types/index.d.ts +1 -0
- package/node_modules/baileys/lib/Types/index.d.ts.map +1 -1
- package/node_modules/baileys/lib/Types/index.js.map +1 -1
- package/node_modules/baileys/lib/Utils/browser-utils.d.ts.map +1 -1
- package/node_modules/baileys/lib/Utils/browser-utils.js +1 -0
- package/node_modules/baileys/lib/Utils/browser-utils.js.map +1 -1
- package/node_modules/baileys/lib/Utils/generics.d.ts +1 -0
- package/node_modules/baileys/lib/Utils/generics.d.ts.map +1 -1
- package/node_modules/baileys/lib/Utils/generics.js +1 -1
- package/node_modules/baileys/lib/Utils/generics.js.map +1 -1
- package/node_modules/baileys/lib/Utils/tc-token-utils.d.ts.map +1 -1
- package/node_modules/baileys/lib/Utils/tc-token-utils.js +3 -2
- package/node_modules/baileys/lib/Utils/tc-token-utils.js.map +1 -1
- package/node_modules/baileys/lib/Utils/validate-connection.d.ts.map +1 -1
- package/node_modules/baileys/lib/Utils/validate-connection.js +9 -2
- package/node_modules/baileys/lib/Utils/validate-connection.js.map +1 -1
- package/node_modules/baileys/node_modules/content-type/README.md +2 -0
- package/node_modules/baileys/node_modules/content-type/dist/index.d.ts +20 -0
- package/node_modules/baileys/node_modules/content-type/dist/index.js +20 -14
- package/node_modules/baileys/node_modules/content-type/dist/index.js.map +1 -1
- package/node_modules/baileys/node_modules/content-type/package.json +1 -1
- package/node_modules/baileys/node_modules/file-type/package.json +1 -1
- package/node_modules/baileys/node_modules/file-type/readme.md +3 -0
- package/node_modules/baileys/node_modules/file-type/source/detectors/zip.js +6 -1
- package/node_modules/baileys/node_modules/file-type/source/index.d.ts +3 -0
- package/node_modules/baileys/node_modules/file-type/source/index.js +25 -13
- package/node_modules/baileys/node_modules/music-metadata/LICENSE.txt +9 -9
- package/node_modules/baileys/node_modules/music-metadata/README.md +878 -878
- package/node_modules/baileys/node_modules/music-metadata/lib/ParseError.d.ts +1 -1
- package/node_modules/baileys/node_modules/music-metadata/lib/ParseError.js +1 -1
- package/node_modules/baileys/node_modules/music-metadata/lib/asf/AsfObject.d.ts +1 -4
- package/node_modules/baileys/node_modules/music-metadata/lib/asf/AsfObject.js +66 -30
- package/node_modules/baileys/node_modules/music-metadata/lib/asf/AsfParser.d.ts +5 -1
- package/node_modules/baileys/node_modules/music-metadata/lib/asf/AsfParser.js +94 -25
- package/node_modules/baileys/node_modules/music-metadata/lib/dsf/DsfChunk.js +2 -2
- package/node_modules/baileys/node_modules/music-metadata/lib/dsf/DsfParser.js +38 -13
- package/node_modules/baileys/node_modules/music-metadata/lib/mp4/AtomToken.js +2 -1
- package/node_modules/baileys/node_modules/music-metadata/lib/mp4/MP4Parser.js +34 -7
- package/node_modules/baileys/node_modules/music-metadata/lib/ogg/speex/SpeexStream.d.ts +7 -0
- package/node_modules/baileys/node_modules/music-metadata/lib/ogg/speex/SpeexStream.js +13 -0
- package/node_modules/baileys/node_modules/music-metadata/lib/riff/RiffChunk.js +1 -1
- package/node_modules/baileys/node_modules/music-metadata/package.json +156 -156
- package/node_modules/baileys/node_modules/protobufjs/README.md +61 -84
- package/node_modules/baileys/node_modules/protobufjs/dist/light/protobuf.js +66 -45
- package/node_modules/baileys/node_modules/protobufjs/dist/light/protobuf.js.map +1 -1
- package/node_modules/baileys/node_modules/protobufjs/dist/light/protobuf.min.js +3 -3
- package/node_modules/baileys/node_modules/protobufjs/dist/light/protobuf.min.js.map +1 -1
- package/node_modules/baileys/node_modules/protobufjs/dist/minimal/protobuf.js +47 -40
- package/node_modules/baileys/node_modules/protobufjs/dist/minimal/protobuf.js.map +1 -1
- package/node_modules/baileys/node_modules/protobufjs/dist/minimal/protobuf.min.js +3 -3
- package/node_modules/baileys/node_modules/protobufjs/dist/minimal/protobuf.min.js.map +1 -1
- package/node_modules/baileys/node_modules/protobufjs/dist/protobuf.js +92 -68
- package/node_modules/baileys/node_modules/protobufjs/dist/protobuf.js.map +1 -1
- package/node_modules/baileys/node_modules/protobufjs/dist/protobuf.min.js +3 -3
- package/node_modules/baileys/node_modules/protobufjs/dist/protobuf.min.js.map +1 -1
- package/node_modules/baileys/node_modules/protobufjs/ext/descriptor.js +26 -10
- package/node_modules/baileys/node_modules/protobufjs/index.d.ts +3 -0
- package/node_modules/baileys/node_modules/protobufjs/package.json +1 -1
- package/node_modules/baileys/node_modules/protobufjs/src/converter.js +5 -1
- package/node_modules/baileys/node_modules/protobufjs/src/enum.js +5 -2
- package/node_modules/baileys/node_modules/protobufjs/src/field.js +6 -1
- package/node_modules/baileys/node_modules/protobufjs/src/parse.js +26 -23
- package/node_modules/baileys/node_modules/protobufjs/src/reader.js +36 -9
- package/node_modules/baileys/node_modules/protobufjs/src/util/codegen.js +3 -1
- package/node_modules/baileys/node_modules/protobufjs/src/util/utf8.js +2 -28
- package/node_modules/baileys/node_modules/protobufjs/src/writer.js +7 -1
- package/node_modules/baileys/package.json +1 -1
- package/node_modules/typebox/build/format/date.d.mts +1 -1
- package/node_modules/typebox/build/format/date.mjs +1 -1
- package/node_modules/typebox/build/format/date_time.d.mts +2 -2
- package/node_modules/typebox/build/format/date_time.mjs +3 -3
- package/node_modules/typebox/build/format/email.d.mts +1 -1
- package/node_modules/typebox/build/format/email.mjs +2 -2
- package/node_modules/typebox/build/format/hostname.mjs +2 -10
- package/node_modules/typebox/build/format/idn_email.d.mts +1 -1
- package/node_modules/typebox/build/format/idn_email.mjs +3 -3
- package/node_modules/typebox/build/format/idn_hostname.d.mts +1 -0
- package/node_modules/typebox/build/format/idn_hostname.mjs +3 -11
- package/node_modules/typebox/build/format/idna/format/bidi.d.mts +3 -0
- package/node_modules/typebox/build/format/idna/format/bidi.mjs +98 -0
- package/node_modules/typebox/build/format/idna/format/puny.d.mts +3 -0
- package/node_modules/typebox/build/format/idna/format/puny.mjs +144 -0
- package/node_modules/typebox/build/format/idna/hostname.d.mts +1 -0
- package/node_modules/typebox/build/format/idna/hostname.mjs +16 -0
- package/node_modules/typebox/build/format/idna/idn-hostname.d.mts +1 -0
- package/node_modules/typebox/build/format/idna/idn-hostname.mjs +23 -0
- package/node_modules/typebox/build/format/idna/index.d.mts +2 -0
- package/node_modules/typebox/build/format/idna/index.mjs +2 -0
- package/node_modules/typebox/build/format/idna/label/ascii.d.mts +1 -0
- package/node_modules/typebox/build/format/idna/label/ascii.mjs +9 -0
- package/node_modules/typebox/build/format/idna/label/puny.d.mts +1 -0
- package/node_modules/typebox/build/format/idna/label/puny.mjs +28 -0
- package/node_modules/typebox/build/format/idna/label/unicode.d.mts +1 -0
- package/node_modules/typebox/build/format/idna/label/unicode.mjs +106 -0
- package/node_modules/typebox/build/format/idna/pattern/pattern.d.mts +30 -0
- package/node_modules/typebox/build/format/idna/pattern/pattern.mjs +70 -0
- package/node_modules/typebox/build/format/ipv4.d.mts +0 -1
- package/node_modules/typebox/build/format/ipv4.mjs +2 -32
- package/node_modules/typebox/build/format/ipv6.mjs +2 -61
- package/node_modules/typebox/build/format/iri.d.mts +2 -2
- package/node_modules/typebox/build/format/iri.mjs +26 -8
- package/node_modules/typebox/build/format/iri_reference.d.mts +2 -2
- package/node_modules/typebox/build/format/iri_reference.mjs +9 -55
- package/node_modules/typebox/build/format/regex.d.mts +1 -2
- package/node_modules/typebox/build/format/regex.mjs +2 -6
- package/node_modules/typebox/build/format/time.d.mts +2 -2
- package/node_modules/typebox/build/format/time.mjs +19 -14
- package/node_modules/typebox/build/format/uri.d.mts +1 -1
- package/node_modules/typebox/build/format/uri.mjs +3 -130
- package/node_modules/typebox/build/format/uri_reference.d.mts +1 -1
- package/node_modules/typebox/build/format/uri_reference.mjs +2 -3
- package/node_modules/typebox/build/format/uri_template.d.mts +2 -3
- package/node_modules/typebox/build/format/uri_template.mjs +4 -5
- package/node_modules/typebox/build/format/url.d.mts +3 -3
- package/node_modules/typebox/build/format/url.mjs +4 -5
- package/node_modules/typebox/build/guard/emit.d.mts +3 -1
- package/node_modules/typebox/build/guard/emit.mjs +12 -5
- package/node_modules/typebox/build/guard/guard.d.mts +8 -2
- package/node_modules/typebox/build/guard/guard.mjs +25 -4
- package/node_modules/typebox/build/guard/string.d.mts +2 -2
- package/node_modules/typebox/build/guard/string.mjs +7 -7
- package/node_modules/typebox/build/schema/engine/_context.mjs +3 -3
- package/node_modules/typebox/build/schema/engine/_functions.mjs +1 -2
- package/node_modules/typebox/build/schema/engine/_regexp.d.mts +2 -0
- package/node_modules/typebox/build/schema/engine/_regexp.mjs +4 -0
- package/node_modules/typebox/build/schema/engine/_stack.mjs +12 -13
- package/node_modules/typebox/build/schema/engine/additionalItems.mjs +17 -7
- package/node_modules/typebox/build/schema/engine/additionalProperties.mjs +4 -3
- package/node_modules/typebox/build/schema/engine/contains.mjs +18 -6
- package/node_modules/typebox/build/schema/engine/enum.mjs +1 -1
- package/node_modules/typebox/build/schema/engine/items.mjs +26 -6
- package/node_modules/typebox/build/schema/engine/maxContains.mjs +3 -3
- package/node_modules/typebox/build/schema/engine/minContains.mjs +14 -4
- package/node_modules/typebox/build/schema/engine/not.mjs +4 -2
- package/node_modules/typebox/build/schema/engine/oneOf.mjs +7 -6
- package/node_modules/typebox/build/schema/engine/pattern.mjs +3 -2
- package/node_modules/typebox/build/schema/engine/patternProperties.mjs +4 -3
- package/node_modules/typebox/build/schema/engine/ref.mjs +1 -7
- package/node_modules/typebox/build/schema/engine/schema.mjs +13 -4
- package/node_modules/typebox/build/schema/engine/type.mjs +1 -1
- package/node_modules/typebox/build/schema/resolve/resolve.d.mts +4 -1
- package/node_modules/typebox/build/schema/resolve/resolve.mjs +202 -1
- package/node_modules/typebox/build/schema/static/propertyNames.d.mts +5 -0
- package/node_modules/typebox/build/schema/static/propertyNames.mjs +3 -0
- package/node_modules/typebox/build/schema/static/schema.d.mts +3 -0
- package/node_modules/typebox/build/schema/types/index.d.mts +0 -2
- package/node_modules/typebox/build/schema/types/index.mjs +0 -2
- package/node_modules/typebox/build/system/memory/clone.mjs +14 -11
- package/node_modules/typebox/build/system/memory/discard.mjs +6 -5
- package/node_modules/typebox/build/system/settings/settings.d.mts +9 -0
- package/node_modules/typebox/build/system/settings/settings.mjs +2 -0
- package/node_modules/typebox/build/type/engine/call/distribute_arguments.d.mts +6 -1
- package/node_modules/typebox/build/type/engine/call/distribute_arguments.mjs +16 -3
- package/node_modules/typebox/build/type/engine/call/instantiate.mjs +34 -4
- package/node_modules/typebox/build/type/engine/evaluate/broaden.d.mts +5 -5
- package/node_modules/typebox/build/type/engine/evaluate/broaden.mjs +20 -26
- package/node_modules/typebox/build/type/engine/evaluate/compare.d.mts +6 -10
- package/node_modules/typebox/build/type/engine/evaluate/compare.mjs +9 -13
- package/node_modules/typebox/build/type/engine/evaluate/composite.d.mts +7 -4
- package/node_modules/typebox/build/type/engine/evaluate/composite.mjs +12 -19
- package/node_modules/typebox/build/type/engine/evaluate/distribute.d.mts +4 -20
- package/node_modules/typebox/build/type/engine/evaluate/distribute.mjs +8 -20
- package/node_modules/typebox/build/type/engine/evaluate/evaluate.d.mts +4 -4
- package/node_modules/typebox/build/type/engine/evaluate/evaluate.mjs +11 -8
- package/node_modules/typebox/build/type/engine/evaluate/flatten.d.mts +1 -1
- package/node_modules/typebox/build/type/engine/evaluate/flatten.mjs +3 -4
- package/node_modules/typebox/build/type/engine/evaluate/narrow.d.mts +17 -2
- package/node_modules/typebox/build/type/engine/evaluate/narrow.mjs +26 -6
- package/node_modules/typebox/build/type/engine/exclude/operation.mjs +3 -4
- package/node_modules/typebox/build/type/engine/extract/operation.d.mts +1 -1
- package/node_modules/typebox/build/type/engine/extract/operation.mjs +3 -4
- package/node_modules/typebox/build/type/engine/priority/priority.d.mts +2 -2
- package/node_modules/typebox/build/type/engine/priority/priority.mjs +3 -4
- package/node_modules/typebox/build/type/script/mapping.d.mts +32 -29
- package/node_modules/typebox/build/type/script/mapping.mjs +18 -25
- package/node_modules/typebox/build/type/script/parser.d.mts +19 -25
- package/node_modules/typebox/build/type/script/parser.mjs +27 -23
- package/node_modules/typebox/build/value/errors/errors.d.mts +2 -2
- package/node_modules/typebox/build/value/errors/errors.mjs +1 -1
- package/node_modules/typebox/package.json +27 -27
- package/node_modules/typebox/readme.md +79 -82
- package/openclaw.plugin.json +2 -1
- package/package.json +6 -6
- package/node_modules/typebox/build/format/_idna.d.mts +0 -2
- package/node_modules/typebox/build/format/_idna.mjs +0 -246
- package/node_modules/typebox/build/format/_puny.d.mts +0 -1
- package/node_modules/typebox/build/format/_puny.mjs +0 -77
- package/node_modules/typebox/build/schema/resolve/ref.d.mts +0 -3
- package/node_modules/typebox/build/schema/resolve/ref.mjs +0 -146
- package/node_modules/typebox/build/schema/types/contentEncoding.d.mts +0 -9
- package/node_modules/typebox/build/schema/types/contentEncoding.mjs +0 -13
- package/node_modules/typebox/build/schema/types/contentMediaType.d.mts +0 -9
- package/node_modules/typebox/build/schema/types/contentMediaType.mjs +0 -13
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { a as resolveWhatsAppAccount } from "./accounts-
|
|
2
|
-
import { c as logoutWeb, f as readWebAuthExistsForDecision, g as readWebSelfId, n as WHATSAPP_AUTH_UNSTABLE_CODE } from "./auth-store-
|
|
1
|
+
import { a as resolveWhatsAppAccount } from "./accounts-CeKQbu_s.js";
|
|
2
|
+
import { c as logoutWeb, f as readWebAuthExistsForDecision, g as readWebSelfId, n as WHATSAPP_AUTH_UNSTABLE_CODE } from "./auth-store-CtpBqH5S.js";
|
|
3
3
|
import { t as getActiveWebListener } from "./active-listener-BEjWsCNM.js";
|
|
4
|
-
import { r as createWaSocket, u as resolveWhatsAppSocketTiming } from "./socket-close-
|
|
4
|
+
import { r as createWaSocket, u as resolveWhatsAppSocketTiming } from "./socket-close-2T0_jZTN.js";
|
|
5
5
|
import { t as formatError } from "./session-errors-JuazczrA.js";
|
|
6
|
-
import { i as closeWaSocket, o as waitForWhatsAppLoginResult, t as WHATSAPP_LOGGED_OUT_QR_MESSAGE } from "./connection-controller-
|
|
6
|
+
import { i as closeWaSocket, o as waitForWhatsAppLoginResult, t as WHATSAPP_LOGGED_OUT_QR_MESSAGE } from "./connection-controller-CIYuBJrs.js";
|
|
7
7
|
import { logInfo } from "openclaw/plugin-sdk/logging-core";
|
|
8
8
|
import { danger, defaultRuntime, info, success } from "openclaw/plugin-sdk/runtime-env";
|
|
9
9
|
import { renderQrPngDataUrl } from "openclaw/plugin-sdk/media-runtime";
|
|
@@ -28,8 +28,8 @@ function closeSocket(sock) {
|
|
|
28
28
|
async function resetActiveLogin(accountId, reason) {
|
|
29
29
|
const login = activeLogins.get(accountId);
|
|
30
30
|
if (login) {
|
|
31
|
-
closeSocket(login.sock);
|
|
32
31
|
activeLogins.delete(accountId);
|
|
32
|
+
closeSocket(login.sock);
|
|
33
33
|
}
|
|
34
34
|
if (reason) logInfo(reason);
|
|
35
35
|
}
|
|
@@ -94,6 +94,7 @@ function attachLoginWaiter(accountId, login) {
|
|
|
94
94
|
verbose: login.verbose,
|
|
95
95
|
runtime: login.runtime,
|
|
96
96
|
socketTiming: login.socketTiming,
|
|
97
|
+
beforeCredentialPersistence: login.beforeCredentialPersistence,
|
|
97
98
|
onQr: (qr) => {
|
|
98
99
|
const current = activeLogins.get(accountId);
|
|
99
100
|
if (!current || current.id !== login.id) return;
|
|
@@ -203,7 +204,8 @@ async function startWebLoginWithQr(opts = {}) {
|
|
|
203
204
|
if (!await logoutWeb({
|
|
204
205
|
authDir: account.authDir,
|
|
205
206
|
isLegacyAuthDir: account.isLegacyAuthDir,
|
|
206
|
-
runtime
|
|
207
|
+
runtime,
|
|
208
|
+
beforeCredentialPersistence: opts.beforeCredentialPersistence
|
|
207
209
|
})) return { message: "WhatsApp login failed: existing auth could not be cleared. Remove or fix the configured WhatsApp auth directory, then retry login." };
|
|
208
210
|
} catch (err) {
|
|
209
211
|
return { message: `WhatsApp login failed: ${formatError(err)}` };
|
|
@@ -226,10 +228,20 @@ async function startWebLoginWithQr(opts = {}) {
|
|
|
226
228
|
let sock;
|
|
227
229
|
let pendingQr = null;
|
|
228
230
|
const loginId = randomUUID();
|
|
231
|
+
const operationOwner = {};
|
|
232
|
+
const beforeCredentialPersistence = async () => {
|
|
233
|
+
const login = operationOwner.current;
|
|
234
|
+
if (!login) {
|
|
235
|
+
await opts.beforeCredentialPersistence?.();
|
|
236
|
+
return;
|
|
237
|
+
}
|
|
238
|
+
if (activeLogins.get(account.accountId) !== login || !isLoginFresh(login)) throw new Error("WhatsApp login is no longer active.");
|
|
239
|
+
};
|
|
229
240
|
try {
|
|
230
241
|
sock = await createWaSocket(false, Boolean(opts.verbose), {
|
|
231
242
|
authDir: account.authDir,
|
|
232
243
|
...socketTiming,
|
|
244
|
+
beforeCredentialPersistence,
|
|
233
245
|
onQr: (qr) => {
|
|
234
246
|
pendingQr = qr;
|
|
235
247
|
const current = activeLogins.get(account.accountId);
|
|
@@ -256,7 +268,7 @@ async function startWebLoginWithQr(opts = {}) {
|
|
|
256
268
|
await resetActiveLogin(account.accountId);
|
|
257
269
|
return { message: `Failed to start WhatsApp login: ${String(err)}` };
|
|
258
270
|
}
|
|
259
|
-
const
|
|
271
|
+
const nextLogin = {
|
|
260
272
|
accountId: account.accountId,
|
|
261
273
|
authDir: account.authDir,
|
|
262
274
|
isLegacyAuthDir: account.isLegacyAuthDir,
|
|
@@ -271,23 +283,32 @@ async function startWebLoginWithQr(opts = {}) {
|
|
|
271
283
|
qrRenderPromise: null,
|
|
272
284
|
verbose: Boolean(opts.verbose),
|
|
273
285
|
runtime,
|
|
274
|
-
socketTiming
|
|
286
|
+
socketTiming,
|
|
287
|
+
beforeCredentialPersistence
|
|
275
288
|
};
|
|
276
|
-
|
|
277
|
-
|
|
289
|
+
try {
|
|
290
|
+
await opts.beforeCredentialPersistence?.();
|
|
291
|
+
} catch (err) {
|
|
292
|
+
clearTimeout(qrTimer);
|
|
293
|
+
closeSocket(sock);
|
|
294
|
+
return { message: `Failed to start WhatsApp login: ${String(err)}` };
|
|
295
|
+
}
|
|
296
|
+
operationOwner.current = nextLogin;
|
|
297
|
+
resetQrUpdateSignal(nextLogin);
|
|
298
|
+
activeLogins.set(account.accountId, nextLogin);
|
|
278
299
|
if (pendingQr) {
|
|
279
|
-
const qrVersion = updateLoginQrState(
|
|
300
|
+
const qrVersion = updateLoginQrState(nextLogin, pendingQr);
|
|
280
301
|
renderLatestQrDataUrlInBackground({
|
|
281
302
|
accountId: account.accountId,
|
|
282
|
-
loginId:
|
|
303
|
+
loginId: nextLogin.id,
|
|
283
304
|
qr: pendingQr,
|
|
284
305
|
qrVersion
|
|
285
306
|
});
|
|
286
307
|
}
|
|
287
|
-
attachLoginWaiter(account.accountId,
|
|
308
|
+
attachLoginWaiter(account.accountId, nextLogin);
|
|
288
309
|
const loginStartResult = await waitForQrOrRecoveredLogin({
|
|
289
310
|
accountId: account.accountId,
|
|
290
|
-
login,
|
|
311
|
+
login: nextLogin,
|
|
291
312
|
qrPromise
|
|
292
313
|
});
|
|
293
314
|
clearTimeout(qrTimer);
|
|
@@ -304,8 +325,8 @@ async function startWebLoginWithQr(opts = {}) {
|
|
|
304
325
|
await resetActiveLogin(account.accountId);
|
|
305
326
|
return { message: loginStartResult.message };
|
|
306
327
|
}
|
|
307
|
-
const qr =
|
|
308
|
-
const qrVersion =
|
|
328
|
+
const qr = nextLogin.qr ?? loginStartResult.qr;
|
|
329
|
+
const qrVersion = nextLogin.qrVersion;
|
|
309
330
|
if (qrVersion === 0) {
|
|
310
331
|
await resetActiveLogin(account.accountId);
|
|
311
332
|
return { message: "Failed to capture the active WhatsApp QR. Ask me to generate a new one." };
|
|
@@ -314,7 +335,7 @@ async function startWebLoginWithQr(opts = {}) {
|
|
|
314
335
|
try {
|
|
315
336
|
qrDataUrl = await ensureQrDataUrl({
|
|
316
337
|
accountId: account.accountId,
|
|
317
|
-
loginId:
|
|
338
|
+
loginId: nextLogin.id,
|
|
318
339
|
qr,
|
|
319
340
|
qrVersion
|
|
320
341
|
});
|
package/dist/login-qr-runtime.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createLazyRuntimeModule } from "openclaw/plugin-sdk/lazy-runtime";
|
|
2
2
|
//#region extensions/whatsapp/login-qr-runtime.ts
|
|
3
|
-
const loadLoginQrModule = createLazyRuntimeModule(() => import("./login-qr-
|
|
3
|
+
const loadLoginQrModule = createLazyRuntimeModule(() => import("./login-qr-B_1sr0hk.js"));
|
|
4
4
|
async function startWebLoginWithQr(...args) {
|
|
5
5
|
const { startWebLoginWithQr: startWebLoginWithQrLocal } = await loadLoginQrModule();
|
|
6
6
|
return await startWebLoginWithQrLocal(...args);
|