@openclaw/whatsapp 2026.7.2-beta.2 → 2026.7.2-beta.4

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 (147) hide show
  1. package/dist/{access-control-DazDX3RB.js → access-control-CRz_v6bR.js} +4 -5
  2. package/dist/{accounts-CKOFMPf-.js → accounts-CxPuEFi-.js} +44 -4
  3. package/dist/{action-runtime-Bf-12TIH.js → action-runtime-CHU7xb6o.js} +2 -2
  4. package/dist/action-runtime-api.js +1 -1
  5. package/dist/action-runtime.runtime.js +1 -1
  6. package/dist/{active-listener-5kHap439.js → active-listener-BEjWsCNM.js} +1 -1
  7. package/dist/api.js +12 -15
  8. package/dist/{approval-handler.runtime-CBiGQuZ5.js → approval-handler.runtime-C4ddB7Kc.js} +4 -4
  9. package/dist/{approval-reactions-BGQoz25s.js → approval-reactions-P2HXjmln.js} +3 -3
  10. package/dist/{auth-store-BQi9pZqQ.js → auth-store-DirYMTbo.js} +4 -3
  11. package/dist/call-tool-api.js +4 -4
  12. package/dist/{channel-DbadDUDD.js → channel-B9xjrOGG.js} +37 -19
  13. package/dist/channel-config-api.js +1 -1
  14. package/dist/channel-plugin-api.js +1 -1
  15. package/dist/{channel-react-action-PoRWfP9x.js → channel-react-action-CBW-PA8q.js} +10 -13
  16. package/dist/{channel.runtime-BDDy4Lhz.js → channel.runtime-DdKuhlNu.js} +5 -5
  17. package/dist/{channel.setup-BZ-po8fg.js → channel.setup-DXUCPHel.js} +3 -6
  18. package/dist/{config-schema-BZ8h1hWA.js → config-schema-C6IeKIC0.js} +6 -0
  19. package/dist/{connection-controller-C1rwfWb4.js → connection-controller-BVRExqrB.js} +186 -27
  20. package/dist/connection-controller-runtime-context-DG0tuYuw.js +23 -0
  21. package/dist/contract-api.js +1 -1
  22. package/dist/directory-config-BTbJkV1W.js +196 -0
  23. package/dist/directory-contract-api.js +1 -1
  24. package/dist/doctor-CwzVXKoE.js +10 -0
  25. package/dist/doctor-contract-api.js +35 -79
  26. package/dist/{group-session-key-CLTZeH_F.js → group-session-key-DJSdYfnb.js} +9 -4
  27. package/dist/{identity-D7L8LCuH.js → identity-BM4_wZeM.js} +2 -2
  28. package/dist/light-runtime-api.js +2 -2
  29. package/dist/{login-DGIoToX8.js → login-BKUm7KSk.js} +6 -7
  30. package/dist/{login-qr-X-CZHOk9.js → login-qr-DagJvMbg.js} +7 -8
  31. package/dist/login-qr-runtime.js +1 -1
  32. package/dist/{monitor-BZ8QvCeV.js → monitor-CBVNJ2lb.js} +623 -400
  33. package/dist/question-reactions-CaOrSYzU.js +142 -0
  34. package/dist/runtime-BLlToOi6.js +21 -0
  35. package/dist/runtime-api.js +10 -10
  36. package/dist/runtime-setter-api.js +1 -1
  37. package/dist/{send-D9Ydnn4o.js → send-DhJVN30g.js} +38 -85
  38. package/dist/{send-api-W33lI2nR.js → send-api-CpHwbor_.js} +38 -32
  39. package/dist/{setup-finalize-DBf1jjBj.js → setup-finalize-9XzKdFq6.js} +3 -3
  40. package/dist/setup-plugin-api.js +1 -1
  41. package/dist/{setup-surface-CiKGdNJv.js → setup-surface-Kv3mPki2.js} +3 -3
  42. package/dist/{setup-core-3aSOoK2T.js → shared-CuqHFnKd.js} +78 -56
  43. package/dist/{session-mxWFn0eS.js → socket-close-BoSHhQNJ.js} +226 -7
  44. package/dist/{targets-runtime-Bsh0HR9y.js → targets-runtime-CKFrhoX4.js} +142 -29
  45. package/dist/text-runtime-CU_IlbK5.js +4 -0
  46. package/node_modules/@protobufjs/utf8/CHANGELOG.md +8 -0
  47. package/node_modules/@protobufjs/utf8/index.js +29 -18
  48. package/node_modules/@protobufjs/utf8/package.json +2 -2
  49. package/node_modules/@protobufjs/utf8/tests/index.js +5 -0
  50. package/node_modules/@thi.ng/bitstream/package.json +4 -4
  51. package/node_modules/@thi.ng/errors/package.json +4 -4
  52. package/node_modules/@types/node/README.md +1 -1
  53. package/node_modules/@types/node/fs/promises.d.ts +16 -6
  54. package/node_modules/@types/node/package.json +2 -2
  55. package/node_modules/audio-type/package.json +3 -2
  56. package/node_modules/lru-cache/dist/commonjs/browser/index.d.ts.map +1 -1
  57. package/node_modules/lru-cache/dist/commonjs/browser/index.js +11 -4
  58. package/node_modules/lru-cache/dist/commonjs/browser/index.js.map +1 -1
  59. package/node_modules/lru-cache/dist/commonjs/browser/index.min.js +1 -1
  60. package/node_modules/lru-cache/dist/commonjs/browser/index.min.js.map +3 -3
  61. package/node_modules/lru-cache/dist/commonjs/index.d.ts.map +1 -1
  62. package/node_modules/lru-cache/dist/commonjs/index.js +11 -4
  63. package/node_modules/lru-cache/dist/commonjs/index.js.map +1 -1
  64. package/node_modules/lru-cache/dist/commonjs/index.min.js +1 -1
  65. package/node_modules/lru-cache/dist/commonjs/index.min.js.map +3 -3
  66. package/node_modules/lru-cache/dist/commonjs/node/index.d.ts.map +1 -1
  67. package/node_modules/lru-cache/dist/commonjs/node/index.js +11 -4
  68. package/node_modules/lru-cache/dist/commonjs/node/index.js.map +1 -1
  69. package/node_modules/lru-cache/dist/commonjs/node/index.min.js +1 -1
  70. package/node_modules/lru-cache/dist/commonjs/node/index.min.js.map +3 -3
  71. package/node_modules/lru-cache/dist/esm/browser/index.d.ts.map +1 -1
  72. package/node_modules/lru-cache/dist/esm/browser/index.js +11 -4
  73. package/node_modules/lru-cache/dist/esm/browser/index.js.map +1 -1
  74. package/node_modules/lru-cache/dist/esm/browser/index.min.js +1 -1
  75. package/node_modules/lru-cache/dist/esm/browser/index.min.js.map +3 -3
  76. package/node_modules/lru-cache/dist/esm/index.d.ts.map +1 -1
  77. package/node_modules/lru-cache/dist/esm/index.js +11 -4
  78. package/node_modules/lru-cache/dist/esm/index.js.map +1 -1
  79. package/node_modules/lru-cache/dist/esm/index.min.js +1 -1
  80. package/node_modules/lru-cache/dist/esm/index.min.js.map +3 -3
  81. package/node_modules/lru-cache/dist/esm/node/index.d.ts.map +1 -1
  82. package/node_modules/lru-cache/dist/esm/node/index.js +11 -4
  83. package/node_modules/lru-cache/dist/esm/node/index.js.map +1 -1
  84. package/node_modules/lru-cache/dist/esm/node/index.min.js +1 -1
  85. package/node_modules/lru-cache/dist/esm/node/index.min.js.map +3 -3
  86. package/node_modules/lru-cache/package.json +1 -1
  87. package/node_modules/music-metadata/lib/common/Util.d.ts +1 -1
  88. package/node_modules/music-metadata/lib/common/Util.js +7 -1
  89. package/node_modules/music-metadata/lib/id3v2/FrameHeader.js +23 -3
  90. package/node_modules/music-metadata/lib/id3v2/FrameParser.js +2 -2
  91. package/node_modules/music-metadata/lib/id3v2/ID3v2Token.js +1 -1
  92. package/node_modules/music-metadata/lib/mp4/AtomToken.js +38 -13
  93. package/node_modules/music-metadata/lib/mpeg/MpegParser.js +1 -1
  94. package/node_modules/music-metadata/package.json +6 -6
  95. package/node_modules/p-queue/dist/index.js +17 -6
  96. package/node_modules/p-queue/package.json +1 -1
  97. package/node_modules/protobufjs/dist/light/protobuf.js +145 -188
  98. package/node_modules/protobufjs/dist/light/protobuf.js.map +1 -1
  99. package/node_modules/protobufjs/dist/light/protobuf.min.js +3 -3
  100. package/node_modules/protobufjs/dist/light/protobuf.min.js.map +1 -1
  101. package/node_modules/protobufjs/dist/minimal/protobuf.js +33 -76
  102. package/node_modules/protobufjs/dist/minimal/protobuf.js.map +1 -1
  103. package/node_modules/protobufjs/dist/minimal/protobuf.min.js +3 -3
  104. package/node_modules/protobufjs/dist/minimal/protobuf.min.js.map +1 -1
  105. package/node_modules/protobufjs/dist/protobuf.js +168 -208
  106. package/node_modules/protobufjs/dist/protobuf.js.map +1 -1
  107. package/node_modules/protobufjs/dist/protobuf.min.js +3 -3
  108. package/node_modules/protobufjs/dist/protobuf.min.js.map +1 -1
  109. package/node_modules/protobufjs/index.d.ts +0 -8
  110. package/node_modules/protobufjs/package.json +2 -3
  111. package/node_modules/protobufjs/src/parse.js +3 -0
  112. package/node_modules/protobufjs/src/util/minimal.js +0 -3
  113. package/node_modules/typebox/build/compile/validator.d.mts +1 -4
  114. package/node_modules/typebox/build/guard/guard.d.mts +1 -1
  115. package/node_modules/typebox/build/guard/guard.mjs +5 -2
  116. package/node_modules/typebox/build/guard/string.mjs +16 -4
  117. package/node_modules/typebox/build/schema/engine/_functions.mjs +34 -15
  118. package/node_modules/typebox/build/type/action/readonly_object.d.mts +5 -0
  119. package/node_modules/typebox/build/type/action/readonly_object.mjs +8 -0
  120. package/node_modules/typebox/build/typebox.d.mts +1 -1
  121. package/node_modules/typebox/build/typebox.mjs +1 -1
  122. package/node_modules/typebox/package.json +1 -1
  123. package/node_modules/typebox/readme.md +29 -32
  124. package/node_modules/ws/lib/receiver.js +15 -32
  125. package/node_modules/ws/lib/websocket-server.js +4 -4
  126. package/node_modules/ws/lib/websocket.js +4 -4
  127. package/node_modules/ws/package.json +5 -1
  128. package/npm-shrinkwrap.json +41 -45
  129. package/openclaw.plugin.json +139 -179
  130. package/package.json +21 -11
  131. package/dist/account-config-LiT9wWH9.js +0 -43
  132. package/dist/connection-controller-runtime-context-CbTsqmPT.js +0 -14
  133. package/dist/directory-config-CLBQrjtC.js +0 -37
  134. package/dist/doctor-By3SB4lm.js +0 -48
  135. package/dist/runtime-BfAdAEYT.js +0 -8
  136. package/dist/text-runtime-BTGkMN0o.js +0 -4
  137. package/node_modules/@protobufjs/inquire/CHANGELOG.md +0 -8
  138. package/node_modules/@protobufjs/inquire/LICENSE +0 -26
  139. package/node_modules/@protobufjs/inquire/README.md +0 -13
  140. package/node_modules/@protobufjs/inquire/index.d.ts +0 -10
  141. package/node_modules/@protobufjs/inquire/index.js +0 -38
  142. package/node_modules/@protobufjs/inquire/package.json +0 -21
  143. package/node_modules/@protobufjs/inquire/tests/data/array.js +0 -1
  144. package/node_modules/@protobufjs/inquire/tests/data/emptyArray.js +0 -1
  145. package/node_modules/@protobufjs/inquire/tests/data/emptyObject.js +0 -1
  146. package/node_modules/@protobufjs/inquire/tests/data/object.js +0 -1
  147. package/node_modules/@protobufjs/inquire/tests/index.js +0 -20
