@openclaw/whatsapp 2026.5.22 → 2026.5.24-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 (35) hide show
  1. package/dist/{action-runtime-D4UqEXqf.js → action-runtime-DGx8vCsS.js} +1 -1
  2. package/dist/action-runtime-api.js +1 -1
  3. package/dist/action-runtime.runtime.js +1 -1
  4. package/dist/api.js +6 -6
  5. package/dist/approval-handler.runtime-j8U6lgcp.js +171 -0
  6. package/dist/approval-resolver-e1hAVRRy.js +15 -0
  7. package/dist/{auth-store-GTQvJznL.js → auth-store-BrKb0mwT.js} +2 -2
  8. package/dist/{channel-BQqQ-Gp5.js → channel-DOxZCBxE.js} +415 -34
  9. package/dist/channel-plugin-api.js +1 -1
  10. package/dist/{channel-react-action-CHdR3gbn.js → channel-react-action-O7asbQQ1.js} +2 -2
  11. package/dist/{channel.runtime-BZ_ya3mR.js → channel.runtime-B0cFknwD.js} +4 -4
  12. package/dist/{channel.setup-vWI0fm8Y.js → channel.setup-Bk7Hmp4a.js} +2 -2
  13. package/dist/{connection-controller-9TXWZRhx.js → connection-controller-ja6z4F_k.js} +2 -2
  14. package/dist/light-runtime-api.js +1 -1
  15. package/dist/{login-nJwaNuC-.js → login-BEkrpJbZ.js} +3 -3
  16. package/dist/{login-qr-l4UaR8Dj.js → login-qr-BVRx8j_M.js} +3 -3
  17. package/dist/login-qr-runtime.js +1 -1
  18. package/dist/{monitor-ClhD-fQ6.js → monitor-BU1ydkuF.js} +324 -87
  19. package/dist/{outbound-adapter-ltiZkW9L.js → outbound-adapter-BObZXXzU.js} +1 -1
  20. package/dist/outbound-payload-test-api.js +1 -1
  21. package/dist/{runtime-CboC4QhQ.js → runtime-BfAdAEYT.js} +2 -2
  22. package/dist/runtime-api.js +8 -8
  23. package/dist/runtime-setter-api.js +1 -1
  24. package/dist/send-C9jEw6hx.js +625 -0
  25. package/dist/{send-api-CXPUXbUL.js → send-api-CC-vHBWG.js} +2 -2
  26. package/dist/{session-CPsgRMMa.js → session-CDgpDc0l.js} +2 -2
  27. package/dist/{session.runtime-C6uBkEaI.js → session.runtime-LZFdq3yb.js} +1 -1
  28. package/dist/{setup-core-BTDKEc-x.js → setup-core-Ce-b_wzQ.js} +2 -2
  29. package/dist/{setup-finalize-DUYdQs-v.js → setup-finalize-BqOudqJw.js} +2 -2
  30. package/dist/setup-plugin-api.js +1 -1
  31. package/dist/{setup-surface-Uoh9W_29.js → setup-surface-CAchPwW5.js} +2 -2
  32. package/dist/test-api.js +1 -1
  33. package/npm-shrinkwrap.json +3 -3
  34. package/package.json +4 -4
  35. package/dist/send-E_kMiuZP.js +0 -269
@@ -1,7 +1,7 @@
1
1
  import { a as resolveWhatsAppAccount } from "./accounts-BPYgj8Fv.js";
2
2
  import { t as resolveWhatsAppOutboundTarget } from "./resolve-outbound-target-CV-iBmSG.js";
3
3
  import { t as resolveWhatsAppReactionLevel } from "./reaction-level-BqMOEBeq.js";
4
- import { r as sendReactionWhatsApp } from "./send-E_kMiuZP.js";
4
+ import { r as sendReactionWhatsApp } from "./send-C9jEw6hx.js";
5
5
  import { ToolAuthorizationError, createActionGate, jsonResult, readReactionParams, readStringParam } from "openclaw/plugin-sdk/channel-actions";
6
6
  //#region extensions/whatsapp/src/action-runtime-target-auth.ts
