@openclaw/whatsapp 2026.7.2-beta.7 → 2026.8.1-beta.3

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.
Files changed (48) hide show
  1. package/dist/{accounts-CSqLvCY5.js → accounts-BX2fZUyR.js} +1 -1
  2. package/dist/action-runtime-api.js +1 -1
  3. package/dist/{action-runtime-BzfDFPbH.js → action-runtime-pM-ExU0l.js} +2 -2
  4. package/dist/action-runtime.runtime.js +1 -1
  5. package/dist/{agent-tools-login-DE9MU98T.js → agent-tools-login-BjRpD-JQ.js} +5 -4
  6. package/dist/api.js +69 -127
  7. package/dist/{approval-handler.runtime-DrA59QSA.js → approval-handler.runtime-CkMMvUjk.js} +4 -4
  8. package/dist/{approval-reactions-Cu66aYdq.js → approval-reactions-Jyr1JaAK.js} +29 -81
  9. package/dist/auth-presence.js +1 -1
  10. package/dist/{auth-store-DcEpIOmE.js → auth-store-CtpBqH5S.js} +82 -18
  11. package/dist/call-tool-api.js +1 -1
  12. package/dist/{channel-Dg62olhy.js → channel-DRMYRfZ8.js} +56 -160
  13. package/dist/channel-plugin-api.js +1 -1
  14. package/dist/{channel-react-action-J_YtyMGX.js → channel-react-action-CstrR0CT.js} +14 -12
  15. package/dist/{channel.runtime-BP0xNmLi.js → channel.runtime-X3JC2gaq.js} +4 -4
  16. package/dist/channel.setup-DhBBhbQv.js +14 -0
  17. package/dist/{connection-controller-BOB2MVKY.js → connection-controller-CIYuBJrs.js} +2 -3
  18. package/dist/contract-api.js +2 -3
  19. package/dist/{creds-files-B1kSWtBg.js → creds-files-W6B3EMZ8.js} +17 -1
  20. package/dist/{directory-config-DalGrfGN.js → directory-config-P7_3U73Z.js} +3 -3
  21. package/dist/directory-contract-api.js +1 -1
  22. package/dist/doctor-contract-api.js +37 -2
  23. package/dist/{group-session-key-DVMZlO3x.js → group-session-key-DmFc_Cqi.js} +23 -4
  24. package/dist/light-runtime-api.js +2 -2
  25. package/dist/{login-CvY2Dhch.js → login-BkpKpndm.js} +4 -4
  26. package/dist/{login-qr-Bncpb6js.js → login-qr-1dpv6jjT.js} +4 -4
  27. package/dist/login-qr-runtime.js +1 -1
  28. package/dist/{monitor-CfkaUSL2.js → monitor-IzwQKizW.js} +545 -549
  29. package/dist/{question-reactions-CRsnyoMK.js → question-reactions-D3eAeB0i.js} +29 -78
  30. package/dist/runtime-api.js +9 -9
  31. package/dist/runtime-group-policy-DeSRFXEV.js +11 -0
  32. package/dist/{send-D37ddk22.js → send-CwvTU4RI.js} +298 -23
  33. package/dist/{send-api-7wk6eQyW.js → send-api-obOSm2cC.js} +126 -137
  34. package/dist/setup-entry.js +1 -8
  35. package/dist/{setup-finalize-BZucx24W.js → setup-finalize-n4K2I2gJ.js} +4 -4
  36. package/dist/setup-plugin-api.js +1 -1
  37. package/dist/{setup-surface-BkVcd769.js → setup-surface-Cwn3zyxK.js} +3 -3
  38. package/dist/{shared-CAxd15bp.js → shared-wg42NKFB.js} +13 -8
  39. package/dist/{socket-close-DridEuzz.js → socket-close-2T0_jZTN.js} +4 -10
  40. package/openclaw.plugin.json +4 -0
  41. package/package.json +4 -5
  42. package/skills/wacli/SKILL.md +8 -1
  43. package/dist/access-control-pZcxTmd5.js +0 -363
  44. package/dist/approval-resolver-DoeBBt22.js +0 -16
  45. package/dist/channel.setup-pMwNVkCA.js +0 -19
  46. package/dist/identity-CPrT5aEU.js +0 -76
  47. package/dist/legacy-state-migrations-api.js +0 -2
  48. package/dist/state-migrations-CAMTrs2U.js +0 -33