@@ -1,7 +1,7 @@
1
- import { a as resolveWhatsAppAccount } from "./accounts-CKOFMPf-.js";
2
- import { n as isSelfChatMode } from "./targets-runtime-Bsh0HR9y.js";
3
- import { n as normalizeE164 } from "./text-runtime-BTGkMN0o.js";
4
- import { a as getSelfIdentity, o as getSenderIdentity } from "./identity-D7L8LCuH.js";
1
+ import { a as resolveWhatsAppAccount } from "./accounts-CxPuEFi-.js";
2
+ import { n as isSelfChatMode } from "./targets-runtime-CKFrhoX4.js";
3
+ import { t as normalizeE164 } from "./text-runtime-CU_IlbK5.js";
4
+ import { a as getSelfIdentity, o as getSenderIdentity } from "./identity-BM4_wZeM.js";
5
5
  import { defaultRuntime } from "openclaw/plugin-sdk/runtime-env";
6
6
  import { resolveChannelGroupPolicy, resolveChannelGroupRequireMention } from "openclaw/plugin-sdk/channel-policy";
7
7
  import { createChannelPairingChallengeIssuer } from "openclaw/plugin-sdk/channel-pairing";
@@ -233,7 +233,6 @@ async function resolveWhatsAppIngressAccess(params) {
233
233
  });