7
7
  function resolveAuthorizedWhatsAppOutboundTarget(params) {
@@ -1,2 +1,2 @@
1
- import { t as handleWhatsAppAction } from "./action-runtime-D4UqEXqf.js";
1
+ import { t as handleWhatsAppAction } from "./action-runtime-DGx8vCsS.js";
2
2
  export { handleWhatsAppAction };
@@ -1,2 +1,2 @@
1
- import { t as handleWhatsAppAction } from "./action-runtime-D4UqEXqf.js";
1
+ import { t as handleWhatsAppAction } from "./action-runtime-DGx8vCsS.js";
2
2
  export { handleWhatsAppAction };
package/dist/api.js CHANGED
@@ -3,19 +3,19 @@ import { a as resolveWhatsAppAccount, i as listWhatsAppAuthDirs, n as hasAnyWhat
3
3
  import { a as normalizeWhatsAppAllowFromEntries, c as normalizeWhatsAppTarget, i as looksLikeWhatsAppTargetId, r as isWhatsAppUserTarget, s as normalizeWhatsAppMessagingTarget, t as isWhatsAppGroupJid } from "./normalize-target-bVWjgftN.js";
4
4
  import { t as resolveWhatsAppOutboundTarget } from "./resolve-outbound-target-CV-iBmSG.js";
5
5
  import "./reaction-level-BqMOEBeq.js";
6
+ import "./send-C9jEw6hx.js";
6
7
  import { c as assertWebChannel, d as markdownToWhatsApp, f as resolveJidToE164, l as isSelfChatMode, m as toWhatsappJidWithLid, n as normalizeE164, p as toWhatsappJid, r as resolveUserPath, u as jidToE164 } from "./text-runtime-Dk37KYHj.js";
7
- import "./send-E_kMiuZP.js";
8
- import { t as whatsappPlugin } from "./channel-BQqQ-Gp5.js";
8
+ import { t as whatsappPlugin } from "./channel-DOxZCBxE.js";
9
9
  import { n as WHATSAPP_LEGACY_OUTBOUND_SEND_DEP_KEYS } from "./outbound-base-E84SMkd9.js";
10
10
  import { t as whatsappCommandPolicy } from "./command-policy-BIOSHySD.js";
11
- import { a as resolveWhatsAppGroupRequireMention, o as resolveWhatsAppGroupToolPolicy, s as resolveWhatsAppGroupIntroHint } from "./setup-core-BTDKEc-x.js";
11
+ import { a as resolveWhatsAppGroupRequireMention, o as resolveWhatsAppGroupToolPolicy, s as resolveWhatsAppGroupIntroHint } from "./setup-core-Ce-b_wzQ.js";
12
12
  import "./config-schema-CsNDlDpL.js";
13
- import { t as whatsappSetupPlugin } from "./channel.setup-vWI0fm8Y.js";
13
+ import { t as whatsappSetupPlugin } from "./channel.setup-Bk7Hmp4a.js";
14
14
  import { t as DEFAULT_WEB_MEDIA_BYTES } from "./constants-HU41RHGI.js";
15
15
  import { n as listWhatsAppDirectoryGroupsFromConfig, r as listWhatsAppDirectoryPeersFromConfig } from "./directory-config-CfLFAK54.js";
16
16
  import { n as testing } from "./access-control-p_vcYDW7.js";
17
- import { p as extractText, t as createWebSendApi } from "./send-api-CXPUXbUL.js";
18
- import { r as waitForWaConnection, t as createWaSocket } from "./session-CPsgRMMa.js";
17
+ import { p as extractText, t as createWebSendApi } from "./send-api-CC-vHBWG.js";
18
+ import { r as waitForWaConnection, t as createWaSocket } from "./session-CDgpDc0l.js";
19
19
  import "openclaw/plugin-sdk/channel-actions";
20
20
  import "openclaw/plugin-sdk/account-resolution";
21
21
  import "openclaw/plugin-sdk/core";
@@ -0,0 +1,171 @@
1
+ import { s as normalizeWhatsAppMessagingTarget } from "./normalize-target-bVWjgftN.js";
2
+ import "./normalize-Bxwqo-bW.js";
3
+ import { i as sendTypingWhatsApp, l as registerWhatsAppApprovalReactionTarget, s as buildWhatsAppApprovalReactionHint, t as sendMessageWhatsApp, u as unregisterWhatsAppApprovalReactionTarget } from "./send-C9jEw6hx.js";
4
+ import { n as getWhatsAppRuntime } from "./runtime-BfAdAEYT.js";
5
+ import { normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
6
+ import { createSubsystemLogger } from "openclaw/plugin-sdk/runtime-env";
7
+ import { buildChannelApprovalNativeTargetKey } from "openclaw/plugin-sdk/approval-native-runtime";
8
+ import { buildApprovalResolvedReplyPayload, buildPluginApprovalExpiredMessage, buildPluginApprovalPendingReplyPayload, buildPluginApprovalResolvedMessage } from "openclaw/plugin-sdk/approval-runtime";
9
+ import { createChannelApprovalNativeRuntimeAdapter } from "openclaw/plugin-sdk/approval-handler-runtime";
10
+ import { buildExecApprovalPendingReplyPayload as buildExecApprovalPendingReplyPayload$1 } from "openclaw/plugin-sdk/approval-reply-runtime";
11
+ //#region extensions/whatsapp/src/approval-handler.runtime.ts
12
+ const log = createSubsystemLogger("whatsapp/approvals");
13
+ function appendReactionHint(params) {
14
+ const hint = buildWhatsAppApprovalReactionHint(params.allowedDecisions);
15
+ return hint ? `${params.text}\n\n${hint}` : params.text;
16
+ }
17
+ function replaceApprovalIdPlaceholder(text, approvalId) {
18
+ return (text ?? "").replace(/\/approve\s+<id>/g, `/approve ${approvalId}`);
19
+ }
20
+ function buildPendingPayload(params) {
21
+ const allowedDecisions = params.view.actions.map((action) => action.decision);
22
+ return {
23
+ text: appendReactionHint({
24
+ text: replaceApprovalIdPlaceholder((params.approvalKind === "plugin" ? buildPluginApprovalPendingReplyPayload({
25
+ request: params.request,
26
+ nowMs: params.nowMs,
27
+ allowedDecisions
28
+ }) : buildExecApprovalPendingReplyPayload$1({
29
+ approvalId: params.request.id,
30
+ approvalSlug: params.request.id.slice(0, 8),
31
+ approvalCommandId: params.request.id,
32
+ warningText: params.view.approvalKind === "exec" ? params.view.warningText ?? void 0 : void 0,
33
+ command: params.view.approvalKind === "exec" ? params.view.commandText : "",
34
+ cwd: params.view.approvalKind === "exec" ? params.view.cwd ?? void 0 : void 0,
35
+ host: params.view.approvalKind === "exec" && params.view.host === "node" ? "node" : "gateway",
36
+ nodeId: params.view.approvalKind === "exec" ? params.view.nodeId ?? void 0 : void 0,
37
+ allowedDecisions,
38
+ expiresAtMs: params.request.expiresAtMs,
39
+ nowMs: params.nowMs
40
+ })).text, params.request.id),
41
+ allowedDecisions
42
+ }),
43
+ allowedDecisions
44
+ };
45
+ }
46
+ function buildResolvedText(params) {
47
+ if (params.view.approvalKind === "plugin") return buildPluginApprovalResolvedMessage(params.resolved);
48
+ const resolvedByText = params.resolved.resolvedBy ? ` Resolved by ${params.resolved.resolvedBy}.` : "";
49
+ return buildApprovalResolvedReplyPayload({
50
+ approvalId: params.request.id,
51
+ approvalSlug: params.request.id.slice(0, 8),
52
+ text: `✅ Exec approval ${params.resolved.decision}.${resolvedByText} ID: ${params.request.id}`
53
+ }).text ?? "";
54
+ }
55
+ function buildExpiredText(params) {
56
+ if (params.view.approvalKind === "plugin") return buildPluginApprovalExpiredMessage(params.request);
57
+ return `⏱️ Exec approval expired. ID: ${params.request.id}`;
58
+ }
59
+ function resolvePreparedAccountId(params) {
60
+ return normalizeOptionalString(params.plannedAccountId) ?? normalizeOptionalString(params.contextAccountId);
61
+ }
62
+ const whatsappApprovalNativeRuntime = createChannelApprovalNativeRuntimeAdapter({
63
+ eventKinds: ["exec", "plugin"],
64
+ availability: {
65
+ isConfigured: ({ context }) => Boolean(context),
66
+ shouldHandle: ({ context }) => Boolean(context)
67
+ },
68
+ presentation: {
69
+ buildPendingPayload: ({ request, approvalKind, nowMs, view }) => buildPendingPayload({
70
+ request,
71
+ approvalKind,
72
+ nowMs,
73
+ view
74
+ }),
75
+ buildResolvedResult: ({ request, resolved, view }) => ({
76
+ kind: "update",
77
+ payload: { text: buildResolvedText({
78
+ request,
79
+ resolved,
80
+ view
81
+ }) }
82
+ }),
83
+ buildExpiredResult: ({ request, view }) => ({
84
+ kind: "update",
85
+ payload: { text: buildExpiredText({
86
+ request,
87
+ view
88
+ }) }
89
+ })
90
+ },
91
+ transport: {
92
+ prepareTarget: ({ plannedTarget, accountId }) => {
93
+ const to = normalizeWhatsAppMessagingTarget(plannedTarget.target.to);
94
+ if (!to) return null;
95
+ const prepared = {
96
+ to,
97
+ accountId: resolvePreparedAccountId({
98
+ plannedAccountId: plannedTarget.target.accountId,
99
+ contextAccountId: accountId
100
+ })
101
+ };
102
+ return {
103
+ dedupeKey: `${prepared.accountId ?? ""}:${buildChannelApprovalNativeTargetKey({ to: prepared.to })}`,
104
+ target: prepared
105
+ };
106
+ },
107
+ deliverPending: async ({ cfg, preparedTarget, pendingPayload }) => {
108
+ const verbose = getWhatsAppRuntime().logging.shouldLogVerbose();
109
+ await sendTypingWhatsApp(preparedTarget.to, {
110
+ cfg,
111
+ ...preparedTarget.accountId ? { accountId: preparedTarget.accountId } : {}
112
+ }).catch(() => {});
113
+ const result = await sendMessageWhatsApp(preparedTarget.to, pendingPayload.text, {
114
+ cfg,
115
+ verbose,
116
+ preserveLeadingWhitespace: true,
117
+ ...preparedTarget.accountId ? { accountId: preparedTarget.accountId } : {}
118
+ });
119
+ if (!result.messageId) return null;
120
+ return {
121
+ accountId: preparedTarget.accountId,
122
+ to: preparedTarget.to,
123
+ remoteJid: result.toJid,
124
+ messageId: result.messageId
125
+ };
126
+ },
127
+ updateEntry: async ({ cfg, entry, payload }) => {
128
+ const verbose = getWhatsAppRuntime().logging.shouldLogVerbose();
129
+ await sendMessageWhatsApp(entry.to, payload.text, {
130
+ cfg,
131
+ verbose,
132
+ preserveLeadingWhitespace: true,
133
+ ...entry.accountId ? { accountId: entry.accountId } : {},
134
+ quotedMessageKey: {
135
+ id: entry.messageId,
136
+ remoteJid: entry.remoteJid,
137
+ fromMe: true
138
+ }
139
+ });
140
+ }
141
+ },
142
+ interactions: {
143
+ bindPending: ({ entry, request, view, pendingPayload }) => registerWhatsAppApprovalReactionTarget({
144
+ accountId: entry.accountId ?? "",
145
+ remoteJid: entry.remoteJid,
146
+ messageId: entry.messageId,
147
+ approvalId: request.id,
148
+ allowedDecisions: pendingPayload.allowedDecisions,
149
+ ttlMs: Math.max(1, view.expiresAtMs - Date.now())
150
+ }) ? true : null,
151
+ unbindPending: ({ entry }) => {
152
+ unregisterWhatsAppApprovalReactionTarget({
153
+ accountId: entry.accountId ?? "",
154
+ remoteJid: entry.remoteJid,
155
+ messageId: entry.messageId
156
+ });
157
+ },
158
+ cancelDelivered: ({ entry }) => {
159
+ unregisterWhatsAppApprovalReactionTarget({
160
+ accountId: entry.accountId ?? "",
161
+ remoteJid: entry.remoteJid,
162
+ messageId: entry.messageId
163
+ });
164
+ }
165
+ },
166
+ observe: { onDeliveryError: ({ error, request }) => {
167
+ log.error(`whatsapp approvals: failed to send request ${request.id}: ${String(error)}`);
168
+ } }
169
+ });
170
+ //#endregion
171
+ export { whatsappApprovalNativeRuntime };
@@ -0,0 +1,15 @@
1
+ import { resolveApprovalOverGateway } from "openclaw/plugin-sdk/approval-gateway-runtime";
2
+ import { isApprovalNotFoundError } from "openclaw/plugin-sdk/error-runtime";
3
+ //#region extensions/whatsapp/src/approval-resolver.ts
4
+ async function resolveWhatsAppApproval(params) {
5
+ await resolveApprovalOverGateway({
6
+ cfg: params.cfg,
7
+ approvalId: params.approvalId,
8
+ decision: params.decision,
9
+ senderId: params.senderId,
10
+ gatewayUrl: params.gatewayUrl,
11
+ clientDisplayName: `WhatsApp approval (${params.senderId?.trim() || "unknown"})`
12
+ });
13
+ }
14
+ //#endregion
15
+ export { isApprovalNotFoundError, resolveWhatsAppApproval };
@@ -7,14 +7,14 @@ import { resolveOAuthDir as resolveOAuthDir$1 } from "openclaw/plugin-sdk/state-
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
- import fs from "node:fs/promises";
11
10
  import { DEFAULT_ACCOUNT_ID } from "openclaw/plugin-sdk/routing";
11
+ import fs from "node:fs/promises";
12
12
  //#region extensions/whatsapp/src/creds-persistence.ts
13
13
  const CREDS_FILE_MODE = 384;
14
14
  const CREDS_SAVE_FLUSH_TIMEOUT_MS = 15e3;
15
15
  const credsSaveQueues = /* @__PURE__ */ new Map();
16
16
  async function stringifyCreds(creds) {
17
- const { BufferJSON } = await import("./session.runtime-C6uBkEaI.js").then((n) => n.a);
17
+ const { BufferJSON } = await import("./session.runtime-LZFdq3yb.js").then((n) => n.o);
18
18
  return JSON.stringify(creds, BufferJSON.replacer);
19
19
  }
20
20
  async function writeWebCredsRawAtomically(params) {