@openclaw/whatsapp 2026.5.7 → 2026.5.10-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.
- package/dist/{access-control-CTj7P7WP.js → access-control-CdP8S3rJ.js} +66 -111
- package/dist/{action-runtime-BqYZmBX_.js → action-runtime-CMhO8liB.js} +1 -1
- package/dist/action-runtime-api.js +1 -1
- package/dist/action-runtime.runtime.js +1 -1
- package/dist/api.js +120 -12
- package/dist/{auth-store-BNZmNP-s.js → auth-store-CjEimXKX.js} +19 -41
- package/dist/{channel-CTr3YjO8.js → channel-BxntAClG.js} +39 -12
- package/dist/channel-config-api.js +1 -1
- package/dist/channel-plugin-api.js +1 -1
- package/dist/{channel-react-action-BuSTzmDX.js → channel-react-action-DJvzhIPw.js} +1 -1
- package/dist/{channel.runtime-C3i9Svfj.js → channel.runtime-CNdPCK3G.js} +5 -5
- package/dist/{channel.setup-BYtkDwHe.js → channel.setup-BqlcEVzR.js} +4 -4
- package/dist/{connection-controller-BCIuChXD.js → connection-controller-DX2phM7V.js} +6 -197
- package/dist/constants.js +1 -1
- package/dist/contract-api.js +7 -7
- package/dist/{directory-config-BNCbgnmy.js → directory-config-o-muXLgk.js} +1 -1
- package/dist/directory-contract-api.js +1 -1
- package/dist/doctor-contract-api.js +1 -1
- package/dist/{identity-DhaC0MoD.js → identity-KxdJfH7p.js} +1 -1
- package/dist/legacy-session-surface-api.js +1 -1
- package/dist/legacy-state-migrations-api.js +1 -1
- package/dist/light-runtime-api.js +3 -3
- package/dist/{login-DSUTCcJ7.js → login-DV99D0IN.js} +4 -3
- package/dist/{login-qr-dfs8tfGo.js → login-qr-cKndAXTv.js} +3 -2
- package/dist/login-qr-runtime.js +1 -1
- package/dist/{monitor-C5_C_RGJ.js → monitor-mfy3Mmq-.js} +111 -687
- package/dist/{outbound-adapter-CbR17Ehj.js → outbound-adapter-B9ZW8sht.js} +3 -3
- package/dist/{outbound-base-BmzhutvF.js → outbound-base-MVpg2zU2.js} +8 -3
- package/dist/{outbound-media-contract-BPdOq7Hb.js → outbound-media-contract-BzWwBppP.js} +37 -41
- package/dist/outbound-payload-test-api.js +1 -1
- package/dist/{quoted-message-BXs55Teh.js → quoted-message-DQ6hAr34.js} +1 -1
- package/dist/runtime-api.js +11 -10
- package/dist/security-contract-api.js +1 -1
- package/dist/send-api-DsbCqDre.js +697 -0
- package/dist/{send-CxctcFGT.js → send-u88yh8Hw.js} +2 -3
- package/dist/session-DeIU_vjJ.js +198 -0
- package/dist/{session.runtime-C1eSE_KK.js → session.runtime-B9VlYnWQ.js} +1 -1
- package/dist/{setup-surface-CF3l3gEZ.js → setup-finalize-D3YuMUBs.js} +5 -52
- package/dist/setup-plugin-api.js +1 -1
- package/dist/setup-surface-CHjYlKJc.js +45 -0
- package/dist/{shared-CTSTwprn.js → shared-CgYT3IzU.js} +7 -7
- package/dist/{state-migrations-DnCdvoYD.js → state-migrations-CtdIArlK.js} +2 -1
- package/dist/test-api.js +2 -2
- package/dist/{text-runtime-DFFwk5z6.js → text-runtime-DBKC9uEi.js} +27 -2
- package/package.json +6 -6
- package/dist/rolldown-runtime-RkAeH_Qm.js +0 -27
- /package/dist/{active-listener-N7GFKsuN.js → active-listener-D2NHQ5Og.js} +0 -0
- /package/dist/{agent-tools-login-DpRxLNRB.js → agent-tools-login-DYKYW5Nh.js} +0 -0
- /package/dist/{audio-preflight.runtime-Bcdsl_ri.js → audio-preflight.runtime-CIFjeaEN.js} +0 -0
- /package/dist/{command-policy-O8sRnqUV.js → command-policy-BgZRZ31o.js} +0 -0
- /package/dist/{config-schema-Dmo66Ubb.js → config-schema-cSC7M4YA.js} +0 -0
- /package/dist/{constants-DLGCIbfl.js → constants-yKXGCGU9.js} +0 -0
- /package/dist/{doctor-A9tXm9Om.js → doctor-BrgepDUP.js} +0 -0
- /package/dist/{group-session-contract-B8QBn0I2.js → group-session-contract-DL-SLclv.js} +0 -0
- /package/dist/{reply-resolver.runtime-BRCgoO4C.js → reply-resolver.runtime-CROyXXQh.js} +0 -0
- /package/dist/{runtime-6fZ67abR.js → runtime-DdodQB8G.js} +0 -0
- /package/dist/{runtime-group-policy-Gp1lQ0at.js → runtime-group-policy-BH_U23qp.js} +0 -0
- /package/dist/{security-contract-DqH8JDX6.js → security-contract-BzlZFreO.js} +0 -0
- /package/dist/{session-contract-B0efQf9P.js → session-contract-BNUscPf4.js} +0 -0
- /package/dist/{setup-core-DZKvpzbH.js → setup-core-DnhO0PjG.js} +0 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { c as normalizeWhatsAppTarget, t as isWhatsAppGroupJid } from "./normalize-target-nXxC_hxG.js";
|
|
2
|
-
import { t as handleWhatsAppAction } from "./action-runtime-
|
|
2
|
+
import { t as handleWhatsAppAction } from "./action-runtime-CMhO8liB.js";
|
|
3
3
|
import "./normalize-Y3eBdM8a.js";
|
|
4
4
|
import { readStringOrNumberParam, readStringParam as readStringParam$1, resolveReactionMessageId } from "openclaw/plugin-sdk/channel-actions";
|
|
5
5
|
//#region extensions/whatsapp/src/channel-react-action.ts
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { startWebLoginWithQr as startWebLoginWithQr$1, waitForWebLogin as waitForWebLogin$1 } from "./login-qr-runtime.js";
|
|
2
|
-
import { a as getWebAuthAgeMs$1, b as webAuthExists$1, d as readWebAuthExistsForDecision$1, f as readWebAuthSnapshot$1, h as readWebSelfId$1, m as readWebAuthState$1, o as logWebSelfId$1, p as readWebAuthSnapshotBestEffort$1, s as logoutWeb$1, u as readWebAuthExistsBestEffort$1 } from "./auth-store-
|
|
3
|
-
import { t as getActiveWebListener$1 } from "./active-listener-
|
|
4
|
-
import { t as monitorWebChannel$1 } from "./monitor-
|
|
5
|
-
import { t as loginWeb$1 } from "./login-
|
|
6
|
-
import { whatsappSetupWizard as whatsappSetupWizard$1 } from "./setup-surface-
|
|
2
|
+
import { a as getWebAuthAgeMs$1, b as webAuthExists$1, d as readWebAuthExistsForDecision$1, f as readWebAuthSnapshot$1, h as readWebSelfId$1, m as readWebAuthState$1, o as logWebSelfId$1, p as readWebAuthSnapshotBestEffort$1, s as logoutWeb$1, u as readWebAuthExistsBestEffort$1 } from "./auth-store-CjEimXKX.js";
|
|
3
|
+
import { t as getActiveWebListener$1 } from "./active-listener-D2NHQ5Og.js";
|
|
4
|
+
import { t as monitorWebChannel$1 } from "./monitor-mfy3Mmq-.js";
|
|
5
|
+
import { t as loginWeb$1 } from "./login-DV99D0IN.js";
|
|
6
|
+
import { whatsappSetupWizard as whatsappSetupWizard$1 } from "./setup-surface-CHjYlKJc.js";
|
|
7
7
|
//#region extensions/whatsapp/src/channel.runtime.ts
|
|
8
8
|
function getActiveWebListener(...args) {
|
|
9
9
|
return getActiveWebListener$1(...args);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { a as resolveWhatsAppGroupToolPolicy, i as resolveWhatsAppGroupRequireMention, o as resolveWhatsAppGroupIntroHint, r as whatsappSetupWizardProxy, t as createWhatsAppPluginBase } from "./shared-
|
|
2
|
-
import { m as readWebAuthState } from "./auth-store-
|
|
3
|
-
import { t as whatsappSetupAdapter } from "./setup-core-
|
|
4
|
-
import { t as detectWhatsAppLegacyStateMigrations } from "./state-migrations-
|
|
1
|
+
import { a as resolveWhatsAppGroupToolPolicy, i as resolveWhatsAppGroupRequireMention, o as resolveWhatsAppGroupIntroHint, r as whatsappSetupWizardProxy, t as createWhatsAppPluginBase } from "./shared-CgYT3IzU.js";
|
|
2
|
+
import { m as readWebAuthState } from "./auth-store-CjEimXKX.js";
|
|
3
|
+
import { t as whatsappSetupAdapter } from "./setup-core-DnhO0PjG.js";
|
|
4
|
+
import { t as detectWhatsAppLegacyStateMigrations } from "./state-migrations-CtdIArlK.js";
|
|
5
5
|
//#region extensions/whatsapp/src/channel.setup.ts
|
|
6
6
|
const whatsappSetupPlugin = {
|
|
7
7
|
...createWhatsAppPluginBase({
|
|
@@ -1,17 +1,11 @@
|
|
|
1
|
-
import { n as resolveWebCredsBackupPath, r as resolveWebCredsPath } from "./creds-files-_2V8jzQa.js";
|
|
2
1
|
import { n as registerWhatsAppConnectionController, r as unregisterWhatsAppConnectionController } from "./connection-controller-registry-D_iIGz5m.js";
|
|
3
2
|
import { n as getStatusCode, t as formatError } from "./session-errors-CSuKZPub.js";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import
|
|
7
|
-
import {
|
|
8
|
-
import { VERSION, formatCliCommand } from "openclaw/plugin-sdk/cli-runtime";
|
|
9
|
-
import { computeBackoff, danger, getChildLogger as getChildLogger$1, info, sleepWithAbort, success, toPinoLikeLogger } from "openclaw/plugin-sdk/runtime-env";
|
|
10
|
-
import { renderQrTerminal } from "openclaw/plugin-sdk/media-runtime";
|
|
11
|
-
import { randomUUID } from "node:crypto";
|
|
3
|
+
import { s as logoutWeb } from "./auth-store-CjEimXKX.js";
|
|
4
|
+
import { r as waitForWaConnection, t as createWaSocket } from "./session-DeIU_vjJ.js";
|
|
5
|
+
import { clamp } from "openclaw/plugin-sdk/text-runtime";
|
|
6
|
+
import { computeBackoff, info, sleepWithAbort } from "openclaw/plugin-sdk/runtime-env";
|
|
12
7
|
import { DisconnectReason } from "@whiskeysockets/baileys";
|
|
13
|
-
import {
|
|
14
|
-
import { resolveEnvHttpProxyUrl, shouldUseEnvHttpProxyForUrl } from "openclaw/plugin-sdk/fetch-runtime";
|
|
8
|
+
import { randomUUID } from "node:crypto";
|
|
15
9
|
const DEFAULT_RECONNECT_POLICY = {
|
|
16
10
|
initialMs: 2e3,
|
|
17
11
|
maxMs: 3e4,
|
|
@@ -39,191 +33,6 @@ function resolveReconnectPolicy(cfg, overrides) {
|
|
|
39
33
|
merged.maxAttempts = Math.max(0, Math.floor(merged.maxAttempts));
|
|
40
34
|
return merged;
|
|
41
35
|
}
|
|
42
|
-
function newConnectionId$1() {
|
|
43
|
-
return randomUUID();
|
|
44
|
-
}
|
|
45
|
-
//#endregion
|
|
46
|
-
//#region extensions/whatsapp/src/socket-timing.ts
|
|
47
|
-
const DEFAULT_WHATSAPP_SOCKET_TIMING = {
|
|
48
|
-
keepAliveIntervalMs: 25e3,
|
|
49
|
-
connectTimeoutMs: 6e4,
|
|
50
|
-
defaultQueryTimeoutMs: 6e4
|
|
51
|
-
};
|
|
52
|
-
function positiveInteger(value) {
|
|
53
|
-
return typeof value === "number" && Number.isInteger(value) && value > 0 ? value : void 0;
|
|
54
|
-
}
|
|
55
|
-
function resolveWhatsAppSocketTiming(cfg, overrides) {
|
|
56
|
-
const configured = cfg.web?.whatsapp;
|
|
57
|
-
return {
|
|
58
|
-
keepAliveIntervalMs: positiveInteger(overrides?.keepAliveIntervalMs) ?? positiveInteger(configured?.keepAliveIntervalMs) ?? DEFAULT_WHATSAPP_SOCKET_TIMING.keepAliveIntervalMs,
|
|
59
|
-
connectTimeoutMs: positiveInteger(overrides?.connectTimeoutMs) ?? positiveInteger(configured?.connectTimeoutMs) ?? DEFAULT_WHATSAPP_SOCKET_TIMING.connectTimeoutMs,
|
|
60
|
-
defaultQueryTimeoutMs: positiveInteger(overrides?.defaultQueryTimeoutMs) ?? positiveInteger(configured?.defaultQueryTimeoutMs) ?? DEFAULT_WHATSAPP_SOCKET_TIMING.defaultQueryTimeoutMs
|
|
61
|
-
};
|
|
62
|
-
}
|
|
63
|
-
//#endregion
|
|
64
|
-
//#region extensions/whatsapp/src/session.ts
|
|
65
|
-
const LOGGED_OUT_STATUS$1 = DisconnectReason$1?.loggedOut ?? 401;
|
|
66
|
-
const WHATSAPP_WEBSOCKET_PROXY_TARGET = "https://mmg.whatsapp.net/";
|
|
67
|
-
const CREDS_FLUSH_TIMEOUT_MESSAGE = "Queued WhatsApp creds save did not finish before auth bootstrap; skipping repair and continuing with primary creds.";
|
|
68
|
-
function enqueueSaveCreds(authDir, saveCreds, logger) {
|
|
69
|
-
enqueueCredsSave(authDir, () => safeSaveCreds(authDir, saveCreds, logger), (err) => {
|
|
70
|
-
logger.warn({ error: String(err) }, "WhatsApp creds save queue error");
|
|
71
|
-
});
|
|
72
|
-
}
|
|
73
|
-
async function safeSaveCreds(authDir, saveCreds, logger) {
|
|
74
|
-
try {
|
|
75
|
-
const credsPath = resolveWebCredsPath(authDir);
|
|
76
|
-
const backupPath = resolveWebCredsBackupPath(authDir);
|
|
77
|
-
const raw = readCredsJsonRaw(credsPath);
|
|
78
|
-
if (raw) try {
|
|
79
|
-
JSON.parse(raw);
|
|
80
|
-
fs.copyFileSync(credsPath, backupPath);
|
|
81
|
-
try {
|
|
82
|
-
fs.chmodSync(backupPath, 384);
|
|
83
|
-
} catch {}
|
|
84
|
-
} catch {}
|
|
85
|
-
} catch {}
|
|
86
|
-
try {
|
|
87
|
-
await Promise.resolve(saveCreds());
|
|
88
|
-
} catch (err) {
|
|
89
|
-
logger.warn({ error: String(err) }, "failed saving WhatsApp creds");
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
async function printTerminalQr(qr) {
|
|
93
|
-
const output = await renderQrTerminal(qr, { small: true });
|
|
94
|
-
process.stdout.write(output.endsWith("\n") ? output : `${output}\n`);
|
|
95
|
-
}
|
|
96
|
-
/**
|
|
97
|
-
* Create a Baileys socket backed by the multi-file auth store we keep on disk.
|
|
98
|
-
* Consumers can opt into QR printing for interactive login flows.
|
|
99
|
-
*/
|
|
100
|
-
async function createWaSocket(printQr, verbose, opts = {}) {
|
|
101
|
-
const logger = toPinoLikeLogger(getChildLogger$1({ module: "baileys" }, { level: verbose ? "info" : "silent" }), verbose ? "info" : "silent");
|
|
102
|
-
const authDir = resolveUserPath(opts.authDir ?? resolveDefaultWebAuthDir());
|
|
103
|
-
await ensureDir(authDir);
|
|
104
|
-
const sessionLogger = getChildLogger$1({ module: "web-session" });
|
|
105
|
-
if (await waitForCredsSaveQueueWithTimeout(authDir) === "timed_out") sessionLogger.warn({ authDir }, CREDS_FLUSH_TIMEOUT_MESSAGE);
|
|
106
|
-
else await restoreCredsFromBackupIfNeeded(authDir);
|
|
107
|
-
const { state } = await useMultiFileAuthState(authDir);
|
|
108
|
-
const saveCreds = async () => {
|
|
109
|
-
await writeCredsJsonAtomically(authDir, state.creds);
|
|
110
|
-
};
|
|
111
|
-
const { version } = await fetchLatestBaileysVersion();
|
|
112
|
-
const agent = await resolveEnvProxyAgent(sessionLogger);
|
|
113
|
-
const fetchAgent = await resolveEnvFetchDispatcher(sessionLogger, agent);
|
|
114
|
-
const socketTiming = {
|
|
115
|
-
keepAliveIntervalMs: opts.keepAliveIntervalMs ?? DEFAULT_WHATSAPP_SOCKET_TIMING.keepAliveIntervalMs,
|
|
116
|
-
connectTimeoutMs: opts.connectTimeoutMs ?? DEFAULT_WHATSAPP_SOCKET_TIMING.connectTimeoutMs,
|
|
117
|
-
defaultQueryTimeoutMs: opts.defaultQueryTimeoutMs ?? DEFAULT_WHATSAPP_SOCKET_TIMING.defaultQueryTimeoutMs
|
|
118
|
-
};
|
|
119
|
-
const sock = makeWASocket({
|
|
120
|
-
auth: {
|
|
121
|
-
creds: state.creds,
|
|
122
|
-
keys: makeCacheableSignalKeyStore(state.keys, logger)
|
|
123
|
-
},
|
|
124
|
-
version,
|
|
125
|
-
logger,
|
|
126
|
-
printQRInTerminal: false,
|
|
127
|
-
browser: [
|
|
128
|
-
"openclaw",
|
|
129
|
-
"cli",
|
|
130
|
-
VERSION
|
|
131
|
-
],
|
|
132
|
-
syncFullHistory: false,
|
|
133
|
-
markOnlineOnConnect: false,
|
|
134
|
-
...socketTiming,
|
|
135
|
-
agent,
|
|
136
|
-
fetchAgent
|
|
137
|
-
});
|
|
138
|
-
sock.ev.on("creds.update", () => enqueueSaveCreds(authDir, saveCreds, sessionLogger));
|
|
139
|
-
sock.ev.on("connection.update", async (update) => {
|
|
140
|
-
try {
|
|
141
|
-
const { connection, lastDisconnect, qr } = update;
|
|
142
|
-
if (qr) {
|
|
143
|
-
opts.onQr?.(qr);
|
|
144
|
-
if (printQr) {
|
|
145
|
-
console.log("Open the WhatsApp app, go to Linked Devices, then scan this QR:");
|
|
146
|
-
printTerminalQr(qr).catch((err) => {
|
|
147
|
-
sessionLogger.warn({ error: String(err) }, "failed rendering WhatsApp QR");
|
|
148
|
-
});
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
if (connection === "close") {
|
|
152
|
-
if (getStatusCode(lastDisconnect?.error) === LOGGED_OUT_STATUS$1) console.error(danger(`WhatsApp session logged out. Run: ${formatCliCommand("openclaw channels login")}`));
|
|
153
|
-
}
|
|
154
|
-
if (connection === "open" && verbose) console.log(success("WhatsApp Web connected."));
|
|
155
|
-
} catch (err) {
|
|
156
|
-
sessionLogger.error({ error: String(err) }, "connection.update handler error");
|
|
157
|
-
}
|
|
158
|
-
});
|
|
159
|
-
if (sock.ws && typeof sock.ws.on === "function") sock.ws.on("error", (err) => {
|
|
160
|
-
sessionLogger.error({ error: String(err) }, "WebSocket error");
|
|
161
|
-
});
|
|
162
|
-
return sock;
|
|
163
|
-
}
|
|
164
|
-
async function resolveEnvProxyAgent(logger) {
|
|
165
|
-
if (!shouldUseEnvHttpProxyForUrl(WHATSAPP_WEBSOCKET_PROXY_TARGET)) return;
|
|
166
|
-
const proxyUrl = resolveEnvHttpProxyUrl("https");
|
|
167
|
-
if (!proxyUrl) return;
|
|
168
|
-
try {
|
|
169
|
-
const agent = new HttpsProxyAgent(proxyUrl);
|
|
170
|
-
logger.info("Using ambient env proxy for WhatsApp WebSocket connection");
|
|
171
|
-
return agent;
|
|
172
|
-
} catch (error) {
|
|
173
|
-
logger.warn({ error: String(error) }, "Failed to initialize env proxy agent for WhatsApp WebSocket connection");
|
|
174
|
-
return;
|
|
175
|
-
}
|
|
176
|
-
}
|
|
177
|
-
async function resolveEnvFetchDispatcher(logger, agent) {
|
|
178
|
-
const proxyUrl = resolveProxyUrlFromAgent(agent);
|
|
179
|
-
const envProxyUrl = resolveEnvHttpsProxyUrl();
|
|
180
|
-
if (!proxyUrl && !envProxyUrl) return;
|
|
181
|
-
try {
|
|
182
|
-
const { EnvHttpProxyAgent, ProxyAgent } = await import("undici");
|
|
183
|
-
return proxyUrl ? new ProxyAgent({
|
|
184
|
-
allowH2: false,
|
|
185
|
-
uri: proxyUrl
|
|
186
|
-
}) : new EnvHttpProxyAgent({ allowH2: false });
|
|
187
|
-
} catch (error) {
|
|
188
|
-
logger.warn({ error: String(error) }, "Failed to initialize env proxy dispatcher for WhatsApp media uploads");
|
|
189
|
-
return;
|
|
190
|
-
}
|
|
191
|
-
}
|
|
192
|
-
function resolveProxyUrlFromAgent(agent) {
|
|
193
|
-
if (typeof agent !== "object" || agent === null || !("proxy" in agent)) return;
|
|
194
|
-
const proxy = agent.proxy;
|
|
195
|
-
if (proxy instanceof URL) return proxy.toString();
|
|
196
|
-
return typeof proxy === "string" && proxy.length > 0 ? proxy : void 0;
|
|
197
|
-
}
|
|
198
|
-
function resolveEnvHttpsProxyUrl(env = process.env) {
|
|
199
|
-
const lowerHttpsProxy = normalizeEnvProxyValue(env.https_proxy);
|
|
200
|
-
const lowerHttpProxy = normalizeEnvProxyValue(env.http_proxy);
|
|
201
|
-
const httpsProxy = lowerHttpsProxy !== void 0 ? lowerHttpsProxy : normalizeEnvProxyValue(env.HTTPS_PROXY);
|
|
202
|
-
const httpProxy = lowerHttpProxy !== void 0 ? lowerHttpProxy : normalizeEnvProxyValue(env.HTTP_PROXY);
|
|
203
|
-
return httpsProxy ?? httpProxy ?? void 0;
|
|
204
|
-
}
|
|
205
|
-
function normalizeEnvProxyValue(value) {
|
|
206
|
-
if (typeof value !== "string") return;
|
|
207
|
-
const trimmed = value.trim();
|
|
208
|
-
return trimmed.length > 0 ? trimmed : null;
|
|
209
|
-
}
|
|
210
|
-
async function waitForWaConnection(sock) {
|
|
211
|
-
return new Promise((resolve, reject) => {
|
|
212
|
-
const evWithOff = sock.ev;
|
|
213
|
-
const handler = (...args) => {
|
|
214
|
-
const update = args[0] ?? {};
|
|
215
|
-
if (update.connection === "open") {
|
|
216
|
-
evWithOff.off?.("connection.update", handler);
|
|
217
|
-
resolve();
|
|
218
|
-
}
|
|
219
|
-
if (update.connection === "close") {
|
|
220
|
-
evWithOff.off?.("connection.update", handler);
|
|
221
|
-
reject(update.lastDisconnect ?? /* @__PURE__ */ new Error("Connection closed"));
|
|
222
|
-
}
|
|
223
|
-
};
|
|
224
|
-
sock.ev.on("connection.update", handler);
|
|
225
|
-
});
|
|
226
|
-
}
|
|
227
36
|
function newConnectionId() {
|
|
228
37
|
return randomUUID();
|
|
229
38
|
}
|
|
@@ -593,4 +402,4 @@ var WhatsAppConnectionController = class {
|
|
|
593
402
|
}
|
|
594
403
|
};
|
|
595
404
|
//#endregion
|
|
596
|
-
export { waitForWhatsAppLoginResult as a,
|
|
405
|
+
export { waitForWhatsAppLoginResult as a, newConnectionId as c, sleepWithAbort as d, closeWaSocketSoon as i, resolveHeartbeatSeconds as l, WhatsAppConnectionController as n, DEFAULT_RECONNECT_POLICY as o, closeWaSocket as r, computeBackoff as s, WHATSAPP_LOGGED_OUT_QR_MESSAGE as t, resolveReconnectPolicy as u };
|
package/dist/constants.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as DEFAULT_WEB_MEDIA_BYTES } from "./constants-
|
|
1
|
+
import { t as DEFAULT_WEB_MEDIA_BYTES } from "./constants-yKXGCGU9.js";
|
|
2
2
|
export { DEFAULT_WEB_MEDIA_BYTES };
|
package/dist/contract-api.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { c as normalizeWhatsAppTarget$1, t as isWhatsAppGroupJid$1 } from "./normalize-target-nXxC_hxG.js";
|
|
2
|
-
import { t as whatsappCommandPolicy$1 } from "./command-policy-
|
|
3
|
-
import { t as resolveLegacyGroupSessionKey$1 } from "./group-session-contract-
|
|
4
|
-
import { n as unsupportedSecretRefSurfacePatterns, t as collectUnsupportedSecretRefConfigCandidates } from "./security-contract-
|
|
5
|
-
import { r as isLegacyGroupSessionKey$1, t as canonicalizeLegacySessionKey$1 } from "./session-contract-
|
|
6
|
-
import { n as listWhatsAppDirectoryGroupsFromConfig, r as listWhatsAppDirectoryPeersFromConfig } from "./directory-config-
|
|
7
|
-
import { t as resolveWhatsAppRuntimeGroupPolicy$1 } from "./runtime-group-policy-
|
|
8
|
-
import { t as __testing } from "./access-control-
|
|
2
|
+
import { t as whatsappCommandPolicy$1 } from "./command-policy-BgZRZ31o.js";
|
|
3
|
+
import { t as resolveLegacyGroupSessionKey$1 } from "./group-session-contract-DL-SLclv.js";
|
|
4
|
+
import { n as unsupportedSecretRefSurfacePatterns, t as collectUnsupportedSecretRefConfigCandidates } from "./security-contract-BzlZFreO.js";
|
|
5
|
+
import { r as isLegacyGroupSessionKey$1, t as canonicalizeLegacySessionKey$1 } from "./session-contract-BNUscPf4.js";
|
|
6
|
+
import { n as listWhatsAppDirectoryGroupsFromConfig, r as listWhatsAppDirectoryPeersFromConfig } from "./directory-config-o-muXLgk.js";
|
|
7
|
+
import { t as resolveWhatsAppRuntimeGroupPolicy$1 } from "./runtime-group-policy-BH_U23qp.js";
|
|
8
|
+
import { t as __testing } from "./access-control-CdP8S3rJ.js";
|
|
9
9
|
//#region extensions/whatsapp/contract-api.ts
|
|
10
10
|
const canonicalizeLegacySessionKey = canonicalizeLegacySessionKey$1;
|
|
11
11
|
const isLegacyGroupSessionKey = isLegacyGroupSessionKey$1;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { l as __exportAll } from "./text-runtime-DBKC9uEi.js";
|
|
2
2
|
import { t as resolveMergedWhatsAppAccountConfig } from "./account-config-CNQ33oav.js";
|
|
3
3
|
import { c as normalizeWhatsAppTarget, t as isWhatsAppGroupJid } from "./normalize-target-nXxC_hxG.js";
|
|
4
4
|
import "./normalize-Y3eBdM8a.js";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as listWhatsAppDirectoryGroupsFromConfig, r as listWhatsAppDirectoryPeersFromConfig } from "./directory-config-
|
|
1
|
+
import { n as listWhatsAppDirectoryGroupsFromConfig, r as listWhatsAppDirectoryPeersFromConfig } from "./directory-config-o-muXLgk.js";
|
|
2
2
|
export { listWhatsAppDirectoryGroupsFromConfig, listWhatsAppDirectoryPeersFromConfig };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as normalizeCompatibilityConfig$1 } from "./doctor-
|
|
1
|
+
import { t as normalizeCompatibilityConfig$1 } from "./doctor-BrgepDUP.js";
|
|
2
2
|
//#region extensions/whatsapp/src/doctor-contract.ts
|
|
3
3
|
function normalizeCompatibilityConfig({ cfg }) {
|
|
4
4
|
return normalizeCompatibilityConfig$1({ cfg });
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { i as jidToE164, t as text_runtime_exports } from "./text-runtime-
|
|
1
|
+
import { i as jidToE164, t as text_runtime_exports } from "./text-runtime-DBKC9uEi.js";
|
|
2
2
|
//#region extensions/whatsapp/src/identity.ts
|
|
3
3
|
const WHATSAPP_LID_RE = /@(lid|hosted\.lid)$/i;
|
|
4
4
|
function normalizeDeviceScopedJid(jid) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { r as isLegacyGroupSessionKey, t as canonicalizeLegacySessionKey } from "./session-contract-
|
|
1
|
+
import { r as isLegacyGroupSessionKey, t as canonicalizeLegacySessionKey } from "./session-contract-BNUscPf4.js";
|
|
2
2
|
//#region extensions/whatsapp/legacy-session-surface-api.ts
|
|
3
3
|
const whatsappLegacySessionSurface = {
|
|
4
4
|
isLegacyGroupSessionKey,
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as detectWhatsAppLegacyStateMigrations } from "./state-migrations-
|
|
1
|
+
import { t as detectWhatsAppLegacyStateMigrations } from "./state-migrations-CtdIArlK.js";
|
|
2
2
|
export { detectWhatsAppLegacyStateMigrations };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { n as getStatusCode, t as formatError } from "./session-errors-CSuKZPub.js";
|
|
2
|
-
import { t as createWhatsAppLoginTool } from "./agent-tools-login-
|
|
3
|
-
import { a as getWebAuthAgeMs, b as webAuthExists, c as pickWebChannel, h as readWebSelfId, o as logWebSelfId, s as logoutWeb, t as WA_WEB_AUTH_DIR } from "./auth-store-
|
|
4
|
-
import { t as getActiveWebListener } from "./active-listener-
|
|
2
|
+
import { t as createWhatsAppLoginTool } from "./agent-tools-login-DYKYW5Nh.js";
|
|
3
|
+
import { a as getWebAuthAgeMs, b as webAuthExists, c as pickWebChannel, h as readWebSelfId, o as logWebSelfId, s as logoutWeb, t as WA_WEB_AUTH_DIR } from "./auth-store-CjEimXKX.js";
|
|
4
|
+
import { t as getActiveWebListener } from "./active-listener-D2NHQ5Og.js";
|
|
5
5
|
export { WA_WEB_AUTH_DIR, createWhatsAppLoginTool, formatError, getActiveWebListener, getStatusCode, getWebAuthAgeMs, logWebSelfId, logoutWeb, pickWebChannel, readWebSelfId, webAuthExists };
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { l as __exportAll } from "./text-runtime-DBKC9uEi.js";
|
|
2
2
|
import { a as resolveWhatsAppAccount } from "./accounts-BDqgpFEB.js";
|
|
3
|
-
import { y as restoreCredsFromBackupIfNeeded } from "./auth-store-
|
|
4
|
-
import { a as
|
|
3
|
+
import { y as restoreCredsFromBackupIfNeeded } from "./auth-store-CjEimXKX.js";
|
|
4
|
+
import { a as renderQrTerminal, i as resolveWhatsAppSocketTiming, t as createWaSocket } from "./session-DeIU_vjJ.js";
|
|
5
|
+
import { a as waitForWhatsAppLoginResult, i as closeWaSocketSoon } from "./connection-controller-DX2phM7V.js";
|
|
5
6
|
import { logInfo } from "openclaw/plugin-sdk/text-runtime";
|
|
6
7
|
import { formatCliCommand } from "openclaw/plugin-sdk/cli-runtime";
|
|
7
8
|
import { danger, defaultRuntime, success } from "openclaw/plugin-sdk/runtime-env";
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { a as resolveWhatsAppAccount } from "./accounts-BDqgpFEB.js";
|
|
2
|
-
import { d as readWebAuthExistsForDecision, h as readWebSelfId, n as WHATSAPP_AUTH_UNSTABLE_CODE } from "./auth-store-
|
|
3
|
-
import {
|
|
2
|
+
import { d as readWebAuthExistsForDecision, h as readWebSelfId, n as WHATSAPP_AUTH_UNSTABLE_CODE } from "./auth-store-CjEimXKX.js";
|
|
3
|
+
import { i as resolveWhatsAppSocketTiming, t as createWaSocket } from "./session-DeIU_vjJ.js";
|
|
4
|
+
import { a as waitForWhatsAppLoginResult, r as closeWaSocket, t as WHATSAPP_LOGGED_OUT_QR_MESSAGE } from "./connection-controller-DX2phM7V.js";
|
|
4
5
|
import { logInfo } from "openclaw/plugin-sdk/text-runtime";
|
|
5
6
|
import { danger, defaultRuntime, info, success } from "openclaw/plugin-sdk/runtime-env";
|
|
6
7
|
import { renderQrPngDataUrl } from "openclaw/plugin-sdk/media-runtime";
|
package/dist/login-qr-runtime.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
//#region extensions/whatsapp/login-qr-runtime.ts
|
|
2
2
|
let loginQrModulePromise = null;
|
|
3
3
|
function loadLoginQrModule() {
|
|
4
|
-
loginQrModulePromise ??= import("./login-qr-
|
|
4
|
+
loginQrModulePromise ??= import("./login-qr-cKndAXTv.js");
|
|
5
5
|
return loginQrModulePromise;
|
|
6
6
|
}
|
|
7
7
|
async function startWebLoginWithQr(...args) {
|