@openclaw/whatsapp 2026.5.2-beta.2 → 2026.5.3-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (301) hide show
  1. package/dist/access-control-BQ3tCkH8.js +288 -0
  2. package/dist/account-config-CNQ33oav.js +47 -0
  3. package/dist/account-ids-DG18xddX.js +5 -0
  4. package/dist/accounts-BDqgpFEB.js +116 -0
  5. package/dist/action-runtime-DTGNgG-i.js +74 -0
  6. package/dist/action-runtime-api.js +2 -0
  7. package/dist/action-runtime.runtime.js +2 -0
  8. package/dist/active-listener-N7GFKsuN.js +11 -0
  9. package/dist/agent-tools-login-DpRxLNRB.js +89 -0
  10. package/dist/api.js +148 -0
  11. package/dist/audio-preflight.runtime-Bcdsl_ri.js +7 -0
  12. package/dist/auth-presence.js +32 -0
  13. package/dist/auth-store-BjCb50Ry.js +381 -0
  14. package/dist/channel-DQ-5Xoj9.js +542 -0
  15. package/dist/channel-config-api.js +2 -0
  16. package/dist/channel-plugin-api.js +2 -0
  17. package/dist/channel-react-action-Df20qAy9.js +42 -0
  18. package/dist/channel.runtime-DKXRnA8x.js +55 -0
  19. package/dist/channel.setup-DOHR2BGp.js +20 -0
  20. package/dist/command-policy-O8sRnqUV.js +8 -0
  21. package/dist/config-schema-Dmo66Ubb.js +27 -0
  22. package/dist/connection-controller-BiHAsTM8.js +596 -0
  23. package/dist/connection-controller-registry-D_iIGz5m.js +22 -0
  24. package/dist/constants-DLGCIbfl.js +4 -0
  25. package/dist/constants.js +2 -0
  26. package/dist/contract-api.js +19 -0
  27. package/dist/creds-files-_2V8jzQa.js +19 -0
  28. package/dist/directory-config-DVs4ffXu.js +37 -0
  29. package/dist/directory-contract-api.js +2 -0
  30. package/dist/doctor-A9tXm9Om.js +48 -0
  31. package/dist/doctor-contract-api.js +10 -0
  32. package/dist/group-session-contract-B8QBn0I2.js +15 -0
  33. package/dist/identity-QHAlV7Fu.js +75 -0
  34. package/dist/index.js +18 -0
  35. package/dist/legacy-session-surface-api.js +8 -0
  36. package/dist/legacy-state-migrations-api.js +2 -0
  37. package/dist/light-runtime-api.js +5 -0
  38. package/dist/login-DymdrKca.js +52 -0
  39. package/dist/login-qr-DIS0Iv-7.js +378 -0
  40. package/dist/login-qr-api.js +2 -0
  41. package/dist/login-qr-runtime.js +16 -0
  42. package/dist/monitor-C4Fhg_lD.js +3349 -0
  43. package/dist/normalize-CWYiGkXw.js +2 -0
  44. package/dist/normalize-target-BPVHNsM5.js +74 -0
  45. package/dist/outbound-adapter-BssVnZdz.js +29 -0
  46. package/dist/outbound-base-Bq1UYEK5.js +119 -0
  47. package/dist/outbound-media-contract-CGss_QHy.js +163 -0
  48. package/dist/outbound-payload-test-api.js +2 -0
  49. package/dist/quoted-message-TENQzyxV.js +108 -0
  50. package/dist/reaction-level-CRVEVAfi.js +16 -0
  51. package/dist/reply-resolver.runtime-BRCgoO4C.js +2 -0
  52. package/dist/resolve-outbound-target-CN-Wo6IY.js +39 -0
  53. package/dist/rolldown-runtime-RkAeH_Qm.js +27 -0
  54. package/dist/runtime-6fZ67abR.js +8 -0
  55. package/dist/runtime-api.js +15 -0
  56. package/dist/runtime-group-policy-Gp1lQ0at.js +11 -0
  57. package/dist/secret-contract-api.js +5 -0
  58. package/dist/security-contract-DqH8JDX6.js +26 -0
  59. package/dist/security-contract-api.js +2 -0
  60. package/dist/send-CIyLFxdZ.js +234 -0
  61. package/dist/session-contract-B0efQf9P.js +27 -0
  62. package/dist/session-errors-CSuKZPub.js +63 -0
  63. package/dist/session.runtime-C1eSE_KK.js +13 -0
  64. package/dist/setup-core-DZKvpzbH.js +46 -0
  65. package/dist/setup-entry.js +23 -0
  66. package/dist/setup-plugin-api.js +2 -0
  67. package/dist/setup-surface-ieFnIW4g.js +344 -0
  68. package/dist/shared-D_wzSVar.js +307 -0
  69. package/dist/state-migrations-DnCdvoYD.js +39 -0
  70. package/dist/targets.js +2 -0
  71. package/dist/test-api.js +3 -0
  72. package/dist/text-runtime-C1zNiZeO.js +116 -0
  73. package/package.json +14 -6
  74. package/action-runtime-api.ts +0 -1
  75. package/action-runtime.runtime.ts +0 -1
  76. package/api.ts +0 -213
  77. package/auth-presence.ts +0 -80
  78. package/channel-config-api.ts +0 -1
  79. package/channel-plugin-api.ts +0 -3
  80. package/config-api.ts +0 -4
  81. package/constants.ts +0 -1
  82. package/contract-api.ts +0 -29
  83. package/directory-contract-api.ts +0 -4
  84. package/doctor-contract-api.ts +0 -8
  85. package/index.test.ts +0 -13
  86. package/index.ts +0 -16
  87. package/legacy-session-surface-api.ts +0 -6
  88. package/legacy-state-migrations-api.ts +0 -1
  89. package/light-runtime-api.ts +0 -12
  90. package/login-qr-api.ts +0 -1
  91. package/login-qr-runtime.ts +0 -23
  92. package/outbound-payload-test-api.ts +0 -1
  93. package/runtime-api.ts +0 -84
  94. package/secret-contract-api.ts +0 -4
  95. package/security-contract-api.ts +0 -4
  96. package/setup-entry.test.ts +0 -21
  97. package/setup-entry.ts +0 -21
  98. package/setup-plugin-api.ts +0 -3
  99. package/src/account-config.ts +0 -77
  100. package/src/account-ids.ts +0 -13
  101. package/src/account-types.ts +0 -5
  102. package/src/accounts.test.ts +0 -182
  103. package/src/accounts.ts +0 -176
  104. package/src/accounts.whatsapp-auth.test.ts +0 -59
  105. package/src/action-runtime-target-auth.ts +0 -27
  106. package/src/action-runtime.test.ts +0 -330
  107. package/src/action-runtime.ts +0 -76
  108. package/src/active-listener.test.ts +0 -65
  109. package/src/active-listener.ts +0 -17
  110. package/src/agent-tools-login.test.ts +0 -81
  111. package/src/agent-tools-login.ts +0 -113
  112. package/src/approval-auth.test.ts +0 -24
  113. package/src/approval-auth.ts +0 -27
  114. package/src/auth-store.runtime.ts +0 -1
  115. package/src/auth-store.test.ts +0 -311
  116. package/src/auth-store.ts +0 -502
  117. package/src/auto-reply/config.runtime.ts +0 -16
  118. package/src/auto-reply/constants.ts +0 -1
  119. package/src/auto-reply/deliver-reply.test.ts +0 -843
  120. package/src/auto-reply/deliver-reply.ts +0 -279
  121. package/src/auto-reply/loggers.ts +0 -6
  122. package/src/auto-reply/mentions.ts +0 -131
  123. package/src/auto-reply/monitor/ack-reaction.test.ts +0 -170
  124. package/src/auto-reply/monitor/ack-reaction.ts +0 -99
  125. package/src/auto-reply/monitor/audio-preflight.runtime.ts +0 -9
  126. package/src/auto-reply/monitor/broadcast.ts +0 -153
  127. package/src/auto-reply/monitor/commands.ts +0 -19
  128. package/src/auto-reply/monitor/echo.ts +0 -64
  129. package/src/auto-reply/monitor/group-activation.runtime.ts +0 -1
  130. package/src/auto-reply/monitor/group-activation.test.ts +0 -189
  131. package/src/auto-reply/monitor/group-activation.ts +0 -73
  132. package/src/auto-reply/monitor/group-gating.audio-preflight.test.ts +0 -103
  133. package/src/auto-reply/monitor/group-gating.runtime.ts +0 -8
  134. package/src/auto-reply/monitor/group-gating.ts +0 -217
  135. package/src/auto-reply/monitor/group-members.test.ts +0 -56
  136. package/src/auto-reply/monitor/group-members.ts +0 -65
  137. package/src/auto-reply/monitor/inbound-context.test.ts +0 -97
  138. package/src/auto-reply/monitor/inbound-context.ts +0 -92
  139. package/src/auto-reply/monitor/inbound-dispatch.runtime.ts +0 -21
  140. package/src/auto-reply/monitor/inbound-dispatch.test.ts +0 -895
  141. package/src/auto-reply/monitor/inbound-dispatch.ts +0 -422
  142. package/src/auto-reply/monitor/last-route.test.ts +0 -37
  143. package/src/auto-reply/monitor/last-route.ts +0 -61
  144. package/src/auto-reply/monitor/message-line.runtime.ts +0 -38
  145. package/src/auto-reply/monitor/message-line.ts +0 -54
  146. package/src/auto-reply/monitor/on-message.audio-preflight.test.ts +0 -354
  147. package/src/auto-reply/monitor/on-message.ts +0 -291
  148. package/src/auto-reply/monitor/peer.ts +0 -17
  149. package/src/auto-reply/monitor/process-message.audio-preflight.test.ts +0 -420
  150. package/src/auto-reply/monitor/process-message.test.ts +0 -355
  151. package/src/auto-reply/monitor/process-message.ts +0 -531
  152. package/src/auto-reply/monitor/runtime-api.ts +0 -30
  153. package/src/auto-reply/monitor-state.test.ts +0 -64
  154. package/src/auto-reply/monitor-state.ts +0 -106
  155. package/src/auto-reply/monitor.ts +0 -600
  156. package/src/auto-reply/reply-resolver.runtime.ts +0 -1
  157. package/src/auto-reply/types.ts +0 -48
  158. package/src/auto-reply/util.ts +0 -63
  159. package/src/auto-reply/web-auto-reply-monitor.test.ts +0 -687
  160. package/src/auto-reply/web-auto-reply-utils.test.ts +0 -392
  161. package/src/auto-reply.broadcast-groups.combined.test.ts +0 -246
  162. package/src/auto-reply.broadcast-groups.test-harness.ts +0 -47
  163. package/src/auto-reply.impl.ts +0 -6
  164. package/src/auto-reply.test-harness.ts +0 -421
  165. package/src/auto-reply.ts +0 -1
  166. package/src/auto-reply.web-auto-reply.compresses-common-formats-jpeg-cap.test.ts +0 -427
  167. package/src/auto-reply.web-auto-reply.connection-and-logging.e2e.test.ts +0 -908
  168. package/src/auto-reply.web-auto-reply.last-route.test.ts +0 -184
  169. package/src/channel-actions.runtime.ts +0 -7
  170. package/src/channel-actions.test.ts +0 -216
  171. package/src/channel-actions.ts +0 -84
  172. package/src/channel-outbound.test.ts +0 -131
  173. package/src/channel-outbound.ts +0 -36
  174. package/src/channel-react-action.runtime.ts +0 -7
  175. package/src/channel-react-action.test.ts +0 -294
  176. package/src/channel-react-action.ts +0 -84
  177. package/src/channel.runtime.ts +0 -117
  178. package/src/channel.setup.test.ts +0 -461
  179. package/src/channel.setup.ts +0 -28
  180. package/src/channel.ts +0 -334
  181. package/src/command-policy.ts +0 -7
  182. package/src/config-accessors.test.ts +0 -34
  183. package/src/config-accessors.ts +0 -22
  184. package/src/config-schema.test.ts +0 -121
  185. package/src/config-schema.ts +0 -6
  186. package/src/config-ui-hints.ts +0 -24
  187. package/src/connection-controller-registry.test.ts +0 -27
  188. package/src/connection-controller-registry.ts +0 -49
  189. package/src/connection-controller.test.ts +0 -282
  190. package/src/connection-controller.ts +0 -679
  191. package/src/creds-files.ts +0 -19
  192. package/src/creds-persistence.ts +0 -102
  193. package/src/directory-config.test.ts +0 -60
  194. package/src/directory-config.ts +0 -40
  195. package/src/directory-contract.test.ts +0 -56
  196. package/src/doctor-contract.ts +0 -11
  197. package/src/doctor.test.ts +0 -74
  198. package/src/doctor.ts +0 -56
  199. package/src/group-intro.ts +0 -15
  200. package/src/group-policy.test.ts +0 -36
  201. package/src/group-policy.ts +0 -40
  202. package/src/group-session-contract.ts +0 -20
  203. package/src/group-session-key.test.ts +0 -53
  204. package/src/group-session-key.ts +0 -41
  205. package/src/heartbeat.ts +0 -34
  206. package/src/identity.ts +0 -164
  207. package/src/inbound/access-control.test-harness.ts +0 -37
  208. package/src/inbound/access-control.test.ts +0 -375
  209. package/src/inbound/access-control.ts +0 -237
  210. package/src/inbound/dedupe.ts +0 -132
  211. package/src/inbound/extract.test.ts +0 -282
  212. package/src/inbound/extract.ts +0 -488
  213. package/src/inbound/lifecycle.ts +0 -39
  214. package/src/inbound/media.node.test.ts +0 -83
  215. package/src/inbound/media.ts +0 -102
  216. package/src/inbound/monitor.ts +0 -890
  217. package/src/inbound/runtime-api.ts +0 -7
  218. package/src/inbound/save-media.runtime.ts +0 -1
  219. package/src/inbound/send-api.test.ts +0 -307
  220. package/src/inbound/send-api.ts +0 -141
  221. package/src/inbound/send-result.ts +0 -61
  222. package/src/inbound/types.ts +0 -106
  223. package/src/inbound-context.contract.test.ts +0 -32
  224. package/src/inbound-policy.ts +0 -231
  225. package/src/inbound.media.test.ts +0 -320
  226. package/src/inbound.test.ts +0 -290
  227. package/src/inbound.ts +0 -9
  228. package/src/login-qr.test.ts +0 -483
  229. package/src/login-qr.ts +0 -542
  230. package/src/login.coverage.test.ts +0 -133
  231. package/src/login.test.ts +0 -89
  232. package/src/login.ts +0 -70
  233. package/src/logout.test.ts +0 -162
  234. package/src/media.test.ts +0 -480
  235. package/src/media.ts +0 -10
  236. package/src/monitor-inbox.allows-messages-from-senders-allowfrom-list.test-support.ts +0 -400
  237. package/src/monitor-inbox.append-upsert.test-support.ts +0 -133
  238. package/src/monitor-inbox.behavior.test.ts +0 -5
  239. package/src/monitor-inbox.blocks-messages-from-unauthorized-senders-not-allowfrom.test-support.ts +0 -362
  240. package/src/monitor-inbox.captures-media-path-image-messages.test-support.ts +0 -306
  241. package/src/monitor-inbox.streams-inbound-messages.test-support.ts +0 -729
  242. package/src/monitor-inbox.test-harness.ts +0 -304
  243. package/src/normalize-target.ts +0 -112
  244. package/src/normalize.ts +0 -6
  245. package/src/outbound-adapter.poll.test.ts +0 -62
  246. package/src/outbound-adapter.sendpayload.test.ts +0 -195
  247. package/src/outbound-adapter.ts +0 -36
  248. package/src/outbound-base.test.ts +0 -560
  249. package/src/outbound-base.ts +0 -244
  250. package/src/outbound-media-contract.ts +0 -278
  251. package/src/outbound-media.runtime.ts +0 -36
  252. package/src/outbound-payload.contract.test.ts +0 -61
  253. package/src/outbound-send-deps.ts +0 -1
  254. package/src/outbound-test-support.ts +0 -16
  255. package/src/pairing-security.test-harness.ts +0 -59
  256. package/src/qr-image.ts +0 -1
  257. package/src/qr-terminal.ts +0 -1
  258. package/src/quoted-message.test.ts +0 -83
  259. package/src/quoted-message.ts +0 -184
  260. package/src/reaction-level.test.ts +0 -94
  261. package/src/reaction-level.ts +0 -21
  262. package/src/reconnect.test.ts +0 -51
  263. package/src/reconnect.ts +0 -55
  264. package/src/resolve-outbound-target.test.ts +0 -265
  265. package/src/resolve-outbound-target.ts +0 -54
  266. package/src/resolve-target.test.ts +0 -97
  267. package/src/runtime-api.ts +0 -59
  268. package/src/runtime-group-policy.ts +0 -16
  269. package/src/runtime.ts +0 -9
  270. package/src/security-contract.ts +0 -47
  271. package/src/security-fix.ts +0 -71
  272. package/src/send.test.ts +0 -515
  273. package/src/send.ts +0 -287
  274. package/src/session-contract.test.ts +0 -31
  275. package/src/session-contract.ts +0 -43
  276. package/src/session-errors.ts +0 -125
  277. package/src/session-route.ts +0 -26
  278. package/src/session.runtime.ts +0 -8
  279. package/src/session.test.ts +0 -559
  280. package/src/session.ts +0 -330
  281. package/src/setup-core.ts +0 -52
  282. package/src/setup-finalize.ts +0 -446
  283. package/src/setup-surface.test.ts +0 -367
  284. package/src/setup-surface.ts +0 -69
  285. package/src/setup-test-helpers.ts +0 -216
  286. package/src/shared.ts +0 -291
  287. package/src/socket-timing.test.ts +0 -49
  288. package/src/socket-timing.ts +0 -38
  289. package/src/state-migrations.ts +0 -54
  290. package/src/status-issues.test.ts +0 -137
  291. package/src/status-issues.ts +0 -185
  292. package/src/system-prompt.test.ts +0 -199
  293. package/src/system-prompt.ts +0 -31
  294. package/src/targets-runtime.ts +0 -180
  295. package/src/test-helpers.ts +0 -690
  296. package/src/text-runtime.test.ts +0 -162
  297. package/src/text-runtime.ts +0 -11
  298. package/src/vcard.ts +0 -84
  299. package/targets.ts +0 -5
  300. package/test-api.ts +0 -2
  301. package/tsconfig.json +0 -16
