@openclaw/whatsapp 2026.7.2-beta.2 → 2026.7.2-beta.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{access-control-DazDX3RB.js → access-control-tjy_em01.js} +1 -1
- package/dist/{accounts-CKOFMPf-.js → accounts-ejK8sXPU.js} +43 -3
- package/dist/action-runtime-api.js +1 -1
- package/dist/{action-runtime-Bf-12TIH.js → action-runtime-p0V390gA.js} +2 -2
- package/dist/action-runtime.runtime.js +1 -1
- package/dist/{active-listener-5kHap439.js → active-listener-BbdlXooT.js} +1 -1
- package/dist/api.js +10 -10
- package/dist/{approval-handler.runtime-CBiGQuZ5.js → approval-handler.runtime-BO1oJ-b8.js} +3 -3
- package/dist/{approval-reactions-BGQoz25s.js → approval-reactions-CrZFAyf-.js} +2 -2
- package/dist/call-tool-api.js +2 -2
- package/dist/{channel-DbadDUDD.js → channel-B2I4Opzb.js} +18 -9
- package/dist/channel-plugin-api.js +1 -1
- package/dist/{channel-react-action-PoRWfP9x.js → channel-react-action-CPRQE-s3.js} +3 -3
- package/dist/{channel.runtime-BDDy4Lhz.js → channel.runtime-CjkhQzk8.js} +4 -4
- package/dist/{channel.setup-BZ-po8fg.js → channel.setup-BMWE9LmN.js} +1 -1
- package/dist/{connection-controller-C1rwfWb4.js → connection-controller-HGaffeFb.js} +183 -22
- package/dist/{connection-controller-runtime-context-CbTsqmPT.js → connection-controller-runtime-context-9mEeAvu1.js} +10 -1
- package/dist/contract-api.js +1 -1
- package/dist/directory-config-BZ775eGX.js +196 -0
- package/dist/directory-contract-api.js +1 -1
- package/dist/{group-session-key-CLTZeH_F.js → group-session-key-Dh8WZun_.js} +1 -1
- package/dist/light-runtime-api.js +1 -1
- package/dist/{login-DGIoToX8.js → login-ifOXCBjo.js} +3 -3
- package/dist/{login-qr-X-CZHOk9.js → login-qr-DUHzVH_Y.js} +4 -4
- package/dist/login-qr-runtime.js +1 -1
- package/dist/{monitor-BZ8QvCeV.js → monitor-_jqDKBXj.js} +544 -295
- package/dist/question-reactions-C0qJ6wGA.js +142 -0
- package/dist/runtime-api.js +7 -7
- package/dist/{send-D9Ydnn4o.js → send-SB-4JrVZ.js} +2 -3
- package/dist/{send-api-W33lI2nR.js → send-api-BG0MgoFI.js} +3 -3
- package/dist/{setup-core-3aSOoK2T.js → setup-core-BbIgEl2M.js} +3 -3
- package/dist/{setup-finalize-DBf1jjBj.js → setup-finalize-Cc-4iWGj.js} +3 -3
- package/dist/setup-plugin-api.js +1 -1
- package/dist/{setup-surface-CiKGdNJv.js → setup-surface-DhnXEZir.js} +2 -2
- package/dist/{session-mxWFn0eS.js → socket-close-jNGyZY4T.js} +221 -1
- package/npm-shrinkwrap.json +3 -3
- package/package.json +4 -4
- package/dist/account-config-LiT9wWH9.js +0 -43
- package/dist/directory-config-CLBQrjtC.js +0 -37
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
import { t as __exportAll } from "./rolldown-runtime-D7D4PA-g.js";
|
|
2
|
+
import { c as resolveMergedWhatsAppAccountConfig, o as resolveWhatsAppAuthDir } from "./accounts-ejK8sXPU.js";
|
|
3
|
+
import { c as normalizeWhatsAppTarget, t as isWhatsAppGroupJid } from "./normalize-target-DSZnHkKF.js";
|
|
4
|
+
import { i as hasPendingWhatsAppConnectionOwner, r as getWhatsAppConnectionController } from "./connection-controller-runtime-context-9mEeAvu1.js";
|
|
5
|
+
import "./normalize-C-Z16y7Q.js";
|
|
6
|
+
import { f as readWebAuthExistsForDecision, w as waitForCredsSaveQueueWithTimeout } from "./auth-store-BQi9pZqQ.js";
|
|
7
|
+
import { n as resolveWebAccountId } from "./active-listener-BbdlXooT.js";
|
|
8
|
+
import { a as waitForWaConnection, h as acquireWhatsAppStandaloneConnectionOwner, n as createWaDirectorySocket, p as WhatsAppConnectionOwnerBusyError, t as closeWhatsAppSocketAndWait } from "./socket-close-jNGyZY4T.js";
|
|
9
|
+
import { listResolvedDirectoryGroupEntriesFromMapKeys, listResolvedDirectoryUserEntriesFromAllowFrom } from "openclaw/plugin-sdk/directory-config-runtime";
|
|
10
|
+
//#region extensions/whatsapp/src/directory-config.ts
|
|
11
|
+
var directory_config_exports = /* @__PURE__ */ __exportAll({
|
|
12
|
+
WHATSAPP_DIRECTORY_UNAVAILABLE_CODE: () => WHATSAPP_DIRECTORY_UNAVAILABLE_CODE,
|
|
13
|
+
WhatsAppDirectoryUnavailableError: () => WhatsAppDirectoryUnavailableError,
|
|
14
|
+
listWhatsAppDirectoryGroupsFromConfig: () => listWhatsAppDirectoryGroupsFromConfig,
|
|
15
|
+
listWhatsAppDirectoryGroupsLive: () => listWhatsAppDirectoryGroupsLive,
|
|
16
|
+
listWhatsAppDirectoryPeersFromConfig: () => listWhatsAppDirectoryPeersFromConfig
|
|
17
|
+
});
|
|
18
|
+
function resolveWhatsAppDirectoryAccount(cfg, accountId) {
|
|
19
|
+
return resolveMergedWhatsAppAccountConfig({
|
|
20
|
+
cfg,
|
|
21
|
+
accountId
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
async function listWhatsAppDirectoryPeersFromConfig(params) {
|
|
25
|
+
return listResolvedDirectoryUserEntriesFromAllowFrom({
|
|
26
|
+
...params,
|
|
27
|
+
resolveAccount: resolveWhatsAppDirectoryAccount,
|
|
28
|
+
resolveAllowFrom: (account) => account.allowFrom,
|
|
29
|
+
normalizeId: (entry) => {
|
|
30
|
+
const normalized = normalizeWhatsAppTarget(entry);
|
|
31
|
+
if (!normalized || isWhatsAppGroupJid(normalized)) return null;
|
|
32
|
+
return normalized;
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
async function listWhatsAppDirectoryGroupsFromConfig(params) {
|
|
37
|
+
return listResolvedDirectoryGroupEntriesFromMapKeys({
|
|
38
|
+
...params,
|
|
39
|
+
resolveAccount: resolveWhatsAppDirectoryAccount,
|
|
40
|
+
resolveGroups: (account) => account.groups
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
const WHATSAPP_DIRECTORY_UNAVAILABLE_CODE = "whatsapp_directory_unavailable";
|
|
44
|
+
var WhatsAppDirectoryUnavailableError = class extends Error {
|
|
45
|
+
constructor(reason, message, options) {
|
|
46
|
+
super(message, options);
|
|
47
|
+
this.reason = reason;
|
|
48
|
+
this.code = WHATSAPP_DIRECTORY_UNAVAILABLE_CODE;
|
|
49
|
+
this.name = "WhatsAppDirectoryUnavailableError";
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
async function fetchLiveGroups(sock, params) {
|
|
53
|
+
const groups = await sock.groupFetchAllParticipating();
|
|
54
|
+
const query = params.query?.trim().toLowerCase() ?? "";
|
|
55
|
+
const limit = typeof params.limit === "number" && params.limit > 0 ? params.limit : void 0;
|
|
56
|
+
const entries = Object.entries(groups).map(([jid, metadata]) => ({
|
|
57
|
+
kind: "group",
|
|
58
|
+
id: jid,
|
|
59
|
+
name: metadata?.subject?.trim() || void 0
|
|
60
|
+
})).filter((entry) => {
|
|
61
|
+
if (!query) return true;
|
|
62
|
+
return entry.id.toLowerCase().includes(query) || entry.name?.toLowerCase().includes(query);
|
|
63
|
+
}).toSorted((left, right) => left.id.localeCompare(right.id));
|
|
64
|
+
return limit ? entries.slice(0, limit) : entries;
|
|
65
|
+
}
|
|
66
|
+
function unavailable(reason, message, cause) {
|
|
67
|
+
return new WhatsAppDirectoryUnavailableError(reason, message, cause ? { cause } : void 0);
|
|
68
|
+
}
|
|
69
|
+
const pendingStandaloneCleanups = /* @__PURE__ */ new Map();
|
|
70
|
+
const STANDALONE_CLEANUP_RETRY_MS = 1e3;
|
|
71
|
+
async function completeStandaloneCleanup(cleanup) {
|
|
72
|
+
if (cleanup.sock && !cleanup.socketClosed) {
|
|
73
|
+
await closeWhatsAppSocketAndWait(cleanup.sock, "OpenClaw WhatsApp standalone directory socket close");
|
|
74
|
+
cleanup.socketClosed = true;
|
|
75
|
+
}
|
|
76
|
+
if (cleanup.sock) {
|
|
77
|
+
if (await waitForCredsSaveQueueWithTimeout(cleanup.authDir) === "timed_out") throw new Error("WhatsApp credential persistence did not drain before socket release");
|
|
78
|
+
}
|
|
79
|
+
await cleanup.ownerLease.release();
|
|
80
|
+
if (pendingStandaloneCleanups.get(cleanup.authDir) === cleanup) pendingStandaloneCleanups.delete(cleanup.authDir);
|
|
81
|
+
if (cleanup.retryTimer) {
|
|
82
|
+
clearTimeout(cleanup.retryTimer);
|
|
83
|
+
cleanup.retryTimer = null;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
function runStandaloneCleanup(cleanup) {
|
|
87
|
+
if (cleanup.inFlight) return cleanup.inFlight;
|
|
88
|
+
const task = completeStandaloneCleanup(cleanup).finally(() => {
|
|
89
|
+
if (cleanup.inFlight === task) cleanup.inFlight = null;
|
|
90
|
+
});
|
|
91
|
+
cleanup.inFlight = task;
|
|
92
|
+
return task;
|
|
93
|
+
}
|
|
94
|
+
function scheduleStandaloneCleanupRetry(cleanup) {
|
|
95
|
+
if (cleanup.retryTimer) return;
|
|
96
|
+
cleanup.retryTimer = setTimeout(() => {
|
|
97
|
+
cleanup.retryTimer = null;
|
|
98
|
+
runStandaloneCleanup(cleanup).catch(() => {
|
|
99
|
+
scheduleStandaloneCleanupRetry(cleanup);
|
|
100
|
+
});
|
|
101
|
+
}, STANDALONE_CLEANUP_RETRY_MS);
|
|
102
|
+
cleanup.retryTimer.unref?.();
|
|
103
|
+
}
|
|
104
|
+
function retainStandaloneCleanup(cleanup) {
|
|
105
|
+
pendingStandaloneCleanups.set(cleanup.authDir, cleanup);
|
|
106
|
+
scheduleStandaloneCleanupRetry(cleanup);
|
|
107
|
+
}
|
|
108
|
+
async function finishStandaloneCleanupOrThrow(cleanup, operationError) {
|
|
109
|
+
try {
|
|
110
|
+
await runStandaloneCleanup(cleanup);
|
|
111
|
+
} catch (cleanupError) {
|
|
112
|
+
retainStandaloneCleanup(cleanup);
|
|
113
|
+
throw cleanupUnavailable(operationError === void 0 ? cleanupError : new AggregateError([operationError, cleanupError], "WhatsApp live group lookup and cleanup failed", { cause: operationError }));
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
function cleanupUnavailable(error) {
|
|
117
|
+
return unavailable("cleanup_failed", "WhatsApp live group lookup could not safely close its standalone connection.", error);
|
|
118
|
+
}
|
|
119
|
+
async function finishPriorStandaloneCleanup(authDir) {
|
|
120
|
+
const cleanup = pendingStandaloneCleanups.get(authDir);
|
|
121
|
+
if (!cleanup) return;
|
|
122
|
+
try {
|
|
123
|
+
await runStandaloneCleanup(cleanup);
|
|
124
|
+
} catch (error) {
|
|
125
|
+
scheduleStandaloneCleanupRetry(cleanup);
|
|
126
|
+
throw cleanupUnavailable(error);
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
async function listGroupsThroughStandaloneOwner(params) {
|
|
130
|
+
const account = resolveWhatsAppDirectoryAccount(params.cfg, params.accountId);
|
|
131
|
+
const authDir = resolveWhatsAppAuthDir({
|
|
132
|
+
cfg: params.cfg,
|
|
133
|
+
accountId: account.accountId
|
|
134
|
+
}).authDir;
|
|
135
|
+
await finishPriorStandaloneCleanup(authDir);
|
|
136
|
+
let ownerLease;
|
|
137
|
+
try {
|
|
138
|
+
ownerLease = await acquireWhatsAppStandaloneConnectionOwner(authDir);
|
|
139
|
+
} catch (error) {
|
|
140
|
+
if (error instanceof WhatsAppConnectionOwnerBusyError) throw unavailable("connection_owner_busy", "WhatsApp live groups are unavailable because the account is owned by another process.", error);
|
|
141
|
+
throw unavailable("connection_failed", "WhatsApp live groups are unavailable because connection ownership failed.", error);
|
|
142
|
+
}
|
|
143
|
+
const cleanup = {
|
|
144
|
+
authDir,
|
|
145
|
+
inFlight: null,
|
|
146
|
+
ownerLease,
|
|
147
|
+
retryTimer: null,
|
|
148
|
+
sock: null,
|
|
149
|
+
socketClosed: true
|
|
150
|
+
};
|
|
151
|
+
let groups;
|
|
152
|
+
try {
|
|
153
|
+
let authState;
|
|
154
|
+
try {
|
|
155
|
+
authState = await readWebAuthExistsForDecision(authDir);
|
|
156
|
+
} catch (error) {
|
|
157
|
+
throw unavailable("auth_unstable", "WhatsApp live groups are unavailable because linked credentials could not be read.", error);
|
|
158
|
+
}
|
|
159
|
+
if (authState.outcome === "unstable") throw unavailable("auth_unstable", "WhatsApp live groups are unavailable while linked credentials are changing.");
|
|
160
|
+
if (!authState.exists) throw unavailable("not_linked", "WhatsApp live groups are unavailable because this account is not linked.");
|
|
161
|
+
try {
|
|
162
|
+
cleanup.sock = await createWaDirectorySocket(authDir);
|
|
163
|
+
cleanup.socketClosed = false;
|
|
164
|
+
await waitForWaConnection(cleanup.sock, { timeoutMs: 3e4 });
|
|
165
|
+
} catch (error) {
|
|
166
|
+
throw unavailable("connection_failed", "WhatsApp live groups are unavailable because the standalone connection failed.", error);
|
|
167
|
+
}
|
|
168
|
+
try {
|
|
169
|
+
groups = await fetchLiveGroups(cleanup.sock, params);
|
|
170
|
+
} catch (error) {
|
|
171
|
+
throw unavailable("lookup_failed", "WhatsApp live group lookup failed.", error);
|
|
172
|
+
}
|
|
173
|
+
} catch (error) {
|
|
174
|
+
await finishStandaloneCleanupOrThrow(cleanup, error);
|
|
175
|
+
throw error;
|
|
176
|
+
}
|
|
177
|
+
await finishStandaloneCleanupOrThrow(cleanup);
|
|
178
|
+
return groups;
|
|
179
|
+
}
|
|
180
|
+
async function listWhatsAppDirectoryGroupsLive(params) {
|
|
181
|
+
const accountId = resolveWebAccountId({
|
|
182
|
+
cfg: params.cfg,
|
|
183
|
+
accountId: params.accountId
|
|
184
|
+
});
|
|
185
|
+
const controller = getWhatsAppConnectionController(accountId);
|
|
186
|
+
if (!controller && !hasPendingWhatsAppConnectionOwner(accountId)) return await listGroupsThroughStandaloneOwner(params);
|
|
187
|
+
const sock = controller?.getCurrentSock();
|
|
188
|
+
if (!sock) throw unavailable("active_owner_unavailable", "WhatsApp live groups are unavailable while the gateway connection is offline.");
|
|
189
|
+
try {
|
|
190
|
+
return await fetchLiveGroups(sock, params);
|
|
191
|
+
} catch (error) {
|
|
192
|
+
throw unavailable("lookup_failed", "WhatsApp live group lookup failed.", error);
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
//#endregion
|
|
196
|
+
export { listWhatsAppDirectoryGroupsFromConfig as n, listWhatsAppDirectoryPeersFromConfig as r, directory_config_exports as t };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as listWhatsAppDirectoryGroupsFromConfig, r as listWhatsAppDirectoryPeersFromConfig } from "./directory-config-
|
|
1
|
+
import { n as listWhatsAppDirectoryGroupsFromConfig, r as listWhatsAppDirectoryPeersFromConfig } from "./directory-config-BZ775eGX.js";
|
|
2
2
|
//#region extensions/whatsapp/directory-contract-api.ts
|
|
3
3
|
const whatsappDirectoryContractPlugin = {
|
|
4
4
|
id: "whatsapp",
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as resolveWhatsAppAccount } from "./accounts-
|
|
1
|
+
import { a as resolveWhatsAppAccount } from "./accounts-ejK8sXPU.js";
|
|
2
2
|
import { c as normalizeWhatsAppTarget } from "./normalize-target-DSZnHkKF.js";
|
|
3
3
|
import "./normalize-C-Z16y7Q.js";
|
|
4
4
|
import { r as jidToE164 } from "./targets-runtime-Bsh0HR9y.js";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as createWhatsAppLoginTool } from "./agent-tools-login-DfyToBpG.js";
|
|
2
2
|
import { c as logoutWeb, g as readWebSelfId, l as pickWebChannel, o as getWebAuthAgeMs, s as logWebSelfId, t as WA_WEB_AUTH_DIR, x as webAuthExists, y as resolveDefaultWebAuthDir } from "./auth-store-BQi9pZqQ.js";
|
|
3
|
+
import { t as getActiveWebListener } from "./active-listener-BbdlXooT.js";
|
|
3
4
|
import { n as getStatusCode, t as formatError } from "./session-errors-JuazczrA.js";
|
|
4
|
-
import { t as getActiveWebListener } from "./active-listener-5kHap439.js";
|
|
5
5
|
export { WA_WEB_AUTH_DIR, createWhatsAppLoginTool, formatError, getActiveWebListener, getStatusCode, getWebAuthAgeMs, logWebSelfId, logoutWeb, pickWebChannel, readWebSelfId, resolveDefaultWebAuthDir, webAuthExists };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-D7D4PA-g.js";
|
|
2
|
-
import { a as resolveWhatsAppAccount } from "./accounts-
|
|
2
|
+
import { a as resolveWhatsAppAccount } from "./accounts-ejK8sXPU.js";
|
|
3
3
|
import { b as restoreCredsFromBackupIfNeeded } from "./auth-store-BQi9pZqQ.js";
|
|
4
|
-
import {
|
|
5
|
-
import { a as closeWaSocketSoon, o as waitForWhatsAppLoginResult } from "./connection-controller-
|
|
4
|
+
import { f as renderQrTerminal, r as createWaSocket, u as resolveWhatsAppSocketTiming } from "./socket-close-jNGyZY4T.js";
|
|
5
|
+
import { a as closeWaSocketSoon, o as waitForWhatsAppLoginResult } from "./connection-controller-HGaffeFb.js";
|
|
6
6
|
import { formatCliCommand } from "openclaw/plugin-sdk/cli-runtime";
|
|
7
7
|
import { logInfo } from "openclaw/plugin-sdk/logging-core";
|
|
8
8
|
import { danger, defaultRuntime, success } from "openclaw/plugin-sdk/runtime-env";
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { a as resolveWhatsAppAccount } from "./accounts-
|
|
1
|
+
import { a as resolveWhatsAppAccount } from "./accounts-ejK8sXPU.js";
|
|
2
2
|
import { c as logoutWeb, f as readWebAuthExistsForDecision, g as readWebSelfId, n as WHATSAPP_AUTH_UNSTABLE_CODE } from "./auth-store-BQi9pZqQ.js";
|
|
3
|
-
import {
|
|
3
|
+
import { t as getActiveWebListener } from "./active-listener-BbdlXooT.js";
|
|
4
|
+
import { r as createWaSocket, u as resolveWhatsAppSocketTiming } from "./socket-close-jNGyZY4T.js";
|
|
4
5
|
import { t as formatError } from "./session-errors-JuazczrA.js";
|
|
5
|
-
import { t as
|
|
6
|
-
import { i as closeWaSocket, o as waitForWhatsAppLoginResult, t as WHATSAPP_LOGGED_OUT_QR_MESSAGE } from "./connection-controller-C1rwfWb4.js";
|
|
6
|
+
import { i as closeWaSocket, o as waitForWhatsAppLoginResult, t as WHATSAPP_LOGGED_OUT_QR_MESSAGE } from "./connection-controller-HGaffeFb.js";
|
|
7
7
|
import { logInfo } from "openclaw/plugin-sdk/logging-core";
|
|
8
8
|
import { danger, defaultRuntime, info, success } from "openclaw/plugin-sdk/runtime-env";
|
|
9
9
|
import { renderQrPngDataUrl } from "openclaw/plugin-sdk/media-runtime";
|
package/dist/login-qr-runtime.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createLazyRuntimeModule } from "openclaw/plugin-sdk/lazy-runtime";
|
|
2
2
|
//#region extensions/whatsapp/login-qr-runtime.ts
|
|
3
|
-
const loadLoginQrModule = createLazyRuntimeModule(() => import("./login-qr-
|
|
3
|
+
const loadLoginQrModule = createLazyRuntimeModule(() => import("./login-qr-DUHzVH_Y.js"));
|
|
4
4
|
async function startWebLoginWithQr(...args) {
|
|
5
5
|
const { startWebLoginWithQr: startWebLoginWithQrLocal } = await loadLoginQrModule();
|
|
6
6
|
return await startWebLoginWithQrLocal(...args);
|