@openclaw/whatsapp 2026.9.8 → 2026.10.1-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/.setup/{accounts-CtRPAQCL.mjs → accounts-F0vHuze2.mjs} +3 -11
- package/dist/.setup/{action-runtime-DeVk5V7r.mjs → action-runtime-CE3zGstN.mjs} +4 -5
- package/dist/.setup/{agent-tools-login-CL5C1rA2.mjs → agent-tools-login-B7VEvJO7.mjs} +17 -36
- package/dist/.setup/{approval-handler.runtime-CjqMlPOX.mjs → approval-handler.runtime-CKposl6w.mjs} +3 -3
- package/dist/.setup/{approval-reactions-DiOFvb1s.mjs → approval-reactions-CD6CDF9k.mjs} +9 -40
- package/dist/.setup/{auth-store-BBonwKks.mjs → auth-store-D2rN-hP5.mjs} +12 -19
- package/dist/.setup/{channel-CJFE0kD_.mjs → channel-DNgKHMCz.mjs} +15 -24
- package/dist/.setup/{channel-react-action-2r_hjLZV.mjs → channel-react-action-BaBV9X6M.mjs} +3 -3
- package/dist/.setup/{channel.runtime-C94goLw9.mjs → channel.runtime-BniF8Swm.mjs} +4 -4
- package/dist/.setup/{channel.setup-CfN1UfdY.mjs → channel.setup-CsS_NAKQ.mjs} +1 -1
- package/dist/.setup/{connection-controller-CHo1oRJA.mjs → connection-controller-COkcq48K.mjs} +5 -14
- package/dist/.setup/{creds-files-CDATZWWM.mjs → creds-files-B8WcOAmE.mjs} +1 -10
- package/dist/.setup/{directory-config-DUiJ5d8I.mjs → directory-config-RYQomHyB.mjs} +6 -14
- package/dist/.setup/{doctor-iMwg0Vhr.mjs → doctor-DKzeBEmH.mjs} +7 -1
- package/dist/.setup/{group-config-path-DZr3ucUO.mjs → group-config-path-BPrak_bJ.mjs} +3 -9
- package/dist/.setup/{group-session-key-2-mja4OF.mjs → group-session-key-BV8Le9r8.mjs} +5 -14
- package/dist/.setup/{login-BFlvSh9h.mjs → login-CV_4V021.mjs} +4 -4
- package/dist/.setup/{login-qr-Ayb8i25J.mjs → login-qr-DFhGc5yH.mjs} +11 -27
- package/dist/.setup/{monitor-CGpV2VNN.mjs → monitor-B5DS4PDV.mjs} +65 -186
- package/dist/.setup/{question-reactions-CPyyi5AY.mjs → question-reactions-LMeijbaq.mjs} +7 -37
- package/dist/.setup/{resolve-outbound-target-C2eUvsTc.mjs → resolve-outbound-target-CzyNKmrl.mjs} +2 -13
- package/dist/.setup/{send-BGdvf5cC.mjs → send-CGUsUdoX.mjs} +31 -6
- package/dist/.setup/{send-api-H4AkQJjT.mjs → send-api-B03VDwZ1.mjs} +35 -53
- package/dist/.setup/{setup-finalize-DmPX4EaW.mjs → setup-finalize-GtBmrO8p.mjs} +8 -20
- package/dist/.setup/setup-plugin-api-Bsp7jI-r.mjs +3 -0
- package/dist/.setup/{setup-surface-43fj197P.mjs → setup-surface-BuA39k6K.mjs} +3 -3
- package/dist/.setup/{shared-DgOG5Iqr.mjs → shared-CP_zs2U7.mjs} +12 -13
- package/dist/.setup/{socket-close-CT__V2fz.mjs → socket-close-DU7eerAa.mjs} +26 -54
- package/dist/.setup/{targets-runtime-DmiqXIXO.mjs → targets-runtime-Dls-Xh4F.mjs} +10 -34
- package/dist/action-runtime-api.js +1 -1
- package/dist/action-runtime.runtime.js +1 -1
- package/dist/agent-tools-api.js +3 -3
- package/dist/api.js +10 -10
- package/dist/auth-presence.js +3 -4
- package/dist/channel-plugin-api.js +1 -1
- package/dist/directory-contract-api.js +1 -1
- package/dist/doctor-contract-api.js +234 -59
- package/dist/light-runtime-api.js +2 -2
- package/dist/login-qr-runtime.js +1 -1
- package/dist/runtime-api.js +10 -10
- package/dist/setup-entry.js +1 -1
- package/dist/setup-plugin-api.js +1 -1
- package/package.json +5 -5
- package/dist/.setup/setup-plugin-api-vJlxKzca.mjs +0 -3
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { n as listConfiguredAccountIds, r as resolveDefaultWhatsAppAccountId, t as listAccountIds } from "./account-ids-CB5SOWjc.mjs";
|
|
2
|
-
import { n as
|
|
2
|
+
import { n as hasWebCredsSync } from "./creds-files-B8WcOAmE.mjs";
|
|
3
3
|
import fs from "node:fs";
|
|
4
4
|
import path from "node:path";
|
|
5
5
|
import { DEFAULT_ACCOUNT_ID, normalizeAccountId, resolveAccountEntry, resolveMergedAccountConfig, resolveUserPath } from "openclaw/plugin-sdk/account-core";
|
|
@@ -34,7 +34,7 @@ const DEFAULT_WHATSAPP_MEDIA_MAX_MB = 50;
|
|
|
34
34
|
function listWhatsAppAuthDirs(cfg) {
|
|
35
35
|
const oauthDir = resolveOAuthDir();
|
|
36
36
|
const whatsappDir = path.join(oauthDir, "whatsapp");
|
|
37
|
-
const authDirs = /* @__PURE__ */ new Set([
|
|
37
|
+
const authDirs = /* @__PURE__ */ new Set([path.join(whatsappDir, DEFAULT_ACCOUNT_ID)]);
|
|
38
38
|
const accountIds = listConfiguredAccountIds(cfg);
|
|
39
39
|
for (const accountId of accountIds) authDirs.add(resolveWhatsAppAuthDir({
|
|
40
40
|
cfg,
|
|
@@ -65,16 +65,8 @@ function resolveWhatsAppAuthDir(params) {
|
|
|
65
65
|
authDir: resolveUserPath(configured),
|
|
66
66
|
isLegacy: false
|
|
67
67
|
};
|
|
68
|
-
const defaultDir = resolveDefaultAuthDir(accountId);
|
|
69
|
-
if (accountId === DEFAULT_ACCOUNT_ID) {
|
|
70
|
-
const legacyDir = resolveOAuthDir();
|
|
71
|
-
if (hasWebCredsRegularFileSync(legacyDir) && !hasWebCredsRegularFileSync(defaultDir)) return {
|
|
72
|
-
authDir: legacyDir,
|
|
73
|
-
isLegacy: true
|
|
74
|
-
};
|
|
75
|
-
}
|
|
76
68
|
return {
|
|
77
|
-
authDir:
|
|
69
|
+
authDir: resolveDefaultAuthDir(accountId),
|
|
78
70
|
isLegacy: false
|
|
79
71
|
};
|
|
80
72
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { a as resolveWhatsAppAccount } from "./accounts-
|
|
2
|
-
import { t as resolveWhatsAppOutboundTarget } from "./resolve-outbound-target-
|
|
3
|
-
import { r as sendReactionWhatsApp,
|
|
1
|
+
import { a as resolveWhatsAppAccount } from "./accounts-F0vHuze2.mjs";
|
|
2
|
+
import { t as resolveWhatsAppOutboundTarget } from "./resolve-outbound-target-CzyNKmrl.mjs";
|
|
3
|
+
import { r as sendReactionWhatsApp, y as resolveWhatsAppReactionLevel } from "./send-CGUsUdoX.mjs";
|
|
4
4
|
import { ToolAuthorizationError, createActionGate, jsonResult, readReactionParams, readStringParam } from "openclaw/plugin-sdk/channel-actions";
|
|
5
5
|
//#region extensions/whatsapp/src/action-runtime-target-auth.ts
|
|
6
6
|
function resolveAuthorizedWhatsAppOutboundTarget(params) {
|
|
@@ -31,8 +31,7 @@ async function handleWhatsAppAction(params, cfg) {
|
|
|
31
31
|
const isActionEnabled = createActionGate(whatsAppConfig?.actions);
|
|
32
32
|
if (action === "react") {
|
|
33
33
|
const accountId = readStringParam(params, "accountId");
|
|
34
|
-
if (!whatsAppConfig) throw new Error("WhatsApp reactions are disabled.");
|
|
35
|
-
if (!isActionEnabled("reactions")) throw new Error("WhatsApp reactions are disabled.");
|
|
34
|
+
if (!whatsAppConfig || !isActionEnabled("reactions")) throw new Error("WhatsApp reactions are disabled.");
|
|
36
35
|
const reactionLevelInfo = resolveWhatsAppReactionLevel({
|
|
37
36
|
cfg,
|
|
38
37
|
accountId: accountId ?? void 0
|
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
import { startWebLoginWithQr, waitForWebLogin } from "../login-qr-runtime.js";
|
|
2
2
|
import "../login-qr-api.js";
|
|
3
3
|
import { optionalPositiveIntegerSchema, readPositiveIntegerParam } from "openclaw/plugin-sdk/channel-actions";
|
|
4
|
-
import {
|
|
4
|
+
import { readNonBlankString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
5
|
+
import { textResult } from "openclaw/plugin-sdk/tool-results";
|
|
5
6
|
import { Type } from "typebox";
|
|
6
7
|
//#region extensions/whatsapp/src/agent-tools-login.ts
|
|
7
8
|
const QR_DATA_URL_MAX_LENGTH = 16384;
|
|
8
|
-
function readLoginStringPreservingWhitespace(value) {
|
|
9
|
-
return hasNonEmptyString(value) ? value : void 0;
|
|
10
|
-
}
|
|
11
9
|
function createWhatsAppLoginTool(context) {
|
|
12
10
|
if (context.senderIsOwner !== true) return null;
|
|
13
11
|
return {
|
|
@@ -30,44 +28,33 @@ function createWhatsAppLoginTool(context) {
|
|
|
30
28
|
if (!signal || signal.aborted) throw new Error("WhatsApp login authority is no longer active.");
|
|
31
29
|
};
|
|
32
30
|
const renderQrReply = (params) => {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
details: {
|
|
45
|
-
connected: params.connected ?? false,
|
|
46
|
-
qr: true
|
|
47
|
-
}
|
|
48
|
-
};
|
|
31
|
+
const text = [
|
|
32
|
+
params.message,
|
|
33
|
+
"",
|
|
34
|
+
"Open WhatsApp → Linked Devices and scan:",
|
|
35
|
+
"",
|
|
36
|
+
``
|
|
37
|
+
].join("\n");
|
|
38
|
+
return textResult(text, {
|
|
39
|
+
connected: params.connected ?? false,
|
|
40
|
+
qr: true
|
|
41
|
+
});
|
|
49
42
|
};
|
|
50
43
|
const action = args?.action ?? "start";
|
|
51
|
-
const accountId =
|
|
44
|
+
const accountId = readNonBlankString(args.accountId);
|
|
52
45
|
const timeoutMs = readPositiveIntegerParam(args, "timeoutMs");
|
|
53
46
|
if (action === "wait") {
|
|
54
47
|
const result = await waitForWebLogin({
|
|
55
48
|
accountId,
|
|
56
49
|
timeoutMs,
|
|
57
|
-
currentQrDataUrl:
|
|
50
|
+
currentQrDataUrl: readNonBlankString(args.currentQrDataUrl)
|
|
58
51
|
});
|
|
59
52
|
if (result.qrDataUrl) return renderQrReply({
|
|
60
53
|
message: result.message,
|
|
61
54
|
qrDataUrl: result.qrDataUrl,
|
|
62
55
|
connected: result.connected
|
|
63
56
|
});
|
|
64
|
-
return {
|
|
65
|
-
content: [{
|
|
66
|
-
type: "text",
|
|
67
|
-
text: result.message
|
|
68
|
-
}],
|
|
69
|
-
details: { connected: result.connected }
|
|
70
|
-
};
|
|
57
|
+
return textResult(result.message, { connected: result.connected });
|
|
71
58
|
}
|
|
72
59
|
await beforeCredentialPersistence();
|
|
73
60
|
const result = await startWebLoginWithQr({
|
|
@@ -76,13 +63,7 @@ function createWhatsAppLoginTool(context) {
|
|
|
76
63
|
beforeCredentialPersistence,
|
|
77
64
|
force: typeof args.force === "boolean" ? args.force : false
|
|
78
65
|
});
|
|
79
|
-
if (!result.qrDataUrl) return {
|
|
80
|
-
content: [{
|
|
81
|
-
type: "text",
|
|
82
|
-
text: result.message
|
|
83
|
-
}],
|
|
84
|
-
details: { qr: false }
|
|
85
|
-
};
|
|
66
|
+
if (!result.qrDataUrl) return textResult(result.message, { qr: false });
|
|
86
67
|
return renderQrReply({
|
|
87
68
|
message: result.message,
|
|
88
69
|
qrDataUrl: result.qrDataUrl,
|
package/dist/.setup/{approval-handler.runtime-CjqMlPOX.mjs → approval-handler.runtime-CKposl6w.mjs}
RENAMED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import "./accounts-
|
|
1
|
+
import "./accounts-F0vHuze2.mjs";
|
|
2
2
|
import { r as resolveDefaultWhatsAppAccountId } from "./account-ids-CB5SOWjc.mjs";
|
|
3
3
|
import { s as normalizeWhatsAppMessagingTarget } from "./normalize-target-BGra1ZnM.mjs";
|
|
4
|
-
import { i as sendTypingWhatsApp, t as sendMessageWhatsApp } from "./send-
|
|
4
|
+
import { i as sendTypingWhatsApp, t as sendMessageWhatsApp } from "./send-CGUsUdoX.mjs";
|
|
5
5
|
import { i as getWhatsAppRuntime } from "./runtime-BLlToOi6.mjs";
|
|
6
|
-
import { i as unregisterWhatsAppApprovalReactionTarget, r as registerWhatsAppApprovalReactionTarget } from "./approval-reactions-
|
|
6
|
+
import { i as unregisterWhatsAppApprovalReactionTarget, r as registerWhatsAppApprovalReactionTarget } from "./approval-reactions-CD6CDF9k.mjs";
|
|
7
7
|
import { createSubsystemLogger } from "openclaw/plugin-sdk/runtime-env";
|
|
8
8
|
import { DEFAULT_ACCOUNT_ID } from "openclaw/plugin-sdk/account-id";
|
|
9
9
|
import { buildApprovalReactionPendingContent } from "openclaw/plugin-sdk/approval-reaction-runtime";
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-BBjsoOtd.mjs";
|
|
2
|
-
import { a as resolveWhatsAppAccount } from "./accounts-
|
|
2
|
+
import { a as resolveWhatsAppAccount } from "./accounts-F0vHuze2.mjs";
|
|
3
|
+
import { d as listWhatsAppDeliveredMessageIdentities } from "./send-CGUsUdoX.mjs";
|
|
3
4
|
import { n as getOptionalWhatsAppRuntime } from "./runtime-BLlToOi6.mjs";
|
|
4
|
-
import { c as
|
|
5
|
+
import { c as whatsappApprovalAuth, s as getWhatsAppApprovalApprovers } from "./group-session-key-BV8Le9r8.mjs";
|
|
6
|
+
import { normalizeUniqueTrimmedStringList } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
5
7
|
import { createLazyRuntimeSurface } from "openclaw/plugin-sdk/lazy-runtime";
|
|
6
8
|
import { approvalReactionDecisionSetsMatch, buildApprovalReactionDeliveredBindingMarker, createApprovalReactionTargetStore, listApprovalReactionBindings, readApprovalReactionDecisionList, readApprovalReactionDeliveredBinding, readApprovalReactionPresentationBinding, readApprovalReactionTargetRecord, resolveTypedApprovalReactionTarget, settleApprovalReaction } from "openclaw/plugin-sdk/approval-reaction-runtime";
|
|
7
9
|
import { createPluginStateErrorReporter } from "openclaw/plugin-sdk/plugin-state-runtime";
|
|
@@ -36,10 +38,6 @@ function buildReactionTargetKey(params) {
|
|
|
36
38
|
if (!accountId || !remoteJid || !messageId) return null;
|
|
37
39
|
return `${accountId}:${remoteJid}:${messageId}`;
|
|
38
40
|
}
|
|
39
|
-
function addCandidateRemoteJid(target, value) {
|
|
40
|
-
const remoteJid = value?.trim();
|
|
41
|
-
if (remoteJid && !target.includes(remoteJid)) target.push(remoteJid);
|
|
42
|
-
}
|
|
43
41
|
function reportApprovalBindingCorrelationMismatch(binding) {
|
|
44
42
|
try {
|
|
45
43
|
getOptionalWhatsAppRuntime()?.logging.getChildLogger({
|
|
@@ -111,33 +109,6 @@ async function registerWhatsAppApprovalReactionTarget(params) {
|
|
|
111
109
|
await whatsappApprovalReactionTargets.register(key, target, { ttlMs: params.ttlMs });
|
|
112
110
|
return target;
|
|
113
111
|
}
|
|
114
|
-
function listWhatsAppDeliveredMessageIdentities(results) {
|
|
115
|
-
const identities = [];
|
|
116
|
-
const seen = /* @__PURE__ */ new Set();
|
|
117
|
-
const add = (params) => {
|
|
118
|
-
if (params.channel && params.channel !== "whatsapp") return;
|
|
119
|
-
const messageId = params.messageId?.trim() ?? "";
|
|
120
|
-
const remoteJid = params.toJid?.trim() ?? "";
|
|
121
|
-
const key = `${remoteJid}:${messageId}`;
|
|
122
|
-
if (!messageId || messageId === "unknown" || !remoteJid || seen.has(key)) return;
|
|
123
|
-
seen.add(key);
|
|
124
|
-
identities.push({
|
|
125
|
-
messageId,
|
|
126
|
-
remoteJid
|
|
127
|
-
});
|
|
128
|
-
};
|
|
129
|
-
for (const result of results) {
|
|
130
|
-
if (result.channel !== "whatsapp") continue;
|
|
131
|
-
add(result);
|
|
132
|
-
for (const raw of result.receipt?.raw ?? []) add(raw);
|
|
133
|
-
for (const part of result.receipt?.parts ?? []) add({
|
|
134
|
-
channel: part.raw?.channel,
|
|
135
|
-
messageId: part.raw?.messageId ?? part.platformMessageId,
|
|
136
|
-
toJid: part.raw?.toJid
|
|
137
|
-
});
|
|
138
|
-
}
|
|
139
|
-
return identities;
|
|
140
|
-
}
|
|
141
112
|
/** Bind generic forwarded approvals to the exact WhatsApp messages accepted by Baileys. */
|
|
142
113
|
async function registerWhatsAppApprovalReactionTargetForDeliveredPayload(params) {
|
|
143
114
|
if (params.target.channel.trim().toLowerCase() !== "whatsapp") return false;
|
|
@@ -155,7 +126,7 @@ async function registerWhatsAppApprovalReactionTargetForDeliveredPayload(params)
|
|
|
155
126
|
accountId: params.target.accountId
|
|
156
127
|
}).accountId;
|
|
157
128
|
const registrations = [];
|
|
158
|
-
for (const { messageId, remoteJid } of listWhatsAppDeliveredMessageIdentities(params.results)) registrations.push(registerWhatsAppApprovalReactionTarget({
|
|
129
|
+
for (const { messageId, remoteJid } of listWhatsAppDeliveredMessageIdentities(params.results, (channel) => !channel || channel === "whatsapp")) registrations.push(registerWhatsAppApprovalReactionTarget({
|
|
159
130
|
accountId,
|
|
160
131
|
remoteJid,
|
|
161
132
|
messageId,
|
|
@@ -187,14 +158,14 @@ async function resolveWhatsAppApprovalReactionTargetWithPersistence(params) {
|
|
|
187
158
|
async function resolveWhatsAppApprovalReactionTargetFromCandidates(params) {
|
|
188
159
|
const candidateRemoteJids = [];
|
|
189
160
|
for (const observedRemoteJid of params.observedRemoteJids) {
|
|
190
|
-
|
|
161
|
+
candidateRemoteJids.push(observedRemoteJid);
|
|
191
162
|
try {
|
|
192
|
-
|
|
163
|
+
candidateRemoteJids.push(...await params.resolveReactionTargetJids?.(observedRemoteJid) ?? []);
|
|
193
164
|
} catch (error) {
|
|
194
165
|
params.logVerboseMessage?.(`whatsapp: approval reaction target JID mapping failed for ${observedRemoteJid}: ${String(error)}`);
|
|
195
166
|
}
|
|
196
167
|
}
|
|
197
|
-
for (const remoteJid of candidateRemoteJids) {
|
|
168
|
+
for (const remoteJid of normalizeUniqueTrimmedStringList(candidateRemoteJids)) {
|
|
198
169
|
const target = await resolveWhatsAppApprovalReactionTargetWithPersistence({
|
|
199
170
|
accountId: params.accountId,
|
|
200
171
|
remoteJid,
|
|
@@ -213,9 +184,7 @@ function readWhatsAppApprovalReactionEvent(params) {
|
|
|
213
184
|
const reaction = msg.message?.reactionMessage;
|
|
214
185
|
const reactionKey = reaction?.text?.trim() ?? "";
|
|
215
186
|
const messageId = reaction?.key?.id?.trim() ?? "";
|
|
216
|
-
const remoteJids = [];
|
|
217
|
-
addCandidateRemoteJid(remoteJids, reaction?.key?.remoteJid);
|
|
218
|
-
addCandidateRemoteJid(remoteJids, msg.key?.remoteJid);
|
|
187
|
+
const remoteJids = normalizeUniqueTrimmedStringList([reaction?.key?.remoteJid, msg.key?.remoteJid]);
|
|
219
188
|
const actorJid = msg.key?.participant?.trim() || (msg.key?.fromMe ? params.selfLid?.trim() ?? params.selfJid?.trim() ?? "" : msg.key?.remoteJid?.trim() ?? "");
|
|
220
189
|
if (!reactionKey || !messageId || remoteJids.length === 0 || !actorJid) return null;
|
|
221
190
|
return {
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-BBjsoOtd.mjs";
|
|
2
|
-
import { a as
|
|
3
|
-
import { r as jidToE164 } from "./targets-runtime-
|
|
2
|
+
import { a as readWebCredsJsonRawSync, c as statWebCredsFileSync, i as readWebCredsJsonRaw, n as hasWebCredsSync, o as resolveWebCredsBackupPath, r as isWhatsAppBaileysAuthFileName, s as resolveWebCredsPath, t as assertWebCredsPathRegularFileOrMissing } from "./creds-files-B8WcOAmE.mjs";
|
|
3
|
+
import { r as jidToE164 } from "./targets-runtime-Dls-Xh4F.mjs";
|
|
4
4
|
import path from "node:path";
|
|
5
5
|
import { resolveOAuthDir as resolveOAuthDir$1 } from "openclaw/plugin-sdk/state-paths";
|
|
6
6
|
import { isPathStrictlyInside } from "openclaw/plugin-sdk/file-access-runtime";
|
|
7
7
|
import { formatCliCommand } from "openclaw/plugin-sdk/cli-runtime";
|
|
8
|
+
import { extractErrorCode } from "openclaw/plugin-sdk/error-runtime";
|
|
8
9
|
import { defaultRuntime, getChildLogger, info, success } from "openclaw/plugin-sdk/runtime-env";
|
|
9
10
|
import { normalizeE164, resolveUserPath } from "openclaw/plugin-sdk/text-utility-runtime";
|
|
10
11
|
import fs from "node:fs/promises";
|
|
@@ -12,6 +13,7 @@ import { DEFAULT_ACCOUNT_ID } from "openclaw/plugin-sdk/routing";
|
|
|
12
13
|
import { enqueueKeyedTask } from "openclaw/plugin-sdk/keyed-async-queue";
|
|
13
14
|
import { resolveTimerTimeoutMs } from "openclaw/plugin-sdk/number-runtime";
|
|
14
15
|
import { replaceFileAtomic } from "openclaw/plugin-sdk/security-runtime";
|
|
16
|
+
import { raceWithTimeout } from "openclaw/plugin-sdk/time-runtime";
|
|
15
17
|
//#region extensions/whatsapp/src/creds-persistence.ts
|
|
16
18
|
const CREDS_FILE_MODE = 384;
|
|
17
19
|
const CREDS_SAVE_FLUSH_TIMEOUT_MS = 15e3;
|
|
@@ -61,12 +63,7 @@ function waitForCredsSaveQueue(authDir) {
|
|
|
61
63
|
}
|
|
62
64
|
async function waitForCredsSaveQueueWithTimeout(authDir, timeoutMs = CREDS_SAVE_FLUSH_TIMEOUT_MS) {
|
|
63
65
|
const boundedTimeoutMs = resolveTimerTimeoutMs(timeoutMs, CREDS_SAVE_FLUSH_TIMEOUT_MS, 0);
|
|
64
|
-
|
|
65
|
-
return await Promise.race([waitForCredsSaveQueue(authDir).then(() => "drained"), new Promise((resolve) => {
|
|
66
|
-
flushTimeout = setTimeout(() => resolve("timed_out"), boundedTimeoutMs);
|
|
67
|
-
})]).finally(() => {
|
|
68
|
-
if (flushTimeout) clearTimeout(flushTimeout);
|
|
69
|
-
});
|
|
66
|
+
return await raceWithTimeout(waitForCredsSaveQueue(authDir).then(() => "drained"), boundedTimeoutMs, () => "timed_out");
|
|
70
67
|
}
|
|
71
68
|
//#endregion
|
|
72
69
|
//#region extensions/whatsapp/src/identity.ts
|
|
@@ -150,7 +147,7 @@ var auth_store_exports = /* @__PURE__ */ __exportAll({
|
|
|
150
147
|
logWebSelfId: () => logWebSelfId,
|
|
151
148
|
logoutWeb: () => logoutWeb,
|
|
152
149
|
pickWebChannel: () => pickWebChannel,
|
|
153
|
-
readCredsJsonRaw: () =>
|
|
150
|
+
readCredsJsonRaw: () => readWebCredsJsonRawSync,
|
|
154
151
|
readWebAuthExistsBestEffort: () => readWebAuthExistsBestEffort,
|
|
155
152
|
readWebAuthExistsForDecision: () => readWebAuthExistsForDecision,
|
|
156
153
|
readWebAuthSnapshot: () => readWebAuthSnapshot,
|
|
@@ -183,9 +180,6 @@ function resolveDefaultWebAuthDir() {
|
|
|
183
180
|
return path.join(resolveOAuthDir$1(), "whatsapp", DEFAULT_ACCOUNT_ID);
|
|
184
181
|
}
|
|
185
182
|
const WA_WEB_AUTH_DIR = resolveDefaultWebAuthDir();
|
|
186
|
-
function readCredsJsonRaw(filePath) {
|
|
187
|
-
return readWebCredsJsonRawSync(filePath);
|
|
188
|
-
}
|
|
189
183
|
async function waitForWebAuthBarrier(authDir, context) {
|
|
190
184
|
const result = await waitForCredsSaveQueueWithTimeout(authDir);
|
|
191
185
|
if (result === "timed_out") authStoreLogger.warn({
|
|
@@ -209,9 +203,9 @@ async function restoreCredsFromBackupIfNeeded(authDir, options) {
|
|
|
209
203
|
const credsPath = resolveWebCredsPath(authDir);
|
|
210
204
|
const backupPath = resolveWebCredsBackupPath(authDir);
|
|
211
205
|
await assertWebCredsPathRegularFileOrMissing(credsPath);
|
|
212
|
-
const raw =
|
|
206
|
+
const raw = readWebCredsJsonRawSync(credsPath);
|
|
213
207
|
if (raw && isValidJson(raw)) return false;
|
|
214
|
-
const backupRaw =
|
|
208
|
+
const backupRaw = readWebCredsJsonRawSync(backupPath);
|
|
215
209
|
if (!backupRaw || !isValidJson(backupRaw)) return false;
|
|
216
210
|
restore = {
|
|
217
211
|
content: backupRaw,
|
|
@@ -244,7 +238,6 @@ async function readWebAuthStateCore(authDir, context) {
|
|
|
244
238
|
const linked = await webAuthExists(resolvedAuthDir);
|
|
245
239
|
return {
|
|
246
240
|
authDir: resolvedAuthDir,
|
|
247
|
-
linked,
|
|
248
241
|
state: barrierResult === "timed_out" ? "unstable" : linked ? "linked" : "not-linked"
|
|
249
242
|
};
|
|
250
243
|
}
|
|
@@ -312,8 +305,7 @@ async function shouldClearOnLogout(authDir, isLegacyAuthDir) {
|
|
|
312
305
|
if ((await fs.lstat(resolveWebCredsPath(authDir)).catch(() => null))?.isFile()) return true;
|
|
313
306
|
return (await fs.lstat(resolveWebCredsBackupPath(authDir)).catch(() => null))?.isFile() === true;
|
|
314
307
|
} catch (error) {
|
|
315
|
-
|
|
316
|
-
return (typeof codeValue === "string" ? codeValue : "") !== "ENOENT";
|
|
308
|
+
return extractErrorCode(error) !== "ENOENT";
|
|
317
309
|
}
|
|
318
310
|
}
|
|
319
311
|
async function pathHasSymlinkComponent(baseDir, targetPath) {
|
|
@@ -381,7 +373,8 @@ async function logoutWeb(params) {
|
|
|
381
373
|
}
|
|
382
374
|
function readWebSelfId(authDir = resolveDefaultWebAuthDir()) {
|
|
383
375
|
try {
|
|
384
|
-
const
|
|
376
|
+
const credsPath = resolveWebCredsPath(resolveUserPath(authDir));
|
|
377
|
+
const raw = readWebCredsJsonRawSync(credsPath);
|
|
385
378
|
if (!raw) return emptyWebSelfId();
|
|
386
379
|
const parsed = JSON.parse(raw);
|
|
387
380
|
const identity = resolveComparableIdentity({
|
|
@@ -439,4 +432,4 @@ async function pickWebChannel(pref, authDir = resolveDefaultWebAuthDir()) {
|
|
|
439
432
|
return choice;
|
|
440
433
|
}
|
|
441
434
|
//#endregion
|
|
442
|
-
export {
|
|
435
|
+
export { waitForCredsSaveQueue as A, getPrimaryIdentityId as C, identitiesOverlap as D, getSenderIdentity as E, writeCredsJsonAtomically as M, writeWebCredsRawAtomically as N, resolveComparableIdentity as O, getMentionIdentities as S, getSelfIdentity as T, readWebSelfIdentityForDecision as _, formatWhatsAppWebAuthStatusState as a, webAuthExists as b, logoutWeb as c, readWebAuthExistsForDecision as d, readWebAuthSnapshot as f, readWebSelfIdentity as g, readWebSelfId as h, auth_store_exports as i, waitForCredsSaveQueueWithTimeout as j, enqueueCredsSave as k, pickWebChannel as l, readWebAuthState as m, WHATSAPP_AUTH_UNSTABLE_CODE as n, getWebAuthAgeMs as o, readWebAuthSnapshotBestEffort as p, WhatsAppAuthUnstableError as r, logWebSelfId as s, WA_WEB_AUTH_DIR as t, readWebAuthExistsBestEffort as u, resolveDefaultWebAuthDir as v, getReplyContext as w, getComparableIdentityValues as x, restoreCredsFromBackupIfNeeded as y };
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { a as resolveWhatsAppAccount } from "./accounts-
|
|
1
|
+
import { a as resolveWhatsAppAccount } from "./accounts-F0vHuze2.mjs";
|
|
2
2
|
import { r as resolveDefaultWhatsAppAccountId, t as listAccountIds } from "./account-ids-CB5SOWjc.mjs";
|
|
3
3
|
import { a as normalizeWhatsAppAllowFromEntries, c as normalizeWhatsAppTarget, i as looksLikeWhatsAppTargetId, n as isWhatsAppNewsletterJid, o as normalizeWhatsAppAllowFromEntry, s as normalizeWhatsAppMessagingTarget, t as isWhatsAppGroupJid } from "./normalize-target-BGra1ZnM.mjs";
|
|
4
|
-
import { t as resolveWhatsAppOutboundTarget } from "./resolve-outbound-target-
|
|
5
|
-
import { c as normalizeWhatsAppPayloadTextPreservingIndentation, i as sendTypingWhatsApp, n as sendPollWhatsApp, o as normalizeWhatsAppOutboundPayload, s as normalizeWhatsAppPayloadText, t as sendMessageWhatsApp,
|
|
4
|
+
import { t as resolveWhatsAppOutboundTarget } from "./resolve-outbound-target-CzyNKmrl.mjs";
|
|
5
|
+
import { c as normalizeWhatsAppPayloadTextPreservingIndentation, i as sendTypingWhatsApp, n as sendPollWhatsApp, o as normalizeWhatsAppOutboundPayload, s as normalizeWhatsAppPayloadText, t as sendMessageWhatsApp, y as resolveWhatsAppReactionLevel } from "./send-CGUsUdoX.mjs";
|
|
6
6
|
import { i as getWhatsAppRuntime } from "./runtime-BLlToOi6.mjs";
|
|
7
|
-
import { c as toWhatsappJid } from "./targets-runtime-
|
|
8
|
-
import { c as
|
|
9
|
-
import { a as loadWhatsAppChannelRuntime, t as createWhatsAppPluginBase } from "./shared-
|
|
7
|
+
import { c as toWhatsappJid } from "./targets-runtime-Dls-Xh4F.mjs";
|
|
8
|
+
import { c as whatsappApprovalAuth, o as lookupInboundMessageMetaForTarget, s as getWhatsAppApprovalApprovers, t as resolveWhatsAppGroupSessionKey } from "./group-session-key-BV8Le9r8.mjs";
|
|
9
|
+
import { a as loadWhatsAppChannelRuntime, t as createWhatsAppPluginBase } from "./shared-CP_zs2U7.mjs";
|
|
10
10
|
import { t as whatsappCommandPolicy } from "./command-policy-BIOSHySD.mjs";
|
|
11
|
-
import {
|
|
11
|
+
import { d as readWebAuthExistsForDecision, n as WHATSAPP_AUTH_UNSTABLE_CODE } from "./auth-store-D2rN-hP5.mjs";
|
|
12
12
|
import { createActionGate } from "openclaw/plugin-sdk/channel-actions";
|
|
13
13
|
import { normalizeOptionalAccountId } from "openclaw/plugin-sdk/account-core";
|
|
14
14
|
import { normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
@@ -17,6 +17,7 @@ import { createMessageReceiptFromOutboundResults, defineChannelMessageAdapter, r
|
|
|
17
17
|
import { formatCliCommand } from "openclaw/plugin-sdk/cli-runtime";
|
|
18
18
|
import { buildChannelOutboundSessionRoute } from "openclaw/plugin-sdk/core";
|
|
19
19
|
import { sendTextMediaPayload } from "openclaw/plugin-sdk/reply-payload";
|
|
20
|
+
import { escapeRegExp } from "openclaw/plugin-sdk/text-utility-runtime";
|
|
20
21
|
import { DEFAULT_ACCOUNT_ID as DEFAULT_ACCOUNT_ID$1 } from "openclaw/plugin-sdk/account-id";
|
|
21
22
|
import { createLazyRuntimeModule } from "openclaw/plugin-sdk/lazy-runtime";
|
|
22
23
|
import { buildDmGroupAccountAllowlistAdapter } from "openclaw/plugin-sdk/allowlist-config-edit";
|
|
@@ -81,7 +82,7 @@ const whatsappApproval = createApproverRestrictedNativeApprovalCapabilityFromFor
|
|
|
81
82
|
approvalKind,
|
|
82
83
|
request
|
|
83
84
|
}),
|
|
84
|
-
load: async () => (await import("./approval-handler.runtime-
|
|
85
|
+
load: async () => (await import("./approval-handler.runtime-CKposl6w.mjs")).whatsappApprovalNativeRuntime
|
|
85
86
|
})
|
|
86
87
|
});
|
|
87
88
|
function buildWhatsAppPendingPayload(params, approvalKind) {
|
|
@@ -238,8 +239,8 @@ function createWhatsAppOutboundBase({ sendMessageWhatsApp, sendPollWhatsApp, sho
|
|
|
238
239
|
}
|
|
239
240
|
//#endregion
|
|
240
241
|
//#region extensions/whatsapp/src/channel-outbound.ts
|
|
241
|
-
const loadWhatsAppApprovalReactionsModule = createLazyRuntimeModule(() => import("./approval-reactions-
|
|
242
|
-
const loadWhatsAppQuestionReactionsModule = createLazyRuntimeModule(() => import("./question-reactions-
|
|
242
|
+
const loadWhatsAppApprovalReactionsModule = createLazyRuntimeModule(() => import("./approval-reactions-CD6CDF9k.mjs").then((n) => n.t));
|
|
243
|
+
const loadWhatsAppQuestionReactionsModule = createLazyRuntimeModule(() => import("./question-reactions-LMeijbaq.mjs").then((n) => n.n));
|
|
243
244
|
async function prepareWhatsAppApprovalPayloadForDelivery(params) {
|
|
244
245
|
const questionPayload = questionGatewayRuntime.prepareReactionPayloadForDelivery({
|
|
245
246
|
payload: params.payload,
|
|
@@ -315,7 +316,7 @@ const whatsappMessageAdapter = defineChannelMessageAdapter({
|
|
|
315
316
|
function resolveWhatsAppMentionStripRegexes(ctx) {
|
|
316
317
|
const selfE164 = (ctx.To ?? "").replace(/^whatsapp:/i, "");
|
|
317
318
|
if (!selfE164) return [];
|
|
318
|
-
const escaped = selfE164
|
|
319
|
+
const escaped = escapeRegExp(selfE164);
|
|
319
320
|
return [new RegExp(escaped, "g"), new RegExp(`@${escaped}`, "g")];
|
|
320
321
|
}
|
|
321
322
|
//#endregion
|
|
@@ -456,8 +457,8 @@ function collectWhatsAppStatusIssues(accounts) {
|
|
|
456
457
|
}
|
|
457
458
|
//#endregion
|
|
458
459
|
//#region extensions/whatsapp/src/channel.ts
|
|
459
|
-
const loadWhatsAppDirectoryConfig = createLazyRuntimeModule(() => import("./directory-config-
|
|
460
|
-
const loadWhatsAppChannelReactAction = createLazyRuntimeModule(() => import("./channel-react-action-
|
|
460
|
+
const loadWhatsAppDirectoryConfig = createLazyRuntimeModule(() => import("./directory-config-RYQomHyB.mjs").then((n) => n.t));
|
|
461
|
+
const loadWhatsAppChannelReactAction = createLazyRuntimeModule(() => import("./channel-react-action-BaBV9X6M.mjs"));
|
|
461
462
|
function projectWhatsAppRuntimeStatus(runtime) {
|
|
462
463
|
return {
|
|
463
464
|
connected: runtime?.connected ?? false,
|
|
@@ -575,17 +576,7 @@ const whatsappPlugin = createChatChannelPlugin({
|
|
|
575
576
|
}),
|
|
576
577
|
supportsAction: ({ action }) => action === "react" || action === "upload-file",
|
|
577
578
|
resolveExecutionMode: ({ action }) => action === "react" || action === "upload-file" ? "gateway" : "local",
|
|
578
|
-
handleAction: async (
|
|
579
|
-
action,
|
|
580
|
-
params,
|
|
581
|
-
cfg,
|
|
582
|
-
accountId,
|
|
583
|
-
requesterSenderId,
|
|
584
|
-
mediaAccess,
|
|
585
|
-
mediaLocalRoots,
|
|
586
|
-
mediaReadFile,
|
|
587
|
-
toolContext
|
|
588
|
-
})
|
|
579
|
+
handleAction: async (params) => await (await loadWhatsAppChannelReactAction()).handleWhatsAppMessageAction(params)
|
|
589
580
|
},
|
|
590
581
|
approvalCapability: whatsappApprovalCapability,
|
|
591
582
|
auth: { login: async ({ cfg, accountId, runtime, verbose }) => {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { a as resolveWhatsAppAccount, s as resolveWhatsAppMediaMaxBytes } from "./accounts-
|
|
1
|
+
import { a as resolveWhatsAppAccount, s as resolveWhatsAppMediaMaxBytes } from "./accounts-F0vHuze2.mjs";
|
|
2
2
|
import { c as normalizeWhatsAppTarget, t as isWhatsAppGroupJid } from "./normalize-target-BGra1ZnM.mjs";
|
|
3
|
-
import { r as resolveAuthorizedWhatsAppOutboundTarget, t as handleWhatsAppAction } from "./action-runtime-
|
|
4
|
-
import { a as sendWhatsAppUploadFile } from "./send-
|
|
3
|
+
import { r as resolveAuthorizedWhatsAppOutboundTarget, t as handleWhatsAppAction } from "./action-runtime-CE3zGstN.mjs";
|
|
4
|
+
import { a as sendWhatsAppUploadFile } from "./send-CGUsUdoX.mjs";
|
|
5
5
|
import { jsonResult, readStringOrNumberParam, readStringParam as readStringParam$1, resolveReactionMessageId } from "openclaw/plugin-sdk/channel-actions";
|
|
6
6
|
import { canonicalizeBase64, estimateBase64DecodedBytes } from "openclaw/plugin-sdk/media-runtime";
|
|
7
7
|
import { readBooleanParam } from "openclaw/plugin-sdk/boolean-param";
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { startWebLoginWithQr as startWebLoginWithQr$1, waitForWebLogin as waitForWebLogin$1 } from "../login-qr-runtime.js";
|
|
2
|
-
import {
|
|
2
|
+
import { b as webAuthExists, c as logoutWeb, d as readWebAuthExistsForDecision, f as readWebAuthSnapshot, h as readWebSelfId, m as readWebAuthState, o as getWebAuthAgeMs, p as readWebAuthSnapshotBestEffort, s as logWebSelfId, u as readWebAuthExistsBestEffort } from "./auth-store-D2rN-hP5.mjs";
|
|
3
3
|
import { t as getActiveWebListener } from "./active-listener-CDjoX9QR.mjs";
|
|
4
|
-
import { t as monitorWebChannel } from "./monitor-
|
|
5
|
-
import { t as loginWeb } from "./login-
|
|
6
|
-
import { whatsappSetupWizard as whatsappSetupWizard$1 } from "./setup-surface-
|
|
4
|
+
import { t as monitorWebChannel } from "./monitor-B5DS4PDV.mjs";
|
|
5
|
+
import { t as loginWeb } from "./login-CV_4V021.mjs";
|
|
6
|
+
import { whatsappSetupWizard as whatsappSetupWizard$1 } from "./setup-surface-BuA39k6K.mjs";
|
|
7
7
|
//#region extensions/whatsapp/src/channel.runtime.ts
|
|
8
8
|
async function startWebLoginWithQr(...args) {
|
|
9
9
|
return await startWebLoginWithQr$1(...args);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as createWhatsAppPluginBase } from "./shared-
|
|
1
|
+
import { t as createWhatsAppPluginBase } from "./shared-CP_zs2U7.mjs";
|
|
2
2
|
//#region extensions/whatsapp/src/channel.setup.ts
|
|
3
3
|
const whatsappSetupPlugin = { ...createWhatsAppPluginBase() };
|
|
4
4
|
//#endregion
|
package/dist/.setup/{connection-controller-CHo1oRJA.mjs → connection-controller-COkcq48K.mjs}
RENAMED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { r as getWhatsAppChannelRuntime } from "./runtime-BLlToOi6.mjs";
|
|
2
2
|
import { n as WHATSAPP_CONNECTION_OWNER_PENDING_CAPABILITY, t as WHATSAPP_CONNECTION_CONTROLLER_CAPABILITY } from "./connection-controller-runtime-context-hgLJoRc8.mjs";
|
|
3
|
-
import {
|
|
4
|
-
import { d as DEFAULT_WHATSAPP_SOCKET_TIMING, i as waitForWaConnection, o as computeBackoff, r as createWaSocket, t as closeWhatsAppSocketAndWait, u as sleepWithAbort, y as acquireWhatsAppGatewayConnectionOwner } from "./socket-close-
|
|
3
|
+
import { O as resolveComparableIdentity, c as logoutWeb, d as readWebAuthExistsForDecision, j as waitForCredsSaveQueueWithTimeout, r as WhatsAppAuthUnstableError } from "./auth-store-D2rN-hP5.mjs";
|
|
4
|
+
import { d as DEFAULT_WHATSAPP_SOCKET_TIMING, i as waitForWaConnection, o as computeBackoff, r as createWaSocket, t as closeWhatsAppSocketAndWait, u as sleepWithAbort$1, y as acquireWhatsAppGatewayConnectionOwner } from "./socket-close-DU7eerAa.mjs";
|
|
5
5
|
import { n as getStatusCode, t as formatError } from "./session-errors-B8UcAnZN.mjs";
|
|
6
6
|
import { info } from "openclaw/plugin-sdk/runtime-env";
|
|
7
7
|
import { registerChannelRuntimeContext } from "openclaw/plugin-sdk/channel-runtime-context";
|
|
8
|
+
import { racePromiseWithAbortSignal } from "openclaw/plugin-sdk/time-runtime";
|
|
8
9
|
import { createDeferred } from "openclaw/plugin-sdk/extension-shared";
|
|
9
10
|
//#region extensions/whatsapp/src/connection-controller.ts
|
|
10
11
|
const LOGGED_OUT_STATUS = 401;
|
|
@@ -219,7 +220,7 @@ var WhatsAppConnectionController = class {
|
|
|
219
220
|
this.watchdogCheckMs = params.watchdogCheckMs;
|
|
220
221
|
this.reconnectPolicy = params.reconnectPolicy;
|
|
221
222
|
this.abortSignal = params.abortSignal;
|
|
222
|
-
this.sleep = params.sleep ?? sleepWithAbort;
|
|
223
|
+
this.sleep = params.sleep ?? sleepWithAbort$1;
|
|
223
224
|
this.isNonRetryableStatus = params.isNonRetryableStatus ?? (() => false);
|
|
224
225
|
this.socketTiming = {
|
|
225
226
|
...DEFAULT_WHATSAPP_SOCKET_TIMING,
|
|
@@ -546,17 +547,7 @@ var WhatsAppConnectionController = class {
|
|
|
546
547
|
}
|
|
547
548
|
async waitForSetupStep(task) {
|
|
548
549
|
this.throwIfSetupStopped();
|
|
549
|
-
|
|
550
|
-
let onAbort;
|
|
551
|
-
const aborted = new Promise((_resolve, reject) => {
|
|
552
|
-
onAbort = () => reject(stoppedControllerError());
|
|
553
|
-
signal.addEventListener("abort", onAbort, { once: true });
|
|
554
|
-
});
|
|
555
|
-
try {
|
|
556
|
-
return await Promise.race([task, aborted]);
|
|
557
|
-
} finally {
|
|
558
|
-
if (onAbort) signal.removeEventListener("abort", onAbort);
|
|
559
|
-
}
|
|
550
|
+
return await racePromiseWithAbortSignal(task, this.setupAbortController.signal, stoppedControllerError);
|
|
560
551
|
}
|
|
561
552
|
async ensureConnectionOwnership() {
|
|
562
553
|
if (this.retainedOwnerReleaseLease) {
|
|
@@ -73,17 +73,8 @@ function statWebCredsFileSync(filePath) {
|
|
|
73
73
|
return null;
|
|
74
74
|
}
|
|
75
75
|
}
|
|
76
|
-
function hasWebCredsRegularFileSync(authDir) {
|
|
77
|
-
try {
|
|
78
|
-
const credsPath = resolveWebCredsPath(authDir);
|
|
79
|
-
assertNoSymlinkParentsSync(resolveWebCredsParentCheck(credsPath));
|
|
80
|
-
return !statRegularFileSync(credsPath).missing;
|
|
81
|
-
} catch {
|
|
82
|
-
return false;
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
76
|
function hasWebCredsSync(authDir) {
|
|
86
77
|
return statWebCredsFileSync(resolveWebCredsPath(authDir)) !== null;
|
|
87
78
|
}
|
|
88
79
|
//#endregion
|
|
89
|
-
export {
|
|
80
|
+
export { readWebCredsJsonRawSync as a, statWebCredsFileSync as c, readWebCredsJsonRaw as i, hasWebCredsSync as n, resolveWebCredsBackupPath as o, isWhatsAppBaileysAuthFileName as r, resolveWebCredsPath as s, assertWebCredsPathRegularFileOrMissing as t };
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-BBjsoOtd.mjs";
|
|
2
|
-
import { c as resolveMergedWhatsAppAccountConfig, o as resolveWhatsAppAuthDir } from "./accounts-
|
|
2
|
+
import { c as resolveMergedWhatsAppAccountConfig, o as resolveWhatsAppAuthDir } from "./accounts-F0vHuze2.mjs";
|
|
3
3
|
import { c as normalizeWhatsAppTarget, t as isWhatsAppGroupJid } from "./normalize-target-BGra1ZnM.mjs";
|
|
4
4
|
import { i as hasPendingWhatsAppConnectionOwner, r as getWhatsAppConnectionController } from "./connection-controller-runtime-context-hgLJoRc8.mjs";
|
|
5
|
-
import {
|
|
5
|
+
import { d as readWebAuthExistsForDecision, j as waitForCredsSaveQueueWithTimeout } from "./auth-store-D2rN-hP5.mjs";
|
|
6
6
|
import { n as resolveWebAccountId } from "./active-listener-CDjoX9QR.mjs";
|
|
7
|
-
import { b as acquireWhatsAppStandaloneConnectionOwner, i as waitForWaConnection, n as createWaDirectorySocket, t as closeWhatsAppSocketAndWait, v as WhatsAppConnectionOwnerBusyError } from "./socket-close-
|
|
7
|
+
import { b as acquireWhatsAppStandaloneConnectionOwner, i as waitForWaConnection, n as createWaDirectorySocket, t as closeWhatsAppSocketAndWait, v as WhatsAppConnectionOwnerBusyError } from "./socket-close-DU7eerAa.mjs";
|
|
8
8
|
import { listResolvedDirectoryGroupEntriesFromMapKeys, listResolvedDirectoryUserEntriesFromAllowFrom } from "openclaw/plugin-sdk/directory-config-runtime";
|
|
9
9
|
//#region extensions/whatsapp/src/directory-config.ts
|
|
10
10
|
var directory_config_exports = /* @__PURE__ */ __exportAll({
|
|
@@ -100,15 +100,12 @@ function scheduleStandaloneCleanupRetry(cleanup) {
|
|
|
100
100
|
}, STANDALONE_CLEANUP_RETRY_MS);
|
|
101
101
|
cleanup.retryTimer.unref?.();
|
|
102
102
|
}
|
|
103
|
-
function retainStandaloneCleanup(cleanup) {
|
|
104
|
-
pendingStandaloneCleanups.set(cleanup.authDir, cleanup);
|
|
105
|
-
scheduleStandaloneCleanupRetry(cleanup);
|
|
106
|
-
}
|
|
107
103
|
async function finishStandaloneCleanupOrThrow(cleanup, operationError) {
|
|
108
104
|
try {
|
|
109
105
|
await runStandaloneCleanup(cleanup);
|
|
110
106
|
} catch (cleanupError) {
|
|
111
|
-
|
|
107
|
+
pendingStandaloneCleanups.set(cleanup.authDir, cleanup);
|
|
108
|
+
scheduleStandaloneCleanupRetry(cleanup);
|
|
112
109
|
throw cleanupUnavailable(operationError === void 0 ? cleanupError : new AggregateError([operationError, cleanupError], "WhatsApp live group lookup and cleanup failed", { cause: operationError }));
|
|
113
110
|
}
|
|
114
111
|
}
|
|
@@ -118,12 +115,7 @@ function cleanupUnavailable(error) {
|
|
|
118
115
|
async function finishPriorStandaloneCleanup(authDir) {
|
|
119
116
|
const cleanup = pendingStandaloneCleanups.get(authDir);
|
|
120
117
|
if (!cleanup) return;
|
|
121
|
-
|
|
122
|
-
await runStandaloneCleanup(cleanup);
|
|
123
|
-
} catch (error) {
|
|
124
|
-
scheduleStandaloneCleanupRetry(cleanup);
|
|
125
|
-
throw cleanupUnavailable(error);
|
|
126
|
-
}
|
|
118
|
+
await finishStandaloneCleanupOrThrow(cleanup);
|
|
127
119
|
}
|
|
128
120
|
async function listGroupsThroughStandaloneOwner(params) {
|
|
129
121
|
const account = resolveMergedWhatsAppAccountConfig(params);
|
|
@@ -99,6 +99,12 @@ function createLegacyWebhookListenerDoctorContract(params) {
|
|
|
99
99
|
};
|
|
100
100
|
const prefix = `channels.${params.channelKey}`;
|
|
101
101
|
return {
|
|
102
|
+
historicalWebhookListener: {
|
|
103
|
+
channelId: params.channelKey,
|
|
104
|
+
port: params.defaultPort,
|
|
105
|
+
preserveAuthoredActivation: params.preserveAuthoredActivation,
|
|
106
|
+
...params.defaultHost === void 0 ? {} : { host: params.defaultHost }
|
|
107
|
+
},
|
|
102
108
|
legacyConfigRules: [{
|
|
103
109
|
path: ["channels", params.channelKey],
|
|
104
110
|
message: `${prefix} webhook listeners moved to Gateway routes. Run "openclaw doctor --fix" to preserve explicitly configured listener settings as legacyWebhook.`,
|
|
@@ -164,7 +170,7 @@ function resolveLegacyAckScope(ack) {
|
|
|
164
170
|
return group === "always" ? "group-all" : group === "mentions" ? "group-mentions" : group === "never" ? "off" : void 0;
|
|
165
171
|
}
|
|
166
172
|
function resolveDefaultAgentEmoji(cfg) {
|
|
167
|
-
const entries = (0, runtime_doctor_migrations_exports.asObjectRecord)((0, runtime_doctor_migrations_exports.asObjectRecord)(cfg
|
|
173
|
+
const entries = (0, runtime_doctor_migrations_exports.asObjectRecord)((0, runtime_doctor_migrations_exports.asObjectRecord)((0, runtime_doctor_migrations_exports.asObjectRecord)(cfg)?.agents)?.entries);
|
|
168
174
|
const agents = entries ? Object.values(entries).flatMap((value) => {
|
|
169
175
|
const entry = (0, runtime_doctor_migrations_exports.asObjectRecord)(value);
|
|
170
176
|
return entry ? [entry] : [];
|