@@ -1,13 +1,14 @@
1
1
  import { t as __exportAll } from "./rolldown-runtime-D7D4PA-g.js";
2
- import { a as readWebCredsJsonRawSync, c as statWebCredsFileSync, i as readWebCredsJsonRaw, o as resolveWebCredsBackupPath, r as hasWebCredsSync, s as resolveWebCredsPath, t as assertWebCredsPathRegularFileOrMissing } from "./creds-files-B1kSWtBg.js";
3
- import { n as resolveUserPath } from "./text-runtime-CaKLhowd.js";
4
- import { c as resolveComparableIdentity } from "./identity-CPrT5aEU.js";
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";
8
8
  import { formatCliCommand } from "openclaw/plugin-sdk/cli-runtime";
9
9
  import { defaultRuntime, getChildLogger, info, success } from "openclaw/plugin-sdk/runtime-env";
10
10
  import fs from "node:fs/promises";
11
+ import { isPathStrictlyInside } from "openclaw/plugin-sdk/file-access-runtime";
11
12
  import { DEFAULT_ACCOUNT_ID } from "openclaw/plugin-sdk/routing";
12
13
  import { enqueueKeyedTask } from "openclaw/plugin-sdk/keyed-async-queue";
13
14
  import { resolveTimerTimeoutMs } from "openclaw/plugin-sdk/number-runtime";
@@ -68,6 +69,79 @@ async function waitForCredsSaveQueueWithTimeout(authDir, timeoutMs = CREDS_SAVE_
68
69
  });
69
70
  }
70
71
  //#endregion
72
+ //#region extensions/whatsapp/src/identity.ts
73
+ const WHATSAPP_LID_RE = /@(lid|hosted\.lid)$/i;
74
+ function normalizeDeviceScopedJid(jid) {
75
+ return jid ? jid.replace(/:\d+/, "") : null;
76
+ }
77
+ function isLidJid(jid) {
78
+ return Boolean(jid && WHATSAPP_LID_RE.test(jid));
79
+ }
80
+ function resolveComparableIdentity(identity, authDir) {
81
+ const rawJid = normalizeDeviceScopedJid(identity?.jid);
82
+ const lid = normalizeDeviceScopedJid(identity?.lid) ?? (isLidJid(rawJid) ? rawJid : null);
83
+ const jid = rawJid && !isLidJid(rawJid) ? rawJid : null;
84
+ const e164 = identity?.e164 != null ? normalizeE164(identity.e164) : (jid ? jidToE164(jid, authDir ? { authDir } : void 0) : null) ?? (lid ? jidToE164(lid, authDir ? { authDir } : void 0) : null);
85
+ return {
86
+ ...identity,
87
+ jid,
88
+ lid,
89
+ e164
90
+ };
91
+ }
92
+ function getComparableIdentityValues(identity) {
93
+ const resolved = resolveComparableIdentity(identity);
94
+ return [
95
+ resolved.e164,
96
+ resolved.jid,
97
+ resolved.lid
98
+ ].filter((value) => Boolean(value));
99
+ }
100
+ function identitiesOverlap(left, right) {
101
+ const leftValues = new Set(getComparableIdentityValues(left));
102
+ if (leftValues.size === 0) return false;
103
+ return getComparableIdentityValues(right).some((value) => leftValues.has(value));
104
+ }
105
+ function getSenderIdentity(msg, authDir) {
106
+ return resolveComparableIdentity(msg.platform.sender ?? {
107
+ jid: msg.platform.senderJid ?? null,
108
+ e164: msg.platform.senderE164 ?? null,
109
+ name: msg.platform.senderName ?? null
110
+ }, authDir);
111
+ }
112
+ function getSelfIdentity(msg, authDir) {
113
+ return resolveComparableIdentity(msg.platform.self ?? {
114
+ jid: msg.platform.selfJid ?? null,
115
+ lid: msg.platform.selfLid ?? null,
116
+ e164: msg.platform.selfE164 ?? null
117
+ }, authDir);
118
+ }
119
+ function getReplyContext(msg, authDir) {
120
+ if (msg.quote?.context) return {
121
+ ...msg.quote.context,
122
+ sender: resolveComparableIdentity(msg.quote.context.sender, authDir)
123
+ };
124
+ if (!msg.quote?.body) return null;
125
+ return {
126
+ id: msg.quote.id,
127
+ body: msg.quote.body,
128
+ sender: resolveComparableIdentity({
129
+ jid: msg.quote.sender?.jid ?? null,
130
+ e164: msg.quote.sender?.e164 ?? null,
131
+ label: msg.quote.sender?.displayName ?? null
132
+ }, authDir)
133
+ };
134
+ }
135
+ function getMentionJids(msg) {
136
+ return msg.group?.mentions?.jids ?? [];
137
+ }
138
+ function getMentionIdentities(msg, authDir) {
139
+ return getMentionJids(msg).map((jid) => resolveComparableIdentity({ jid }, authDir));
140
+ }
141
+ function getPrimaryIdentityId(identity) {
142
+ return identity?.e164 || identity?.jid?.trim() || identity?.lid || null;
143
+ }
144
+ //#endregion
71
145
  //#region extensions/whatsapp/src/auth-store.ts