234
234
  }
235
235
  async function resolveWhatsAppCommandAuthorized(params) {
236
- if (!(params.cfg.commands?.useAccessGroups !== false)) return true;
237
236
  const self = getSelfIdentity(params.msg, params.authDir);
238
237
  const admission = requireWhatsAppInboundAdmission(params.msg);
239
238
  const policy = params.policy ?? resolveWhatsAppInboundPolicy({
@@ -1,11 +1,51 @@
1
- import { t as resolveMergedWhatsAppAccountConfig } from "./account-config-LiT9wWH9.js";
2
1
  import { n as listConfiguredAccountIds, r as resolveDefaultWhatsAppAccountId, t as listAccountIds } from "./account-ids-CB5SOWjc.js";
3
2
  import { n as hasWebCredsRegularFileSync, r as hasWebCredsSync } from "./creds-files-B1kSWtBg.js";
4
3
  import fs from "node:fs";
5
4
  import path from "node:path";
6
- import { DEFAULT_ACCOUNT_ID, normalizeAccountId, resolveUserPath } from "openclaw/plugin-sdk/account-core";
5
+ import { DEFAULT_ACCOUNT_ID, mergeAccountConfig, normalizeAccountId, resolveAccountEntry, resolveMergedAccountConfig, resolveUserPath } from "openclaw/plugin-sdk/account-core";
7
6
  import { resolveOAuthDir } from "openclaw/plugin-sdk/state-paths";
8
7
  import { normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
8
+ //#region extensions/whatsapp/src/account-config.ts
9
+ function resolveWhatsAppDefaultAccountSharedConfig(cfg) {
10
+ const defaultAccount = resolveAccountEntry(cfg.channels?.whatsapp?.accounts, DEFAULT_ACCOUNT_ID);
11
+ if (!defaultAccount) return;
12
+ const { enabled: _ignoredEnabled, name: _ignoredName, authDir: _ignoredAuthDir, selfChatMode: _ignoredSelfChatMode, ...sharedDefaults } = defaultAccount;
13
+ return sharedDefaults;
14
+ }
15
+ function resolveWhatsAppAccountConfigForTest(cfg, accountId) {
16
+ return resolveAccountEntry(cfg.channels?.whatsapp?.accounts, accountId);
17
+ }
18
+ function resolveMergedNamedWhatsAppAccountConfig(params) {
19
+ const rootCfg = params.cfg.channels?.whatsapp;
20
+ const accountConfig = resolveWhatsAppAccountConfigForTest(params.cfg, params.accountId);
21
+ return {
22
+ ...mergeAccountConfig({
23
+ channelConfig: rootCfg,
24
+ accountConfig: void 0,
25
+ omitKeys: ["defaultAccount"]
26
+ }),
27
+ ...resolveWhatsAppDefaultAccountSharedConfig(params.cfg),
28
+ ...accountConfig
29
+ };
30
+ }
31
+ function resolveMergedWhatsAppAccountConfig(params) {
32
+ const rootCfg = params.cfg.channels?.whatsapp;
33
+ const accountId = params.accountId?.trim() || rootCfg?.defaultAccount || DEFAULT_ACCOUNT_ID;
34
+ const base = resolveMergedAccountConfig({
35
+ channelConfig: rootCfg,
36
+ accounts: rootCfg?.accounts,
37
+ accountId,
38
+ omitKeys: ["defaultAccount"]
39
+ });
40
+ return {
41
+ accountId,
42
+ ...accountId === DEFAULT_ACCOUNT_ID ? base : resolveMergedNamedWhatsAppAccountConfig({
43
+ cfg: params.cfg,
44
+ accountId
45
+ })
46
+ };
47
+ }
48
+ //#endregion
9
49
  //#region extensions/whatsapp/src/accounts.ts
10
50
  const DEFAULT_WHATSAPP_MEDIA_MAX_MB = 50;
11
51
  function listWhatsAppAuthDirs(cfg) {
@@ -77,7 +117,7 @@ function resolveWhatsAppAccount(params) {
77
117
  name: normalizeOptionalString(merged.name),
78
118
  enabled,
79
119
  sendReadReceipts: merged.sendReadReceipts ?? true,
80
- messagePrefix: merged.messagePrefix ?? params.cfg.messages?.messagePrefix,
120
+ messagePrefix: merged.responsePrefix,
81
121
  defaultTo: merged.defaultTo,
82
122
  authDir,
83
123
  isLegacyAuthDir: isLegacy,
@@ -110,4 +150,4 @@ function listEnabledWhatsAppAccounts(cfg) {
110
150
  })).filter((account) => account.enabled);
111
151
  }
112
152
  //#endregion
113
- export { resolveWhatsAppAccount as a, listWhatsAppAuthDirs as i, hasAnyWhatsAppAuth as n, resolveWhatsAppAuthDir as o, listEnabledWhatsAppAccounts as r, resolveWhatsAppMediaMaxBytes as s, DEFAULT_WHATSAPP_MEDIA_MAX_MB as t };
153
+ export { resolveWhatsAppAccount as a, resolveMergedWhatsAppAccountConfig as c, listWhatsAppAuthDirs as i, hasAnyWhatsAppAuth as n, resolveWhatsAppAuthDir as o, listEnabledWhatsAppAccounts as r, resolveWhatsAppMediaMaxBytes as s, DEFAULT_WHATSAPP_MEDIA_MAX_MB as t };
@@ -1,6 +1,6 @@
1
- import { a as resolveWhatsAppAccount } from "./accounts-CKOFMPf-.js";
1
+ import { a as resolveWhatsAppAccount } from "./accounts-CxPuEFi-.js";
2
2
  import { t as resolveWhatsAppOutboundTarget } from "./resolve-outbound-target-BR97fAbB.js";
3
- import { r as sendReactionWhatsApp, u as resolveWhatsAppReactionLevel } from "./send-D9Ydnn4o.js";
3
+ import { r as sendReactionWhatsApp, u as resolveWhatsAppReactionLevel } from "./send-DhJVN30g.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-Bf-12TIH.js";
1
+ import { t as handleWhatsAppAction } from "./action-runtime-CHU7xb6o.js";
2
2
  export { handleWhatsAppAction };
@@ -1,2 +1,2 @@
1
- import { t as handleWhatsAppAction } from "./action-runtime-Bf-12TIH.js";
1
+ import { t as handleWhatsAppAction } from "./action-runtime-CHU7xb6o.js";
2
2
  export { handleWhatsAppAction };
@@ -1,5 +1,5 @@
1
1
  import { r as resolveDefaultWhatsAppAccountId } from "./account-ids-CB5SOWjc.js";
2
- import { n as getWhatsAppConnectionController } from "./connection-controller-runtime-context-CbTsqmPT.js";
2
+ import { r as getWhatsAppConnectionController } from "./connection-controller-runtime-context-DG0tuYuw.js";
3
3
  //#region extensions/whatsapp/src/active-listener.ts
4
4
  function resolveWebAccountId(params) {
5
5
  return (params.accountId ?? "").trim() || resolveDefaultWhatsAppAccountId(params.cfg);
package/dist/api.js CHANGED
@@ -1,29 +1,26 @@
1
+ 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-CxPuEFi-.js";
1
2
  import { r as resolveDefaultWhatsAppAccountId, t as listAccountIds } from "./account-ids-CB5SOWjc.js";
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-CKOFMPf-.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-DSZnHkKF.js";
4
4
  import { t as resolveWhatsAppOutboundTarget } from "./resolve-outbound-target-BR97fAbB.js";
5
- import "./send-D9Ydnn4o.js";
6
- import { c as toWhatsappJidWithLid, i as markdownToWhatsApp, n as isSelfChatMode, o as resolveJidToE164, r as jidToE164, s as toWhatsappJid, t as assertWebChannel } from "./targets-runtime-Bsh0HR9y.js";
7
- import { n as normalizeE164, r as resolveUserPath } from "./text-runtime-BTGkMN0o.js";
8
- import { n as resolveWhatsAppGroupIntroHint, r as WHATSAPP_LEGACY_OUTBOUND_SEND_DEP_KEYS, t as whatsappPlugin } from "./channel-DbadDUDD.js";
5
+ import "./send-DhJVN30g.js";
6
+ import { c as toWhatsappJid, i as markdownToWhatsApp, l as toWhatsappJidWithLid, n as isSelfChatMode, r as jidToE164, s as resolveJidToE164, t as assertWebChannel } from "./targets-runtime-CKFrhoX4.js";
7
+ import { n as resolveUserPath, t as normalizeE164 } from "./text-runtime-CU_IlbK5.js";
8
+ import { n as resolveWhatsAppGroupIntroHint, r as WHATSAPP_LEGACY_OUTBOUND_SEND_DEP_KEYS, t as whatsappPlugin } from "./channel-B9xjrOGG.js";
9
+ import { a as resolveWhatsAppGroupRequireMention, o as resolveWhatsAppGroupToolPolicy } from "./shared-CuqHFnKd.js";
9
10
  import { t as whatsappCommandPolicy } from "./command-policy-BIOSHySD.js";
10
- import { a as resolveWhatsAppGroupRequireMention, o as resolveWhatsAppGroupToolPolicy } from "./setup-core-3aSOoK2T.js";
11
- import "./config-schema-BZ8h1hWA.js";
12
- import { t as whatsappSetupPlugin } from "./channel.setup-BZ-po8fg.js";
11
+ import "./config-schema-C6IeKIC0.js";
12
+ import { t as whatsappSetupPlugin } from "./channel.setup-DXUCPHel.js";
13
13
  import { t as DEFAULT_WEB_MEDIA_BYTES } from "./constants-HU41RHGI.js";
14
- import { n as listWhatsAppDirectoryGroupsFromConfig, r as listWhatsAppDirectoryPeersFromConfig } from "./directory-config-CLBQrjtC.js";
15
- import { n as testing } from "./access-control-DazDX3RB.js";
16
- import { _ as extractLocationData, b as extractText, d as normalizeMessageContent, f as resolveInboundMediaMimetype, h as extractContextInfo, p as describeReplyContext, t as createWebSendApi } from "./send-api-W33lI2nR.js";
17
- import { a as createWhatsAppSocketOperationTimeoutAdapter, i as DEFAULT_WHATSAPP_SOCKET_TIMING, r as waitForWaConnection, t as createWaSocket } from "./session-mxWFn0eS.js";
14
+ import { a as waitForWaConnection, o as DEFAULT_WHATSAPP_SOCKET_TIMING, r as createWaSocket, s as createWhatsAppSocketOperationTimeoutAdapter } from "./socket-close-BoSHhQNJ.js";
18
15
  import { n as getStatusCode, t as formatError } from "./session-errors-JuazczrA.js";
16
+ import { n as listWhatsAppDirectoryGroupsFromConfig, r as listWhatsAppDirectoryPeersFromConfig } from "./directory-config-BTbJkV1W.js";
17
+ import { n as testing } from "./access-control-CRz_v6bR.js";
18
+ import { d as normalizeMessageContent, f as describeReplyContext, g as extractLocationData, m as extractContextInfo, t as createWebSendApi, x as resolveInboundMediaMimetype, y as extractText } from "./send-api-CpHwbor_.js";
19
19
  import "openclaw/plugin-sdk/channel-actions";
20
20
  import "openclaw/plugin-sdk/account-resolution";
21
21
  import "openclaw/plugin-sdk/core";
22
22
  import "openclaw/plugin-sdk/account-id";
23
- import { createLazyRuntimeModule } from "openclaw/plugin-sdk/lazy-runtime";
24
23
  import { formatLocationText } from "openclaw/plugin-sdk/channel-inbound";
25
- createLazyRuntimeModule(() => import("./channel.runtime-BDDy4Lhz.js"));
26
- //#endregion
27
24
  //#region extensions/whatsapp/src/qa-driver.runtime.ts
28
25
  function isRecord(value) {
29
26
  return Boolean(value && typeof value === "object");
@@ -1,10 +1,10 @@
1
+ import "./accounts-CxPuEFi-.js";
1
2
  import { r as resolveDefaultWhatsAppAccountId } from "./account-ids-CB5SOWjc.js";
2
- import "./accounts-CKOFMPf-.js";
3
3
  import { s as normalizeWhatsAppMessagingTarget } from "./normalize-target-DSZnHkKF.js";
4
- import { i as sendTypingWhatsApp, t as sendMessageWhatsApp } from "./send-D9Ydnn4o.js";
5
- import { n as getWhatsAppRuntime } from "./runtime-BfAdAEYT.js";
4
+ import { i as sendTypingWhatsApp, t as sendMessageWhatsApp } from "./send-DhJVN30g.js";
5
+ import { i as getWhatsAppRuntime } from "./runtime-BLlToOi6.js";
6
6
  import "./normalize-C-Z16y7Q.js";
7
- import { i as unregisterWhatsAppApprovalReactionTarget, r as registerWhatsAppApprovalReactionTarget } from "./approval-reactions-BGQoz25s.js";
7
+ import { i as unregisterWhatsAppApprovalReactionTarget, r as registerWhatsAppApprovalReactionTarget } from "./approval-reactions-P2HXjmln.js";
8
8
  import { createSubsystemLogger } from "openclaw/plugin-sdk/runtime-env";
9
9
  import { DEFAULT_ACCOUNT_ID } from "openclaw/plugin-sdk/account-id";
10
10
  import { buildChannelApprovalNativeTargetKey } from "openclaw/plugin-sdk/approval-native-runtime";
@@ -1,7 +1,7 @@
1
1
  import { t as __exportAll } from "./rolldown-runtime-D7D4PA-g.js";
2
- import { a as resolveWhatsAppAccount } from "./accounts-CKOFMPf-.js";
3
- import { t as getOptionalWhatsAppRuntime } from "./runtime-BfAdAEYT.js";
4
- import { c as getWhatsAppApprovalApprovers, l as whatsappApprovalAuth } from "./group-session-key-CLTZeH_F.js";
2
+ import { a as resolveWhatsAppAccount } from "./accounts-CxPuEFi-.js";
3
+ import { n as getOptionalWhatsAppRuntime } from "./runtime-BLlToOi6.js";
4
+ import { c as getWhatsAppApprovalApprovers, l as whatsappApprovalAuth } from "./group-session-key-DJSdYfnb.js";
5
5
  import { createLazyRuntimeModule } from "openclaw/plugin-sdk/lazy-runtime";
6
6
  import { createApprovalReactionTargetStore, listApprovalReactionBindings, resolveTypedApprovalReactionTarget } from "openclaw/plugin-sdk/approval-reaction-runtime";
7
7
  //#region extensions/whatsapp/src/approval-reactions.ts
@@ -1,7 +1,7 @@
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, s as resolveWebCredsPath, t as assertWebCredsPathRegularFileOrMissing } from "./creds-files-B1kSWtBg.js";
3
- import { r as resolveUserPath } from "./text-runtime-BTGkMN0o.js";
4
- import { c as resolveComparableIdentity } from "./identity-D7L8LCuH.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-CU_IlbK5.js";
4
+ import { c as resolveComparableIdentity } from "./identity-BM4_wZeM.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";
@@ -75,6 +75,7 @@ var auth_store_exports = /* @__PURE__ */ __exportAll({
75
75
  WhatsAppAuthUnstableError: () => WhatsAppAuthUnstableError,
76
76
  formatWhatsAppWebAuthStatusState: () => formatWhatsAppWebAuthStatusState,
77
77
  getWebAuthAgeMs: () => getWebAuthAgeMs,
78
+ hasWebCredsSync: () => hasWebCredsSync,
78
79
  logWebSelfId: () => logWebSelfId,
79
80
  logoutWeb: () => logoutWeb,
80
81
  pickWebChannel: () => pickWebChannel,
@@ -1,16 +1,16 @@
1
- import { a as resolveWhatsAppAccount } from "./accounts-CKOFMPf-.js";
2
- import { n as getWhatsAppConnectionController } from "./connection-controller-runtime-context-CbTsqmPT.js";
3
- import { o as resolveJidToE164 } from "./targets-runtime-Bsh0HR9y.js";
1
+ import { a as resolveWhatsAppAccount } from "./accounts-CxPuEFi-.js";
2
+ import { r as getWhatsAppConnectionController } from "./connection-controller-runtime-context-DG0tuYuw.js";
3
+ import { s as resolveJidToE164 } from "./targets-runtime-CKFrhoX4.js";
4
4
  import { createActionGate, stringEnum } from "openclaw/plugin-sdk/channel-actions";
5
5
  import path from "node:path";
6
6
  import { resolveOAuthDir } from "openclaw/plugin-sdk/state-paths";
7
7
  import { normalizeE164 } from "openclaw/plugin-sdk/account-resolution";
8
- import { resolvePreferredOpenClawTmpDir } from "openclaw/plugin-sdk/temp-path";
9
8
  import { normalizeAccountId } from "openclaw/plugin-sdk/account-id";
10
9
  import { Type } from "typebox";
11
10
  import fs from "node:fs/promises";
12
11
  import { mulawToPcm } from "openclaw/plugin-sdk/realtime-voice";
13
12
  import { detectBinary } from "openclaw/plugin-sdk/setup-tools";
13
+ import { resolvePreferredOpenClawTmpDir } from "openclaw/plugin-sdk/temp-path";
14
14
  import { jsonResult as jsonResult$1 } from "openclaw/plugin-sdk/tool-results";
15
15
  //#region extensions/whatsapp/src/agent-tools-call.ts
16
16
  const MEOWCALLER_COMMAND = "meowcaller";
@@ -1,17 +1,17 @@
1
+ import { a as resolveWhatsAppAccount } from "./accounts-CxPuEFi-.js";
1
2
  import { r as resolveDefaultWhatsAppAccountId, t as listAccountIds } from "./account-ids-CB5SOWjc.js";
2
- import { a as resolveWhatsAppAccount } from "./accounts-CKOFMPf-.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-DSZnHkKF.js";
4
4
  import { t as resolveWhatsAppOutboundTarget } from "./resolve-outbound-target-BR97fAbB.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-D9Ydnn4o.js";
6
- import { n as getWhatsAppRuntime } from "./runtime-BfAdAEYT.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-DhJVN30g.js";
6
+ import { i as getWhatsAppRuntime } from "./runtime-BLlToOi6.js";
7
7
  import "./normalize-C-Z16y7Q.js";
8
- import { s as toWhatsappJid } from "./targets-runtime-Bsh0HR9y.js";
9
- import "./text-runtime-BTGkMN0o.js";
8
+ import { c as toWhatsappJid } from "./targets-runtime-CKFrhoX4.js";
9
+ import "./text-runtime-CU_IlbK5.js";
10
10
  import { t as createWhatsAppLoginTool } from "./agent-tools-login-DfyToBpG.js";
11
- import { c as getWhatsAppApprovalApprovers, l as whatsappApprovalAuth, s as lookupInboundMessageMetaForTarget, t as resolveWhatsAppGroupSessionKey } from "./group-session-key-CLTZeH_F.js";
11
+ import { c as getWhatsAppApprovalApprovers, l as whatsappApprovalAuth, s as lookupInboundMessageMetaForTarget, t as resolveWhatsAppGroupSessionKey } from "./group-session-key-DJSdYfnb.js";
12
+ import { a as resolveWhatsAppGroupRequireMention, c as isWhatsAppAuthConfigured, i as whatsappSetupContract, l as loadWhatsAppChannelRuntime, n as whatsappSetupWizardProxy, o as resolveWhatsAppGroupToolPolicy, r as whatsappSetupAdapter, s as formatWhatsAppConfigAllowFromEntries, t as createWhatsAppPluginBase } from "./shared-CuqHFnKd.js";
12
13
  import { t as whatsappCommandPolicy } from "./command-policy-BIOSHySD.js";
13
- import { a as resolveWhatsAppGroupRequireMention, i as whatsappSetupWizardProxy, n as createWhatsAppPluginBase, o as resolveWhatsAppGroupToolPolicy, r as loadWhatsAppChannelRuntime, s as formatWhatsAppConfigAllowFromEntries, t as whatsappSetupAdapter } from "./setup-core-3aSOoK2T.js";
14
- import { f as readWebAuthExistsForDecision, n as WHATSAPP_AUTH_UNSTABLE_CODE } from "./auth-store-BQi9pZqQ.js";
14
+ import { f as readWebAuthExistsForDecision, n as WHATSAPP_AUTH_UNSTABLE_CODE } from "./auth-store-DirYMTbo.js";
15
15
  import { t as detectWhatsAppLegacyStateMigrations } from "./state-migrations-CAMTrs2U.js";
16
16
  import { createActionGate as createActionGate$1 } from "openclaw/plugin-sdk/channel-actions";
17
17
  import { normalizeOptionalAccountId } from "openclaw/plugin-sdk/account-core";
@@ -19,6 +19,7 @@ import { normalizeLowercaseStringOrEmpty, normalizeOptionalString } from "opencl
19
19
  import { asString, collectIssuesForEnabledAccounts, createAsyncComputedAccountStatusAdapter, createDefaultChannelRuntimeState, isRecord as isRecord$1, readAccountStatusSnapshot } from "openclaw/plugin-sdk/status-helpers";
20
20
  import { formatCliCommand } from "openclaw/plugin-sdk/cli-runtime";
21
21
  import { buildChannelOutboundSessionRoute } from "openclaw/plugin-sdk/core";
22
+ import { chunkText } from "openclaw/plugin-sdk/reply-chunking";
22
23
  import { createMessageReceiptFromOutboundResults, defineChannelMessageAdapter, resolveOutboundSendDep } from "openclaw/plugin-sdk/channel-outbound";
23
24
  import { sendTextMediaPayload } from "openclaw/plugin-sdk/reply-payload";
24
25
  import { DEFAULT_ACCOUNT_ID as DEFAULT_ACCOUNT_ID$1 } from "openclaw/plugin-sdk/account-id";
@@ -30,7 +31,7 @@ import { createLazyChannelApprovalNativeRuntimeAdapter } from "openclaw/plugin-s
30
31
  import { createChannelApproverDmTargetResolver, createChannelNativeOriginTargetResolver, createNativeApprovalChannelRouteGates, createNativeApprovalForwardingFallbackSuppressor } from "openclaw/plugin-sdk/approval-native-runtime";
31
32
  import { buildApprovalReactionPromptPayloadForRequest } from "openclaw/plugin-sdk/approval-reaction-runtime";
32
33
  import { buildTypedApprovalPresentation } from "openclaw/plugin-sdk/approval-reply-runtime";
33
- import { chunkText } from "openclaw/plugin-sdk/reply-chunking";
34
+ import { questionGatewayRuntime } from "openclaw/plugin-sdk/question-gateway-runtime";
34
35
  import { attachChannelToResult, createAttachedChannelResultAdapter } from "openclaw/plugin-sdk/channel-send-result";
35
36
  //#region extensions/whatsapp/src/approval-native.ts
36
37
  const DEFAULT_APPROVAL_FORWARDING_MODE = "session";
@@ -224,7 +225,7 @@ const whatsappApprovalCapability = createChannelApprovalCapability({
224
225
  approvalKind,
225
226
  request
226
227
  }),
227
- load: async () => (await import("./approval-handler.runtime-CBiGQuZ5.js")).whatsappApprovalNativeRuntime
228
+ load: async () => (await import("./approval-handler.runtime-C4ddB7Kc.js")).whatsappApprovalNativeRuntime
228
229
  })
229
230
  });
230
231
  //#endregion
@@ -293,7 +294,8 @@ function createWhatsAppOutboundBase({ chunker, sendMessageWhatsApp, sendPollWhat
293
294
  remoteJid: cachedMeta?.remoteJid ?? targetJid,
294
295
  fromMe: cachedMeta?.fromMe ?? false,
295
296
  participant: cachedMeta?.participant,
296
- messageText: cachedMeta?.body
297
+ messageText: cachedMeta?.body,
298
+ media: cachedMeta?.media
297
299
  };
298
300
  };
299
301
  const outbound = {
@@ -390,7 +392,8 @@ function createWhatsAppOutboundBase({ chunker, sendMessageWhatsApp, sendPollWhat
390
392
  }
391
393
  //#endregion
392
394
  //#region extensions/whatsapp/src/channel-outbound.ts
393
- const loadWhatsAppApprovalReactionsModule = createLazyRuntimeModule(() => import("./approval-reactions-BGQoz25s.js").then((n) => n.t));
395
+ const loadWhatsAppApprovalReactionsModule = createLazyRuntimeModule(() => import("./approval-reactions-P2HXjmln.js").then((n) => n.t));
396
+ const loadWhatsAppQuestionReactionsModule = createLazyRuntimeModule(() => import("./question-reactions-CaOrSYzU.js").then((n) => n.n));
394
397
  function normalizeWhatsAppChannelPayloadText(text) {
395
398
  return normalizeWhatsAppPayloadTextPreservingIndentation(text);
396
399
  }
@@ -399,12 +402,18 @@ function normalizeWhatsAppChannelSendText(text) {
399
402
  return normalized.trim() ? normalized : "";
400
403
  }
401
404
  async function prepareWhatsAppApprovalPayloadForDelivery(params) {
405
+ const questionPayload = questionGatewayRuntime.prepareReactionPayloadForDelivery({
406
+ payload: params.payload,
407
+ presentation: params.presentation
408
+ });
409
+ if (questionPayload) return questionPayload;
402
410
  return (await loadWhatsAppApprovalReactionsModule()).prepareWhatsAppApprovalPayloadForDelivery({
403
411
  payload: params.payload,
404
412
  presentation: params.presentation
405
413
  });
406
414
  }
407
415
  async function registerDeliveredWhatsAppApprovalPayload(params) {
416
+ (await loadWhatsAppQuestionReactionsModule()).registerWhatsAppQuestionReactionTargetForDeliveredPayload(params);
408
417
  (await loadWhatsAppApprovalReactionsModule()).registerWhatsAppApprovalReactionTargetForDeliveredPayload(params);
409
418
  }
410
419
  const whatsappChannelOutbound = {
@@ -483,7 +492,7 @@ function resolveWhatsAppMentionStripRegexes(ctx) {
483
492
  //#endregion
484
493
  //#region extensions/whatsapp/src/heartbeat.ts
485
494
  async function checkWhatsAppHeartbeatReady(params) {
486
- if (params.cfg.web?.enabled === false) return {
495
+ if (params.cfg.channels?.whatsapp?.enabled === false) return {
487
496
  ok: false,
488
497
  reason: "whatsapp-disabled"
489
498
  };
@@ -657,8 +666,8 @@ function collectWhatsAppStatusIssues(accounts) {
657
666
  }
658
667
  //#endregion
659
668
  //#region extensions/whatsapp/src/channel.ts
660
- const loadWhatsAppDirectoryConfig = createLazyRuntimeModule(() => import("./directory-config-CLBQrjtC.js").then((n) => n.t));
661
- const loadWhatsAppChannelReactAction = createLazyRuntimeModule(() => import("./channel-react-action-PoRWfP9x.js"));
669
+ const loadWhatsAppDirectoryConfig = createLazyRuntimeModule(() => import("./directory-config-BTbJkV1W.js").then((n) => n.t));
670
+ const loadWhatsAppChannelReactAction = createLazyRuntimeModule(() => import("./channel-react-action-CBW-PA8q.js"));
662
671
  function resolveWhatsAppTargetInfo(raw) {
663
672
  const normalized = normalizeWhatsAppTarget(raw);
664
673
  if (!normalized) return null;
@@ -667,6 +676,10 @@ function resolveWhatsAppTargetInfo(raw) {
667
676
  chatType: isWhatsAppGroupJid(normalized) ? "group" : isWhatsAppNewsletterJid(normalized) ? "channel" : "direct"
668
677
  };
669
678
  }
679
+ function resolveWhatsAppMessageActionTarget(params) {
680
+ const chatJid = params.args.chatJid;
681
+ return typeof chatJid === "string" ? normalizeWhatsAppMessagingTarget(chatJid) : void 0;
682
+ }
670
683
  const whatsappPlugin = createChatChannelPlugin({
671
684
  pairing: {
672
685
  idLabel: "whatsappSenderId",
@@ -688,9 +701,8 @@ const whatsappPlugin = createChatChannelPlugin({
688
701
  },
689
702
  setupWizard: whatsappSetupWizardProxy,
690
703
  setup: whatsappSetupAdapter,
691
- isConfigured: async (account) => {
692
- return await (await loadWhatsAppChannelRuntime()).readWebAuthState(account.authDir) === "linked";
693
- }
704
+ setupContract: whatsappSetupContract,
705
+ isConfigured: async (account) => await isWhatsAppAuthConfigured(account.authDir)
694
706
  }),
695
707
  agentTools: () => [createWhatsAppLoginTool()],
696
708
  allowlist: buildDmGroupAccountAllowlistAdapter({
@@ -758,9 +770,15 @@ const whatsappPlugin = createChatChannelPlugin({
758
770
  };
759
771
  },
760
772
  listPeers: async (params) => (await loadWhatsAppDirectoryConfig()).listWhatsAppDirectoryPeersFromConfig(params),
761
- listGroups: async (params) => (await loadWhatsAppDirectoryConfig()).listWhatsAppDirectoryGroupsFromConfig(params)
773
+ listGroups: async (params) => (await loadWhatsAppDirectoryConfig()).listWhatsAppDirectoryGroupsFromConfig(params),
774
+ listGroupsLive: async (params) => (await loadWhatsAppDirectoryConfig()).listWhatsAppDirectoryGroupsLive(params)
762
775
  },
763
776
  actions: {
777
+ messageActionTargetAliases: { react: {
778
+ aliases: ["chatJid", "messageId"],
779
+ deliveryTargetAliases: ["chatJid"],
780
+ resolveDeliveryTarget: resolveWhatsAppMessageActionTarget
781
+ } },
764
782
  describeMessageTool: ({ cfg, accountId }) => describeWhatsAppMessageActions({
765
783
  cfg,
766
784
  accountId
@@ -1,2 +1,2 @@
1
- import { t as WhatsAppChannelConfigSchema } from "./config-schema-BZ8h1hWA.js";
1
+ import { t as WhatsAppChannelConfigSchema } from "./config-schema-C6IeKIC0.js";
2
2
  export { WhatsAppChannelConfigSchema };
@@ -1,2 +1,2 @@
1
- import { t as whatsappPlugin } from "./channel-DbadDUDD.js";
1
+ import { t as whatsappPlugin } from "./channel-B9xjrOGG.js";
2
2
  export { whatsappPlugin };
@@ -1,9 +1,10 @@
1
- import { a as resolveWhatsAppAccount, s as resolveWhatsAppMediaMaxBytes } from "./accounts-CKOFMPf-.js";
1
+ import { a as resolveWhatsAppAccount, s as resolveWhatsAppMediaMaxBytes } from "./accounts-CxPuEFi-.js";
2
2
  import { c as normalizeWhatsAppTarget, t as isWhatsAppGroupJid } from "./normalize-target-DSZnHkKF.js";
3
- import { r as resolveAuthorizedWhatsAppOutboundTarget, t as handleWhatsAppAction } from "./action-runtime-Bf-12TIH.js";
4
- import { t as sendMessageWhatsApp } from "./send-D9Ydnn4o.js";
3
+ import { r as resolveAuthorizedWhatsAppOutboundTarget, t as handleWhatsAppAction } from "./action-runtime-CHU7xb6o.js";
4
+ import { t as sendMessageWhatsApp } from "./send-DhJVN30g.js";
5
5
  import "./normalize-C-Z16y7Q.js";
6
6
  import { jsonResult, readStringOrNumberParam, readStringParam as readStringParam$1, resolveReactionMessageId } from "openclaw/plugin-sdk/channel-actions";
7
+ import { canonicalizeBase64, estimateBase64DecodedBytes } from "openclaw/plugin-sdk/media-runtime";
7
8
  import { readBooleanParam } from "openclaw/plugin-sdk/boolean-param";
8
9
  //#region extensions/whatsapp/src/channel-react-action.ts
9
10
  const WHATSAPP_CHANNEL = "whatsapp";
@@ -23,23 +24,19 @@ function readWhatsAppActionChatJid(params) {
23
24
  return normalizeWhatsAppTarget(params.toolContext.currentChannelId) ?? void 0;
24
25
  }
25
26
  function extractBase64Payload(encoded) {
26
- const payload = /^data:[^;]+;base64,(.*)$/i.exec(encoded.trim())?.[1];
27
- return payload !== void 0 ? payload : encoded;
28
- }
29
- function estimateBase64DecodedBytes(encoded) {
30
- const compact = extractBase64Payload(encoded).replace(/\s/g, "");
31
- if (!compact) return 0;
32
- const padding = compact.endsWith("==") ? 2 : compact.endsWith("=") ? 1 : 0;
33
- return Math.max(0, Math.floor(compact.length * 3 / 4) - padding);
27
+ return /^data:[^;]+;base64,(.*)$/is.exec(encoded.trim())?.[1] ?? encoded;
34
28
  }
35
29
  function decodeUploadFileMediaPayload(params) {
30
+ const payload = extractBase64Payload(params.encoded);
36
31
  if (params.maxBytes !== void 0) {
37
- const estimatedBytes = estimateBase64DecodedBytes(params.encoded);
32
+ const estimatedBytes = estimateBase64DecodedBytes(payload);
38
33
  if (estimatedBytes > params.maxBytes) throw new Error(`WhatsApp upload-file buffer exceeds configured media limit (${estimatedBytes} bytes > ${params.maxBytes} bytes).`);
39
34
  }
40
35
  const contentType = readStringParam$1(params.args, "contentType") ?? readStringParam$1(params.args, "mimeType");
41
36
  const fileName = readStringParam$1(params.args, "filename") ?? readStringParam$1(params.args, "fileName");
42
- const buffer = Buffer.from(extractBase64Payload(params.encoded), "base64");
37
+ const canonicalPayload = canonicalizeBase64(payload);
38
+ if (!canonicalPayload) throw new Error("WhatsApp upload-file buffer must be valid base64 or a base64 data URL.");
39
+ const buffer = Buffer.from(canonicalPayload, "base64");
43
40
  if (params.maxBytes !== void 0 && buffer.byteLength > params.maxBytes) throw new Error(`WhatsApp upload-file buffer exceeds configured media limit (${buffer.byteLength} bytes > ${params.maxBytes} bytes).`);
44
41
  return {
45
42
  buffer,
@@ -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-BQi9pZqQ.js";
3
- import { t as getActiveWebListener$1 } from "./active-listener-5kHap439.js";
4
- import { t as monitorWebChannel$1 } from "./monitor-BZ8QvCeV.js";
5
- import { t as loginWeb$1 } from "./login-DGIoToX8.js";
6
- import { whatsappSetupWizard as whatsappSetupWizard$1 } from "./setup-surface-CiKGdNJv.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-DirYMTbo.js";
3
+ import { t as getActiveWebListener$1 } from "./active-listener-BEjWsCNM.js";
4
+ import { t as monitorWebChannel$1 } from "./monitor-CBVNJ2lb.js";
5
+ import { t as loginWeb$1 } from "./login-BKUm7KSk.js";
6
+ import { whatsappSetupWizard as whatsappSetupWizard$1 } from "./setup-surface-Kv3mPki2.js";
7
7
  //#region extensions/whatsapp/src/channel.runtime.ts
8
8
  function getActiveWebListener(...args) {
9
9
  return getActiveWebListener$1(...args);
@@ -1,10 +1,6 @@
1
- import { a as resolveWhatsAppGroupRequireMention, i as whatsappSetupWizardProxy, n as createWhatsAppPluginBase, o as resolveWhatsAppGroupToolPolicy, t as whatsappSetupAdapter } from "./setup-core-3aSOoK2T.js";
1
+ import { a as resolveWhatsAppGroupRequireMention, c as isWhatsAppAuthConfigured, i as whatsappSetupContract, n as whatsappSetupWizardProxy, o as resolveWhatsAppGroupToolPolicy, r as whatsappSetupAdapter, t as createWhatsAppPluginBase } from "./shared-CuqHFnKd.js";
2
2
  import { t as detectWhatsAppLegacyStateMigrations } from "./state-migrations-CAMTrs2U.js";
3
3
  //#region extensions/whatsapp/src/channel.setup.ts
4
- async function isWhatsAppAuthConfigured(account) {
5
- const { readWebAuthState } = await import("./auth-store-BQi9pZqQ.js").then((n) => n.i);
6
- return await readWebAuthState(account.authDir) === "linked";
7
- }
8
4
  const whatsappSetupPlugin = {
9
5
  ...createWhatsAppPluginBase({
10
6
  groups: {
@@ -13,7 +9,8 @@ const whatsappSetupPlugin = {
13
9
  },
14
10
  setupWizard: whatsappSetupWizardProxy,
15
11
  setup: whatsappSetupAdapter,
16
- isConfigured: isWhatsAppAuthConfigured
12
+ setupContract: whatsappSetupContract,
13
+ isConfigured: async (account) => await isWhatsAppAuthConfigured(account.authDir)
17
14
  }),
18
15
  lifecycle: { detectLegacyStateMigrations: ({ oauthDir }) => detectWhatsAppLegacyStateMigrations({ oauthDir }) }
19
16
  };
@@ -12,6 +12,12 @@ const WhatsAppChannelConfigSchema = buildChannelConfigSchema(WhatsAppConfigSchem
12
12
  channelLabel: "WhatsApp",
13
13
  dmPolicy: { channelKey: "whatsapp" }
14
14
  }),
15
+ allowFrom: { presentation: "phone-number" },
16
+ defaultTo: { presentation: "phone-number" },
17
+ groupAllowFrom: { presentation: "phone-number" },
18
+ "accounts.*.allowFrom.*": { presentation: "phone-number" },
19
+ "accounts.*.defaultTo": { presentation: "phone-number" },
20
+ "accounts.*.groupAllowFrom.*": { presentation: "phone-number" },
15
21
  selfChatMode: {
16
22
  label: "WhatsApp Self-Phone Mode",
17
23
  help: "Same-phone setup (bot uses your personal WhatsApp number)."