@@ -0,0 +1,116 @@
1
+ import { n as __reExport, t as __exportAll } from "./rolldown-runtime-RkAeH_Qm.js";
2
+ import fs from "node:fs";
3
+ import path from "node:path";
4
+ import { CONFIG_DIR, escapeRegExp, resolveUserPath } from "openclaw/plugin-sdk/text-runtime";
5
+ import { normalizeE164 } from "openclaw/plugin-sdk/account-resolution";
6
+ import { logVerbose, shouldLogVerbose } from "openclaw/plugin-sdk/runtime-env";
7
+ //#region extensions/whatsapp/src/targets-runtime.ts
8
+ const WHATSAPP_FENCE_PLACEHOLDER = "\0FENCE";
9
+ const WHATSAPP_INLINE_CODE_PLACEHOLDER = "\0CODE";
10
+ function assertWebChannel(input) {
11
+ if (input !== "web") throw new Error("Web channel must be 'web'");
12
+ }
13
+ function isSelfChatMode(selfE164, allowFrom) {
14
+ if (!selfE164) return false;
15
+ if (!Array.isArray(allowFrom) || allowFrom.length === 0) return false;
16
+ const normalizedSelf = normalizeE164(selfE164);
17
+ return allowFrom.some((n) => {
18
+ if (n === "*") return false;
19
+ try {
20
+ return normalizeE164(String(n)) === normalizedSelf;
21
+ } catch {
22
+ return false;
23
+ }
24
+ });
25
+ }
26
+ function toWhatsappJid(number) {
27
+ const withoutPrefix = number.replace(/^whatsapp:/i, "").trim();
28
+ if (withoutPrefix.includes("@")) return withoutPrefix;
29
+ return `${normalizeE164(withoutPrefix).replace(/\D/g, "")}@s.whatsapp.net`;
30
+ }
31
+ function resolveLidMappingDirs(params) {
32
+ const dirs = /* @__PURE__ */ new Set();
33
+ const addDir = (dir) => {
34
+ if (!dir) return;
35
+ dirs.add(resolveUserPath(dir));
36
+ };
37
+ addDir(params.opts?.authDir);
38
+ for (const dir of params.opts?.lidMappingDirs ?? []) addDir(dir);
39
+ addDir(CONFIG_DIR);
40
+ addDir(path.join(CONFIG_DIR, "credentials"));
41
+ return [...dirs];
42
+ }
43
+ function readLidReverseMapping(params) {
44
+ const mappingFilename = `lid-mapping-${params.lid}_reverse.json`;
45
+ const mappingDirs = resolveLidMappingDirs({ opts: params.opts });
46
+ for (const dir of mappingDirs) {
47
+ const mappingPath = path.join(dir, mappingFilename);
48
+ try {
49
+ const data = fs.readFileSync(mappingPath, "utf8");
50
+ const phone = JSON.parse(data);
51
+ if (phone === null || phone === void 0) continue;
52
+ return normalizeE164(String(phone));
53
+ } catch {}
54
+ }
55
+ return null;
56
+ }
57
+ function jidToE164(jid, opts) {
58
+ const match = jid.match(/^(\d+)(?::\d+)?@(s\.whatsapp\.net|hosted)$/);
59
+ if (match) return `+${match[1]}`;
60
+ const lidMatch = jid.match(/^(\d+)(?::\d+)?@(lid|hosted\.lid)$/);
61
+ if (!lidMatch) return null;
62
+ const phone = readLidReverseMapping({
63
+ lid: lidMatch[1],
64
+ opts
65
+ });
66
+ if (phone) return phone;
67
+ if (opts?.logMissing ?? shouldLogVerbose()) logVerbose(`LID mapping not found for ${lidMatch[1]}; skipping inbound message`);
68
+ return null;
69
+ }
70
+ async function resolveJidToE164(jid, opts) {
71
+ if (!jid) return null;
72
+ const direct = jidToE164(jid, opts);
73
+ if (direct) return direct;
74
+ if (!/(@lid|@hosted\.lid)$/.test(jid) || !opts?.lidLookup?.getPNForLID) return null;
75
+ try {
76
+ const pnJid = await opts.lidLookup.getPNForLID(jid);
77
+ if (!pnJid) return null;
78
+ return jidToE164(pnJid, opts);
79
+ } catch (err) {
80
+ if (shouldLogVerbose()) logVerbose(`LID mapping lookup failed for ${jid}: ${String(err)}`);
81
+ return null;
82
+ }
83
+ }
84
+ function markdownToWhatsApp(text) {
85
+ if (!text) return text;
86
+ const fences = [];
87
+ let result = text.replace(/```[\s\S]*?```/g, (match) => {
88
+ fences.push(match);
89
+ return `${WHATSAPP_FENCE_PLACEHOLDER}${fences.length - 1}`;
90
+ });
91
+ const inlineCodes = [];
92
+ result = result.replace(/`[^`\n]+`/g, (match) => {
93
+ inlineCodes.push(match);
94
+ return `${WHATSAPP_INLINE_CODE_PLACEHOLDER}${inlineCodes.length - 1}`;
95
+ });
96
+ result = result.replace(/\*\*(.+?)\*\*/g, "*$1*");
97
+ result = result.replace(/__(.+?)__/g, "*$1*");
98
+ result = result.replace(/~~(.+?)~~/g, "~$1~");
99
+ result = result.replace(new RegExp(`${escapeRegExp(WHATSAPP_INLINE_CODE_PLACEHOLDER)}(\\d+)`, "g"), (_, idx) => inlineCodes[Number(idx)] ?? "");
100
+ result = result.replace(new RegExp(`${escapeRegExp(WHATSAPP_FENCE_PLACEHOLDER)}(\\d+)`, "g"), (_, idx) => fences[Number(idx)] ?? "");
101
+ return result;
102
+ }
103
+ //#endregion
104
+ //#region extensions/whatsapp/src/text-runtime.ts
105
+ var text_runtime_exports = /* @__PURE__ */ __exportAll({
106
+ assertWebChannel: () => assertWebChannel,
107
+ isSelfChatMode: () => isSelfChatMode,
108
+ jidToE164: () => jidToE164,
109
+ markdownToWhatsApp: () => markdownToWhatsApp,
110
+ resolveJidToE164: () => resolveJidToE164,
111
+ toWhatsappJid: () => toWhatsappJid
112
+ });
113
+ import * as import_openclaw_plugin_sdk_text_runtime from "openclaw/plugin-sdk/text-runtime";
114
+ __reExport(text_runtime_exports, import_openclaw_plugin_sdk_text_runtime);
115
+ //#endregion
116
+ export { markdownToWhatsApp as a, jidToE164 as i, assertWebChannel as n, resolveJidToE164 as o, isSelfChatMode as r, toWhatsappJid as s, text_runtime_exports as t };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openclaw/whatsapp",
3
- "version": "2026.5.2-beta.2",
3
+ "version": "2026.5.3-beta.1",
4
4
  "description": "OpenClaw WhatsApp channel plugin",
5
5
  "repository": {
6
6
  "type": "git",
@@ -19,7 +19,7 @@
19
19
  "openclaw": "workspace:*"
20
20
  },
21
21
  "peerDependencies": {
22
- "openclaw": ">=2026.5.2-beta.2"
22
+ "openclaw": ">=2026.5.3-beta.1"
23
23
  },
24
24
  "peerDependenciesMeta": {
25
25
  "openclaw": {
@@ -61,14 +61,22 @@
61
61
  "minHostVersion": ">=2026.4.25"
62
62
  },
63
63
  "compat": {
64
- "pluginApi": ">=2026.5.2-beta.2"
64
+ "pluginApi": ">=2026.5.3-beta.1"
65
65
  },
66
66
  "build": {
67
- "openclawVersion": "2026.5.2-beta.2"
67
+ "openclawVersion": "2026.5.3-beta.1"
68
68
  },
69
69
  "release": {
70
70
  "publishToClawHub": true,
71
71
  "publishToNpm": true
72
- }
73
- }
72
+ },
73
+ "runtimeExtensions": [
74
+ "./dist/index.js"
75
+ ],
76
+ "runtimeSetupEntry": "./dist/setup-entry.js"
77
+ },
78
+ "files": [
79
+ "dist/**",
80
+ "openclaw.plugin.json"
81
+ ]
74
82
  }
@@ -1 +0,0 @@
1
- export { handleWhatsAppAction } from "./src/action-runtime.js";
@@ -1 +0,0 @@
1
- export { handleWhatsAppAction } from "./src/action-runtime.js";
package/api.ts DELETED
@@ -1,213 +0,0 @@
1
- export { whatsappPlugin } from "./src/channel.js";
2
- export { whatsappSetupPlugin } from "./src/channel.setup.js";
3
- export {
4
- DEFAULT_WHATSAPP_MEDIA_MAX_MB,
5
- hasAnyWhatsAppAuth,
6
- listEnabledWhatsAppAccounts,
7
- listWhatsAppAccountIds,
8
- listWhatsAppAuthDirs,
9
- resolveDefaultWhatsAppAccountId,
10
- type ResolvedWhatsAppAccount,
11
- resolveWhatsAppAccount,
12
- resolveWhatsAppAuthDir,
13
- resolveWhatsAppMediaMaxBytes,
14
- } from "./src/accounts.js";
15
- export { DEFAULT_WEB_MEDIA_BYTES } from "./src/auto-reply/constants.js";
16
- export { whatsappCommandPolicy } from "./src/command-policy.js";
17
- export {
18
- resolveWhatsAppGroupRequireMention,
19
- resolveWhatsAppGroupToolPolicy,
20
- } from "./src/group-policy.js";
21
- export { WHATSAPP_LEGACY_OUTBOUND_SEND_DEP_KEYS } from "./src/outbound-send-deps.js";
22
- export {
23
- __test__,
24
- asNullableObjectRecord,
25
- asNullableRecord,
26
- asOptionalObjectRecord,
27
- asOptionalRecord,
28
- asRecord,
29
- assertWebChannel,
30
- type AssistantVisibleTextSanitizerProfile,
31
- bindAbortRelay,
32
- buildTimeoutAbortSignal,
33
- chunkItems,
34
- chunkMarkdownIR,
35
- clamp,
36
- clampInt,
37
- clampNumber,
38
- type CodeRegion,
39
- CONFIG_DIR,
40
- convertMarkdownTables,
41
- createScopedExpiringIdCache,
42
- DEFAULT_LOG_DIR,
43
- DEFAULT_LOG_FILE,
44
- diagnosticLogger,
45
- type DisplayMessageWithContent,
46
- displayPath,
47
- displayString,
48
- ensureDir,
49
- escapeRegExp,
50
- fetchWithTimeout,
51
- FILE_REF_EXTENSIONS_WITH_TLD,
52
- findCodeRegions,
53
- getChildLogger,
54
- getDefaultRedactPatterns,
55
- getDiagnosticSessionStateCountForTest,
56
- getLogger,
57
- getResolvedLoggerSettings,
58
- hasNonEmptyString,
59
- hasOrphanReasoningCloseBoundary,
60
- hasSystemMark,
61
- type InlineDirectiveParseResult,
62
- isAutoLinkedFileRef,
63
- isFileLogLevelEnabled,
64
- isInsideCode,
65
- isRecord,
66
- isSelfChatMode,
67
- jidToE164,
68
- type JidToE164Options,
69
- localeLowercasePreservingWhitespace,
70
- logActiveRuns,
71
- logDebug,
72
- logError,
73
- type LoggerResolvedSettings,
74
- type LoggerSettings,
75
- logInfo,
76
- logLaneDequeue,
77
- logLaneEnqueue,
78
- logMessageProcessed,
79
- logMessageQueued,
80
- logRunAttempt,
81
- logSessionStateChange,
82
- logSuccess,
83
- logToolLoopAction,
84
- logWarn,
85
- logWebhookError,
86
- logWebhookProcessed,
87
- logWebhookReceived,
88
- lowercasePreservingWhitespace,
89
- type MarkdownIR,
90
- type MarkdownLinkSpan,
91
- type MarkdownParseOptions,
92
- type MarkdownStyle,
93
- type MarkdownStyleSpan,
94
- type MarkdownTableData,
95
- type MarkdownTableMeta,
96
- markdownToIR,
97
- markdownToIRWithMeta,
98
- markdownToWhatsApp,
99
- normalizeArrayBackedTrimmedStringList,
100
- normalizeAtHashSlug,
101
- normalizeCsvOrLooseStringList,
102
- normalizeE164,
103
- normalizeFastMode,
104
- normalizeHyphenSlug,
105
- normalizeLowercaseStringOrEmpty,
106
- normalizeNullableString,
107
- normalizeOptionalLowercaseString,
108
- normalizeOptionalString,
109
- normalizeOptionalStringifiedId,
110
- normalizeOptionalThreadValue,
111
- normalizeOptionalTrimmedStringList,
112
- normalizeSingleOrTrimmedStringList,
113
- normalizeStringEntries,
114
- normalizeStringEntriesLower,
115
- normalizeStringifiedOptionalString,
116
- normalizeTrimmedStringList,
117
- parseInlineDirectives,
118
- pathExists,
119
- type PinoLikeLogger,
120
- prefixSystemMessage,
121
- type ReactionLevel,
122
- readStringField,
123
- readStringValue,
124
- type ReasoningTagMode,
125
- type ReasoningTagTrim,
126
- redactIdentifier,
127
- redactSensitiveLines,
128
- type RedactSensitiveMode,
129
- redactSensitiveText,
130
- redactToolDetail,
131
- type RenderedMarkdownChunk,
132
- type RenderLink,
133
- renderMarkdownIRChunksWithinLimit,
134
- type RenderMarkdownIRChunksWithinLimitOptions,
135
- renderMarkdownWithMarkers,
136
- type RenderOptions,
137
- type RenderStyleMap,
138
- type RenderStyleMarker,
139
- resetDiagnosticStateForTest,
140
- resetLogger,
141
- resolveConfigDir,
142
- type ResolvedReactionLevel,
143
- type ResolvedRedactOptions,
144
- resolveGlobalMap,
145
- resolveGlobalSingleton,
146
- resolveHomeDir,
147
- resolveJidToE164,
148
- resolvePrimaryStringValue,
149
- resolveReactionLevel,
150
- resolveRedactOptions,
151
- resolveStuckSessionWarnMs,
152
- resolveUserPath,
153
- safeParseJson,
154
- sanitizeAssistantVisibleText,
155
- sanitizeAssistantVisibleTextWithOptions,
156
- sanitizeAssistantVisibleTextWithProfile,
157
- sanitizeReplyDirectiveId,
158
- sanitizeTerminalText,
159
- type ScopedExpiringIdCache,
160
- setLoggerOverride,
161
- sha256HexPrefix,
162
- shortenHomeInString,
163
- shortenHomePath,
164
- sleep,
165
- sliceMarkdownIR,
166
- sliceUtf16Safe,
167
- startDiagnosticHeartbeat,
168
- stopDiagnosticHeartbeat,
169
- stripAssistantInternalScaffolding,
170
- stripDowngradedToolCallText,
171
- stripInlineDirectiveTagsForDelivery,
172
- stripInlineDirectiveTagsForDisplay,
173
- stripInlineDirectiveTagsFromMessageForDisplay,
174
- stripMarkdown,
175
- stripMinimaxToolCallXml,
176
- stripReasoningTagsFromText,
177
- stripToolCallXmlTags,
178
- summarizeStringEntries,
179
- SYSTEM_MARK,
180
- toPinoLikeLogger,
181
- toWhatsappJid,
182
- truncateUtf16Safe,
183
- type WebChannel,
184
- withTimeout,
185
- } from "./src/text-runtime.js";
186
- export {
187
- type WebChannelHealthState,
188
- type WebChannelStatus,
189
- type WebInboundMsg,
190
- type WebMonitorTuning,
191
- } from "./src/auto-reply/types.js";
192
- export {
193
- type ActiveWebListener,
194
- type ActiveWebSendOptions,
195
- type WebInboundMessage,
196
- type WebListenerCloseReason,
197
- type WhatsAppStructuredContactContext,
198
- } from "./src/inbound/types.js";
199
- export {
200
- listWhatsAppDirectoryGroupsFromConfig,
201
- listWhatsAppDirectoryPeersFromConfig,
202
- } from "./src/directory-config.js";
203
- export { resolveWhatsAppOutboundTarget } from "./src/resolve-outbound-target.js";
204
- export {
205
- isWhatsAppGroupJid,
206
- normalizeWhatsAppAllowFromEntries,
207
- isWhatsAppUserTarget,
208
- looksLikeWhatsAppTargetId,
209
- normalizeWhatsAppMessagingTarget,
210
- normalizeWhatsAppTarget,
211
- } from "./src/normalize-target.js";
212
- export { resolveWhatsAppGroupIntroHint } from "./src/runtime-api.js";
213
- export { __testing as whatsappAccessControlTesting } from "./src/inbound/access-control.js";
package/auth-presence.ts DELETED
@@ -1,80 +0,0 @@
1
- import fs from "node:fs";
2
- import path from "node:path";
3
- import { DEFAULT_ACCOUNT_ID, normalizeAccountId } from "openclaw/plugin-sdk/account-id";
4
- import { resolveUserPath } from "openclaw/plugin-sdk/account-resolution";
5
- import type { OpenClawConfig } from "openclaw/plugin-sdk/config-types";
6
- import { resolveOAuthDir } from "openclaw/plugin-sdk/state-paths";
7
- import { hasWebCredsSync } from "./src/creds-files.js";
8
-
9
- type WhatsAppAuthPresenceParams =
10
- | {
11
- cfg: OpenClawConfig;
12
- env?: NodeJS.ProcessEnv;
13
- }
14
- | OpenClawConfig;
15
-
16
- function addAccountAuthDirs(
17
- authDirs: Set<string>,
18
- accountId: string,
19
- authDir: string | undefined,
20
- accountsRoot: string,
21
- env: NodeJS.ProcessEnv,
22
- ): void {
23
- authDirs.add(path.join(accountsRoot, normalizeAccountId(accountId)));
24
- const configuredAuthDir = authDir?.trim();
25
- if (configuredAuthDir) {
26
- authDirs.add(resolveUserPath(configuredAuthDir, env));
27
- }
28
- }
29
-
30
- function listWhatsAppAuthDirs(
31
- cfg: OpenClawConfig,
32
- env: NodeJS.ProcessEnv = process.env,
33
- ): readonly string[] {
34
- const oauthDir = resolveOAuthDir(env);
35
- const accountsRoot = path.join(oauthDir, "whatsapp");
36
- const channel = cfg.channels?.whatsapp;
37
- const authDirs = new Set<string>([oauthDir, path.join(accountsRoot, DEFAULT_ACCOUNT_ID)]);
38
-
39
- addAccountAuthDirs(authDirs, DEFAULT_ACCOUNT_ID, undefined, accountsRoot, env);
40
-
41
- if (channel?.defaultAccount?.trim()) {
42
- addAccountAuthDirs(
43
- authDirs,
44
- channel.defaultAccount,
45
- channel.accounts?.[channel.defaultAccount]?.authDir,
46
- accountsRoot,
47
- env,
48
- );
49
- }
50
-
51
- const accounts = channel?.accounts;
52
- if (accounts) {
53
- for (const [accountId, account] of Object.entries(accounts)) {
54
- addAccountAuthDirs(authDirs, accountId, account?.authDir, accountsRoot, env);
55
- }
56
- }
57
-
58
- try {
59
- const entries = fs.readdirSync(accountsRoot, { withFileTypes: true });
60
- for (const entry of entries) {
61
- if (entry.isDirectory()) {
62
- authDirs.add(path.join(accountsRoot, entry.name));
63
- }
64
- }
65
- } catch {
66
- // Missing directories mean no auth state.
67
- }
68
-
69
- return [...authDirs];
70
- }
71
-
72
- export function hasAnyWhatsAppAuth(
73
- params: WhatsAppAuthPresenceParams,
74
- env: NodeJS.ProcessEnv = process.env,
75
- ): boolean {
76
- const cfg = params && typeof params === "object" && "cfg" in params ? params.cfg : params;
77
- const resolvedEnv =
78
- params && typeof params === "object" && "cfg" in params ? (params.env ?? env) : env;
79
- return listWhatsAppAuthDirs(cfg, resolvedEnv).some((authDir) => hasWebCredsSync(authDir));
80
- }
@@ -1 +0,0 @@
1
- export { WhatsAppChannelConfigSchema } from "./src/config-schema.js";
@@ -1,3 +0,0 @@
1
- // Keep bundled channel bootstrap loads narrow so lightweight channel entry
2
- // loads do not import setup-only surfaces.
3
- export { whatsappPlugin } from "./src/channel.js";
package/config-api.ts DELETED
@@ -1,4 +0,0 @@
1
- export {
2
- buildChannelConfigSchema,
3
- WhatsAppConfigSchema,
4
- } from "openclaw/plugin-sdk/bundled-channel-config-schema";
package/constants.ts DELETED
@@ -1 +0,0 @@
1
- export { DEFAULT_WEB_MEDIA_BYTES } from "./src/auto-reply/constants.js";
package/contract-api.ts DELETED
@@ -1,29 +0,0 @@
1
- import { whatsappCommandPolicy as whatsappCommandPolicyImpl } from "./src/command-policy.js";
2
- import { resolveLegacyGroupSessionKey as resolveLegacyGroupSessionKeyImpl } from "./src/group-session-contract.js";
3
- import { __testing as whatsappAccessControlTestingImpl } from "./src/inbound/access-control.js";
4
- import {
5
- isWhatsAppGroupJid as isWhatsAppGroupJidImpl,
6
- normalizeWhatsAppTarget as normalizeWhatsAppTargetImpl,
7
- } from "./src/normalize-target.js";
8
- export {
9
- listWhatsAppDirectoryGroupsFromConfig,
10
- listWhatsAppDirectoryPeersFromConfig,
11
- } from "./src/directory-config.js";
12
- import { resolveWhatsAppRuntimeGroupPolicy as resolveWhatsAppRuntimeGroupPolicyImpl } from "./src/runtime-group-policy.js";
13
- import {
14
- canonicalizeLegacySessionKey as canonicalizeLegacySessionKeyImpl,
15
- isLegacyGroupSessionKey as isLegacyGroupSessionKeyImpl,
16
- } from "./src/session-contract.js";
17
- export {
18
- collectUnsupportedSecretRefConfigCandidates,
19
- unsupportedSecretRefSurfacePatterns,
20
- } from "./src/security-contract.js";
21
-
22
- export const canonicalizeLegacySessionKey = canonicalizeLegacySessionKeyImpl;
23
- export const isLegacyGroupSessionKey = isLegacyGroupSessionKeyImpl;
24
- export const isWhatsAppGroupJid = isWhatsAppGroupJidImpl;
25
- export const normalizeWhatsAppTarget = normalizeWhatsAppTargetImpl;
26
- export const resolveLegacyGroupSessionKey = resolveLegacyGroupSessionKeyImpl;
27
- export const resolveWhatsAppRuntimeGroupPolicy = resolveWhatsAppRuntimeGroupPolicyImpl;
28
- export const whatsappAccessControlTesting = whatsappAccessControlTestingImpl;
29
- export const whatsappCommandPolicy = whatsappCommandPolicyImpl;
@@ -1,4 +0,0 @@
1
- export {
2
- listWhatsAppDirectoryGroupsFromConfig,
3
- listWhatsAppDirectoryPeersFromConfig,
4
- } from "./src/directory-config.js";
@@ -1,8 +0,0 @@
1
- import type { ChannelDoctorLegacyConfigRule } from "openclaw/plugin-sdk/channel-contract";
2
-
3
- export { normalizeCompatibilityConfig } from "./src/doctor-contract.js";
4
-
5
- // WhatsApp currently exposes doctor compatibility fixes without extra legacy
6
- // rule scans. Keep that empty answer on a lightweight contract surface so
7
- // config validation stays off the broad contract-api import path.
8
- export const legacyConfigRules: ChannelDoctorLegacyConfigRule[] = [];
package/index.test.ts DELETED
@@ -1,13 +0,0 @@
1
- import { assertBundledChannelEntries } from "openclaw/plugin-sdk/channel-test-helpers";
2
- import { describe } from "vitest";
3
- import entry from "./index.js";
4
- import setupEntry from "./setup-entry.js";
5
-
6
- describe("whatsapp bundled entries", () => {
7
- assertBundledChannelEntries({
8
- entry,
9
- expectedId: "whatsapp",
10
- expectedName: "WhatsApp",
11
- setupEntry,
12
- });
13
- });
package/index.ts DELETED
@@ -1,16 +0,0 @@
1
- import { defineBundledChannelEntry } from "openclaw/plugin-sdk/channel-entry-contract";
2
-
3
- export default defineBundledChannelEntry({
4
- id: "whatsapp",
5
- name: "WhatsApp",
6
- description: "WhatsApp channel plugin",
7
- importMetaUrl: import.meta.url,
8
- plugin: {
9
- specifier: "./channel-plugin-api.js",
10
- exportName: "whatsappPlugin",
11
- },
12
- runtime: {
13
- specifier: "./runtime-api.js",
14
- exportName: "setWhatsAppRuntime",
15
- },
16
- });
@@ -1,6 +0,0 @@
1
- import { canonicalizeLegacySessionKey, isLegacyGroupSessionKey } from "./src/session-contract.js";
2
-
3
- export const whatsappLegacySessionSurface = {
4
- isLegacyGroupSessionKey,
5
- canonicalizeLegacySessionKey,
6
- };
@@ -1 +0,0 @@
1
- export { detectWhatsAppLegacyStateMigrations } from "./src/state-migrations.js";
@@ -1,12 +0,0 @@
1
- export { getActiveWebListener } from "./src/active-listener.js";
2
- export {
3
- getWebAuthAgeMs,
4
- logWebSelfId,
5
- logoutWeb,
6
- pickWebChannel,
7
- readWebSelfId,
8
- WA_WEB_AUTH_DIR,
9
- webAuthExists,
10
- } from "./src/auth-store.js";
11
- export { createWhatsAppLoginTool } from "./src/agent-tools-login.js";
12
- export { formatError, getStatusCode } from "./src/session-errors.js";
package/login-qr-api.ts DELETED
@@ -1 +0,0 @@
1
- export { startWebLoginWithQr, waitForWebLogin } from "./login-qr-runtime.js";
@@ -1,23 +0,0 @@
1
- type StartWebLoginWithQr = typeof import("./src/login-qr.js").startWebLoginWithQr;
2
- type WaitForWebLogin = typeof import("./src/login-qr.js").waitForWebLogin;
3
-
4
- let loginQrModulePromise: Promise<typeof import("./src/login-qr.js")> | null = null;
5
-
6
- function loadLoginQrModule() {
7
- loginQrModulePromise ??= import("./src/login-qr.js");
8
- return loginQrModulePromise;
9
- }
10
-
11
- export async function startWebLoginWithQr(
12
- ...args: Parameters<StartWebLoginWithQr>
13
- ): ReturnType<StartWebLoginWithQr> {
14
- const { startWebLoginWithQr } = await loadLoginQrModule();
15
- return await startWebLoginWithQr(...args);
16
- }
17
-
18
- export async function waitForWebLogin(
19
- ...args: Parameters<WaitForWebLogin>
20
- ): ReturnType<WaitForWebLogin> {
21
- const { waitForWebLogin } = await loadLoginQrModule();
22
- return await waitForWebLogin(...args);
23
- }
@@ -1 +0,0 @@
1
- export { whatsappOutbound } from "./src/outbound-adapter.js";