@openclaw/whatsapp 2026.7.2-beta.7 → 2026.8.1-beta.2
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-CSqLvCY5.js → accounts-BX2fZUyR.js} +1 -1
- package/dist/{action-runtime-BzfDFPbH.js → action-runtime-B4e3XFOY.js} +2 -2
- package/dist/action-runtime-api.js +1 -1
- package/dist/action-runtime.runtime.js +1 -1
- package/dist/{agent-tools-login-DE9MU98T.js → agent-tools-login-BjRpD-JQ.js} +5 -4
- package/dist/api.js +69 -127
- package/dist/{approval-handler.runtime-DrA59QSA.js → approval-handler.runtime-fgGZhALv.js} +4 -4
- package/dist/{approval-reactions-Cu66aYdq.js → approval-reactions-CmtJCxe_.js} +25 -73
- package/dist/auth-presence.js +1 -1
- package/dist/{auth-store-DcEpIOmE.js → auth-store-B_DQIdzp.js} +79 -12
- package/dist/call-tool-api.js +1 -1
- package/dist/{channel-Dg62olhy.js → channel-DJVQHz_V.js} +56 -160
- package/dist/channel-plugin-api.js +1 -1
- package/dist/{channel-react-action-J_YtyMGX.js → channel-react-action-d6OacTNj.js} +3 -3
- package/dist/{channel.runtime-BP0xNmLi.js → channel.runtime-RxuNGZ7w.js} +4 -4
- package/dist/channel.setup-Cmvd967u.js +14 -0
- package/dist/{connection-controller-BOB2MVKY.js → connection-controller-CUyZgGpf.js} +2 -3
- package/dist/contract-api.js +2 -3
- package/dist/{creds-files-B1kSWtBg.js → creds-files-W6B3EMZ8.js} +17 -1
- package/dist/{directory-config-DalGrfGN.js → directory-config-Pc4f07wB.js} +3 -3
- package/dist/directory-contract-api.js +1 -1
- package/dist/doctor-contract-api.js +37 -2
- package/dist/{group-session-key-DVMZlO3x.js → group-session-key-DmFc_Cqi.js} +23 -4
- package/dist/light-runtime-api.js +2 -2
- package/dist/{login-CvY2Dhch.js → login-D6_rfxTZ.js} +4 -4
- package/dist/{login-qr-Bncpb6js.js → login-qr-B0VyVSqQ.js} +4 -4
- package/dist/login-qr-runtime.js +1 -1
- package/dist/{monitor-CfkaUSL2.js → monitor-BCe5Mm-1.js} +574 -163
- package/dist/{question-reactions-CRsnyoMK.js → question-reactions-D3eAeB0i.js} +29 -78
- package/dist/runtime-api.js +9 -9
- package/dist/runtime-group-policy-DeSRFXEV.js +11 -0
- package/dist/{send-api-7wk6eQyW.js → send-api-DimZST3E.js} +86 -107
- package/dist/{send-D37ddk22.js → send-prK8F7Vj.js} +277 -16
- package/dist/setup-entry.js +1 -8
- package/dist/{setup-finalize-BZucx24W.js → setup-finalize-D3n71Uyx.js} +4 -4
- package/dist/setup-plugin-api.js +1 -1
- package/dist/{setup-surface-BkVcd769.js → setup-surface-BCZszf3l.js} +3 -3
- package/dist/{shared-CAxd15bp.js → shared-Dp9M3ZPX.js} +5 -6
- package/dist/{socket-close-DridEuzz.js → socket-close-09FojDO2.js} +4 -10
- package/openclaw.plugin.json +4 -0
- package/package.json +4 -5
- package/skills/wacli/SKILL.md +8 -1
- package/dist/access-control-pZcxTmd5.js +0 -363
- package/dist/approval-resolver-DoeBBt22.js +0 -16
- package/dist/channel.setup-pMwNVkCA.js +0 -19
- package/dist/identity-CPrT5aEU.js +0 -76
- package/dist/legacy-state-migrations-api.js +0 -2
- package/dist/state-migrations-CAMTrs2U.js +0 -33
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-D7D4PA-g.js";
|
|
2
|
-
import { a as
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
2
|
+
import { a as readWebCredsJsonRaw, c as resolveWebCredsPath, i as isWhatsAppBaileysAuthFileName, l as statWebCredsFileSync, o as readWebCredsJsonRawSync, r as hasWebCredsSync, s as resolveWebCredsBackupPath, t as assertWebCredsPathRegularFileOrMissing } from "./creds-files-W6B3EMZ8.js";
|
|
3
|
+
import { r as jidToE164 } from "./targets-runtime-TMk0lGuy.js";
|
|
4
|
+
import { n as resolveUserPath, t as normalizeE164 } from "./text-runtime-CaKLhowd.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";
|
|
@@ -68,6 +68,79 @@ async function waitForCredsSaveQueueWithTimeout(authDir, timeoutMs = CREDS_SAVE_
|
|
|
68
68
|
});
|
|
69
69
|
}
|
|
70
70
|
//#endregion
|
|
71
|
+
//#region extensions/whatsapp/src/identity.ts
|
|
72
|
+
const WHATSAPP_LID_RE = /@(lid|hosted\.lid)$/i;
|
|
73
|
+
function normalizeDeviceScopedJid(jid) {
|
|
74
|
+
return jid ? jid.replace(/:\d+/, "") : null;
|
|
75
|
+
}
|
|
76
|
+
function isLidJid(jid) {
|
|
77
|
+
return Boolean(jid && WHATSAPP_LID_RE.test(jid));
|
|
78
|
+
}
|
|
79
|
+
function resolveComparableIdentity(identity, authDir) {
|
|
80
|
+
const rawJid = normalizeDeviceScopedJid(identity?.jid);
|
|
81
|
+
const lid = normalizeDeviceScopedJid(identity?.lid) ?? (isLidJid(rawJid) ? rawJid : null);
|
|
82
|
+
const jid = rawJid && !isLidJid(rawJid) ? rawJid : null;
|
|
83
|
+
const e164 = identity?.e164 != null ? normalizeE164(identity.e164) : (jid ? jidToE164(jid, authDir ? { authDir } : void 0) : null) ?? (lid ? jidToE164(lid, authDir ? { authDir } : void 0) : null);
|
|
84
|
+
return {
|
|
85
|
+
...identity,
|
|
86
|
+
jid,
|
|
87
|
+
lid,
|
|
88
|
+
e164
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
function getComparableIdentityValues(identity) {
|
|
92
|
+
const resolved = resolveComparableIdentity(identity);
|
|
93
|
+
return [
|
|
94
|
+
resolved.e164,
|
|
95
|
+
resolved.jid,
|
|
96
|
+
resolved.lid
|
|
97
|
+
].filter((value) => Boolean(value));
|
|
98
|
+
}
|
|
99
|
+
function identitiesOverlap(left, right) {
|
|
100
|
+
const leftValues = new Set(getComparableIdentityValues(left));
|
|
101
|
+
if (leftValues.size === 0) return false;
|
|
102
|
+
return getComparableIdentityValues(right).some((value) => leftValues.has(value));
|
|
103
|
+
}
|
|
104
|
+
function getSenderIdentity(msg, authDir) {
|
|
105
|
+
return resolveComparableIdentity(msg.platform.sender ?? {
|
|
106
|
+
jid: msg.platform.senderJid ?? null,
|
|
107
|
+
e164: msg.platform.senderE164 ?? null,
|
|
108
|
+
name: msg.platform.senderName ?? null
|
|
109
|
+
}, authDir);
|
|
110
|
+
}
|
|
111
|
+
function getSelfIdentity(msg, authDir) {
|
|
112
|
+
return resolveComparableIdentity(msg.platform.self ?? {
|
|
113
|
+
jid: msg.platform.selfJid ?? null,
|
|
114
|
+
lid: msg.platform.selfLid ?? null,
|
|
115
|
+
e164: msg.platform.selfE164 ?? null
|
|
116
|
+
}, authDir);
|
|
117
|
+
}
|
|
118
|
+
function getReplyContext(msg, authDir) {
|
|
119
|
+
if (msg.quote?.context) return {
|
|
120
|
+
...msg.quote.context,
|
|
121
|
+
sender: resolveComparableIdentity(msg.quote.context.sender, authDir)
|
|
122
|
+
};
|
|
123
|
+
if (!msg.quote?.body) return null;
|
|
124
|
+
return {
|
|
125
|
+
id: msg.quote.id,
|
|
126
|
+
body: msg.quote.body,
|
|
127
|
+
sender: resolveComparableIdentity({
|
|
128
|
+
jid: msg.quote.sender?.jid ?? null,
|
|
129
|
+
e164: msg.quote.sender?.e164 ?? null,
|
|
130
|
+
label: msg.quote.sender?.displayName ?? null
|
|
131
|
+
}, authDir)
|
|
132
|
+
};
|
|
133
|
+
}
|
|
134
|
+
function getMentionJids(msg) {
|
|
135
|
+
return msg.group?.mentions?.jids ?? [];
|
|
136
|
+
}
|
|
137
|
+
function getMentionIdentities(msg, authDir) {
|
|
138
|
+
return getMentionJids(msg).map((jid) => resolveComparableIdentity({ jid }, authDir));
|
|
139
|
+
}
|
|
140
|
+
function getPrimaryIdentityId(identity) {
|
|
141
|
+
return identity?.e164 || identity?.jid?.trim() || identity?.lid || null;
|
|
142
|
+
}
|
|
143
|
+
//#endregion
|
|
71
144
|
//#region extensions/whatsapp/src/auth-store.ts
|
|
72
145
|
var auth_store_exports = /* @__PURE__ */ __exportAll({
|
|
73
146
|
WA_WEB_AUTH_DIR: () => WA_WEB_AUTH_DIR,
|
|
@@ -235,16 +308,10 @@ async function readWebAuthSnapshotBestEffort(authDir = resolveDefaultWebAuthDir(
|
|
|
235
308
|
selfId: snapshot.selfId
|
|
236
309
|
};
|
|
237
310
|
}
|
|
238
|
-
function isBaileysAuthFileName(name) {
|
|
239
|
-
if (name === "oauth.json") return false;
|
|
240
|
-
if (name === "creds.json" || name === "creds.json.bak") return true;
|
|
241
|
-
if (!name.endsWith(".json")) return false;
|
|
242
|
-
return /^(app-state-sync|session|sender-key|pre-key)-/.test(name);
|
|
243
|
-
}
|
|
244
311
|
async function clearBaileysAuthFiles(authDir, beforeCredentialPersistence) {
|
|
245
312
|
const rootStats = await fs.lstat(authDir).catch(() => null);
|
|
246
313
|
if (!rootStats?.isDirectory() || rootStats.isSymbolicLink()) return;
|
|
247
|
-
const credentialFiles = (await fs.readdir(authDir, { withFileTypes: true })).filter((entry) => entry.isFile() &&
|
|
314
|
+
const credentialFiles = (await fs.readdir(authDir, { withFileTypes: true })).filter((entry) => entry.isFile() && isWhatsAppBaileysAuthFileName(entry.name));
|
|
248
315
|
if (credentialFiles.length === 0) return;
|
|
249
316
|
await beforeCredentialPersistence?.();
|
|
250
317
|
await Promise.all(credentialFiles.map(async (entry) => {
|
|
@@ -257,7 +324,7 @@ async function shouldClearOnLogout(authDir, isLegacyAuthDir) {
|
|
|
257
324
|
if (!stats.isDirectory() || stats.isSymbolicLink()) return false;
|
|
258
325
|
if (isLegacyAuthDir) return (await fs.readdir(authDir, { withFileTypes: true })).some((entry) => {
|
|
259
326
|
if (!entry.isFile()) return false;
|
|
260
|
-
return
|
|
327
|
+
return isWhatsAppBaileysAuthFileName(entry.name);
|
|
261
328
|
});
|
|
262
329
|
if ((await fs.lstat(resolveWebCredsPath(authDir)).catch(() => null))?.isFile()) return true;
|
|
263
330
|
return (await fs.lstat(resolveWebCredsBackupPath(authDir)).catch(() => null))?.isFile() === true;
|
|
@@ -397,4 +464,4 @@ async function pickWebChannel(pref, authDir = resolveDefaultWebAuthDir()) {
|
|
|
397
464
|
return choice;
|
|
398
465
|
}
|
|
399
466
|
//#endregion
|
|
400
|
-
export {
|
|
467
|
+
export { enqueueCredsSave as A, getMentionIdentities as C, getSenderIdentity as D, getSelfIdentity as E, waitForCredsSaveQueueWithTimeout as M, writeCredsJsonAtomically as N, identitiesOverlap as O, writeWebCredsRawAtomically as P, getComparableIdentityValues as S, getReplyContext as T, readWebSelfIdentity as _, formatWhatsAppWebAuthStatusState as a, restoreCredsFromBackupIfNeeded as b, logoutWeb as c, readWebAuthExistsBestEffort as d, readWebAuthExistsForDecision as f, readWebSelfId as g, readWebAuthState as h, auth_store_exports as i, waitForCredsSaveQueue as j, resolveComparableIdentity as k, pickWebChannel as l, readWebAuthSnapshotBestEffort as m, WHATSAPP_AUTH_UNSTABLE_CODE as n, getWebAuthAgeMs as o, readWebAuthSnapshot as p, WhatsAppAuthUnstableError as r, logWebSelfId as s, WA_WEB_AUTH_DIR as t, readCredsJsonRaw as u, readWebSelfIdentityForDecision as v, getPrimaryIdentityId as w, webAuthExists as x, resolveDefaultWebAuthDir as y };
|
package/dist/call-tool-api.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as resolveWhatsAppAccount } from "./accounts-
|
|
1
|
+
import { a as resolveWhatsAppAccount } from "./accounts-BX2fZUyR.js";
|
|
2
2
|
import { r as getWhatsAppConnectionController } from "./connection-controller-runtime-context-DG0tuYuw.js";
|
|
3
3
|
import { s as resolveJidToE164 } from "./targets-runtime-TMk0lGuy.js";
|
|
4
4
|
import { createActionGate, stringEnum } from "openclaw/plugin-sdk/channel-actions";
|
|
@@ -1,22 +1,21 @@
|
|
|
1
|
-
import { a as resolveWhatsAppAccount } from "./accounts-
|
|
1
|
+
import { a as resolveWhatsAppAccount } from "./accounts-BX2fZUyR.js";
|
|
2
2
|
import { r as resolveDefaultWhatsAppAccountId, t as listAccountIds } from "./account-ids-CB5SOWjc.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-CugRyONv.js";
|
|
4
4
|
import { t as resolveWhatsAppOutboundTarget } from "./resolve-outbound-target-1GqbT1uX.js";
|
|
5
|
-
import { a as normalizeWhatsAppOutboundPayload, i as sendTypingWhatsApp, n as sendPollWhatsApp, o as normalizeWhatsAppPayloadText, s as normalizeWhatsAppPayloadTextPreservingIndentation, t as sendMessageWhatsApp
|
|
5
|
+
import { _ as resolveWhatsAppReactionLevel, a as normalizeWhatsAppOutboundPayload, i as sendTypingWhatsApp, n as sendPollWhatsApp, o as normalizeWhatsAppPayloadText, s as normalizeWhatsAppPayloadTextPreservingIndentation, t as sendMessageWhatsApp } from "./send-prK8F7Vj.js";
|
|
6
6
|
import { i as getWhatsAppRuntime } from "./runtime-BLlToOi6.js";
|
|
7
7
|
import "./normalize-C7Hkc_vE.js";
|
|
8
8
|
import { c as toWhatsappJid } from "./targets-runtime-TMk0lGuy.js";
|
|
9
9
|
import "./text-runtime-CaKLhowd.js";
|
|
10
|
-
import { t as createWhatsAppLoginTool } from "./agent-tools-login-
|
|
11
|
-
import { c as getWhatsAppApprovalApprovers, l as whatsappApprovalAuth, s as lookupInboundMessageMetaForTarget, t as resolveWhatsAppGroupSessionKey } from "./group-session-key-
|
|
12
|
-
import { a as resolveWhatsAppGroupRequireMention, c as loadWhatsAppChannelRuntime, i as whatsappSetupContract, l as readWhatsAppAccountLinkState, n as whatsappSetupWizardProxy, o as resolveWhatsAppGroupToolPolicy,
|
|
10
|
+
import { t as createWhatsAppLoginTool } from "./agent-tools-login-BjRpD-JQ.js";
|
|
11
|
+
import { c as getWhatsAppApprovalApprovers, l as whatsappApprovalAuth, s as lookupInboundMessageMetaForTarget, t as resolveWhatsAppGroupSessionKey } from "./group-session-key-DmFc_Cqi.js";
|
|
12
|
+
import { a as resolveWhatsAppGroupRequireMention, c as loadWhatsAppChannelRuntime, i as whatsappSetupContract, l as readWhatsAppAccountLinkState, n as whatsappSetupWizardProxy, o as resolveWhatsAppGroupToolPolicy, s as formatWhatsAppConfigAllowFromEntries, t as createWhatsAppPluginBase } from "./shared-Dp9M3ZPX.js";
|
|
13
13
|
import { t as whatsappCommandPolicy } from "./command-policy-BIOSHySD.js";
|
|
14
|
-
import { f as readWebAuthExistsForDecision, n as WHATSAPP_AUTH_UNSTABLE_CODE } from "./auth-store-
|
|
15
|
-
import { t as detectWhatsAppLegacyStateMigrations } from "./state-migrations-CAMTrs2U.js";
|
|
14
|
+
import { f as readWebAuthExistsForDecision, n as WHATSAPP_AUTH_UNSTABLE_CODE } from "./auth-store-B_DQIdzp.js";
|
|
16
15
|
import { createActionGate as createActionGate$1 } from "openclaw/plugin-sdk/channel-actions";
|
|
17
16
|
import { normalizeOptionalAccountId } from "openclaw/plugin-sdk/account-core";
|
|
18
17
|
import { normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
19
|
-
import {
|
|
18
|
+
import { collectIssuesForEnabledAccounts, createComputedAccountStatusAdapter, createDefaultChannelRuntimeState, isRecord as isRecord$1, readAccountStatusSnapshot } from "openclaw/plugin-sdk/status-helpers";
|
|
20
19
|
import { formatCliCommand } from "openclaw/plugin-sdk/cli-runtime";
|
|
21
20
|
import { buildChannelOutboundSessionRoute } from "openclaw/plugin-sdk/core";
|
|
22
21
|
import { chunkText } from "openclaw/plugin-sdk/reply-chunking";
|
|
@@ -26,180 +25,76 @@ import { DEFAULT_ACCOUNT_ID as DEFAULT_ACCOUNT_ID$1 } from "openclaw/plugin-sdk/
|
|
|
26
25
|
import { buildDmGroupAccountAllowlistAdapter } from "openclaw/plugin-sdk/allowlist-config-edit";
|
|
27
26
|
import { createChatChannelPlugin } from "openclaw/plugin-sdk/channel-core";
|
|
28
27
|
import { createLazyRuntimeModule } from "openclaw/plugin-sdk/lazy-runtime";
|
|
29
|
-
import {
|
|
28
|
+
import { createApproverRestrictedNativeApprovalCapabilityFromForwardingRoutes } from "openclaw/plugin-sdk/approval-delivery-runtime";
|
|
30
29
|
import { createLazyChannelApprovalNativeRuntimeAdapter } from "openclaw/plugin-sdk/approval-handler-adapter-runtime";
|
|
31
|
-
import { createChannelApproverDmTargetResolver, createChannelNativeOriginTargetResolver, createNativeApprovalChannelRouteGates, createNativeApprovalForwardingFallbackSuppressor, createNativeApprovalMessagingTargetResolvers } from "openclaw/plugin-sdk/approval-native-runtime";
|
|
32
30
|
import { buildApprovalReactionPromptPayloadForRequest } from "openclaw/plugin-sdk/approval-reaction-runtime";
|
|
33
31
|
import { buildTypedApprovalPresentation } from "openclaw/plugin-sdk/approval-reply-runtime";
|
|
34
32
|
import { questionGatewayRuntime } from "openclaw/plugin-sdk/question-gateway-runtime";
|
|
35
33
|
import { attachChannelToResult, createAttachedChannelResultAdapter } from "openclaw/plugin-sdk/channel-send-result";
|
|
36
34
|
//#region extensions/whatsapp/src/approval-native.ts
|
|
37
|
-
const DEFAULT_APPROVAL_FORWARDING_MODE = "session";
|
|
38
|
-
const { normalizeForwardTarget: normalizeWhatsAppForwardTarget, normalizeTarget: normalizeWhatsAppApprovalTarget, resolveSessionTarget: resolveSessionWhatsAppOriginTarget, resolveTurnSourceTarget: resolveTurnSourceWhatsAppOriginTarget } = createNativeApprovalMessagingTargetResolvers({
|
|
39
|
-
channel: "whatsapp",
|
|
40
|
-
normalizeTo: normalizeWhatsAppMessagingTarget
|
|
41
|
-
});
|
|
42
35
|
function isWhatsAppApprovalTransportEnabled(params) {
|
|
43
36
|
return resolveWhatsAppAccount({
|
|
44
37
|
cfg: params.cfg,
|
|
45
38
|
accountId: params.accountId
|
|
46
39
|
}).enabled;
|
|
47
40
|
}
|
|
48
|
-
const
|
|
49
|
-
channel: "whatsapp",
|
|
50
|
-
defaultForwardingMode: DEFAULT_APPROVAL_FORWARDING_MODE,
|
|
51
|
-
isTransportEnabled: isWhatsAppApprovalTransportEnabled,
|
|
52
|
-
listAccountIds,
|
|
53
|
-
resolveDefaultAccountId: resolveDefaultWhatsAppAccountId,
|
|
54
|
-
normalizeForwardTarget: normalizeWhatsAppForwardTarget,
|
|
55
|
-
resolveTurnSourceTarget: resolveTurnSourceWhatsAppOriginTarget
|
|
56
|
-
});
|
|
57
|
-
const resolveWhatsAppOriginTargetBase = createChannelNativeOriginTargetResolver({
|
|
58
|
-
channel: "whatsapp",
|
|
59
|
-
shouldHandleRequest: shouldHandleWhatsAppApprovalRequest,
|
|
60
|
-
resolveTurnSourceTarget: resolveTurnSourceWhatsAppOriginTarget,
|
|
61
|
-
resolveSessionTarget: resolveSessionWhatsAppOriginTarget,
|
|
62
|
-
normalizeTarget: normalizeWhatsAppApprovalTarget
|
|
63
|
-
});
|
|
64
|
-
function resolveWhatsAppOriginTarget(params) {
|
|
65
|
-
const target = resolveWhatsAppOriginTargetBase(params);
|
|
66
|
-
if (!target) return null;
|
|
67
|
-
if (isWhatsAppGroupJid(target.to) && getWhatsAppApprovalApprovers({
|
|
68
|
-
cfg: params.cfg,
|
|
69
|
-
accountId: params.accountId
|
|
70
|
-
}).length === 0) return null;
|
|
71
|
-
return target;
|
|
72
|
-
}
|
|
73
|
-
const resolveWhatsAppApproverDmTargets = createChannelApproverDmTargetResolver({
|
|
74
|
-
shouldHandleRequest: shouldHandleWhatsAppApprovalRequest,
|
|
75
|
-
resolveApprovers: getWhatsAppApprovalApprovers,
|
|
76
|
-
mapApprover: (approver, params) => {
|
|
77
|
-
const to = normalizeWhatsAppMessagingTarget(approver);
|
|
78
|
-
if (!to) return null;
|
|
79
|
-
return {
|
|
80
|
-
to,
|
|
81
|
-
accountId: normalizeOptionalString(params.accountId)
|
|
82
|
-
};
|
|
83
|
-
}
|
|
84
|
-
});
|
|
85
|
-
const shouldSuppressWhatsAppForwardingFallback = createNativeApprovalForwardingFallbackSuppressor({
|
|
41
|
+
const whatsappApproval = createApproverRestrictedNativeApprovalCapabilityFromForwardingRoutes({
|
|
86
42
|
channel: "whatsapp",
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
...payload,
|
|
102
|
-
presentation: buildTypedApprovalPresentation({
|
|
103
|
-
approvalId: params.request.id,
|
|
104
|
-
approvalKind: "exec",
|
|
105
|
-
allowedDecisions: payload.allowedDecisions
|
|
106
|
-
})
|
|
107
|
-
};
|
|
108
|
-
}
|
|
109
|
-
function buildWhatsAppPluginPendingPayload(params) {
|
|
110
|
-
const payload = buildApprovalReactionPromptPayloadForRequest(params);
|
|
111
|
-
return {
|
|
112
|
-
...payload,
|
|
113
|
-
presentation: buildTypedApprovalPresentation({
|
|
114
|
-
approvalId: params.request.id,
|
|
115
|
-
approvalKind: "plugin",
|
|
116
|
-
allowedDecisions: payload.allowedDecisions
|
|
117
|
-
})
|
|
118
|
-
};
|
|
119
|
-
}
|
|
120
|
-
const whatsappApprovalCapability = createChannelApprovalCapability({
|
|
121
|
-
...whatsappApprovalAuth,
|
|
122
|
-
getActionAvailabilityState: ({ cfg, accountId, approvalKind }) => (approvalKind ? canApprovalPotentiallyRouteToWhatsApp({
|
|
123
|
-
cfg,
|
|
124
|
-
accountId,
|
|
125
|
-
approvalKind
|
|
126
|
-
}) : canAnyApprovalPotentiallyRouteToWhatsApp({
|
|
127
|
-
cfg,
|
|
128
|
-
accountId
|
|
129
|
-
})) ? { kind: "enabled" } : { kind: "disabled" },
|
|
130
|
-
getExecInitiatingSurfaceState: ({ cfg, accountId }) => canApprovalPotentiallyRouteToWhatsApp({
|
|
131
|
-
cfg,
|
|
132
|
-
accountId,
|
|
133
|
-
approvalKind: "exec"
|
|
134
|
-
}) ? { kind: "enabled" } : { kind: "disabled" },
|
|
43
|
+
channelLabel: "WhatsApp",
|
|
44
|
+
authorizeActorAction: (params) => whatsappApprovalAuth.authorizeActorAction(params),
|
|
45
|
+
routing: {
|
|
46
|
+
defaultForwardingMode: "session",
|
|
47
|
+
isTransportEnabled: isWhatsAppApprovalTransportEnabled,
|
|
48
|
+
listAccountIds,
|
|
49
|
+
resolveDefaultAccountId: resolveDefaultWhatsAppAccountId,
|
|
50
|
+
normalizeTo: normalizeWhatsAppMessagingTarget,
|
|
51
|
+
resolveApprovers: getWhatsAppApprovalApprovers,
|
|
52
|
+
isOriginTargetAllowed: ({ cfg, accountId, target }) => !isWhatsAppGroupJid(target.to) || getWhatsAppApprovalApprovers({
|
|
53
|
+
cfg,
|
|
54
|
+
accountId
|
|
55
|
+
}).length > 0
|
|
56
|
+
},
|
|
135
57
|
describeExecApprovalSetup: ({ accountId }) => {
|
|
136
58
|
return `WhatsApp supports native exec approvals for this account when \`approvals.exec.enabled\` is true and the route allows WhatsApp. Link WhatsApp and keep the gateway running; configure \`${accountId && accountId !== "default" ? `channels.whatsapp.accounts.${accountId}` : "channels.whatsapp"}.allowFrom\` to restrict approvers.`;
|
|
137
59
|
},
|
|
138
|
-
delivery: {
|
|
139
|
-
hasConfiguredDmRoute: ({ cfg }) => listAccountIds(cfg).some((accountId) => {
|
|
140
|
-
if (!canAnyApprovalPotentiallyRouteToWhatsApp({
|
|
141
|
-
cfg,
|
|
142
|
-
accountId,
|
|
143
|
-
nativeSessionOnly: true
|
|
144
|
-
})) return false;
|
|
145
|
-
return getWhatsAppApprovalApprovers({
|
|
146
|
-
cfg,
|
|
147
|
-
accountId
|
|
148
|
-
}).length > 0;
|
|
149
|
-
}),
|
|
150
|
-
shouldSuppressForwardingFallback: shouldSuppressWhatsAppForwardingFallback
|
|
151
|
-
},
|
|
152
60
|
render: {
|
|
153
|
-
exec: { buildPendingPayload: ({ request, nowMs }) =>
|
|
61
|
+
exec: { buildPendingPayload: ({ request, nowMs }) => buildWhatsAppPendingPayload({
|
|
154
62
|
request,
|
|
155
63
|
nowMs
|
|
156
|
-
}) },
|
|
157
|
-
plugin: { buildPendingPayload: ({ request, nowMs }) =>
|
|
64
|
+
}, "exec") },
|
|
65
|
+
plugin: { buildPendingPayload: ({ request, nowMs }) => buildWhatsAppPendingPayload({
|
|
158
66
|
request,
|
|
159
67
|
nowMs
|
|
160
|
-
}) }
|
|
68
|
+
}, "plugin") }
|
|
161
69
|
},
|
|
162
|
-
|
|
163
|
-
describeDeliveryCapabilities: ({ cfg, accountId, approvalKind, request }) => {
|
|
164
|
-
const originTarget = resolveWhatsAppOriginTarget({
|
|
165
|
-
cfg,
|
|
166
|
-
accountId,
|
|
167
|
-
approvalKind,
|
|
168
|
-
request
|
|
169
|
-
});
|
|
170
|
-
const approverTargets = resolveWhatsAppApproverDmTargets({
|
|
171
|
-
cfg,
|
|
172
|
-
accountId,
|
|
173
|
-
approvalKind,
|
|
174
|
-
request
|
|
175
|
-
});
|
|
176
|
-
return {
|
|
177
|
-
enabled: Boolean(originTarget) || approverTargets.length > 0,
|
|
178
|
-
preferredSurface: originTarget ? "origin" : "approver-dm",
|
|
179
|
-
supportsOriginSurface: Boolean(originTarget),
|
|
180
|
-
supportsApproverDmSurface: approverTargets.length > 0,
|
|
181
|
-
notifyOriginWhenDmOnly: true
|
|
182
|
-
};
|
|
183
|
-
},
|
|
184
|
-
resolveOriginTarget: resolveWhatsAppOriginTarget,
|
|
185
|
-
resolveApproverDmTargets: resolveWhatsAppApproverDmTargets
|
|
186
|
-
},
|
|
187
|
-
nativeRuntime: createLazyChannelApprovalNativeRuntimeAdapter({
|
|
70
|
+
createNativeRuntime: (routing) => createLazyChannelApprovalNativeRuntimeAdapter({
|
|
188
71
|
eventKinds: ["exec", "plugin"],
|
|
189
|
-
isConfigured: ({ cfg, accountId, context }) => Boolean(context) &&
|
|
72
|
+
isConfigured: ({ cfg, accountId, context }) => Boolean(context) && routing.canAnyApprovalPotentiallyRouteToChannel({
|
|
190
73
|
cfg,
|
|
191
74
|
accountId,
|
|
192
75
|
nativeSessionOnly: true
|
|
193
76
|
}),
|
|
194
|
-
shouldHandle: ({ cfg, accountId, context, approvalKind, request }) => Boolean(context) &&
|
|
77
|
+
shouldHandle: ({ cfg, accountId, context, approvalKind, request }) => Boolean(context) && routing.shouldHandleApprovalRequest({
|
|
195
78
|
cfg,
|
|
196
79
|
accountId,
|
|
197
80
|
approvalKind,
|
|
198
81
|
request
|
|
199
82
|
}),
|
|
200
|
-
load: async () => (await import("./approval-handler.runtime-
|
|
83
|
+
load: async () => (await import("./approval-handler.runtime-fgGZhALv.js")).whatsappApprovalNativeRuntime
|
|
201
84
|
})
|
|
202
85
|
});
|
|
86
|
+
function buildWhatsAppPendingPayload(params, approvalKind) {
|
|
87
|
+
const payload = buildApprovalReactionPromptPayloadForRequest(params);
|
|
88
|
+
return {
|
|
89
|
+
...payload,
|
|
90
|
+
presentation: buildTypedApprovalPresentation({
|
|
91
|
+
approvalId: params.request.id,
|
|
92
|
+
approvalKind,
|
|
93
|
+
allowedDecisions: payload.allowedDecisions
|
|
94
|
+
})
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
const whatsappApprovalCapability = whatsappApproval.capability;
|
|
203
98
|
//#endregion
|
|
204
99
|
//#region extensions/whatsapp/src/channel-actions.ts
|
|
205
100
|
function areWhatsAppAgentReactionsEnabled(params) {
|
|
@@ -266,6 +161,7 @@ function createWhatsAppOutboundBase({ chunker, sendMessageWhatsApp, sendPollWhat
|
|
|
266
161
|
remoteJid: cachedMeta?.remoteJid ?? targetJid,
|
|
267
162
|
fromMe: cachedMeta?.fromMe ?? false,
|
|
268
163
|
participant: cachedMeta?.participant,
|
|
164
|
+
...cachedMeta && cachedMeta.remoteJid !== targetJid ? { lookupTargetJid: targetJid } : {},
|
|
269
165
|
messageText: cachedMeta?.body,
|
|
270
166
|
media: cachedMeta?.media
|
|
271
167
|
};
|
|
@@ -364,8 +260,8 @@ function createWhatsAppOutboundBase({ chunker, sendMessageWhatsApp, sendPollWhat
|
|
|
364
260
|
}
|
|
365
261
|
//#endregion
|
|
366
262
|
//#region extensions/whatsapp/src/channel-outbound.ts
|
|
367
|
-
const loadWhatsAppApprovalReactionsModule = createLazyRuntimeModule(() => import("./approval-reactions-
|
|
368
|
-
const loadWhatsAppQuestionReactionsModule = createLazyRuntimeModule(() => import("./question-reactions-
|
|
263
|
+
const loadWhatsAppApprovalReactionsModule = createLazyRuntimeModule(() => import("./approval-reactions-CmtJCxe_.js").then((n) => n.t));
|
|
264
|
+
const loadWhatsAppQuestionReactionsModule = createLazyRuntimeModule(() => import("./question-reactions-D3eAeB0i.js").then((n) => n.n));
|
|
369
265
|
function normalizeWhatsAppChannelPayloadText(text) {
|
|
370
266
|
return normalizeWhatsAppPayloadTextPreservingIndentation(text);
|
|
371
267
|
}
|
|
@@ -525,7 +421,7 @@ const WHATSAPP_ACCOUNT_STATUS_FIELDS = [
|
|
|
525
421
|
const RECENT_DISCONNECT_WARNING_WINDOW_MS = 900 * 1e3;
|
|
526
422
|
function readLastDisconnect(value) {
|
|
527
423
|
if (typeof value === "string") {
|
|
528
|
-
const error =
|
|
424
|
+
const error = normalizeOptionalString(value);
|
|
529
425
|
return error ? {
|
|
530
426
|
at: null,
|
|
531
427
|
error
|
|
@@ -534,7 +430,7 @@ function readLastDisconnect(value) {
|
|
|
534
430
|
if (!isRecord$1(value)) return null;
|
|
535
431
|
return {
|
|
536
432
|
at: typeof value.at === "number" ? value.at : null,
|
|
537
|
-
error:
|
|
433
|
+
error: normalizeOptionalString(value.error)
|
|
538
434
|
};
|
|
539
435
|
}
|
|
540
436
|
function isRecentDisconnect(disconnect, now = Date.now()) {
|
|
@@ -547,14 +443,14 @@ function collectWhatsAppStatusIssues(accounts) {
|
|
|
547
443
|
readAccount: (value) => readAccountStatusSnapshot(value, WHATSAPP_ACCOUNT_STATUS_FIELDS),
|
|
548
444
|
collectIssues: ({ account, accountId, issues }) => {
|
|
549
445
|
const linked = account.linked === true;
|
|
550
|
-
const statusState =
|
|
446
|
+
const statusState = normalizeOptionalString(account.statusState);
|
|
551
447
|
const running = account.running === true;
|
|
552
448
|
const connected = account.connected === true;
|
|
553
449
|
const reconnectAttempts = typeof account.reconnectAttempts === "number" ? account.reconnectAttempts : null;
|
|
554
450
|
const lastInboundAt = typeof account.lastInboundAt === "number" ? account.lastInboundAt : null;
|
|
555
451
|
const lastDisconnect = readLastDisconnect(account.lastDisconnect);
|
|
556
|
-
const lastError =
|
|
557
|
-
const healthState =
|
|
452
|
+
const lastError = normalizeOptionalString(account.lastError) ?? lastDisconnect?.error;
|
|
453
|
+
const healthState = normalizeOptionalString(account.healthState);
|
|
558
454
|
if (statusState === "unstable") {
|
|
559
455
|
issues.push({
|
|
560
456
|
channel: "whatsapp",
|
|
@@ -629,8 +525,8 @@ function collectWhatsAppStatusIssues(accounts) {
|
|
|
629
525
|
}
|
|
630
526
|
//#endregion
|
|
631
527
|
//#region extensions/whatsapp/src/channel.ts
|
|
632
|
-
const loadWhatsAppDirectoryConfig = createLazyRuntimeModule(() => import("./directory-config-
|
|
633
|
-
const loadWhatsAppChannelReactAction = createLazyRuntimeModule(() => import("./channel-react-action-
|
|
528
|
+
const loadWhatsAppDirectoryConfig = createLazyRuntimeModule(() => import("./directory-config-Pc4f07wB.js").then((n) => n.t));
|
|
529
|
+
const loadWhatsAppChannelReactAction = createLazyRuntimeModule(() => import("./channel-react-action-d6OacTNj.js"));
|
|
634
530
|
function resolveWhatsAppTargetInfo(raw) {
|
|
635
531
|
const normalized = normalizeWhatsAppTarget(raw);
|
|
636
532
|
if (!normalized) return null;
|
|
@@ -663,7 +559,6 @@ const whatsappPlugin = createChatChannelPlugin({
|
|
|
663
559
|
resolveToolPolicy: resolveWhatsAppGroupToolPolicy
|
|
664
560
|
},
|
|
665
561
|
setupWizard: whatsappSetupWizardProxy,
|
|
666
|
-
setup: whatsappSetupAdapter,
|
|
667
562
|
setupContract: whatsappSetupContract,
|
|
668
563
|
isConfigured: (account) => Boolean(account.authDir),
|
|
669
564
|
isLinked: async (account) => await readWhatsAppAccountLinkState(account.authDir)
|
|
@@ -766,7 +661,6 @@ const whatsappPlugin = createChatChannelPlugin({
|
|
|
766
661
|
const resolvedAccountId = accountId?.trim() || whatsappPlugin.config.defaultAccountId?.(cfg) || DEFAULT_ACCOUNT_ID$1;
|
|
767
662
|
await (await loadWhatsAppChannelRuntime()).loginWeb(Boolean(verbose), void 0, runtime, resolvedAccountId);
|
|
768
663
|
} },
|
|
769
|
-
lifecycle: { detectLegacyStateMigrations: ({ oauthDir }) => detectWhatsAppLegacyStateMigrations({ oauthDir }) },
|
|
770
664
|
heartbeat: {
|
|
771
665
|
checkReady: async ({ cfg, accountId, deps }) => await checkWhatsAppHeartbeatReady({
|
|
772
666
|
cfg,
|
|
@@ -791,7 +685,8 @@ const whatsappPlugin = createChatChannelPlugin({
|
|
|
791
685
|
lastEventAt: null,
|
|
792
686
|
busy: false,
|
|
793
687
|
lastRunActivityAt: null,
|
|
794
|
-
healthState: "stopped"
|
|
688
|
+
healthState: "stopped",
|
|
689
|
+
lifecycle: "stopped"
|
|
795
690
|
}),
|
|
796
691
|
collectStatusIssues: collectWhatsAppStatusIssues,
|
|
797
692
|
buildChannelSummary: async ({ account, snapshot }) => {
|
|
@@ -833,6 +728,7 @@ const whatsappPlugin = createChatChannelPlugin({
|
|
|
833
728
|
lastRunActivityAt: snapshot.lastRunActivityAt ?? null,
|
|
834
729
|
lastError: snapshot.lastError ?? null,
|
|
835
730
|
healthState: snapshot.healthState ?? void 0,
|
|
731
|
+
lifecycle: snapshot.lifecycle ?? void 0,
|
|
836
732
|
...snapshot.terminalDisconnect ? { terminalDisconnect: snapshot.terminalDisconnect } : {}
|
|
837
733
|
};
|
|
838
734
|
},
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as whatsappPlugin } from "./channel-
|
|
1
|
+
import { t as whatsappPlugin } from "./channel-DJVQHz_V.js";
|
|
2
2
|
export { whatsappPlugin };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { a as resolveWhatsAppAccount, s as resolveWhatsAppMediaMaxBytes } from "./accounts-
|
|
1
|
+
import { a as resolveWhatsAppAccount, s as resolveWhatsAppMediaMaxBytes } from "./accounts-BX2fZUyR.js";
|
|
2
2
|
import { c as normalizeWhatsAppTarget, t as isWhatsAppGroupJid } from "./normalize-target-CugRyONv.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-B4e3XFOY.js";
|
|
4
|
+
import { t as sendMessageWhatsApp } from "./send-prK8F7Vj.js";
|
|
5
5
|
import "./normalize-C7Hkc_vE.js";
|
|
6
6
|
import { jsonResult, readStringOrNumberParam, readStringParam as readStringParam$1, resolveReactionMessageId } from "openclaw/plugin-sdk/channel-actions";
|
|
7
7
|
import { canonicalizeBase64, estimateBase64DecodedBytes } from "openclaw/plugin-sdk/media-runtime";
|
|
@@ -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-B_DQIdzp.js";
|
|
3
3
|
import { t as getActiveWebListener$1 } from "./active-listener-BEjWsCNM.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-BCe5Mm-1.js";
|
|
5
|
+
import { t as loginWeb$1 } from "./login-D6_rfxTZ.js";
|
|
6
|
+
import { whatsappSetupWizard as whatsappSetupWizard$1 } from "./setup-surface-BCZszf3l.js";
|
|
7
7
|
//#region extensions/whatsapp/src/channel.runtime.ts
|
|
8
8
|
function getActiveWebListener(...args) {
|
|
9
9
|
return getActiveWebListener$1(...args);
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { a as resolveWhatsAppGroupRequireMention, i as whatsappSetupContract, l as readWhatsAppAccountLinkState, n as whatsappSetupWizardProxy, o as resolveWhatsAppGroupToolPolicy, t as createWhatsAppPluginBase } from "./shared-Dp9M3ZPX.js";
|
|
2
|
+
//#region extensions/whatsapp/src/channel.setup.ts
|
|
3
|
+
const whatsappSetupPlugin = { ...createWhatsAppPluginBase({
|
|
4
|
+
groups: {
|
|
5
|
+
resolveRequireMention: resolveWhatsAppGroupRequireMention,
|
|
6
|
+
resolveToolPolicy: resolveWhatsAppGroupToolPolicy
|
|
7
|
+
},
|
|
8
|
+
setupWizard: whatsappSetupWizardProxy,
|
|
9
|
+
setupContract: whatsappSetupContract,
|
|
10
|
+
isConfigured: (account) => Boolean(account.authDir),
|
|
11
|
+
isLinked: async (account) => await readWhatsAppAccountLinkState(account.authDir)
|
|
12
|
+
}) };
|
|
13
|
+
//#endregion
|
|
14
|
+
export { whatsappSetupPlugin as t };
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { r as getWhatsAppChannelRuntime } from "./runtime-BLlToOi6.js";
|
|
2
2
|
import { n as WHATSAPP_CONNECTION_OWNER_PENDING_CAPABILITY, t as WHATSAPP_CONNECTION_CONTROLLER_CAPABILITY } from "./connection-controller-runtime-context-DG0tuYuw.js";
|
|
3
|
-
import { c as logoutWeb, f as readWebAuthExistsForDecision,
|
|
4
|
-
import {
|
|
5
|
-
import { a as waitForWaConnection, m as acquireWhatsAppGatewayConnectionOwner, o as DEFAULT_WHATSAPP_SOCKET_TIMING, r as createWaSocket, t as closeWhatsAppSocketAndWait } from "./socket-close-DridEuzz.js";
|
|
3
|
+
import { M as waitForCredsSaveQueueWithTimeout, c as logoutWeb, f as readWebAuthExistsForDecision, k as resolveComparableIdentity, r as WhatsAppAuthUnstableError } from "./auth-store-B_DQIdzp.js";
|
|
4
|
+
import { a as waitForWaConnection, m as acquireWhatsAppGatewayConnectionOwner, o as DEFAULT_WHATSAPP_SOCKET_TIMING, r as createWaSocket, t as closeWhatsAppSocketAndWait } from "./socket-close-09FojDO2.js";
|
|
6
5
|
import { n as getStatusCode, t as formatError } from "./session-errors-JuazczrA.js";
|
|
7
6
|
import { computeBackoff, info, sleepWithAbort } from "openclaw/plugin-sdk/runtime-env";
|
|
8
7
|
import { registerChannelRuntimeContext } from "openclaw/plugin-sdk/channel-runtime-context";
|
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 {
|
|
5
|
+
import { t as resolveWhatsAppRuntimeGroupPolicy$1 } from "./runtime-group-policy-DeSRFXEV.js";
|
|
6
6
|
//#region extensions/whatsapp/contract-api.ts
|
|
7
7
|
const canonicalizeLegacySessionKey = canonicalizeLegacySessionKey$1;
|
|
8
8
|
const isLegacyGroupSessionKey = isLegacyGroupSessionKey$1;
|
|
@@ -10,7 +10,6 @@ const isWhatsAppGroupJid = isWhatsAppGroupJid$1;
|
|
|
10
10
|
const normalizeWhatsAppTarget = normalizeWhatsAppTarget$1;
|
|
11
11
|
const resolveLegacyGroupSessionKey = resolveLegacyGroupSessionKey$1;
|
|
12
12
|
const resolveWhatsAppRuntimeGroupPolicy = resolveWhatsAppRuntimeGroupPolicy$1;
|
|
13
|
-
const whatsappAccessControlTesting = testing;
|
|
14
13
|
const whatsappCommandPolicy = whatsappCommandPolicy$1;
|
|
15
14
|
//#endregion
|
|
16
|
-
export { canonicalizeLegacySessionKey, isLegacyGroupSessionKey, isWhatsAppGroupJid, normalizeWhatsAppTarget, resolveLegacyGroupSessionKey, resolveWhatsAppRuntimeGroupPolicy,
|
|
15
|
+
export { canonicalizeLegacySessionKey, isLegacyGroupSessionKey, isWhatsAppGroupJid, normalizeWhatsAppTarget, resolveLegacyGroupSessionKey, resolveWhatsAppRuntimeGroupPolicy, whatsappCommandPolicy };
|
|
@@ -1,6 +1,22 @@
|
|
|
1
1
|
import path from "node:path";
|
|
2
2
|
import { assertNoSymlinkParents, assertNoSymlinkParentsSync, readRegularFile, readRegularFileSync, statRegularFile, statRegularFileSync } from "openclaw/plugin-sdk/security-runtime";
|
|
3
3
|
//#region extensions/whatsapp/src/creds-files.ts
|
|
4
|
+
const BAILEYS_SIGNAL_AUTH_CATEGORIES = {
|
|
5
|
+
"app-state-sync-key": true,
|
|
6
|
+
"app-state-sync-version": true,
|
|
7
|
+
"device-list": true,
|
|
8
|
+
"identity-key": true,
|
|
9
|
+
"lid-mapping": true,
|
|
10
|
+
"pre-key": true,
|
|
11
|
+
"sender-key": true,
|
|
12
|
+
"sender-key-memory": true,
|
|
13
|
+
session: true,
|
|
14
|
+
tctoken: true
|
|
15
|
+
};
|
|
16
|
+
function isWhatsAppBaileysAuthFileName(name) {
|
|
17
|
+
if (name === "creds.json" || name === "creds.json.bak") return true;
|
|
18
|
+
return name.endsWith(".json") && Object.keys(BAILEYS_SIGNAL_AUTH_CATEGORIES).some((category) => name.startsWith(`${category}-`));
|
|
19
|
+
}
|
|
4
20
|
function resolveWebCredsPath(authDir) {
|
|
5
21
|
return path.join(authDir, "creds.json");
|
|
6
22
|
}
|
|
@@ -76,4 +92,4 @@ function hasWebCredsSync(authDir) {
|
|
|
76
92
|
return statWebCredsFileSync(resolveWebCredsPath(authDir)) !== null;
|
|
77
93
|
}
|
|
78
94
|
//#endregion
|
|
79
|
-
export {
|
|
95
|
+
export { readWebCredsJsonRaw as a, resolveWebCredsPath as c, isWhatsAppBaileysAuthFileName as i, statWebCredsFileSync as l, hasWebCredsRegularFileSync as n, readWebCredsJsonRawSync as o, hasWebCredsSync as r, resolveWebCredsBackupPath as s, assertWebCredsPathRegularFileOrMissing as t };
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-D7D4PA-g.js";
|
|
2
|
-
import { c as resolveMergedWhatsAppAccountConfig, o as resolveWhatsAppAuthDir } from "./accounts-
|
|
2
|
+
import { c as resolveMergedWhatsAppAccountConfig, o as resolveWhatsAppAuthDir } from "./accounts-BX2fZUyR.js";
|
|
3
3
|
import { c as normalizeWhatsAppTarget, t as isWhatsAppGroupJid } from "./normalize-target-CugRyONv.js";
|
|
4
4
|
import { i as hasPendingWhatsAppConnectionOwner, r as getWhatsAppConnectionController } from "./connection-controller-runtime-context-DG0tuYuw.js";
|
|
5
5
|
import "./normalize-C7Hkc_vE.js";
|
|
6
|
-
import {
|
|
6
|
+
import { M as waitForCredsSaveQueueWithTimeout, f as readWebAuthExistsForDecision } from "./auth-store-B_DQIdzp.js";
|
|
7
7
|
import { n as resolveWebAccountId } from "./active-listener-BEjWsCNM.js";
|
|
8
|
-
import { a as waitForWaConnection, h as acquireWhatsAppStandaloneConnectionOwner, n as createWaDirectorySocket, p as WhatsAppConnectionOwnerBusyError, t as closeWhatsAppSocketAndWait } from "./socket-close-
|
|
8
|
+
import { a as waitForWaConnection, h as acquireWhatsAppStandaloneConnectionOwner, n as createWaDirectorySocket, p as WhatsAppConnectionOwnerBusyError, t as closeWhatsAppSocketAndWait } from "./socket-close-09FojDO2.js";
|
|
9
9
|
import { listResolvedDirectoryGroupEntriesFromMapKeys, listResolvedDirectoryUserEntriesFromAllowFrom } from "openclaw/plugin-sdk/directory-config-runtime";
|
|
10
10
|
//#region extensions/whatsapp/src/directory-config.ts
|
|
11
11
|
var directory_config_exports = /* @__PURE__ */ __exportAll({
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as listWhatsAppDirectoryGroupsFromConfig, r as listWhatsAppDirectoryPeersFromConfig } from "./directory-config-
|
|
1
|
+
import { n as listWhatsAppDirectoryGroupsFromConfig, r as listWhatsAppDirectoryPeersFromConfig } from "./directory-config-Pc4f07wB.js";
|
|
2
2
|
//#region extensions/whatsapp/directory-contract-api.ts
|
|
3
3
|
const whatsappDirectoryContractPlugin = {
|
|
4
4
|
id: "whatsapp",
|