@openclaw/whatsapp 2026.6.6 → 2026.6.8-beta.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.
@@ -1,6 +1,6 @@
1
1
  import { a as resolveWhatsAppAccount } from "./accounts-DgViSyJx.js";
2
2
  import { l as isSelfChatMode, n as normalizeE164 } from "./text-runtime-Dk37KYHj.js";
3
- import { a as getSelfIdentity, o as getSenderIdentity } from "./identity-xoLLdqEv.js";
3
+ import { a as getSelfIdentity, o as getSenderIdentity } from "./identity-Bupuq9vF.js";
4
4
  import { defaultRuntime } from "openclaw/plugin-sdk/runtime-env";
5
5
  import { resolveChannelGroupPolicy, resolveChannelGroupRequireMention } from "openclaw/plugin-sdk/channel-policy";
6
6
  import { createChannelPairingChallengeIssuer } from "openclaw/plugin-sdk/channel-pairing";
@@ -132,7 +132,7 @@ async function resolveWhatsAppCommandAuthorized(params) {
132
132
  cfg: params.cfg,
133
133
  policy,
134
134
  isGroup,
135
- conversationId: params.msg.conversationId ?? params.msg.chatId ?? params.msg.from,
135
+ conversationId: params.msg.conversationId ?? params.msg.platform.chatJid ?? params.msg.from,
136
136
  senderId: isGroup ? groupSender : dmSender,
137
137
  dmSenderId: dmSender,
138
138
  includeCommand: true
package/dist/api.js CHANGED
@@ -5,16 +5,16 @@ import { t as resolveWhatsAppOutboundTarget } from "./resolve-outbound-target-Cc
5
5
  import "./send-DSlVXKL_.js";
6
6
  import { n as getStatusCode, t as formatError } from "./session-errors-CbsoQqoy.js";
7
7
  import { c as assertWebChannel, d as markdownToWhatsApp, f as resolveJidToE164, l as isSelfChatMode, m as toWhatsappJidWithLid, n as normalizeE164, p as toWhatsappJid, r as resolveUserPath, u as jidToE164 } from "./text-runtime-Dk37KYHj.js";
8
- import { n as WHATSAPP_LEGACY_OUTBOUND_SEND_DEP_KEYS, t as whatsappPlugin } from "./channel-DhMmokKH.js";
8
+ import { n as WHATSAPP_LEGACY_OUTBOUND_SEND_DEP_KEYS, t as whatsappPlugin } from "./channel-DyUm8hqs.js";
9
9
  import { t as whatsappCommandPolicy } from "./command-policy-BIOSHySD.js";
10
- import { a as resolveWhatsAppGroupRequireMention, o as resolveWhatsAppGroupToolPolicy, s as resolveWhatsAppGroupIntroHint } from "./setup-core-D0Zm67Lv.js";
10
+ import { a as resolveWhatsAppGroupRequireMention, o as resolveWhatsAppGroupToolPolicy, s as resolveWhatsAppGroupIntroHint } from "./setup-core-Cp0NMO89.js";
11
11
  import "./config-schema-CROZuhT-.js";
12
- import { t as whatsappSetupPlugin } from "./channel.setup-Cq3cdnzK.js";
12
+ import { t as whatsappSetupPlugin } from "./channel.setup-CpyAie9O.js";
13
13
  import { t as DEFAULT_WEB_MEDIA_BYTES } from "./constants-HU41RHGI.js";
14
14
  import { n as listWhatsAppDirectoryGroupsFromConfig, r as listWhatsAppDirectoryPeersFromConfig } from "./directory-config-Dijefxc3.js";
15
- import { n as testing } from "./access-control-C53zKYSN.js";
16
- import { d as normalizeMessageContent, f as resolveInboundMediaMimetype, g as extractLocationData, h as extractContextInfo, p as describeReplyContext, t as createWebSendApi, y as extractText } from "./send-api-CFbAgIbn.js";
17
- import { r as waitForWaConnection, t as createWaSocket } from "./session-CoxlXm2K.js";
15
+ import { n as testing } from "./access-control-BKaMOvIk.js";
16
+ import { d as normalizeMessageContent, f as resolveInboundMediaMimetype, g as extractLocationData, h as extractContextInfo, p as describeReplyContext, t as createWebSendApi, y as extractText } from "./send-api-Cp9CUH5P.js";
17
+ import { r as waitForWaConnection, t as createWaSocket } from "./session-BCKUPRkN.js";
18
18
  import "openclaw/plugin-sdk/channel-actions";
19
19
  import "openclaw/plugin-sdk/account-resolution";
20
20
  import "openclaw/plugin-sdk/core";
@@ -1,7 +1,7 @@
1
1
  import { t as __exportAll } from "./rolldown-runtime-D7D4PA-g.js";
2
2
  import { a as readWebCredsJsonRawSync, c as statWebCredsFileSync, i as readWebCredsJsonRaw, o as resolveWebCredsBackupPath, s as resolveWebCredsPath, t as assertWebCredsPathRegularFileOrMissing } from "./creds-files-B1kSWtBg.js";
3
3
  import { r as resolveUserPath } from "./text-runtime-Dk37KYHj.js";
4
- import { c as resolveComparableIdentity } from "./identity-xoLLdqEv.js";
4
+ import { c as resolveComparableIdentity } from "./identity-Bupuq9vF.js";
5
5
  import path from "node:path";
6
6
  import { resolveOAuthDir as resolveOAuthDir$1 } from "openclaw/plugin-sdk/state-paths";
7
7
  import { replaceFileAtomic } from "openclaw/plugin-sdk/security-runtime";
@@ -9,8 +9,8 @@ import { p as toWhatsappJid } from "./text-runtime-Dk37KYHj.js";
9
9
  import { t as createWhatsAppLoginTool } from "./agent-tools-login-BX7eHgDm.js";
10
10
  import { i as lookupInboundMessageMetaForTarget } from "./quoted-message-CveINB35.js";
11
11
  import { t as whatsappCommandPolicy } from "./command-policy-BIOSHySD.js";
12
- import { a as resolveWhatsAppGroupRequireMention, c as resolveWhatsAppMentionStripRegexes, i as whatsappSetupWizardProxy, l as formatWhatsAppConfigAllowFromEntries, n as createWhatsAppPluginBase, o as resolveWhatsAppGroupToolPolicy, r as loadWhatsAppChannelRuntime, s as resolveWhatsAppGroupIntroHint, t as whatsappSetupAdapter } from "./setup-core-D0Zm67Lv.js";
13
- import { f as readWebAuthExistsForDecision, n as WHATSAPP_AUTH_UNSTABLE_CODE } from "./auth-store-B2ZibndQ.js";
12
+ import { a as resolveWhatsAppGroupRequireMention, c as resolveWhatsAppMentionStripRegexes, i as whatsappSetupWizardProxy, l as formatWhatsAppConfigAllowFromEntries, n as createWhatsAppPluginBase, o as resolveWhatsAppGroupToolPolicy, r as loadWhatsAppChannelRuntime, s as resolveWhatsAppGroupIntroHint, t as whatsappSetupAdapter } from "./setup-core-Cp0NMO89.js";
13
+ import { f as readWebAuthExistsForDecision, n as WHATSAPP_AUTH_UNSTABLE_CODE } from "./auth-store-e9VzLZ-S.js";
14
14
  import { t as detectWhatsAppLegacyStateMigrations } from "./state-migrations-D_BmQUR9.js";
15
15
  import { createActionGate as createActionGate$1 } from "openclaw/plugin-sdk/channel-actions";
16
16
  import { DEFAULT_ACCOUNT_ID, listCombinedAccountIds, normalizeOptionalAccountId, resolveListedDefaultAccountId } from "openclaw/plugin-sdk/account-core";
@@ -651,6 +651,19 @@ const whatsappPlugin = createChatChannelPlugin({
651
651
  }),
652
652
  mentions: { stripRegexes: ({ ctx }) => resolveWhatsAppMentionStripRegexes(ctx) },
653
653
  commands: whatsappCommandPolicy,
654
+ bindings: {
655
+ compileConfiguredBinding: ({ conversationId }) => {
656
+ const normalized = normalizeWhatsAppTarget(conversationId);
657
+ return normalized ? { conversationId: normalized } : null;
658
+ },
659
+ matchInboundConversation: ({ compiledBinding, conversationId }) => {
660
+ if (normalizeWhatsAppTarget(conversationId) === compiledBinding.conversationId) return {
661
+ conversationId: compiledBinding.conversationId,
662
+ matchPriority: 2
663
+ };
664
+ return null;
665
+ }
666
+ },
654
667
  agentPrompt: { reactionGuidance: ({ cfg, accountId }) => {
655
668
  const level = resolveWhatsAppAgentReactionGuidance({
656
669
  cfg,
@@ -1,2 +1,2 @@
1
- import { t as whatsappPlugin } from "./channel-DhMmokKH.js";
1
+ import { t as whatsappPlugin } from "./channel-DyUm8hqs.js";
2
2
  export { whatsappPlugin };
@@ -1,9 +1,9 @@
1
1
  import { startWebLoginWithQr as startWebLoginWithQr$1, waitForWebLogin as waitForWebLogin$1 } from "./login-qr-runtime.js";
2
- import { c as logoutWeb$1, d as readWebAuthExistsBestEffort$1, f as readWebAuthExistsForDecision$1, g as readWebSelfId$1, h as readWebAuthState$1, m as readWebAuthSnapshotBestEffort$1, o as getWebAuthAgeMs$1, p as readWebAuthSnapshot$1, s as logWebSelfId$1, x as webAuthExists$1 } from "./auth-store-B2ZibndQ.js";
2
+ import { c as logoutWeb$1, d as readWebAuthExistsBestEffort$1, f as readWebAuthExistsForDecision$1, g as readWebSelfId$1, h as readWebAuthState$1, m as readWebAuthSnapshotBestEffort$1, o as getWebAuthAgeMs$1, p as readWebAuthSnapshot$1, s as logWebSelfId$1, x as webAuthExists$1 } from "./auth-store-e9VzLZ-S.js";
3
3
  import { t as getActiveWebListener$1 } from "./active-listener-CFwkn3ho.js";
4
- import { t as monitorWebChannel$1 } from "./monitor-CXuZBVgk.js";
5
- import { t as loginWeb$1 } from "./login-BExWg_jW.js";
6
- import { whatsappSetupWizard as whatsappSetupWizard$1 } from "./setup-surface-vIg4EcCu.js";
4
+ import { t as monitorWebChannel$1 } from "./monitor-Ggwn3FDi.js";
5
+ import { t as loginWeb$1 } from "./login-Xv3ujrl0.js";
6
+ import { whatsappSetupWizard as whatsappSetupWizard$1 } from "./setup-surface-BmPcAhIF.js";
7
7
  //#region extensions/whatsapp/src/channel.runtime.ts
8
8
  function getActiveWebListener(...args) {
9
9
  return getActiveWebListener$1(...args);
@@ -1,8 +1,8 @@
1
- import { a as resolveWhatsAppGroupRequireMention, i as whatsappSetupWizardProxy, n as createWhatsAppPluginBase, o as resolveWhatsAppGroupToolPolicy, s as resolveWhatsAppGroupIntroHint, t as whatsappSetupAdapter } from "./setup-core-D0Zm67Lv.js";
1
+ import { a as resolveWhatsAppGroupRequireMention, i as whatsappSetupWizardProxy, n as createWhatsAppPluginBase, o as resolveWhatsAppGroupToolPolicy, s as resolveWhatsAppGroupIntroHint, t as whatsappSetupAdapter } from "./setup-core-Cp0NMO89.js";
2
2
  import { t as detectWhatsAppLegacyStateMigrations } from "./state-migrations-D_BmQUR9.js";
3
3
  //#region extensions/whatsapp/src/channel.setup.ts
4
4
  async function isWhatsAppAuthConfigured(account) {
5
- const { readWebAuthState } = await import("./auth-store-B2ZibndQ.js").then((n) => n.i);
5
+ const { readWebAuthState } = await import("./auth-store-e9VzLZ-S.js").then((n) => n.i);
6
6
  return await readWebAuthState(account.authDir) === "linked";
7
7
  }
8
8
  const whatsappSetupPlugin = {
@@ -1,7 +1,7 @@
1
1
  import { a as unregisterWhatsAppConnectionController, i as registerWhatsAppConnectionController, n as getStatusCode, t as formatError } from "./session-errors-CbsoQqoy.js";
2
- import { c as logoutWeb } from "./auth-store-B2ZibndQ.js";
3
- import { c as resolveComparableIdentity } from "./identity-xoLLdqEv.js";
4
- import { i as DEFAULT_WHATSAPP_SOCKET_TIMING, r as waitForWaConnection, t as createWaSocket } from "./session-CoxlXm2K.js";
2
+ import { c as logoutWeb, f as readWebAuthExistsForDecision, r as WhatsAppAuthUnstableError } from "./auth-store-e9VzLZ-S.js";
3
+ import { c as resolveComparableIdentity } from "./identity-Bupuq9vF.js";
4
+ import { i as DEFAULT_WHATSAPP_SOCKET_TIMING, r as waitForWaConnection, t as createWaSocket } from "./session-BCKUPRkN.js";
5
5
  import { computeBackoff, info, sleepWithAbort } from "openclaw/plugin-sdk/runtime-env";
6
6
  import { clamp } from "openclaw/plugin-sdk/text-utility-runtime";
7
7
  import { randomUUID } from "node:crypto";
@@ -43,6 +43,8 @@ const TIMED_OUT_STATUS = 408;
43
43
  const WHATSAPP_LOGIN_RESTART_MESSAGE = "WhatsApp asked for a restart after pairing (code 515); waiting for creds to save…";
44
44
  const WHATSAPP_LOGIN_TIMEOUT_RESTART_MESSAGE = "WhatsApp connection timed out before login; retrying with a fresh socket…";
45
45
  const WHATSAPP_LOGGED_OUT_RELINK_MESSAGE = "WhatsApp reported the session is logged out. Cleared cached web session; please rerun openclaw channels login and scan the QR again.";
46
+ const WHATSAPP_LOGIN_AUTH_UNSTABLE_MESSAGE = "WhatsApp connected, but saving the linked credentials has not settled on disk yet. Retry login in a moment.";
47
+ const WHATSAPP_LOGIN_AUTH_NOT_PERSISTED_MESSAGE = "WhatsApp connected, but the linked credentials were not found on disk. Retry login in a moment.";
46
48
  const WHATSAPP_LOGGED_OUT_QR_MESSAGE = "WhatsApp reported the session is logged out. Cleared cached web session; please scan a new QR.";
47
49
  const WHATSAPP_WATCHDOG_TIMEOUT_ERROR = "watchdog-timeout";
48
50
  function createNeverResolvePromise() {
@@ -106,6 +108,17 @@ async function waitForWhatsAppLoginResult(params) {
106
108
  let timeoutRestarted = false;
107
109
  while (true) try {
108
110
  await wait(currentSock, { timeout: "none" });
111
+ const persistedAuth = await readWebAuthExistsForDecision(params.authDir);
112
+ if (persistedAuth.outcome === "unstable") return {
113
+ outcome: "failed",
114
+ message: WHATSAPP_LOGIN_AUTH_UNSTABLE_MESSAGE,
115
+ error: new WhatsAppAuthUnstableError(WHATSAPP_LOGIN_AUTH_UNSTABLE_MESSAGE)
116
+ };
117
+ if (!persistedAuth.exists) return {
118
+ outcome: "failed",
119
+ message: WHATSAPP_LOGIN_AUTH_NOT_PERSISTED_MESSAGE,
120
+ error: new WhatsAppAuthUnstableError(WHATSAPP_LOGIN_AUTH_NOT_PERSISTED_MESSAGE)
121
+ };
109
122
  return {
110
123
  outcome: "connected",
111
124
  restarted: postPairingRestarted || timeoutRestarted,
@@ -2,7 +2,7 @@ import { c as normalizeWhatsAppTarget$1, t as isWhatsAppGroupJid$1 } from "./nor
2
2
  import { t as whatsappCommandPolicy$1 } from "./command-policy-BIOSHySD.js";
3
3
  import { t as resolveLegacyGroupSessionKey$1 } from "./group-session-contract-DDnZSsJ1.js";
4
4
  import { r as isLegacyGroupSessionKey$1, t as canonicalizeLegacySessionKey$1 } from "./session-contract-DMTm6Q_L.js";
5
- import { a as resolveWhatsAppRuntimeGroupPolicy$1, n as testing } from "./access-control-C53zKYSN.js";
5
+ import { a as resolveWhatsAppRuntimeGroupPolicy$1, n as testing } from "./access-control-BKaMOvIk.js";
6
6
  //#region extensions/whatsapp/contract-api.ts
7
7
  const canonicalizeLegacySessionKey = canonicalizeLegacySessionKey$1;
8
8
  const isLegacyGroupSessionKey = isLegacyGroupSessionKey$1;
@@ -33,37 +33,37 @@ function identitiesOverlap(left, right) {
33
33
  return getComparableIdentityValues(right).some((value) => leftValues.has(value));
34
34
  }
35
35
  function getSenderIdentity(msg, authDir) {
36
- return resolveComparableIdentity(msg.sender ?? {
37
- jid: msg.senderJid ?? null,
38
- e164: msg.senderE164 ?? null,
39
- name: msg.senderName ?? null
36
+ return resolveComparableIdentity(msg.platform.sender ?? {
37
+ jid: msg.platform.senderJid ?? null,
38
+ e164: msg.platform.senderE164 ?? null,
39
+ name: msg.platform.senderName ?? null
40
40
  }, authDir);
41
41
  }
42
42
  function getSelfIdentity(msg, authDir) {
43
- return resolveComparableIdentity(msg.self ?? {
44
- jid: msg.selfJid ?? null,
45
- lid: msg.selfLid ?? null,
46
- e164: msg.selfE164 ?? null
43
+ return resolveComparableIdentity(msg.platform.self ?? {
44
+ jid: msg.platform.selfJid ?? null,
45
+ lid: msg.platform.selfLid ?? null,
46
+ e164: msg.platform.selfE164 ?? null
47
47
  }, authDir);
48
48
  }
49
49
  function getReplyContext(msg, authDir) {
50
- if (msg.replyTo) return {
51
- ...msg.replyTo,
52
- sender: resolveComparableIdentity(msg.replyTo.sender, authDir)
50
+ if (msg.quote?.context) return {
51
+ ...msg.quote.context,
52
+ sender: resolveComparableIdentity(msg.quote.context.sender, authDir)
53
53
  };
54
- if (!msg.replyToBody) return null;
54
+ if (!msg.quote?.body) return null;
55
55
  return {
56
- id: msg.replyToId,
57
- body: msg.replyToBody,
56
+ id: msg.quote.id,
57
+ body: msg.quote.body,
58
58
  sender: resolveComparableIdentity({
59
- jid: msg.replyToSenderJid ?? null,
60
- e164: msg.replyToSenderE164 ?? null,
61
- label: msg.replyToSender ?? null
59
+ jid: msg.quote.sender?.jid ?? null,
60
+ e164: msg.quote.sender?.e164 ?? null,
61
+ label: msg.quote.sender?.displayName ?? null
62
62
  }, authDir)
63
63
  };
64
64
  }
65
65
  function getMentionJids(msg) {
66
- return msg.mentions ?? msg.mentionedJids ?? [];
66
+ return msg.group?.mentions?.jids ?? [];
67
67
  }
68
68
  function getMentionIdentities(msg, authDir) {
69
69
  return getMentionJids(msg).map((jid) => resolveComparableIdentity({ jid }, authDir));
@@ -1,5 +1,5 @@
1
1
  import { n as getStatusCode, t as formatError } from "./session-errors-CbsoQqoy.js";
2
2
  import { t as createWhatsAppLoginTool } from "./agent-tools-login-BX7eHgDm.js";
3
- import { c as logoutWeb, g as readWebSelfId, l as pickWebChannel, o as getWebAuthAgeMs, s as logWebSelfId, t as WA_WEB_AUTH_DIR, x as webAuthExists, y as resolveDefaultWebAuthDir } from "./auth-store-B2ZibndQ.js";
3
+ import { c as logoutWeb, g as readWebSelfId, l as pickWebChannel, o as getWebAuthAgeMs, s as logWebSelfId, t as WA_WEB_AUTH_DIR, x as webAuthExists, y as resolveDefaultWebAuthDir } from "./auth-store-e9VzLZ-S.js";
4
4
  import { t as getActiveWebListener } from "./active-listener-CFwkn3ho.js";
5
5
  export { WA_WEB_AUTH_DIR, createWhatsAppLoginTool, formatError, getActiveWebListener, getStatusCode, getWebAuthAgeMs, logWebSelfId, logoutWeb, pickWebChannel, readWebSelfId, resolveDefaultWebAuthDir, webAuthExists };
@@ -1,8 +1,8 @@
1
1
  import { t as __exportAll } from "./rolldown-runtime-D7D4PA-g.js";
2
2
  import { a as resolveWhatsAppAccount } from "./accounts-DgViSyJx.js";
3
- import { b as restoreCredsFromBackupIfNeeded } from "./auth-store-B2ZibndQ.js";
4
- import { a as resolveWhatsAppSocketTiming, o as renderQrTerminal, t as createWaSocket } from "./session-CoxlXm2K.js";
5
- import { a as closeWaSocketSoon, o as waitForWhatsAppLoginResult } from "./connection-controller-TvY2F126.js";
3
+ import { b as restoreCredsFromBackupIfNeeded } from "./auth-store-e9VzLZ-S.js";
4
+ import { a as resolveWhatsAppSocketTiming, o as renderQrTerminal, t as createWaSocket } from "./session-BCKUPRkN.js";
5
+ import { a as closeWaSocketSoon, o as waitForWhatsAppLoginResult } from "./connection-controller-BWBoVQr4.js";
6
6
  import { formatCliCommand } from "openclaw/plugin-sdk/cli-runtime";
7
7
  import { logInfo } from "openclaw/plugin-sdk/logging-core";
8
8
  import { danger, defaultRuntime, success } from "openclaw/plugin-sdk/runtime-env";
@@ -1,7 +1,7 @@
1
1
  import { a as resolveWhatsAppAccount } from "./accounts-DgViSyJx.js";
2
- import { f as readWebAuthExistsForDecision, g as readWebSelfId, n as WHATSAPP_AUTH_UNSTABLE_CODE } from "./auth-store-B2ZibndQ.js";
3
- import { a as resolveWhatsAppSocketTiming, t as createWaSocket } from "./session-CoxlXm2K.js";
4
- import { i as closeWaSocket, o as waitForWhatsAppLoginResult, t as WHATSAPP_LOGGED_OUT_QR_MESSAGE } from "./connection-controller-TvY2F126.js";
2
+ import { f as readWebAuthExistsForDecision, g as readWebSelfId, n as WHATSAPP_AUTH_UNSTABLE_CODE } from "./auth-store-e9VzLZ-S.js";
3
+ import { a as resolveWhatsAppSocketTiming, t as createWaSocket } from "./session-BCKUPRkN.js";
4
+ import { i as closeWaSocket, o as waitForWhatsAppLoginResult, t as WHATSAPP_LOGGED_OUT_QR_MESSAGE } from "./connection-controller-BWBoVQr4.js";
5
5
  import { logInfo } from "openclaw/plugin-sdk/logging-core";
6
6
  import { danger, defaultRuntime, info, success } from "openclaw/plugin-sdk/runtime-env";
7
7
  import { renderQrPngDataUrl } from "openclaw/plugin-sdk/media-runtime";
@@ -1,7 +1,7 @@
1
1
  //#region extensions/whatsapp/login-qr-runtime.ts
2
2
  let loginQrModulePromise = null;
3
3
  function loadLoginQrModule() {
4
- loginQrModulePromise ??= import("./login-qr-DiZ0U-P8.js");
4
+ loginQrModulePromise ??= import("./login-qr-CaJziL93.js");
5
5
  return loginQrModulePromise;
6
6
  }
7
7
  async function startWebLoginWithQr(...args) {