@openclaw/whatsapp 2026.6.11-beta.2 → 2026.7.1-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.
- package/dist/{access-control-_oQx0_UZ.js → access-control-88UPniDc.js} +4 -4
- package/dist/{action-runtime-D-FTwc8j.js → action-runtime-HPX_j5T4.js} +1 -1
- package/dist/action-runtime-api.js +1 -1
- package/dist/action-runtime.runtime.js +1 -1
- package/dist/api.js +12 -9
- package/dist/{approval-handler.runtime-DNBh4thG.js → approval-handler.runtime-CSpqzpr5.js} +1 -1
- package/dist/{auth-store-BRv2o3w2.js → auth-store-ECx4h57q.js} +2 -2
- package/dist/{channel-C9zebxrw.js → channel-BAj2xDFM.js} +13 -7
- package/dist/channel-plugin-api.js +1 -1
- package/dist/{channel-react-action-C56UzM_r.js → channel-react-action-Dfn3giuP.js} +11 -5
- package/dist/{channel.runtime-kVF_UONw.js → channel.runtime-D_0MiKk3.js} +4 -4
- package/dist/{channel.setup-BTi6IdDT.js → channel.setup-3tEq3gHA.js} +2 -2
- package/dist/{connection-controller-Ds4puj_n.js → connection-controller-u-tfAFhJ.js} +3 -3
- package/dist/contract-api.js +1 -1
- package/dist/{identity-DdeafYji.js → identity-CmsTmkKR.js} +1 -1
- package/dist/light-runtime-api.js +1 -1
- package/dist/{login-FpqysWi0.js → login-8lHwLmXj.js} +3 -3
- package/dist/{login-qr-BjfpyyN0.js → login-qr-BEZZqrTb.js} +3 -3
- package/dist/login-qr-runtime.js +1 -1
- package/dist/{monitor-BVD90YEd.js → monitor-DnsIesIx.js} +72 -31
- package/dist/{quoted-message-DqmWlbN7.js → quoted-message-CpA_ujXK.js} +1 -1
- package/dist/runtime-api.js +7 -7
- package/dist/{send-BplHdEjw.js → send-BVzLSkaY.js} +1 -1
- package/dist/{send-api-11yoHJhM.js → send-api-45J-BzEp.js} +4 -4
- package/dist/{session-DlHpYSAl.js → session-WU4SVP8f.js} +20 -1
- package/dist/{setup-core-D0JxJ53T.js → setup-core-BLI8hThs.js} +2 -2
- package/dist/{setup-finalize-BRTq3uPs.js → setup-finalize-BrZsNK4V.js} +2 -2
- package/dist/setup-plugin-api.js +1 -1
- package/dist/{setup-surface-BpdIDwDg.js → setup-surface-DaVQrr0L.js} +2 -2
- package/dist/{text-runtime-CpiloI73.js → text-runtime-C88QkuU9.js} +6 -0
- package/npm-shrinkwrap.json +3 -3
- package/package.json +4 -4
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { a as resolveWhatsAppAccount } from "./accounts-DgViSyJx.js";
|
|
2
|
-
import { l as isSelfChatMode, n as normalizeE164 } from "./text-runtime-
|
|
3
|
-
import { a as getSelfIdentity, o as getSenderIdentity } from "./identity-
|
|
2
|
+
import { l as isSelfChatMode, n as normalizeE164 } from "./text-runtime-C88QkuU9.js";
|
|
3
|
+
import { a as getSelfIdentity, o as getSenderIdentity } from "./identity-CmsTmkKR.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";
|
|
@@ -233,7 +233,7 @@ async function resolveWhatsAppIngressAccess(params) {
|
|
|
233
233
|
}
|
|
234
234
|
async function resolveWhatsAppCommandAuthorized(params) {
|
|
235
235
|
if (!(params.cfg.commands?.useAccessGroups !== false)) return true;
|
|
236
|
-
const self = getSelfIdentity(params.msg);
|
|
236
|
+
const self = getSelfIdentity(params.msg, params.authDir);
|
|
237
237
|
const admission = requireWhatsAppInboundAdmission(params.msg);
|
|
238
238
|
const policy = params.policy ?? resolveWhatsAppInboundPolicy({
|
|
239
239
|
cfg: params.cfg,
|
|
@@ -241,7 +241,7 @@ async function resolveWhatsAppCommandAuthorized(params) {
|
|
|
241
241
|
selfE164: self.e164 ?? null
|
|
242
242
|
});
|
|
243
243
|
const isGroup = admission.conversation.kind === "group";
|
|
244
|
-
const sender = getSenderIdentity(params.msg);
|
|
244
|
+
const sender = getSenderIdentity(params.msg, params.authDir);
|
|
245
245
|
const dmSender = sender.e164 ?? admission.conversation.id;
|
|
246
246
|
const groupSender = sender.e164 ?? "";
|
|
247
247
|
if (!normalizeE164(isGroup ? groupSender : dmSender)) return false;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { a as resolveWhatsAppAccount } from "./accounts-DgViSyJx.js";
|
|
2
2
|
import { t as resolveWhatsAppOutboundTarget } from "./resolve-outbound-target-CcdugbDf.js";
|
|
3
|
-
import { g as resolveWhatsAppReactionLevel, r as sendReactionWhatsApp } from "./send-
|
|
3
|
+
import { g as resolveWhatsAppReactionLevel, r as sendReactionWhatsApp } from "./send-BVzLSkaY.js";
|
|
4
4
|
import { ToolAuthorizationError, createActionGate, jsonResult, readReactionParams, readStringParam } from "openclaw/plugin-sdk/channel-actions";
|
|
5
5
|
//#region extensions/whatsapp/src/action-runtime-target-auth.ts
|
|
6
6
|
function resolveAuthorizedWhatsAppOutboundTarget(params) {
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as handleWhatsAppAction } from "./action-runtime-
|
|
1
|
+
import { t as handleWhatsAppAction } from "./action-runtime-HPX_j5T4.js";
|
|
2
2
|
export { handleWhatsAppAction };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as handleWhatsAppAction } from "./action-runtime-
|
|
1
|
+
import { t as handleWhatsAppAction } from "./action-runtime-HPX_j5T4.js";
|
|
2
2
|
export { handleWhatsAppAction };
|
package/dist/api.js
CHANGED
|
@@ -2,20 +2,20 @@ import { r as resolveDefaultWhatsAppAccountId, t as listAccountIds } from "./acc
|
|
|
2
2
|
import { a as resolveWhatsAppAccount, i as listWhatsAppAuthDirs, n as hasAnyWhatsAppAuth, o as resolveWhatsAppAuthDir, r as listEnabledWhatsAppAccounts, s as resolveWhatsAppMediaMaxBytes, t as DEFAULT_WHATSAPP_MEDIA_MAX_MB } from "./accounts-DgViSyJx.js";
|
|
3
3
|
import { a as normalizeWhatsAppAllowFromEntries, c as normalizeWhatsAppTarget, i as looksLikeWhatsAppTargetId, r as isWhatsAppUserTarget, s as normalizeWhatsAppMessagingTarget, t as isWhatsAppGroupJid } from "./normalize-target-bVWjgftN.js";
|
|
4
4
|
import { t as resolveWhatsAppOutboundTarget } from "./resolve-outbound-target-CcdugbDf.js";
|
|
5
|
-
import "./send-
|
|
5
|
+
import "./send-BVzLSkaY.js";
|
|
6
6
|
import { n as getStatusCode, t as formatError } from "./session-errors-CbsoQqoy.js";
|
|
7
7
|
import { n as createWhatsAppSocketOperationTimeoutAdapter, t as DEFAULT_WHATSAPP_SOCKET_TIMING } from "./socket-timing-DvMNkIge.js";
|
|
8
|
-
import { c as assertWebChannel, d as markdownToWhatsApp, h as toWhatsappJidWithLid, l as isSelfChatMode, m as toWhatsappJid, n as normalizeE164, p as resolveJidToE164, r as resolveUserPath, u as jidToE164 } from "./text-runtime-
|
|
9
|
-
import { n as WHATSAPP_LEGACY_OUTBOUND_SEND_DEP_KEYS, t as whatsappPlugin } from "./channel-
|
|
8
|
+
import { c as assertWebChannel, d as markdownToWhatsApp, h as toWhatsappJidWithLid, l as isSelfChatMode, m as toWhatsappJid, n as normalizeE164, p as resolveJidToE164, r as resolveUserPath, u as jidToE164 } from "./text-runtime-C88QkuU9.js";
|
|
9
|
+
import { n as WHATSAPP_LEGACY_OUTBOUND_SEND_DEP_KEYS, t as whatsappPlugin } from "./channel-BAj2xDFM.js";
|
|
10
10
|
import { t as whatsappCommandPolicy } from "./command-policy-BIOSHySD.js";
|
|
11
|
-
import { a as resolveWhatsAppGroupRequireMention, o as resolveWhatsAppGroupToolPolicy, s as resolveWhatsAppGroupIntroHint } from "./setup-core-
|
|
11
|
+
import { a as resolveWhatsAppGroupRequireMention, o as resolveWhatsAppGroupToolPolicy, s as resolveWhatsAppGroupIntroHint } from "./setup-core-BLI8hThs.js";
|
|
12
12
|
import "./config-schema-CROZuhT-.js";
|
|
13
|
-
import { t as whatsappSetupPlugin } from "./channel.setup-
|
|
13
|
+
import { t as whatsappSetupPlugin } from "./channel.setup-3tEq3gHA.js";
|
|
14
14
|
import { t as DEFAULT_WEB_MEDIA_BYTES } from "./constants-HU41RHGI.js";
|
|
15
15
|
import { n as listWhatsAppDirectoryGroupsFromConfig, r as listWhatsAppDirectoryPeersFromConfig } from "./directory-config-Dijefxc3.js";
|
|
16
|
-
import { n as testing } from "./access-control-
|
|
17
|
-
import { _ as extractLocationData, b as extractText, d as normalizeMessageContent, f as resolveInboundMediaMimetype, h as extractContextInfo, p as describeReplyContext, t as createWebSendApi } from "./send-api-
|
|
18
|
-
import { r as waitForWaConnection, t as createWaSocket } from "./session-
|
|
16
|
+
import { n as testing } from "./access-control-88UPniDc.js";
|
|
17
|
+
import { _ as extractLocationData, b as extractText, d as normalizeMessageContent, f as resolveInboundMediaMimetype, h as extractContextInfo, p as describeReplyContext, t as createWebSendApi } from "./send-api-45J-BzEp.js";
|
|
18
|
+
import { r as waitForWaConnection, t as createWaSocket } from "./session-WU4SVP8f.js";
|
|
19
19
|
import "openclaw/plugin-sdk/channel-actions";
|
|
20
20
|
import "openclaw/plugin-sdk/account-resolution";
|
|
21
21
|
import "openclaw/plugin-sdk/core";
|
|
@@ -129,15 +129,18 @@ function normalizeObservedMessage(message, authDir) {
|
|
|
129
129
|
const kind = reaction ? "reaction" : poll ? "poll" : media ? "media" : location ? "location" : text ? "text" : "unknown";
|
|
130
130
|
if (!text && kind === "unknown") return null;
|
|
131
131
|
const fromJid = message.key.remoteJid ?? void 0;
|
|
132
|
+
const senderJid = fromJid && isWhatsAppGroupJid(fromJid) ? message.key.participant ?? fromJid : fromJid;
|
|
133
|
+
const participantJid = message.key.participant ?? void 0;
|
|
132
134
|
return {
|
|
133
135
|
fromJid,
|
|
134
|
-
fromPhoneE164:
|
|
136
|
+
fromPhoneE164: senderJid ? jidToE164(senderJid, { authDir }) : null,
|
|
135
137
|
hasMedia: media ? true : void 0,
|
|
136
138
|
kind,
|
|
137
139
|
mediaFileName: media?.fileName,
|
|
138
140
|
mediaType: media?.mediaType,
|
|
139
141
|
messageId: message.key.id ?? void 0,
|
|
140
142
|
observedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
143
|
+
...participantJid ? { participantJid } : {},
|
|
141
144
|
poll,
|
|
142
145
|
quoted,
|
|
143
146
|
reaction,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { s as normalizeWhatsAppMessagingTarget } from "./normalize-target-bVWjgftN.js";
|
|
2
|
-
import { f as registerWhatsAppApprovalReactionTarget, i as sendTypingWhatsApp, p as unregisterWhatsAppApprovalReactionTarget, t as sendMessageWhatsApp } from "./send-
|
|
2
|
+
import { f as registerWhatsAppApprovalReactionTarget, i as sendTypingWhatsApp, p as unregisterWhatsAppApprovalReactionTarget, t as sendMessageWhatsApp } from "./send-BVzLSkaY.js";
|
|
3
3
|
import "./normalize-Bxwqo-bW.js";
|
|
4
4
|
import { n as getWhatsAppRuntime } from "./runtime-BfAdAEYT.js";
|
|
5
5
|
import { createSubsystemLogger } from "openclaw/plugin-sdk/runtime-env";
|
|
@@ -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
|
-
import { r as resolveUserPath } from "./text-runtime-
|
|
4
|
-
import { c as resolveComparableIdentity } from "./identity-
|
|
3
|
+
import { r as resolveUserPath } from "./text-runtime-C88QkuU9.js";
|
|
4
|
+
import { c as resolveComparableIdentity } from "./identity-CmsTmkKR.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";
|
|
@@ -2,15 +2,15 @@ import { r as resolveDefaultWhatsAppAccountId, t as listAccountIds } from "./acc
|
|
|
2
2
|
import { a as resolveWhatsAppAccount } from "./accounts-DgViSyJx.js";
|
|
3
3
|
import { c as normalizeWhatsAppTarget, i as looksLikeWhatsAppTargetId, n as isWhatsAppNewsletterJid, o as normalizeWhatsAppAllowFromEntry, s as normalizeWhatsAppMessagingTarget, t as isWhatsAppGroupJid } from "./normalize-target-bVWjgftN.js";
|
|
4
4
|
import { t as resolveWhatsAppOutboundTarget } from "./resolve-outbound-target-CcdugbDf.js";
|
|
5
|
-
import { a as normalizeWhatsAppOutboundPayload, g as resolveWhatsAppReactionLevel, h as whatsappApprovalAuth, i as sendTypingWhatsApp, m as getWhatsAppApprovalApprovers, n as sendPollWhatsApp, o as normalizeWhatsAppPayloadText, s as normalizeWhatsAppPayloadTextPreservingIndentation, t as sendMessageWhatsApp } from "./send-
|
|
5
|
+
import { a as normalizeWhatsAppOutboundPayload, g as resolveWhatsAppReactionLevel, h as whatsappApprovalAuth, i as sendTypingWhatsApp, m as getWhatsAppApprovalApprovers, n as sendPollWhatsApp, o as normalizeWhatsAppPayloadText, s as normalizeWhatsAppPayloadTextPreservingIndentation, t as sendMessageWhatsApp } from "./send-BVzLSkaY.js";
|
|
6
6
|
import "./normalize-Bxwqo-bW.js";
|
|
7
7
|
import { n as getWhatsAppRuntime } from "./runtime-BfAdAEYT.js";
|
|
8
|
-
import { m as toWhatsappJid } from "./text-runtime-
|
|
8
|
+
import { m as toWhatsappJid } from "./text-runtime-C88QkuU9.js";
|
|
9
9
|
import { t as createWhatsAppLoginTool } from "./agent-tools-login-BX7eHgDm.js";
|
|
10
|
-
import { i as lookupInboundMessageMetaForTarget } from "./quoted-message-
|
|
10
|
+
import { i as lookupInboundMessageMetaForTarget } from "./quoted-message-CpA_ujXK.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-
|
|
13
|
-
import { f as readWebAuthExistsForDecision, n as WHATSAPP_AUTH_UNSTABLE_CODE } from "./auth-store-
|
|
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-BLI8hThs.js";
|
|
13
|
+
import { f as readWebAuthExistsForDecision, n as WHATSAPP_AUTH_UNSTABLE_CODE } from "./auth-store-ECx4h57q.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";
|
|
@@ -205,7 +205,7 @@ const whatsappApprovalCapability = createChannelApprovalCapability({
|
|
|
205
205
|
accountId,
|
|
206
206
|
request
|
|
207
207
|
}),
|
|
208
|
-
load: async () => (await import("./approval-handler.runtime-
|
|
208
|
+
load: async () => (await import("./approval-handler.runtime-CSpqzpr5.js")).whatsappApprovalNativeRuntime
|
|
209
209
|
})
|
|
210
210
|
});
|
|
211
211
|
//#endregion
|
|
@@ -601,7 +601,7 @@ function collectWhatsAppStatusIssues(accounts) {
|
|
|
601
601
|
//#endregion
|
|
602
602
|
//#region extensions/whatsapp/src/channel.ts
|
|
603
603
|
const loadWhatsAppDirectoryConfig = createLazyRuntimeModule(() => import("./directory-config-Dijefxc3.js").then((n) => n.t));
|
|
604
|
-
const loadWhatsAppChannelReactAction = createLazyRuntimeModule(() => import("./channel-react-action-
|
|
604
|
+
const loadWhatsAppChannelReactAction = createLazyRuntimeModule(() => import("./channel-react-action-Dfn3giuP.js"));
|
|
605
605
|
function resolveWhatsAppTargetInfo(raw) {
|
|
606
606
|
const normalized = normalizeWhatsAppTarget(raw);
|
|
607
607
|
if (!normalized) return null;
|
|
@@ -751,6 +751,8 @@ const whatsappPlugin = createChatChannelPlugin({
|
|
|
751
751
|
lastInboundAt: null,
|
|
752
752
|
lastMessageAt: null,
|
|
753
753
|
lastEventAt: null,
|
|
754
|
+
busy: false,
|
|
755
|
+
lastRunActivityAt: null,
|
|
754
756
|
healthState: "stopped"
|
|
755
757
|
}),
|
|
756
758
|
collectStatusIssues: collectWhatsAppStatusIssues,
|
|
@@ -790,6 +792,8 @@ const whatsappPlugin = createChatChannelPlugin({
|
|
|
790
792
|
lastInboundAt: snapshot.lastInboundAt ?? snapshot.lastMessageAt ?? null,
|
|
791
793
|
lastMessageAt: snapshot.lastMessageAt ?? null,
|
|
792
794
|
lastEventAt: snapshot.lastEventAt ?? null,
|
|
795
|
+
busy: snapshot.busy ?? false,
|
|
796
|
+
lastRunActivityAt: snapshot.lastRunActivityAt ?? null,
|
|
793
797
|
lastError: snapshot.lastError ?? null,
|
|
794
798
|
healthState: snapshot.healthState ?? void 0
|
|
795
799
|
};
|
|
@@ -811,6 +815,8 @@ const whatsappPlugin = createChatChannelPlugin({
|
|
|
811
815
|
lastInboundAt: runtime?.lastInboundAt ?? runtime?.lastMessageAt ?? null,
|
|
812
816
|
lastMessageAt: runtime?.lastMessageAt ?? null,
|
|
813
817
|
lastEventAt: runtime?.lastEventAt ?? null,
|
|
818
|
+
busy: runtime?.busy ?? false,
|
|
819
|
+
lastRunActivityAt: runtime?.lastRunActivityAt ?? null,
|
|
814
820
|
healthState: runtime?.healthState ?? void 0,
|
|
815
821
|
dmPolicy: account.dmPolicy,
|
|
816
822
|
allowFrom: account.allowFrom
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as whatsappPlugin } from "./channel-
|
|
1
|
+
import { t as whatsappPlugin } from "./channel-BAj2xDFM.js";
|
|
2
2
|
export { whatsappPlugin };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { a as resolveWhatsAppAccount, s as resolveWhatsAppMediaMaxBytes } from "./accounts-DgViSyJx.js";
|
|
2
2
|
import { c as normalizeWhatsAppTarget, t as isWhatsAppGroupJid } from "./normalize-target-bVWjgftN.js";
|
|
3
|
-
import { r as resolveAuthorizedWhatsAppOutboundTarget, t as handleWhatsAppAction } from "./action-runtime-
|
|
4
|
-
import { t as sendMessageWhatsApp } from "./send-
|
|
3
|
+
import { r as resolveAuthorizedWhatsAppOutboundTarget, t as handleWhatsAppAction } from "./action-runtime-HPX_j5T4.js";
|
|
4
|
+
import { t as sendMessageWhatsApp } from "./send-BVzLSkaY.js";
|
|
5
5
|
import "./normalize-Bxwqo-bW.js";
|
|
6
6
|
import { jsonResult, readStringOrNumberParam, readStringParam as readStringParam$1, resolveReactionMessageId } from "openclaw/plugin-sdk/channel-actions";
|
|
7
7
|
//#region extensions/whatsapp/src/channel-react-action.ts
|
|
@@ -23,6 +23,12 @@ function readBooleanParam(args, key) {
|
|
|
23
23
|
function hasUploadFileBufferPayload(args) {
|
|
24
24
|
return readStringParam$1(args, "buffer", { trim: false }) !== void 0;
|
|
25
25
|
}
|
|
26
|
+
function readWhatsAppActionChatJid(params) {
|
|
27
|
+
const explicit = readStringParam$1(params.params, "chatJid") ?? readStringParam$1(params.params, "to");
|
|
28
|
+
if (explicit) return explicit;
|
|
29
|
+
if (params.toolContext?.currentChannelProvider !== WHATSAPP_CHANNEL || !params.toolContext.currentChannelId) return;
|
|
30
|
+
return normalizeWhatsAppTarget(params.toolContext.currentChannelId) ?? void 0;
|
|
31
|
+
}
|
|
26
32
|
function extractBase64Payload(encoded) {
|
|
27
33
|
const match = /^data:[^;]+;base64,(.*)$/i.exec(encoded.trim());
|
|
28
34
|
return match ? match[1] : encoded;
|
|
@@ -52,7 +58,7 @@ async function handleWhatsAppUploadFileAction(params) {
|
|
|
52
58
|
const mediaUrl = readUploadFileMediaSource(params.params);
|
|
53
59
|
const encodedPayload = readStringParam$1(params.params, "buffer", { trim: false });
|
|
54
60
|
if (!mediaUrl && !hasUploadFileBufferPayload(params.params)) throw new Error("WhatsApp upload-file requires media, mediaUrl, filePath, path, fileUrl, or buffer.");
|
|
55
|
-
const to = readStringParam$1(params.params, "to", { required: true });
|
|
61
|
+
const to = readWhatsAppActionChatJid(params) ?? readStringParam$1(params.params, "to", { required: true });
|
|
56
62
|
const resolved = resolveAuthorizedWhatsAppOutboundTarget({
|
|
57
63
|
cfg: params.cfg,
|
|
58
64
|
chatJid: to,
|
|
@@ -93,7 +99,7 @@ async function handleWhatsAppMessageAction(params) {
|
|
|
93
99
|
if (params.action === "upload-file") return await handleWhatsAppUploadFileAction(params);
|
|
94
100
|
if (params.action !== "react") throw new Error(`Action ${params.action} is not supported for provider ${WHATSAPP_CHANNEL}.`);
|
|
95
101
|
const isWhatsAppSource = params.toolContext?.currentChannelProvider === WHATSAPP_CHANNEL;
|
|
96
|
-
const explicitTarget =
|
|
102
|
+
const explicitTarget = readWhatsAppActionChatJid(params);
|
|
97
103
|
const normalizedTarget = explicitTarget ? normalizeWhatsAppTarget(explicitTarget) : null;
|
|
98
104
|
const normalizedCurrent = isWhatsAppSource && params.toolContext?.currentChannelId ? normalizeWhatsAppTarget(params.toolContext.currentChannelId) : null;
|
|
99
105
|
const isCrossChat = normalizedTarget != null && (normalizedCurrent == null || normalizedTarget !== normalizedCurrent);
|
|
@@ -115,7 +121,7 @@ async function handleWhatsAppMessageAction(params) {
|
|
|
115
121
|
const inferredParticipant = explicitParticipant || explicitMessageId != null || !isWhatsAppSource || isCrossChat || !isWhatsAppGroupJid(explicitTarget ?? params.toolContext?.currentChannelId ?? "") ? void 0 : typeof params.requesterSenderId === "string" && params.requesterSenderId.trim().length > 0 ? params.requesterSenderId.trim() : void 0;
|
|
116
122
|
return await handleWhatsAppAction({
|
|
117
123
|
action: "react",
|
|
118
|
-
chatJid:
|
|
124
|
+
chatJid: readWhatsAppActionChatJid(params) ?? readStringParam$1(params.params, "to", { required: true }),
|
|
119
125
|
messageId,
|
|
120
126
|
emoji,
|
|
121
127
|
remove,
|
|
@@ -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-
|
|
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-ECx4h57q.js";
|
|
3
3
|
import { t as getActiveWebListener$1 } from "./active-listener-CFwkn3ho.js";
|
|
4
|
-
import { t as monitorWebChannel$1 } from "./monitor-
|
|
5
|
-
import { t as loginWeb$1 } from "./login-
|
|
6
|
-
import { whatsappSetupWizard as whatsappSetupWizard$1 } from "./setup-surface-
|
|
4
|
+
import { t as monitorWebChannel$1 } from "./monitor-DnsIesIx.js";
|
|
5
|
+
import { t as loginWeb$1 } from "./login-8lHwLmXj.js";
|
|
6
|
+
import { whatsappSetupWizard as whatsappSetupWizard$1 } from "./setup-surface-DaVQrr0L.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-
|
|
1
|
+
import { a as resolveWhatsAppGroupRequireMention, i as whatsappSetupWizardProxy, n as createWhatsAppPluginBase, o as resolveWhatsAppGroupToolPolicy, s as resolveWhatsAppGroupIntroHint, t as whatsappSetupAdapter } from "./setup-core-BLI8hThs.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-
|
|
5
|
+
const { readWebAuthState } = await import("./auth-store-ECx4h57q.js").then((n) => n.i);
|
|
6
6
|
return await readWebAuthState(account.authDir) === "linked";
|
|
7
7
|
}
|
|
8
8
|
const whatsappSetupPlugin = {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { a as unregisterWhatsAppConnectionController, i as registerWhatsAppConnectionController, n as getStatusCode, t as formatError } from "./session-errors-CbsoQqoy.js";
|
|
2
2
|
import { t as DEFAULT_WHATSAPP_SOCKET_TIMING } from "./socket-timing-DvMNkIge.js";
|
|
3
|
-
import { c as logoutWeb, f as readWebAuthExistsForDecision, r as WhatsAppAuthUnstableError } from "./auth-store-
|
|
4
|
-
import { c as resolveComparableIdentity } from "./identity-
|
|
5
|
-
import { r as waitForWaConnection, t as createWaSocket } from "./session-
|
|
3
|
+
import { c as logoutWeb, f as readWebAuthExistsForDecision, r as WhatsAppAuthUnstableError } from "./auth-store-ECx4h57q.js";
|
|
4
|
+
import { c as resolveComparableIdentity } from "./identity-CmsTmkKR.js";
|
|
5
|
+
import { r as waitForWaConnection, t as createWaSocket } from "./session-WU4SVP8f.js";
|
|
6
6
|
import { computeBackoff, info, sleepWithAbort } from "openclaw/plugin-sdk/runtime-env";
|
|
7
7
|
import { clamp } from "openclaw/plugin-sdk/text-utility-runtime";
|
|
8
8
|
import { randomUUID } from "node:crypto";
|
package/dist/contract-api.js
CHANGED
|
@@ -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-
|
|
5
|
+
import { a as resolveWhatsAppRuntimeGroupPolicy$1, n as testing } from "./access-control-88UPniDc.js";
|
|
6
6
|
//#region extensions/whatsapp/contract-api.ts
|
|
7
7
|
const canonicalizeLegacySessionKey = canonicalizeLegacySessionKey$1;
|
|
8
8
|
const isLegacyGroupSessionKey = isLegacyGroupSessionKey$1;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as normalizeE164, u as jidToE164 } from "./text-runtime-
|
|
1
|
+
import { n as normalizeE164, u as jidToE164 } from "./text-runtime-C88QkuU9.js";
|
|
2
2
|
//#region extensions/whatsapp/src/identity.ts
|
|
3
3
|
const WHATSAPP_LID_RE = /@(lid|hosted\.lid)$/i;
|
|
4
4
|
function normalizeDeviceScopedJid(jid) {
|
|
@@ -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-
|
|
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-ECx4h57q.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,9 +1,9 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-D7D4PA-g.js";
|
|
2
2
|
import { a as resolveWhatsAppAccount } from "./accounts-DgViSyJx.js";
|
|
3
3
|
import { a as resolveWhatsAppSocketTiming } from "./socket-timing-DvMNkIge.js";
|
|
4
|
-
import { b as restoreCredsFromBackupIfNeeded } from "./auth-store-
|
|
5
|
-
import { i as renderQrTerminal, t as createWaSocket } from "./session-
|
|
6
|
-
import { a as closeWaSocketSoon, o as waitForWhatsAppLoginResult } from "./connection-controller-
|
|
4
|
+
import { b as restoreCredsFromBackupIfNeeded } from "./auth-store-ECx4h57q.js";
|
|
5
|
+
import { i as renderQrTerminal, t as createWaSocket } from "./session-WU4SVP8f.js";
|
|
6
|
+
import { a as closeWaSocketSoon, o as waitForWhatsAppLoginResult } from "./connection-controller-u-tfAFhJ.js";
|
|
7
7
|
import { formatCliCommand } from "openclaw/plugin-sdk/cli-runtime";
|
|
8
8
|
import { logInfo } from "openclaw/plugin-sdk/logging-core";
|
|
9
9
|
import { danger, defaultRuntime, success } from "openclaw/plugin-sdk/runtime-env";
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { a as resolveWhatsAppAccount } from "./accounts-DgViSyJx.js";
|
|
2
2
|
import { t as formatError } from "./session-errors-CbsoQqoy.js";
|
|
3
3
|
import { a as resolveWhatsAppSocketTiming } from "./socket-timing-DvMNkIge.js";
|
|
4
|
-
import { c as logoutWeb, f as readWebAuthExistsForDecision, g as readWebSelfId, n as WHATSAPP_AUTH_UNSTABLE_CODE } from "./auth-store-
|
|
5
|
-
import { t as createWaSocket } from "./session-
|
|
4
|
+
import { c as logoutWeb, f as readWebAuthExistsForDecision, g as readWebSelfId, n as WHATSAPP_AUTH_UNSTABLE_CODE } from "./auth-store-ECx4h57q.js";
|
|
5
|
+
import { t as createWaSocket } from "./session-WU4SVP8f.js";
|
|
6
6
|
import { t as getActiveWebListener } from "./active-listener-CFwkn3ho.js";
|
|
7
|
-
import { i as closeWaSocket, o as waitForWhatsAppLoginResult, t as WHATSAPP_LOGGED_OUT_QR_MESSAGE } from "./connection-controller-
|
|
7
|
+
import { i as closeWaSocket, o as waitForWhatsAppLoginResult, t as WHATSAPP_LOGGED_OUT_QR_MESSAGE } from "./connection-controller-u-tfAFhJ.js";
|
|
8
8
|
import { logInfo } from "openclaw/plugin-sdk/logging-core";
|
|
9
9
|
import { danger, defaultRuntime, info, success } from "openclaw/plugin-sdk/runtime-env";
|
|
10
10
|
import { renderQrPngDataUrl } from "openclaw/plugin-sdk/media-runtime";
|
package/dist/login-qr-runtime.js
CHANGED
|
@@ -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-
|
|
4
|
+
loginQrModulePromise ??= import("./login-qr-BEZZqrTb.js");
|
|
5
5
|
return loginQrModulePromise;
|
|
6
6
|
}
|
|
7
7
|
async function startWebLoginWithQr(...args) {
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import { a as resolveWhatsAppAccount, s as resolveWhatsAppMediaMaxBytes } from "./accounts-DgViSyJx.js";
|
|
2
|
-
import { a as normalizeWhatsAppOutboundPayload, c as prepareWhatsAppOutboundMedia, d as maybeResolveWhatsAppApprovalReaction, g as resolveWhatsAppReactionLevel, l as sendWhatsAppOutboundWithRetry, r as sendReactionWhatsApp, s as normalizeWhatsAppPayloadTextPreservingIndentation } from "./send-
|
|
2
|
+
import { a as normalizeWhatsAppOutboundPayload, c as prepareWhatsAppOutboundMedia, d as maybeResolveWhatsAppApprovalReaction, g as resolveWhatsAppReactionLevel, l as sendWhatsAppOutboundWithRetry, r as sendReactionWhatsApp, s as normalizeWhatsAppPayloadTextPreservingIndentation } from "./send-BVzLSkaY.js";
|
|
3
3
|
import { n as getWhatsAppRuntime } from "./runtime-BfAdAEYT.js";
|
|
4
4
|
import { n as getStatusCode, r as getRegisteredWhatsAppConnectionController, t as formatError } from "./session-errors-CbsoQqoy.js";
|
|
5
5
|
import { a as resolveWhatsAppSocketTiming, i as resolveWhatsAppSocketOperationTimeoutMs, n as createWhatsAppSocketOperationTimeoutAdapter, o as withWhatsAppSocketOperationTimeout, r as isWhatsAppSocketOperationTimeoutError } from "./socket-timing-DvMNkIge.js";
|
|
6
|
-
import { d as markdownToWhatsApp, f as resolveEquivalentWhatsAppDirectChatJids, l as isSelfChatMode, n as normalizeE164, p as resolveJidToE164, t as convertMarkdownTables$1, u as jidToE164 } from "./text-runtime-
|
|
7
|
-
import { n as cacheInboundMessageMeta, r as lookupInboundMessageMeta, t as buildQuotedMessageOptions } from "./quoted-message-
|
|
8
|
-
import { g as readWebSelfId, o as getWebAuthAgeMs, r as WhatsAppAuthUnstableError, v as readWebSelfIdentityForDecision } from "./auth-store-
|
|
9
|
-
import { a as getSelfIdentity, c as resolveComparableIdentity, i as getReplyContext, n as getMentionIdentities, o as getSenderIdentity, r as getPrimaryIdentityId, s as identitiesOverlap, t as getComparableIdentityValues } from "./identity-
|
|
6
|
+
import { d as markdownToWhatsApp, f as resolveEquivalentWhatsAppDirectChatJids, l as isSelfChatMode, n as normalizeE164, p as resolveJidToE164, t as convertMarkdownTables$1, u as jidToE164 } from "./text-runtime-C88QkuU9.js";
|
|
7
|
+
import { n as cacheInboundMessageMeta, r as lookupInboundMessageMeta, t as buildQuotedMessageOptions } from "./quoted-message-CpA_ujXK.js";
|
|
8
|
+
import { g as readWebSelfId, o as getWebAuthAgeMs, r as WhatsAppAuthUnstableError, v as readWebSelfIdentityForDecision } from "./auth-store-ECx4h57q.js";
|
|
9
|
+
import { a as getSelfIdentity, c as resolveComparableIdentity, i as getReplyContext, n as getMentionIdentities, o as getSenderIdentity, r as getPrimaryIdentityId, s as identitiesOverlap, t as getComparableIdentityValues } from "./identity-CmsTmkKR.js";
|
|
10
10
|
import { n as resolveWhatsAppGroupsConfigPath } from "./group-config-path-BGyzT9Lg.js";
|
|
11
|
-
import { c as requireWhatsAppInboundAdmission, i as resolveWhatsAppInboundPolicy, l as resolveWhatsAppGroupConversationId, o as buildDeprecatedFlatWhatsAppInboundAdmission, r as resolveWhatsAppCommandAuthorized, s as requireAdmittedWhatsAppInboundMessage, t as checkInboundAccessControl } from "./access-control-
|
|
12
|
-
import { _ as extractLocationData, a as mayContainWhatsAppOutboundMention, b as extractText, c as DisconnectReason, d as normalizeMessageContent, f as resolveInboundMediaMimetype, g as extractExternalAdReplyContext, h as extractContextInfo, i as addWhatsAppOutboundMentionsToContent, l as downloadMediaMessage, m as extractContactContext, n as listWhatsAppSendResultMessageIds, o as resolveWhatsAppOutboundMentions, p as describeReplyContext, r as normalizeWhatsAppSendResult, s as addWhatsAppImagePreviewFields, t as createWebSendApi, u as isJidGroup, v as extractMediaPlaceholder, x as hasInboundUserContent, y as extractMentionedJids } from "./send-api-
|
|
13
|
-
import { r as waitForWaConnection, t as createWaSocket } from "./session-
|
|
11
|
+
import { c as requireWhatsAppInboundAdmission, i as resolveWhatsAppInboundPolicy, l as resolveWhatsAppGroupConversationId, o as buildDeprecatedFlatWhatsAppInboundAdmission, r as resolveWhatsAppCommandAuthorized, s as requireAdmittedWhatsAppInboundMessage, t as checkInboundAccessControl } from "./access-control-88UPniDc.js";
|
|
12
|
+
import { _ as extractLocationData, a as mayContainWhatsAppOutboundMention, b as extractText, c as DisconnectReason, d as normalizeMessageContent, f as resolveInboundMediaMimetype, g as extractExternalAdReplyContext, h as extractContextInfo, i as addWhatsAppOutboundMentionsToContent, l as downloadMediaMessage, m as extractContactContext, n as listWhatsAppSendResultMessageIds, o as resolveWhatsAppOutboundMentions, p as describeReplyContext, r as normalizeWhatsAppSendResult, s as addWhatsAppImagePreviewFields, t as createWebSendApi, u as isJidGroup, v as extractMediaPlaceholder, x as hasInboundUserContent, y as extractMentionedJids } from "./send-api-45J-BzEp.js";
|
|
13
|
+
import { r as waitForWaConnection, t as createWaSocket } from "./session-WU4SVP8f.js";
|
|
14
14
|
import { t as BufferJSON } from "./session.runtime-CyooSQvj.js";
|
|
15
|
-
import { c as computeBackoff, d as resolveReconnectPolicy, f as sleepWithAbort, l as newConnectionId, n as WHATSAPP_WATCHDOG_TIMEOUT_ERROR, r as WhatsAppConnectionController, s as DEFAULT_RECONNECT_POLICY, u as resolveHeartbeatSeconds } from "./connection-controller-
|
|
15
|
+
import { c as computeBackoff, d as resolveReconnectPolicy, f as sleepWithAbort, l as newConnectionId, n as WHATSAPP_WATCHDOG_TIMEOUT_ERROR, r as WhatsAppConnectionController, s as DEFAULT_RECONNECT_POLICY, u as resolveHeartbeatSeconds } from "./connection-controller-u-tfAFhJ.js";
|
|
16
16
|
import { resolveAccountEntry } from "openclaw/plugin-sdk/account-core";
|
|
17
17
|
import { normalizeLowercaseStringOrEmpty, normalizeStringEntries, uniqueStrings } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
18
18
|
import { createChannelMessageReplyPipeline, createDurableInboundReceiveJournalFromQueue, createMessageReceiptFromOutboundResults, deliverInboundReplyWithMessageSendContext, resolveChannelMessageSourceReplyDeliveryMode } from "openclaw/plugin-sdk/channel-outbound";
|
|
@@ -24,12 +24,13 @@ import { resolveMarkdownTableMode as resolveMarkdownTableMode$1 } from "openclaw
|
|
|
24
24
|
import { createSubsystemLogger, defaultRuntime, formatDurationPrecise, getChildLogger as getChildLogger$1, logVerbose, logVerbose as logVerbose$1, registerUnhandledRejectionHandler, shouldLogVerbose, shouldLogVerbose as shouldLogVerbose$1, warn } from "openclaw/plugin-sdk/runtime-env";
|
|
25
25
|
import { getAgentScopedMediaLocalRoots } from "openclaw/plugin-sdk/media-runtime";
|
|
26
26
|
import { asDateTimestampMs, parseStrictFiniteNumber, resolveExpiresAtMsFromDurationMs } from "openclaw/plugin-sdk/number-runtime";
|
|
27
|
+
import { truncateUtf16Safe } from "openclaw/plugin-sdk/text-utility-runtime";
|
|
27
28
|
import { LocalMediaAccessError, getDefaultLocalRoots, loadWebMedia as loadWebMedia$1, loadWebMediaRaw, optimizeImageToJpeg, optimizeImageToPng } from "openclaw/plugin-sdk/web-media";
|
|
28
29
|
import { chunkMarkdownTextWithMode } from "openclaw/plugin-sdk/reply-chunking";
|
|
29
30
|
import { isReasoningReplyPayload, resolveSendableOutboundReplyParts, sendMediaWithLeadingCaption } from "openclaw/plugin-sdk/reply-payload";
|
|
30
31
|
import { DEFAULT_ACCOUNT_ID as DEFAULT_ACCOUNT_ID$1, DEFAULT_MAIN_KEY, buildAgentMainSessionKey, buildAgentSessionKey, buildGroupHistoryKey, deriveLastRoutePolicy, normalizeAccountId as normalizeAccountId$1, normalizeAgentId, resolveAgentRoute, resolveInboundLastRouteSessionKey, resolveThreadSessionKeys } from "openclaw/plugin-sdk/routing";
|
|
31
32
|
import { recordInboundSession } from "openclaw/plugin-sdk/conversation-runtime";
|
|
32
|
-
import {
|
|
33
|
+
import { getSessionEntry, patchSessionEntry, resolveStorePath, resolveStorePath as resolveStorePath$1, updateLastRoute } from "openclaw/plugin-sdk/session-store-runtime";
|
|
33
34
|
import { buildChannelInboundEventContext, filterChannelInboundQuoteContext, formatInboundEnvelope, formatInboundEnvelope as formatInboundEnvelope$1, formatLocationText, hasVisibleInboundReplyDispatch, resolveInboundSessionEnvelopeContext, runChannelInboundEvent, toInboundMediaFacts, toLocationContext } from "openclaw/plugin-sdk/channel-inbound";
|
|
34
35
|
import { saveMediaStream } from "openclaw/plugin-sdk/media-store";
|
|
35
36
|
import { recordChannelActivity } from "openclaw/plugin-sdk/channel-activity-runtime";
|
|
@@ -704,6 +705,11 @@ async function attachWebInboxToSocket(options) {
|
|
|
704
705
|
const inboundDebounceMs = Math.max(0, Math.trunc(options.debounceMs ?? 0));
|
|
705
706
|
const pendingDebounceKeys = /* @__PURE__ */ new Set();
|
|
706
707
|
const activeInboundFlushes = /* @__PURE__ */ new Set();
|
|
708
|
+
const pendingMessageHandlers = /* @__PURE__ */ new Set();
|
|
709
|
+
let nextReceiveOrder = 0;
|
|
710
|
+
const publishPendingWorkState = (at = Date.now()) => {
|
|
711
|
+
options.onPendingWorkChanged?.(pendingMessageHandlers.size + pendingDebounceKeys.size + activeInboundFlushes.size, at);
|
|
712
|
+
};
|
|
707
713
|
const buildInboundDebounceKey = (msg) => {
|
|
708
714
|
const admission = requireWhatsAppInboundAdmission(msg);
|
|
709
715
|
const sender = msg.platform.sender;
|
|
@@ -739,6 +745,7 @@ async function attachWebInboxToSocket(options) {
|
|
|
739
745
|
finishFlush = resolve;
|
|
740
746
|
});
|
|
741
747
|
activeInboundFlushes.add(flushTask);
|
|
748
|
+
publishPendingWorkState();
|
|
742
749
|
try {
|
|
743
750
|
const orderedEntries = orderDebouncedInboundEntries(entries);
|
|
744
751
|
const last = orderedEntries.at(-1);
|
|
@@ -782,6 +789,7 @@ async function attachWebInboxToSocket(options) {
|
|
|
782
789
|
for (const entry of entries) if (entry.debounceKey) pendingDebounceKeys.delete(entry.debounceKey);
|
|
783
790
|
activeInboundFlushes.delete(flushTask);
|
|
784
791
|
finishFlush();
|
|
792
|
+
publishPendingWorkState();
|
|
785
793
|
}
|
|
786
794
|
},
|
|
787
795
|
onError: (err) => {
|
|
@@ -1245,7 +1253,10 @@ async function attachWebInboxToSocket(options) {
|
|
|
1245
1253
|
const debounceKey = buildInboundDebounceKey(inboundMessage);
|
|
1246
1254
|
if (debounceKey) {
|
|
1247
1255
|
inboundMessage.debounceKey = debounceKey;
|
|
1248
|
-
if (inboundDebounceMs > 0 && shouldDebounceInboundMessage(inboundMessage))
|
|
1256
|
+
if (inboundDebounceMs > 0 && shouldDebounceInboundMessage(inboundMessage)) {
|
|
1257
|
+
pendingDebounceKeys.add(debounceKey);
|
|
1258
|
+
publishPendingWorkState();
|
|
1259
|
+
}
|
|
1249
1260
|
}
|
|
1250
1261
|
if (inboundMessage.event.id) {
|
|
1251
1262
|
const admission = requireWhatsAppInboundAdmission(inboundMessage);
|
|
@@ -1266,8 +1277,6 @@ async function attachWebInboxToSocket(options) {
|
|
|
1266
1277
|
inboundConsoleLog.error(`Failed handling inbound web message: ${String(err)}`);
|
|
1267
1278
|
}
|
|
1268
1279
|
};
|
|
1269
|
-
const pendingMessageHandlers = /* @__PURE__ */ new Set();
|
|
1270
|
-
let nextReceiveOrder = 0;
|
|
1271
1280
|
const handleMessagesUpsert = async (upsert) => {
|
|
1272
1281
|
if (upsert.type !== "notify" && upsert.type !== "append") return;
|
|
1273
1282
|
for (const msg of upsert.messages ?? []) {
|
|
@@ -1292,8 +1301,10 @@ async function attachWebInboxToSocket(options) {
|
|
|
1292
1301
|
inboundConsoleLog.error(`Messages upsert handler error: ${String(err)}`);
|
|
1293
1302
|
});
|
|
1294
1303
|
pendingMessageHandlers.add(task);
|
|
1304
|
+
publishPendingWorkState();
|
|
1295
1305
|
task.finally(() => {
|
|
1296
1306
|
pendingMessageHandlers.delete(task);
|
|
1307
|
+
publishPendingWorkState();
|
|
1297
1308
|
});
|
|
1298
1309
|
};
|
|
1299
1310
|
const waitForPendingMessageHandlers = async () => {
|
|
@@ -1386,8 +1397,10 @@ async function attachWebInboxToSocket(options) {
|
|
|
1386
1397
|
inboundConsoleLog.error(`Failed replaying durable WhatsApp inbound: ${String(err)}`);
|
|
1387
1398
|
});
|
|
1388
1399
|
pendingMessageHandlers.add(replayTask);
|
|
1400
|
+
publishPendingWorkState();
|
|
1389
1401
|
replayTask.finally(() => {
|
|
1390
1402
|
pendingMessageHandlers.delete(replayTask);
|
|
1403
|
+
publishPendingWorkState();
|
|
1391
1404
|
});
|
|
1392
1405
|
(async () => {
|
|
1393
1406
|
try {
|
|
@@ -1563,6 +1576,8 @@ function createWebChannelStatusController(statusSink) {
|
|
|
1563
1576
|
lastMessageAt: null,
|
|
1564
1577
|
lastEventAt: null,
|
|
1565
1578
|
lastError: null,
|
|
1579
|
+
busy: false,
|
|
1580
|
+
lastRunActivityAt: null,
|
|
1566
1581
|
healthState: "starting"
|
|
1567
1582
|
};
|
|
1568
1583
|
const emit = () => {
|
|
@@ -1596,6 +1611,13 @@ function createWebChannelStatusController(statusSink) {
|
|
|
1596
1611
|
Object.assign(status, createTransportActivityStatusPatch(at));
|
|
1597
1612
|
emit();
|
|
1598
1613
|
},
|
|
1614
|
+
noteBusy(busy, at = Date.now()) {
|
|
1615
|
+
if (status.busy === busy && status.lastRunActivityAt === at) return;
|
|
1616
|
+
status.busy = busy;
|
|
1617
|
+
status.lastRunActivityAt = at;
|
|
1618
|
+
if (status.connected && busy) status.healthState = "healthy";
|
|
1619
|
+
emit();
|
|
1620
|
+
},
|
|
1599
1621
|
noteWatchdogStale(at = Date.now()) {
|
|
1600
1622
|
status.lastEventAt = at;
|
|
1601
1623
|
if (status.connected) status.healthState = "stale";
|
|
@@ -1714,23 +1736,37 @@ function hasNamedWhatsAppAccounts(cfg) {
|
|
|
1714
1736
|
function isActivationOnlyEntry(entry) {
|
|
1715
1737
|
return entry?.groupActivation !== void 0 && typeof entry?.sessionId !== "string" && typeof entry?.updatedAt !== "number";
|
|
1716
1738
|
}
|
|
1739
|
+
/** Resolves group activation for a WhatsApp conversation and backfills scoped session metadata. */
|
|
1717
1740
|
async function resolveGroupActivationFor(params) {
|
|
1718
|
-
const
|
|
1719
|
-
|
|
1741
|
+
const sessionScope = {
|
|
1742
|
+
storePath: resolveStorePath(params.cfg.session?.store, { agentId: params.agentId }),
|
|
1743
|
+
agentId: params.agentId
|
|
1744
|
+
};
|
|
1720
1745
|
const legacySessionKey = resolveWhatsAppLegacyGroupSessionKey({
|
|
1721
1746
|
sessionKey: params.sessionKey,
|
|
1722
1747
|
accountId: params.accountId
|
|
1723
1748
|
});
|
|
1724
|
-
const legacyEntry = legacySessionKey ?
|
|
1725
|
-
|
|
1749
|
+
const legacyEntry = legacySessionKey ? getSessionEntry({
|
|
1750
|
+
...sessionScope,
|
|
1751
|
+
sessionKey: legacySessionKey
|
|
1752
|
+
}) : void 0;
|
|
1753
|
+
const scopedEntry = getSessionEntry({
|
|
1754
|
+
...sessionScope,
|
|
1755
|
+
sessionKey: params.sessionKey
|
|
1756
|
+
});
|
|
1726
1757
|
const activation = (normalizeAccountId$1(params.accountId) === DEFAULT_ACCOUNT_ID$1 && hasNamedWhatsAppAccounts(params.cfg) && isActivationOnlyEntry(scopedEntry) ? void 0 : scopedEntry?.groupActivation) ?? legacyEntry?.groupActivation;
|
|
1727
|
-
if (activation !== void 0 && scopedEntry?.groupActivation === void 0) await
|
|
1728
|
-
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
|
|
1758
|
+
if (activation !== void 0 && scopedEntry?.groupActivation === void 0) await patchSessionEntry({
|
|
1759
|
+
...sessionScope,
|
|
1760
|
+
sessionKey: params.sessionKey,
|
|
1761
|
+
fallbackEntry: {},
|
|
1762
|
+
replaceEntry: true,
|
|
1763
|
+
update: (entry) => {
|
|
1764
|
+
if (entry.groupActivation !== void 0) return null;
|
|
1765
|
+
return {
|
|
1766
|
+
...entry,
|
|
1767
|
+
groupActivation: activation
|
|
1768
|
+
};
|
|
1769
|
+
}
|
|
1734
1770
|
});
|
|
1735
1771
|
const defaultActivation = !resolveWhatsAppInboundPolicy({
|
|
1736
1772
|
cfg: params.cfg,
|
|
@@ -1943,10 +1979,10 @@ function shouldWarnForGroupDrop(warnKey) {
|
|
|
1943
1979
|
}
|
|
1944
1980
|
return true;
|
|
1945
1981
|
}
|
|
1946
|
-
function isOwnerSender(baseMentionConfig, msg) {
|
|
1947
|
-
const sender = normalizeE164(getSenderIdentity(msg).e164 ?? "");
|
|
1982
|
+
function isOwnerSender(baseMentionConfig, msg, authDir) {
|
|
1983
|
+
const sender = normalizeE164(getSenderIdentity(msg, authDir).e164 ?? "");
|
|
1948
1984
|
if (!sender) return false;
|
|
1949
|
-
return resolveOwnerList(baseMentionConfig, getSelfIdentity(msg).e164 ?? void 0).includes(sender);
|
|
1985
|
+
return resolveOwnerList(baseMentionConfig, getSelfIdentity(msg, authDir).e164 ?? void 0).includes(sender);
|
|
1950
1986
|
}
|
|
1951
1987
|
function recordPendingGroupHistoryEntry(params) {
|
|
1952
1988
|
const senderIdentity = getSenderIdentity(params.msg);
|
|
@@ -2023,7 +2059,7 @@ async function applyGroupGating(params) {
|
|
|
2023
2059
|
} : params.msg;
|
|
2024
2060
|
const commandBody = stripMentionsForCommand(mentionMsg.payload.body, mentionConfig.mentionRegexes, self.e164);
|
|
2025
2061
|
const activationCommand = parseActivationCommand(commandBody);
|
|
2026
|
-
const owner = isOwnerSender(baseMentionConfig, params.msg);
|
|
2062
|
+
const owner = isOwnerSender(baseMentionConfig, params.msg, params.authDir);
|
|
2027
2063
|
const shouldBypassMention = owner && hasControlCommand(commandBody, params.cfg);
|
|
2028
2064
|
if (activationCommand.hasCommand && !owner) return skipGroupMessageAndStoreHistory(params, `Ignoring /activation from non-owner in group ${conversationId}`);
|
|
2029
2065
|
const mentionDebug = debugMention(mentionMsg, mentionConfig, params.authDir);
|
|
@@ -2079,7 +2115,7 @@ function trackBackgroundTask(backgroundTasks, task) {
|
|
|
2079
2115
|
task.then(cleanup, cleanup);
|
|
2080
2116
|
}
|
|
2081
2117
|
function updateLastRouteInBackground(params) {
|
|
2082
|
-
const storePath = resolveStorePath(params.cfg.session?.store, { agentId: params.storeAgentId });
|
|
2118
|
+
const storePath = resolveStorePath$1(params.cfg.session?.store, { agentId: params.storeAgentId });
|
|
2083
2119
|
const task = updateLastRoute({
|
|
2084
2120
|
storePath,
|
|
2085
2121
|
sessionKey: params.sessionKey,
|
|
@@ -2133,7 +2169,8 @@ function resolveWhatsAppDirectSystemPrompt(params) {
|
|
|
2133
2169
|
function elide(text, limit = 400) {
|
|
2134
2170
|
if (!text) return text;
|
|
2135
2171
|
if (text.length <= limit) return text;
|
|
2136
|
-
|
|
2172
|
+
const truncated = truncateUtf16Safe(text, limit);
|
|
2173
|
+
return `${truncated}… (truncated ${text.length - truncated.length} chars)`;
|
|
2137
2174
|
}
|
|
2138
2175
|
function markWhatsAppVisibleDeliveryError(error) {
|
|
2139
2176
|
if (typeof error === "object" && error !== null && !Array.isArray(error)) try {
|
|
@@ -3218,7 +3255,8 @@ async function processMessage(params) {
|
|
|
3218
3255
|
const commandAuthorized = shouldCheckCommandAuth ? await resolveWhatsAppCommandAuthorized({
|
|
3219
3256
|
cfg: params.cfg,
|
|
3220
3257
|
msg: params.msg,
|
|
3221
|
-
policy: inboundPolicy
|
|
3258
|
+
policy: inboundPolicy,
|
|
3259
|
+
authDir: account.authDir
|
|
3222
3260
|
}) : void 0;
|
|
3223
3261
|
const commandTurn = isTextCommand ? {
|
|
3224
3262
|
kind: "text-slash",
|
|
@@ -3861,6 +3899,9 @@ async function monitorWebChannel(verbose, listenerFactory = attachWebInboxToSock
|
|
|
3861
3899
|
statusController.noteInbound(inboundAt);
|
|
3862
3900
|
await onMessage(normalized);
|
|
3863
3901
|
},
|
|
3902
|
+
onPendingWorkChanged: (pendingWorkCount, at) => {
|
|
3903
|
+
statusController.noteBusy(pendingWorkCount > 0, at);
|
|
3904
|
+
},
|
|
3864
3905
|
sock
|
|
3865
3906
|
});
|
|
3866
3907
|
},
|
package/dist/runtime-api.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { o as resolveWebCredsBackupPath, r as hasWebCredsSync, s as resolveWebCredsPath } from "./creds-files-B1kSWtBg.js";
|
|
2
|
-
import { n as whatsAppActionRuntime, t as handleWhatsAppAction } from "./action-runtime-
|
|
3
|
-
import { i as sendTypingWhatsApp, n as sendPollWhatsApp, r as sendReactionWhatsApp, t as sendMessageWhatsApp } from "./send-
|
|
2
|
+
import { n as whatsAppActionRuntime, t as handleWhatsAppAction } from "./action-runtime-HPX_j5T4.js";
|
|
3
|
+
import { i as sendTypingWhatsApp, n as sendPollWhatsApp, r as sendReactionWhatsApp, t as sendMessageWhatsApp } from "./send-BVzLSkaY.js";
|
|
4
4
|
import { r as setWhatsAppRuntime } from "./runtime-BfAdAEYT.js";
|
|
5
5
|
import { n as getStatusCode, t as formatError } from "./session-errors-CbsoQqoy.js";
|
|
6
6
|
import { startWebLoginWithQr, waitForWebLogin } from "./login-qr-runtime.js";
|
|
7
7
|
import { t as createWhatsAppLoginTool } from "./agent-tools-login-BX7eHgDm.js";
|
|
8
|
-
import { C as waitForCredsSaveQueue, T as writeCredsJsonAtomically, _ as readWebSelfIdentity, a as formatWhatsAppWebAuthStatusState, b as restoreCredsFromBackupIfNeeded, c as logoutWeb, d as readWebAuthExistsBestEffort, f as readWebAuthExistsForDecision, g as readWebSelfId, h as readWebAuthState, l as pickWebChannel, m as readWebAuthSnapshotBestEffort, n as WHATSAPP_AUTH_UNSTABLE_CODE, o as getWebAuthAgeMs, p as readWebAuthSnapshot, r as WhatsAppAuthUnstableError, s as logWebSelfId, t as WA_WEB_AUTH_DIR, u as readCredsJsonRaw, v as readWebSelfIdentityForDecision, w as waitForCredsSaveQueueWithTimeout, x as webAuthExists, y as resolveDefaultWebAuthDir } from "./auth-store-
|
|
8
|
+
import { C as waitForCredsSaveQueue, T as writeCredsJsonAtomically, _ as readWebSelfIdentity, a as formatWhatsAppWebAuthStatusState, b as restoreCredsFromBackupIfNeeded, c as logoutWeb, d as readWebAuthExistsBestEffort, f as readWebAuthExistsForDecision, g as readWebSelfId, h as readWebAuthState, l as pickWebChannel, m as readWebAuthSnapshotBestEffort, n as WHATSAPP_AUTH_UNSTABLE_CODE, o as getWebAuthAgeMs, p as readWebAuthSnapshot, r as WhatsAppAuthUnstableError, s as logWebSelfId, t as WA_WEB_AUTH_DIR, u as readCredsJsonRaw, v as readWebSelfIdentityForDecision, w as waitForCredsSaveQueueWithTimeout, x as webAuthExists, y as resolveDefaultWebAuthDir } from "./auth-store-ECx4h57q.js";
|
|
9
9
|
import { t as DEFAULT_WEB_MEDIA_BYTES } from "./constants-HU41RHGI.js";
|
|
10
|
-
import { _ as extractLocationData, b as extractText, m as extractContactContext, v as extractMediaPlaceholder } from "./send-api-
|
|
11
|
-
import { n as newConnectionId, r as waitForWaConnection, t as createWaSocket } from "./session-
|
|
10
|
+
import { _ as extractLocationData, b as extractText, m as extractContactContext, v as extractMediaPlaceholder } from "./send-api-45J-BzEp.js";
|
|
11
|
+
import { n as newConnectionId, r as waitForWaConnection, t as createWaSocket } from "./session-WU4SVP8f.js";
|
|
12
12
|
import { n as resolveWebAccountId, t as getActiveWebListener } from "./active-listener-CFwkn3ho.js";
|
|
13
|
-
import { a as loadWebMediaRaw, c as monitorWebInbox, i as loadWebMedia, l as resetWebInboundDedupe, n as LocalMediaAccessError, o as optimizeImageToJpeg, r as getDefaultLocalRoots, s as optimizeImageToPng, t as monitorWebChannel } from "./monitor-
|
|
14
|
-
import { t as loginWeb } from "./login-
|
|
13
|
+
import { a as loadWebMediaRaw, c as monitorWebInbox, i as loadWebMedia, l as resetWebInboundDedupe, n as LocalMediaAccessError, o as optimizeImageToJpeg, r as getDefaultLocalRoots, s as optimizeImageToPng, t as monitorWebChannel } from "./monitor-DnsIesIx.js";
|
|
14
|
+
import { t as loginWeb } from "./login-8lHwLmXj.js";
|
|
15
15
|
import { HEARTBEAT_PROMPT, HEARTBEAT_TOKEN, SILENT_REPLY_TOKEN, stripHeartbeatToken } from "openclaw/plugin-sdk/reply-runtime";
|
|
16
16
|
export { DEFAULT_WEB_MEDIA_BYTES, HEARTBEAT_PROMPT, HEARTBEAT_TOKEN, LocalMediaAccessError, SILENT_REPLY_TOKEN, WA_WEB_AUTH_DIR, WHATSAPP_AUTH_UNSTABLE_CODE, WhatsAppAuthUnstableError, createWaSocket, createWhatsAppLoginTool, extractContactContext, extractLocationData, extractMediaPlaceholder, extractText, formatError, formatWhatsAppWebAuthStatusState, getActiveWebListener, getDefaultLocalRoots, getStatusCode, getWebAuthAgeMs, handleWhatsAppAction, hasWebCredsSync, loadWebMedia, loadWebMediaRaw, logWebSelfId, loginWeb, logoutWeb, monitorWebChannel, monitorWebInbox, newConnectionId, optimizeImageToJpeg, optimizeImageToPng, pickWebChannel, readCredsJsonRaw, readWebAuthExistsBestEffort, readWebAuthExistsForDecision, readWebAuthSnapshot, readWebAuthSnapshotBestEffort, readWebAuthState, readWebSelfId, readWebSelfIdentity, readWebSelfIdentityForDecision, resetWebInboundDedupe, resolveDefaultWebAuthDir, resolveWebAccountId, resolveWebCredsBackupPath, resolveWebCredsPath, restoreCredsFromBackupIfNeeded, sendMessageWhatsApp, sendPollWhatsApp, sendReactionWhatsApp, sendTypingWhatsApp, setWhatsAppRuntime, startWebLoginWithQr, stripHeartbeatToken, waitForCredsSaveQueue, waitForCredsSaveQueueWithTimeout, waitForWaConnection, waitForWebLogin, webAuthExists, whatsAppActionRuntime, writeCredsJsonAtomically };
|
|
@@ -6,7 +6,7 @@ import "./normalize-Bxwqo-bW.js";
|
|
|
6
6
|
import { t as getOptionalWhatsAppRuntime } from "./runtime-BfAdAEYT.js";
|
|
7
7
|
import { r as getRegisteredWhatsAppConnectionController, t as formatError } from "./session-errors-CbsoQqoy.js";
|
|
8
8
|
import { r as isWhatsAppSocketOperationTimeoutError } from "./socket-timing-DvMNkIge.js";
|
|
9
|
-
import { a as sanitizeAssistantVisibleTextWithProfile, d as markdownToWhatsApp, i as sanitizeAssistantVisibleText, m as toWhatsappJid, o as sleep, s as stripToolCallXmlTags } from "./text-runtime-
|
|
9
|
+
import { a as sanitizeAssistantVisibleTextWithProfile, d as markdownToWhatsApp, i as sanitizeAssistantVisibleText, m as toWhatsappJid, o as sleep, s as stripToolCallXmlTags } from "./text-runtime-C88QkuU9.js";
|
|
10
10
|
import path from "node:path";
|
|
11
11
|
import { uniqueStrings } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
12
12
|
import { sanitizeForPlainText } from "openclaw/plugin-sdk/channel-outbound";
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { n as isWhatsAppNewsletterJid } from "./normalize-target-bVWjgftN.js";
|
|
2
|
-
import { u as resolveWhatsAppDocumentFileName } from "./send-
|
|
2
|
+
import { u as resolveWhatsAppDocumentFileName } from "./send-BVzLSkaY.js";
|
|
3
3
|
import "./normalize-Bxwqo-bW.js";
|
|
4
|
-
import { h as toWhatsappJidWithLid, m as toWhatsappJid, u as jidToE164 } from "./text-runtime-
|
|
5
|
-
import { t as buildQuotedMessageOptions } from "./quoted-message-
|
|
6
|
-
import { c as resolveComparableIdentity } from "./identity-
|
|
4
|
+
import { h as toWhatsappJidWithLid, m as toWhatsappJid, u as jidToE164 } from "./text-runtime-C88QkuU9.js";
|
|
5
|
+
import { t as buildQuotedMessageOptions } from "./quoted-message-CpA_ujXK.js";
|
|
6
|
+
import { c as resolveComparableIdentity } from "./identity-CmsTmkKR.js";
|
|
7
7
|
import { normalizeLowercaseStringOrEmpty, normalizeStringEntries, uniqueStrings } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
8
8
|
import { createMessageReceiptFromOutboundResults, listMessageReceiptPlatformIds } from "openclaw/plugin-sdk/channel-outbound";
|
|
9
9
|
import { logVerbose } from "openclaw/plugin-sdk/runtime-env";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { o as resolveWebCredsBackupPath, s as resolveWebCredsPath, t as assertWebCredsPathRegularFileOrMissing } from "./creds-files-B1kSWtBg.js";
|
|
2
2
|
import { n as getStatusCode } from "./session-errors-CbsoQqoy.js";
|
|
3
3
|
import { t as DEFAULT_WHATSAPP_SOCKET_TIMING } from "./socket-timing-DvMNkIge.js";
|
|
4
|
-
import { E as writeWebCredsRawAtomically, S as enqueueCredsSave, T as writeCredsJsonAtomically, b as restoreCredsFromBackupIfNeeded, u as readCredsJsonRaw, w as waitForCredsSaveQueueWithTimeout, y as resolveDefaultWebAuthDir } from "./auth-store-
|
|
4
|
+
import { E as writeWebCredsRawAtomically, S as enqueueCredsSave, T as writeCredsJsonAtomically, b as restoreCredsFromBackupIfNeeded, u as readCredsJsonRaw, w as waitForCredsSaveQueueWithTimeout, y as resolveDefaultWebAuthDir } from "./auth-store-ECx4h57q.js";
|
|
5
5
|
import { i as makeWASocket, n as fetchLatestBaileysVersion, o as useMultiFileAuthState, r as makeCacheableSignalKeyStore } from "./session.runtime-CyooSQvj.js";
|
|
6
6
|
import { VERSION, formatCliCommand } from "openclaw/plugin-sdk/cli-runtime";
|
|
7
7
|
import { danger, getChildLogger, success, toPinoLikeLogger } from "openclaw/plugin-sdk/runtime-env";
|
|
@@ -13,6 +13,7 @@ import { createHttp1EnvHttpProxyAgent, createHttp1ProxyAgent, createNodeProxyAge
|
|
|
13
13
|
const LOGGED_OUT_STATUS = 401;
|
|
14
14
|
const WHATSAPP_WEBSOCKET_PROXY_TARGET = "https://mmg.whatsapp.net/";
|
|
15
15
|
const CREDS_FLUSH_TIMEOUT_MESSAGE = "Queued WhatsApp creds save did not finish before auth bootstrap; skipping repair and continuing with primary creds.";
|
|
16
|
+
const OPENCLAW_WHATSAPP_WEB_SOCKET_URL_ENV = "OPENCLAW_WHATSAPP_WEB_SOCKET_URL";
|
|
16
17
|
async function rejectUnsafeWebCredsPath(authDir) {
|
|
17
18
|
await assertWebCredsPathRegularFileOrMissing(resolveWebCredsPath(authDir));
|
|
18
19
|
}
|
|
@@ -45,6 +46,22 @@ async function printTerminalQr(qr) {
|
|
|
45
46
|
const output = await renderQrTerminal(qr, { small: true });
|
|
46
47
|
process.stdout.write(output.endsWith("\n") ? output : `${output}\n`);
|
|
47
48
|
}
|
|
49
|
+
function resolveWaWebSocketUrl(value) {
|
|
50
|
+
if (typeof value !== "string") return value;
|
|
51
|
+
return value.trim() || void 0;
|
|
52
|
+
}
|
|
53
|
+
function resolveEnvWaWebSocketUrl() {
|
|
54
|
+
const value = resolveWaWebSocketUrl(process.env[OPENCLAW_WHATSAPP_WEB_SOCKET_URL_ENV]);
|
|
55
|
+
if (!value) return;
|
|
56
|
+
let url;
|
|
57
|
+
try {
|
|
58
|
+
url = new URL(value);
|
|
59
|
+
} catch {
|
|
60
|
+
throw new Error(`${OPENCLAW_WHATSAPP_WEB_SOCKET_URL_ENV} must be a valid URL.`);
|
|
61
|
+
}
|
|
62
|
+
if (url.protocol !== "ws:" && url.protocol !== "wss:") throw new Error(`${OPENCLAW_WHATSAPP_WEB_SOCKET_URL_ENV} must use ws:// or wss://.`);
|
|
63
|
+
return url.toString();
|
|
64
|
+
}
|
|
48
65
|
/**
|
|
49
66
|
* Create a Baileys socket backed by the multi-file auth store we keep on disk.
|
|
50
67
|
* Consumers can opt into QR printing for interactive login flows.
|
|
@@ -66,6 +83,7 @@ async function createWaSocket(printQr, verbose, opts = {}) {
|
|
|
66
83
|
await writeCredsJsonAtomically(authDir, state.creds);
|
|
67
84
|
};
|
|
68
85
|
const { version } = await fetchLatestBaileysVersion();
|
|
86
|
+
const waWebSocketUrl = resolveWaWebSocketUrl(opts.waWebSocketUrl) ?? resolveEnvWaWebSocketUrl();
|
|
69
87
|
const agent = await resolveEnvProxyAgent(sessionLogger);
|
|
70
88
|
const fetchAgent = await resolveEnvFetchDispatcher(sessionLogger, agent);
|
|
71
89
|
const socketTiming = {
|
|
@@ -91,6 +109,7 @@ async function createWaSocket(printQr, verbose, opts = {}) {
|
|
|
91
109
|
...socketTiming,
|
|
92
110
|
agent,
|
|
93
111
|
fetchAgent,
|
|
112
|
+
...waWebSocketUrl ? { waWebSocketUrl } : {},
|
|
94
113
|
...opts.getMessage ? { getMessage: opts.getMessage } : {},
|
|
95
114
|
...opts.cachedGroupMetadata ? { cachedGroupMetadata: opts.cachedGroupMetadata } : {}
|
|
96
115
|
});
|
|
@@ -99,10 +99,10 @@ async function applyWhatsAppSecurityConfigFixes(params) {
|
|
|
99
99
|
//#region extensions/whatsapp/src/shared.ts
|
|
100
100
|
const WHATSAPP_CHANNEL = "whatsapp";
|
|
101
101
|
async function loadWhatsAppChannelRuntime() {
|
|
102
|
-
return await import("./channel.runtime-
|
|
102
|
+
return await import("./channel.runtime-D_0MiKk3.js");
|
|
103
103
|
}
|
|
104
104
|
async function loadWhatsAppSetupSurface() {
|
|
105
|
-
return await import("./setup-surface-
|
|
105
|
+
return await import("./setup-surface-DaVQrr0L.js");
|
|
106
106
|
}
|
|
107
107
|
const whatsappSetupWizardProxy = createWhatsAppSetupWizardProxy(async () => (await loadWhatsAppSetupSurface()).whatsappSetupWizard);
|
|
108
108
|
const whatsappConfigAdapter = createScopedChannelConfigAdapter({
|
|
@@ -2,7 +2,7 @@ import { r as resolveDefaultWhatsAppAccountId } from "./account-ids-CB5SOWjc.js"
|
|
|
2
2
|
import { r as hasWebCredsSync } from "./creds-files-B1kSWtBg.js";
|
|
3
3
|
import { a as resolveWhatsAppAccount, o as resolveWhatsAppAuthDir } from "./accounts-DgViSyJx.js";
|
|
4
4
|
import { a as normalizeWhatsAppAllowFromEntries, o as normalizeWhatsAppAllowFromEntry } from "./normalize-target-bVWjgftN.js";
|
|
5
|
-
import { t as whatsappSetupAdapter } from "./setup-core-
|
|
5
|
+
import { t as whatsappSetupAdapter } from "./setup-core-BLI8hThs.js";
|
|
6
6
|
import { DEFAULT_ACCOUNT_ID, createSetupTranslator, splitSetupEntries } from "openclaw/plugin-sdk/setup";
|
|
7
7
|
import { formatCliCommand, formatDocsLink } from "openclaw/plugin-sdk/setup-tools";
|
|
8
8
|
//#region extensions/whatsapp/src/setup-finalize.ts
|
|
@@ -280,7 +280,7 @@ async function finalizeWhatsAppSetup(params) {
|
|
|
280
280
|
message: linked ? t("wizard.whatsapp.relinkPrompt") : t("wizard.whatsapp.linkNowPrompt"),
|
|
281
281
|
initialValue: !linked
|
|
282
282
|
})) try {
|
|
283
|
-
const { loginWeb } = await import("./login-
|
|
283
|
+
const { loginWeb } = await import("./login-8lHwLmXj.js").then((n) => n.n);
|
|
284
284
|
await loginWeb(false, void 0, params.runtime, accountId);
|
|
285
285
|
} catch (error) {
|
|
286
286
|
params.runtime.error(`WhatsApp login failed: ${String(error)}`);
|
package/dist/setup-plugin-api.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as whatsappSetupPlugin } from "./channel.setup-
|
|
1
|
+
import { t as whatsappSetupPlugin } from "./channel.setup-3tEq3gHA.js";
|
|
2
2
|
export { whatsappSetupPlugin };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { t as listAccountIds } from "./account-ids-CB5SOWjc.js";
|
|
2
2
|
import { o as resolveWhatsAppAuthDir } from "./accounts-DgViSyJx.js";
|
|
3
|
-
import { a as formatWhatsAppWebAuthStatusState, h as readWebAuthState } from "./auth-store-
|
|
3
|
+
import { a as formatWhatsAppWebAuthStatusState, h as readWebAuthState } from "./auth-store-ECx4h57q.js";
|
|
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-BrZsNK4V.js")).finalizeWhatsAppSetup(params),
|
|
40
40
|
disable: (cfg) => setSetupChannelEnabled(cfg, channel, false),
|
|
41
41
|
onAccountRecorded: (accountId, options) => {
|
|
42
42
|
options?.onAccountId?.(channel, accountId);
|
|
@@ -171,6 +171,12 @@ function markdownToWhatsApp(text) {
|
|
|
171
171
|
inlineCodes.push(match);
|
|
172
172
|
return `${WHATSAPP_INLINE_CODE_PLACEHOLDER}${inlineCodes.length - 1}${WHATSAPP_PLACEHOLDER_TERMINATOR}`;
|
|
173
173
|
});
|
|
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_*");
|
|
174
180
|
result = result.replace(/\*\*(.+?)\*\*/g, "*$1*");
|
|
175
181
|
result = result.replace(/__(.+?)__/g, "*$1*");
|
|
176
182
|
result = result.replace(/~~(.+?)~~/g, "~$1~");
|
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openclaw/whatsapp",
|
|
3
|
-
"version": "2026.
|
|
3
|
+
"version": "2026.7.1-beta.1",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "@openclaw/whatsapp",
|
|
9
|
-
"version": "2026.
|
|
9
|
+
"version": "2026.7.1-beta.1",
|
|
10
10
|
"dependencies": {
|
|
11
11
|
"audio-decode": "2.2.3",
|
|
12
12
|
"baileys": "7.0.0-rc13",
|
|
13
13
|
"typebox": "1.1.39"
|
|
14
14
|
},
|
|
15
15
|
"peerDependencies": {
|
|
16
|
-
"openclaw": ">=2026.
|
|
16
|
+
"openclaw": ">=2026.7.1-beta.1"
|
|
17
17
|
},
|
|
18
18
|
"peerDependenciesMeta": {
|
|
19
19
|
"openclaw": {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openclaw/whatsapp",
|
|
3
|
-
"version": "2026.
|
|
3
|
+
"version": "2026.7.1-beta.1",
|
|
4
4
|
"description": "OpenClaw WhatsApp channel plugin for WhatsApp Web chats.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
"typebox": "1.1.39"
|
|
14
14
|
},
|
|
15
15
|
"peerDependencies": {
|
|
16
|
-
"openclaw": ">=2026.
|
|
16
|
+
"openclaw": ">=2026.7.1-beta.1"
|
|
17
17
|
},
|
|
18
18
|
"peerDependenciesMeta": {
|
|
19
19
|
"openclaw": {
|
|
@@ -56,10 +56,10 @@
|
|
|
56
56
|
"minHostVersion": ">=2026.4.25"
|
|
57
57
|
},
|
|
58
58
|
"compat": {
|
|
59
|
-
"pluginApi": ">=2026.
|
|
59
|
+
"pluginApi": ">=2026.7.1-beta.1"
|
|
60
60
|
},
|
|
61
61
|
"build": {
|
|
62
|
-
"openclawVersion": "2026.
|
|
62
|
+
"openclawVersion": "2026.7.1-beta.1"
|
|
63
63
|
},
|
|
64
64
|
"release": {
|
|
65
65
|
"publishToClawHub": true,
|