72
146
  var auth_store_exports = /* @__PURE__ */ __exportAll({
73
147
  WA_WEB_AUTH_DIR: () => WA_WEB_AUTH_DIR,
@@ -235,16 +309,10 @@ async function readWebAuthSnapshotBestEffort(authDir = resolveDefaultWebAuthDir(
235
309
  selfId: snapshot.selfId
236
310
  };
237
311
  }
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
312
  async function clearBaileysAuthFiles(authDir, beforeCredentialPersistence) {
245
313
  const rootStats = await fs.lstat(authDir).catch(() => null);
246
314
  if (!rootStats?.isDirectory() || rootStats.isSymbolicLink()) return;
247
- const credentialFiles = (await fs.readdir(authDir, { withFileTypes: true })).filter((entry) => entry.isFile() && isBaileysAuthFileName(entry.name));
315
+ const credentialFiles = (await fs.readdir(authDir, { withFileTypes: true })).filter((entry) => entry.isFile() && isWhatsAppBaileysAuthFileName(entry.name));
248
316
  if (credentialFiles.length === 0) return;
249
317
  await beforeCredentialPersistence?.();
250
318
  await Promise.all(credentialFiles.map(async (entry) => {
@@ -257,7 +325,7 @@ async function shouldClearOnLogout(authDir, isLegacyAuthDir) {
257
325
  if (!stats.isDirectory() || stats.isSymbolicLink()) return false;
258
326
  if (isLegacyAuthDir) return (await fs.readdir(authDir, { withFileTypes: true })).some((entry) => {
259
327
  if (!entry.isFile()) return false;
260
- return isBaileysAuthFileName(entry.name);
328
+ return isWhatsAppBaileysAuthFileName(entry.name);
261
329
  });
262
330
  if ((await fs.lstat(resolveWebCredsPath(authDir)).catch(() => null))?.isFile()) return true;
263
331
  return (await fs.lstat(resolveWebCredsBackupPath(authDir)).catch(() => null))?.isFile() === true;
@@ -266,10 +334,6 @@ async function shouldClearOnLogout(authDir, isLegacyAuthDir) {
266
334
  return (typeof codeValue === "string" ? codeValue : "") !== "ENOENT";
267
335
  }
268
336
  }
269
- function isPathInsideDirectory(baseDir, targetPath) {
270
- const relativePath = path.relative(baseDir, targetPath);
271
- return relativePath !== "" && !relativePath.startsWith("..") && !path.isAbsolute(relativePath);
272
- }
273
337
  async function pathHasSymlinkComponent(baseDir, targetPath) {
274
338
  const relativePath = path.relative(baseDir, targetPath);
275
339
  let currentPath = baseDir;
@@ -290,10 +354,10 @@ async function isLegacyWebAuthDir(authDir) {
290
354
  async function classifyWebAuthDirOwnership(authDir) {
291
355
  const whatsappAuthBase = path.resolve(resolveOAuthDir$1(), "whatsapp");
292
356
  const resolvedAuthDir = path.resolve(authDir);
293
- if (!isPathInsideDirectory(whatsappAuthBase, resolvedAuthDir)) return { kind: "external" };
357
+ if (!isPathStrictlyInside(whatsappAuthBase, resolvedAuthDir)) return { kind: "external" };
294
358
  const [baseRealPath, authDirRealPath] = await Promise.all([fs.realpath(whatsappAuthBase).catch(() => null), fs.realpath(resolvedAuthDir).catch(() => null)]);
295
359
  if (!baseRealPath || !authDirRealPath) return { kind: "unsafe-owned" };
296
- if (!isPathInsideDirectory(baseRealPath, authDirRealPath)) return { kind: "unsafe-owned" };
360
+ if (!isPathStrictlyInside(baseRealPath, authDirRealPath)) return { kind: "unsafe-owned" };
297
361
  if (await pathHasSymlinkComponent(whatsappAuthBase, resolvedAuthDir)) return { kind: "unsafe-owned" };
298
362
  return {
299
363
  kind: "owned",
@@ -397,4 +461,4 @@ async function pickWebChannel(pref, authDir = resolveDefaultWebAuthDir()) {
397
461
  return choice;
398
462
  }
399
463
  //#endregion
400
- export { waitForCredsSaveQueue as C, writeWebCredsRawAtomically as E, enqueueCredsSave as S, writeCredsJsonAtomically 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, 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, waitForCredsSaveQueueWithTimeout as w, webAuthExists as x, resolveDefaultWebAuthDir as y };
464
+ 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 };
@@ -1,4 +1,4 @@
1
- import { a as resolveWhatsAppAccount } from "./accounts-CSqLvCY5.js";
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-CSqLvCY5.js";
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, u as resolveWhatsAppReactionLevel } from "./send-D37ddk22.js";
5
+ import { c as normalizeWhatsAppPayloadTextPreservingIndentation, i as sendTypingWhatsApp, n as sendPollWhatsApp, o as normalizeWhatsAppOutboundPayload, s as normalizeWhatsAppPayloadText, t as sendMessageWhatsApp, v as resolveWhatsAppReactionLevel } from "./send-CwvTU4RI.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-DE9MU98T.js";
11
- import { c as getWhatsAppApprovalApprovers, l as whatsappApprovalAuth, s as lookupInboundMessageMetaForTarget, t as resolveWhatsAppGroupSessionKey } from "./group-session-key-DVMZlO3x.js";
12
- import { a as resolveWhatsAppGroupRequireMention, c as loadWhatsAppChannelRuntime, i as whatsappSetupContract, l as readWhatsAppAccountLinkState, n as whatsappSetupWizardProxy, o as resolveWhatsAppGroupToolPolicy, r as whatsappSetupAdapter, s as formatWhatsAppConfigAllowFromEntries, t as createWhatsAppPluginBase } from "./shared-CAxd15bp.js";
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-wg42NKFB.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-DcEpIOmE.js";
15
- import { t as detectWhatsAppLegacyStateMigrations } from "./state-migrations-CAMTrs2U.js";
14
+ import { f as readWebAuthExistsForDecision, n as WHATSAPP_AUTH_UNSTABLE_CODE } from "./auth-store-CtpBqH5S.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 { asString, collectIssuesForEnabledAccounts, createComputedAccountStatusAdapter, createDefaultChannelRuntimeState, isRecord as isRecord$1, readAccountStatusSnapshot } from "openclaw/plugin-sdk/status-helpers";
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 { createChannelApprovalCapability } from "openclaw/plugin-sdk/approval-delivery-runtime";
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 { canApprovalPotentiallyRouteToChannel: canApprovalPotentiallyRouteToWhatsApp, canAnyApprovalPotentiallyRouteToChannel: canAnyApprovalPotentiallyRouteToWhatsApp, isSessionApprovalEligible: isWhatsAppSessionApprovalEligible, isExplicitTargetEligible: isWhatsAppExplicitTargetEligible, shouldHandleApprovalRequest: shouldHandleWhatsAppApprovalRequest } = createNativeApprovalChannelRouteGates({
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
- normalizeForwardTarget: normalizeWhatsAppForwardTarget,
88
- resolveAccountId: ({ forwardingTarget, request }) => forwardingTarget.accountId ?? normalizeOptionalString(request.request.turnSourceAccountId),
89
- resolveForwardingTargetForMatch: ({ forwardingTarget, accountId }) => ({
90
- ...forwardingTarget,
91
- accountId
92
- }),
93
- isSessionRouteEligible: isWhatsAppSessionApprovalEligible,
94
- isExplicitTargetEligible: isWhatsAppExplicitTargetEligible,
95
- resolveOriginTarget: resolveWhatsAppOriginTarget,
96
- resolveApproverDmTargets: resolveWhatsAppApproverDmTargets
97
- });
98
- function buildWhatsAppExecPendingPayload(params) {
99
- const payload = buildApprovalReactionPromptPayloadForRequest(params);
100
- return {
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 }) => buildWhatsAppExecPendingPayload({
61
+ exec: { buildPendingPayload: ({ request, nowMs }) => buildWhatsAppPendingPayload({
154
62
  request,
155
63
  nowMs
156
- }) },
157
- plugin: { buildPendingPayload: ({ request, nowMs }) => buildWhatsAppPluginPendingPayload({
64
+ }, "exec") },
65
+ plugin: { buildPendingPayload: ({ request, nowMs }) => buildWhatsAppPendingPayload({
158
66
  request,
159
67
  nowMs
160
- }) }
68
+ }, "plugin") }
161
69
  },
162
- native: {
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) && canAnyApprovalPotentiallyRouteToWhatsApp({
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) && shouldHandleWhatsAppApprovalRequest({
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-DrA59QSA.js")).whatsappApprovalNativeRuntime
83
+ load: async () => (await import("./approval-handler.runtime-CkMMvUjk.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-Cu66aYdq.js").then((n) => n.t));
368
- const loadWhatsAppQuestionReactionsModule = createLazyRuntimeModule(() => import("./question-reactions-CRsnyoMK.js").then((n) => n.n));
263
+ const loadWhatsAppApprovalReactionsModule = createLazyRuntimeModule(() => import("./approval-reactions-Jyr1JaAK.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 = asString(value);
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: asString(value.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 = asString(account.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 = asString(account.lastError) ?? lastDisconnect?.error;
557
- const healthState = asString(account.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-DalGrfGN.js").then((n) => n.t));
633
- const loadWhatsAppChannelReactAction = createLazyRuntimeModule(() => import("./channel-react-action-J_YtyMGX.js"));
528
+ const loadWhatsAppDirectoryConfig = createLazyRuntimeModule(() => import("./directory-config-P7_3U73Z.js").then((n) => n.t));
529
+ const loadWhatsAppChannelReactAction = createLazyRuntimeModule(() => import("./channel-react-action-CstrR0CT.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-Dg62olhy.js";
1
+ import { t as whatsappPlugin } from "./channel-DRMYRfZ8.js";
2
2
  export { whatsappPlugin };
@@ -1,7 +1,7 @@
1
- import { a as resolveWhatsAppAccount, s as resolveWhatsAppMediaMaxBytes } from "./accounts-CSqLvCY5.js";
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-BzfDFPbH.js";
4
- import { t as sendMessageWhatsApp } from "./send-D37ddk22.js";
3
+ import { r as resolveAuthorizedWhatsAppOutboundTarget, t as handleWhatsAppAction } from "./action-runtime-pM-ExU0l.js";
4
+ import { a as sendWhatsAppUploadFile } from "./send-CwvTU4RI.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";
@@ -23,17 +23,14 @@ function readWhatsAppActionChatJid(params) {
23
23
  if (params.toolContext?.currentChannelProvider !== WHATSAPP_CHANNEL || !params.toolContext.currentChannelId) return;
24
24
  return normalizeWhatsAppTarget(params.toolContext.currentChannelId) ?? void 0;
25
25
  }
26
- function extractBase64Payload(encoded) {
27
- return /^data:[^;]+;base64,(.*)$/is.exec(encoded.trim())?.[1] ?? encoded;
28
- }
29
26
  function decodeUploadFileMediaPayload(params) {
30
- const payload = extractBase64Payload(params.encoded);
27
+ const dataUrl = /^data:([^;]+);base64,(.*)$/is.exec(params.encoded.trim());
28
+ const payload = dataUrl?.[2] ?? params.encoded;
31
29
  if (params.maxBytes !== void 0) {
32
30
  const estimatedBytes = estimateBase64DecodedBytes(payload);
33
31
  if (estimatedBytes > params.maxBytes) throw new Error(`WhatsApp upload-file buffer exceeds configured media limit (${estimatedBytes} bytes > ${params.maxBytes} bytes).`);
34
32
  }
35
- const contentType = readStringParam$1(params.args, "contentType") ?? readStringParam$1(params.args, "mimeType");
36
- const fileName = readStringParam$1(params.args, "filename") ?? readStringParam$1(params.args, "fileName");
33
+ const contentType = params.contentType ?? dataUrl?.[1];
37
34
  const canonicalPayload = canonicalizeBase64(payload);
38
35
  if (!canonicalPayload) throw new Error("WhatsApp upload-file buffer must be valid base64 or a base64 data URL.");
39
36
  const buffer = Buffer.from(canonicalPayload, "base64");
@@ -41,12 +38,14 @@ function decodeUploadFileMediaPayload(params) {
41
38
  return {
42
39
  buffer,
43
40
  ...contentType ? { contentType } : {},
44
- ...fileName ? { fileName } : {}
41
+ ...params.fileName ? { fileName: params.fileName } : {}
45
42
  };
46
43
  }
47
44
  async function handleWhatsAppUploadFileAction(params) {
48
45
  const mediaUrl = readUploadFileMediaSource(params.params);
49
46
  const encodedPayload = readStringParam$1(params.params, "buffer", { trim: false });
47
+ const contentType = readStringParam$1(params.params, "contentType") ?? readStringParam$1(params.params, "mimeType");
48
+ const fileName = readStringParam$1(params.params, "filename") ?? readStringParam$1(params.params, "fileName");
50
49
  if (!mediaUrl && !hasUploadFileBufferPayload(params.params)) throw new Error("WhatsApp upload-file requires media, mediaUrl, filePath, path, fileUrl, or buffer.");
51
50
  const to = readWhatsAppActionChatJid(params) ?? readStringParam$1(params.params, "to", { required: true });
52
51
  const resolved = resolveAuthorizedWhatsAppOutboundTarget({
@@ -60,15 +59,18 @@ async function handleWhatsAppUploadFileAction(params) {
60
59
  accountId: resolved.accountId
61
60
  });
62
61
  const mediaPayload = encodedPayload ? decodeUploadFileMediaPayload({
63
- args: params.params,
64
62
  encoded: encodedPayload,
63
+ contentType,
64
+ fileName,
65
65
  maxBytes: resolveWhatsAppMediaMaxBytes(account)
66
66
  }) : void 0;
67
- const result = await sendMessageWhatsApp(resolved.to, readUploadFileCaptionText(params.params), {
67
+ const result = await sendWhatsAppUploadFile(resolved.to, readUploadFileCaptionText(params.params), {
68
68
  verbose: false,
69
69
  cfg: params.cfg,
70
70
  ...mediaUrl && !mediaPayload ? { mediaUrl } : {},
71
71
  ...mediaPayload ? { mediaPayload } : {},
72
+ ...mediaUrl && !mediaPayload && fileName ? { fileName } : {},
73
+ ...mediaUrl && !mediaPayload && contentType ? { contentType } : {},
72
74
  mediaAccess: params.mediaAccess,
73
75
  mediaLocalRoots: params.mediaLocalRoots,
74
76
  mediaReadFile: params.mediaReadFile,
@@ -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-DcEpIOmE.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-CtpBqH5S.js";
3
3
  import { t as getActiveWebListener$1 } from "./active-listener-BEjWsCNM.js";
4
- import { t as monitorWebChannel$1 } from "./monitor-CfkaUSL2.js";
5
- import { t as loginWeb$1 } from "./login-CvY2Dhch.js";
6
- import { whatsappSetupWizard as whatsappSetupWizard$1 } from "./setup-surface-BkVcd769.js";
4
+ import { t as monitorWebChannel$1 } from "./monitor-IzwQKizW.js";
5
+ import { t as loginWeb$1 } from "./login-BkpKpndm.js";
6
+ import { whatsappSetupWizard as whatsappSetupWizard$1 } from "./setup-surface-Cwn3zyxK.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-wg42NKFB.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, r as WhatsAppAuthUnstableError, w as waitForCredsSaveQueueWithTimeout } from "./auth-store-DcEpIOmE.js";
4
- import { c as resolveComparableIdentity } from "./identity-CPrT5aEU.js";
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-CtpBqH5S.js";
4
+ import { a as waitForWaConnection, m as acquireWhatsAppGatewayConnectionOwner, o as DEFAULT_WHATSAPP_SOCKET_TIMING, r as createWaSocket, t as closeWhatsAppSocketAndWait } from "./socket-close-2T0_jZTN.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";
@@ -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-pZcxTmd5.js";
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, whatsappAccessControlTesting, whatsappCommandPolicy };
15
+ export { canonicalizeLegacySessionKey, isLegacyGroupSessionKey, isWhatsAppGroupJid, normalizeWhatsAppTarget, resolveLegacyGroupSessionKey, resolveWhatsAppRuntimeGroupPolicy, whatsappCommandPolicy };