@openclaw/whatsapp 2026.5.19 → 2026.5.20-beta.2
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-Blo69-dW.js → access-control-p_vcYDW7.js} +4 -4
- package/dist/{accounts-CJNZl-3e.js → accounts-BPYgj8Fv.js} +4 -8
- package/dist/{action-runtime-cZLWNUXF.js → action-runtime-D4UqEXqf.js} +4 -4
- package/dist/action-runtime-api.js +1 -1
- package/dist/action-runtime.runtime.js +1 -1
- package/dist/{active-listener-C4ClVut4.js → active-listener-B4SDebQ6.js} +2 -2
- package/dist/{agent-tools-login-DpRxLNRB.js → agent-tools-login-BDzvb3ee.js} +0 -1
- package/dist/api.js +18 -18
- package/dist/auth-presence.js +1 -1
- package/dist/{auth-store-BLGYDyCH.js → auth-store-GTQvJznL.js} +55 -64
- package/dist/{channel-CHsR8MoG.js → channel-BVMD1oZL.js} +17 -17
- package/dist/channel-config-api.js +1 -1
- package/dist/channel-plugin-api.js +1 -1
- package/dist/{channel-react-action-6n63NhGY.js → channel-react-action-CHdR3gbn.js} +5 -5
- package/dist/{channel.runtime-n14SNsjm.js → channel.runtime-BBPZSziE.js} +5 -5
- package/dist/{channel.setup-BiuhxbjG.js → channel.setup-BDH3Mk5M.js} +3 -3
- package/dist/{connection-controller-Cq6sY2mA.js → connection-controller-9TXWZRhx.js} +4 -4
- package/dist/constants.js +1 -1
- package/dist/contract-api.js +8 -8
- package/dist/creds-files-B1kSWtBg.js +79 -0
- package/dist/{directory-config-QH8Oe8bc.js → directory-config-CfLFAK54.js} +4 -4
- package/dist/directory-contract-api.js +1 -1
- package/dist/doctor-contract-api.js +1 -1
- package/dist/{identity-CVFJuB0Q.js → identity-xoLLdqEv.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 +4 -4
- package/dist/{login-DJYp3l4Z.js → login-nJwaNuC-.js} +5 -5
- package/dist/{login-qr-CipY7q23.js → login-qr-l4UaR8Dj.js} +4 -4
- package/dist/login-qr-runtime.js +1 -1
- package/dist/{monitor-oXSnOpto.js → monitor-Dw2i5QSQ.js} +20 -26
- package/dist/normalize-Bxwqo-bW.js +2 -0
- package/dist/{outbound-adapter-BT7Dkqni.js → outbound-adapter-ltiZkW9L.js} +4 -4
- package/dist/{outbound-base-ARCS45ql.js → outbound-base-E84SMkd9.js} +3 -3
- package/dist/{outbound-media-contract-ItL7G0Az.js → outbound-media-contract-ioTkt8tn.js} +3 -3
- package/dist/outbound-payload-test-api.js +1 -1
- package/dist/{quoted-message-C5vX90mp.js → quoted-message-CveINB35.js} +1 -1
- package/dist/{reaction-level-DeO7ktWb.js → reaction-level-BqMOEBeq.js} +1 -1
- package/dist/{resolve-outbound-target-Ba7sH80H.js → resolve-outbound-target-CV-iBmSG.js} +1 -1
- package/dist/runtime-api.js +13 -13
- package/dist/security-contract-api.js +1 -1
- package/dist/{send-BtGELs96.js → send-E_kMiuZP.js} +8 -8
- package/dist/{send-api-BvUGZEIA.js → send-api-CXPUXbUL.js} +6 -6
- package/dist/{session-DqDc1usL.js → session-CPsgRMMa.js} +18 -10
- package/dist/{session.runtime-BxyATGX0.js → session.runtime-C6uBkEaI.js} +1 -1
- package/dist/{setup-core-P6dnz4Ur.js → setup-core-Dm1hsI3r.js} +10 -10
- package/dist/{setup-finalize-DYm-2hSc.js → setup-finalize-BlTQrUj9.js} +8 -8
- package/dist/setup-plugin-api.js +1 -1
- package/dist/{setup-surface-Bq3gnUCD.js → setup-surface-DqY0LqAY.js} +4 -4
- package/dist/targets.js +1 -1
- package/dist/test-api.js +2 -2
- package/package.json +5 -5
- package/dist/creds-files-_2V8jzQa.js +0 -19
- package/dist/normalize-LMXvL6w0.js +0 -2
- /package/dist/{account-config-D3OXPtpW.js → account-config-Bxl16soz.js} +0 -0
- /package/dist/{account-ids-DgtV_RiP.js → account-ids-CB5SOWjc.js} +0 -0
- /package/dist/{audio-preflight.runtime-CIFjeaEN.js → audio-preflight.runtime-C_glQhZY.js} +0 -0
- /package/dist/{command-policy-O8sRnqUV.js → command-policy-BIOSHySD.js} +0 -0
- /package/dist/{config-schema-Dmo66Ubb.js → config-schema-CsNDlDpL.js} +0 -0
- /package/dist/{connection-controller-registry-D_iIGz5m.js → connection-controller-registry-TSX_udJp.js} +0 -0
- /package/dist/{constants-yKXGCGU9.js → constants-HU41RHGI.js} +0 -0
- /package/dist/{doctor-A9tXm9Om.js → doctor-By3SB4lm.js} +0 -0
- /package/dist/{group-session-contract-DdqigLJl.js → group-session-contract-DDnZSsJ1.js} +0 -0
- /package/dist/{normalize-target-MB6Z_4Bn.js → normalize-target-bVWjgftN.js} +0 -0
- /package/dist/{reply-resolver.runtime-CROyXXQh.js → reply-resolver.runtime-Ded8D58Y.js} +0 -0
- /package/dist/{rolldown-runtime-CiIaOW0V.js → rolldown-runtime-D7D4PA-g.js} +0 -0
- /package/dist/{runtime-6fZ67abR.js → runtime-CboC4QhQ.js} +0 -0
- /package/dist/{runtime-group-policy-BH_U23qp.js → runtime-group-policy-DeSRFXEV.js} +0 -0
- /package/dist/{security-contract-CvfWex9e.js → security-contract-nAzD945y.js} +0 -0
- /package/dist/{session-contract-B0efQf9P.js → session-contract-DMTm6Q_L.js} +0 -0
- /package/dist/{session-errors-KYQIoX8M.js → session-errors-BAj9D2La.js} +0 -0
- /package/dist/{state-migrations-CtdIArlK.js → state-migrations-D_BmQUR9.js} +0 -0
- /package/dist/{text-runtime-DyR0XOJ4.js → text-runtime-Dk37KYHj.js} +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { a as resolveWhatsAppAccount } from "./accounts-
|
|
2
|
-
import { l as isSelfChatMode, n as normalizeE164 } from "./text-runtime-
|
|
3
|
-
import { a as getSelfIdentity, o as getSenderIdentity } from "./identity-
|
|
4
|
-
import { t as resolveWhatsAppRuntimeGroupPolicy } from "./runtime-group-policy-
|
|
1
|
+
import { a as resolveWhatsAppAccount } from "./accounts-BPYgj8Fv.js";
|
|
2
|
+
import { l as isSelfChatMode, n as normalizeE164 } from "./text-runtime-Dk37KYHj.js";
|
|
3
|
+
import { a as getSelfIdentity, o as getSenderIdentity } from "./identity-xoLLdqEv.js";
|
|
4
|
+
import { t as resolveWhatsAppRuntimeGroupPolicy } from "./runtime-group-policy-DeSRFXEV.js";
|
|
5
5
|
import { defaultRuntime } from "openclaw/plugin-sdk/runtime-env";
|
|
6
6
|
import { resolveChannelGroupPolicy, resolveChannelGroupRequireMention } from "openclaw/plugin-sdk/channel-policy";
|
|
7
7
|
import { createChannelPairingChallengeIssuer } from "openclaw/plugin-sdk/channel-pairing";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { t as resolveMergedWhatsAppAccountConfig } from "./account-config-
|
|
2
|
-
import { n as listConfiguredAccountIds, r as resolveDefaultWhatsAppAccountId, t as listAccountIds } from "./account-ids-
|
|
3
|
-
import {
|
|
1
|
+
import { t as resolveMergedWhatsAppAccountConfig } from "./account-config-Bxl16soz.js";
|
|
2
|
+
import { n as listConfiguredAccountIds, r as resolveDefaultWhatsAppAccountId, t as listAccountIds } from "./account-ids-CB5SOWjc.js";
|
|
3
|
+
import { n as hasWebCredsRegularFileSync, r as hasWebCredsSync } from "./creds-files-B1kSWtBg.js";
|
|
4
4
|
import fs from "node:fs";
|
|
5
5
|
import path from "node:path";
|
|
6
6
|
import { DEFAULT_ACCOUNT_ID, normalizeAccountId, resolveUserPath } from "openclaw/plugin-sdk/account-core";
|
|
@@ -36,11 +36,7 @@ function resolveLegacyAuthDir() {
|
|
|
36
36
|
return resolveOAuthDir();
|
|
37
37
|
}
|
|
38
38
|
function legacyAuthExists(authDir) {
|
|
39
|
-
|
|
40
|
-
return fs.existsSync(path.join(authDir, "creds.json"));
|
|
41
|
-
} catch {
|
|
42
|
-
return false;
|
|
43
|
-
}
|
|
39
|
+
return hasWebCredsRegularFileSync(authDir);
|
|
44
40
|
}
|
|
45
41
|
function resolveWhatsAppAuthDir(params) {
|
|
46
42
|
const accountId = params.accountId.trim() || DEFAULT_ACCOUNT_ID;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { a as resolveWhatsAppAccount } from "./accounts-
|
|
2
|
-
import { t as resolveWhatsAppOutboundTarget } from "./resolve-outbound-target-
|
|
3
|
-
import { t as resolveWhatsAppReactionLevel } from "./reaction-level-
|
|
4
|
-
import { r as sendReactionWhatsApp } from "./send-
|
|
1
|
+
import { a as resolveWhatsAppAccount } from "./accounts-BPYgj8Fv.js";
|
|
2
|
+
import { t as resolveWhatsAppOutboundTarget } from "./resolve-outbound-target-CV-iBmSG.js";
|
|
3
|
+
import { t as resolveWhatsAppReactionLevel } from "./reaction-level-BqMOEBeq.js";
|
|
4
|
+
import { r as sendReactionWhatsApp } from "./send-E_kMiuZP.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-
|
|
1
|
+
import { t as handleWhatsAppAction } from "./action-runtime-D4UqEXqf.js";
|
|
2
2
|
export { handleWhatsAppAction };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as handleWhatsAppAction } from "./action-runtime-
|
|
1
|
+
import { t as handleWhatsAppAction } from "./action-runtime-D4UqEXqf.js";
|
|
2
2
|
export { handleWhatsAppAction };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { r as resolveDefaultWhatsAppAccountId } from "./account-ids-
|
|
2
|
-
import { t as getRegisteredWhatsAppConnectionController } from "./connection-controller-registry-
|
|
1
|
+
import { r as resolveDefaultWhatsAppAccountId } from "./account-ids-CB5SOWjc.js";
|
|
2
|
+
import { t as getRegisteredWhatsAppConnectionController } from "./connection-controller-registry-TSX_udJp.js";
|
|
3
3
|
//#region extensions/whatsapp/src/active-listener.ts
|
|
4
4
|
function resolveWebAccountId(params) {
|
|
5
5
|
return (params.accountId ?? "").trim() || resolveDefaultWhatsAppAccountId(params.cfg);
|
|
@@ -10,7 +10,6 @@ function createWhatsAppLoginTool() {
|
|
|
10
10
|
return {
|
|
11
11
|
label: "WhatsApp Login",
|
|
12
12
|
name: "whatsapp_login",
|
|
13
|
-
ownerOnly: true,
|
|
14
13
|
description: "Generate a WhatsApp QR code for linking, or wait for the scan to complete.",
|
|
15
14
|
parameters: Type.Object({
|
|
16
15
|
action: Type.Unsafe({
|
package/dist/api.js
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
import { r as resolveDefaultWhatsAppAccountId, t as listAccountIds } from "./account-ids-
|
|
2
|
-
import { a as resolveWhatsAppAccount, i as listWhatsAppAuthDirs, n as hasAnyWhatsAppAuth, o as resolveWhatsAppAuthDir, r as listEnabledWhatsAppAccounts, s as resolveWhatsAppMediaMaxBytes, t as DEFAULT_WHATSAPP_MEDIA_MAX_MB } from "./accounts-
|
|
3
|
-
import { a as normalizeWhatsAppAllowFromEntries, c as normalizeWhatsAppTarget, i as looksLikeWhatsAppTargetId, r as isWhatsAppUserTarget, s as normalizeWhatsAppMessagingTarget, t as isWhatsAppGroupJid } from "./normalize-target-
|
|
4
|
-
import { t as resolveWhatsAppOutboundTarget } from "./resolve-outbound-target-
|
|
5
|
-
import "./reaction-level-
|
|
6
|
-
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-
|
|
7
|
-
import "./send-
|
|
8
|
-
import { t as whatsappPlugin } from "./channel-
|
|
9
|
-
import { n as WHATSAPP_LEGACY_OUTBOUND_SEND_DEP_KEYS } from "./outbound-base-
|
|
10
|
-
import { t as whatsappCommandPolicy } from "./command-policy-
|
|
11
|
-
import { a as resolveWhatsAppGroupRequireMention, o as resolveWhatsAppGroupToolPolicy, s as resolveWhatsAppGroupIntroHint } from "./setup-core-
|
|
12
|
-
import "./config-schema-
|
|
13
|
-
import { t as whatsappSetupPlugin } from "./channel.setup-
|
|
14
|
-
import { t as DEFAULT_WEB_MEDIA_BYTES } from "./constants-
|
|
15
|
-
import { n as listWhatsAppDirectoryGroupsFromConfig, r as listWhatsAppDirectoryPeersFromConfig } from "./directory-config-
|
|
16
|
-
import { n as testing } from "./access-control-
|
|
17
|
-
import { p as extractText, t as createWebSendApi } from "./send-api-
|
|
18
|
-
import { r as waitForWaConnection, t as createWaSocket } from "./session-
|
|
1
|
+
import { r as resolveDefaultWhatsAppAccountId, t as listAccountIds } from "./account-ids-CB5SOWjc.js";
|
|
2
|
+
import { a as resolveWhatsAppAccount, i as listWhatsAppAuthDirs, n as hasAnyWhatsAppAuth, o as resolveWhatsAppAuthDir, r as listEnabledWhatsAppAccounts, s as resolveWhatsAppMediaMaxBytes, t as DEFAULT_WHATSAPP_MEDIA_MAX_MB } from "./accounts-BPYgj8Fv.js";
|
|
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
|
+
import { t as resolveWhatsAppOutboundTarget } from "./resolve-outbound-target-CV-iBmSG.js";
|
|
5
|
+
import "./reaction-level-BqMOEBeq.js";
|
|
6
|
+
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-BVMD1oZL.js";
|
|
9
|
+
import { n as WHATSAPP_LEGACY_OUTBOUND_SEND_DEP_KEYS } from "./outbound-base-E84SMkd9.js";
|
|
10
|
+
import { t as whatsappCommandPolicy } from "./command-policy-BIOSHySD.js";
|
|
11
|
+
import { a as resolveWhatsAppGroupRequireMention, o as resolveWhatsAppGroupToolPolicy, s as resolveWhatsAppGroupIntroHint } from "./setup-core-Dm1hsI3r.js";
|
|
12
|
+
import "./config-schema-CsNDlDpL.js";
|
|
13
|
+
import { t as whatsappSetupPlugin } from "./channel.setup-BDH3Mk5M.js";
|
|
14
|
+
import { t as DEFAULT_WEB_MEDIA_BYTES } from "./constants-HU41RHGI.js";
|
|
15
|
+
import { n as listWhatsAppDirectoryGroupsFromConfig, r as listWhatsAppDirectoryPeersFromConfig } from "./directory-config-CfLFAK54.js";
|
|
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";
|
|
19
19
|
import "openclaw/plugin-sdk/channel-actions";
|
|
20
20
|
import "openclaw/plugin-sdk/account-resolution";
|
|
21
21
|
import "openclaw/plugin-sdk/core";
|
package/dist/auth-presence.js
CHANGED
|
@@ -1,32 +1,42 @@
|
|
|
1
|
-
import { t as __exportAll } from "./rolldown-runtime-
|
|
2
|
-
import {
|
|
3
|
-
import { r as resolveUserPath } from "./text-runtime-
|
|
4
|
-
import { c as resolveComparableIdentity } from "./identity-
|
|
5
|
-
import fs from "node:fs";
|
|
1
|
+
import { t as __exportAll } from "./rolldown-runtime-D7D4PA-g.js";
|
|
2
|
+
import { a as readWebCredsJsonRawSync, c as statWebCredsFileSync, i as readWebCredsJsonRaw, o as resolveWebCredsBackupPath, s as resolveWebCredsPath, t as assertWebCredsPathRegularFileOrMissing } from "./creds-files-B1kSWtBg.js";
|
|
3
|
+
import { r as resolveUserPath } from "./text-runtime-Dk37KYHj.js";
|
|
4
|
+
import { c as resolveComparableIdentity } from "./identity-xoLLdqEv.js";
|
|
6
5
|
import path from "node:path";
|
|
7
6
|
import { resolveOAuthDir as resolveOAuthDir$1 } from "openclaw/plugin-sdk/state-paths";
|
|
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
|
|
11
|
-
import fs$1 from "node:fs/promises";
|
|
10
|
+
import fs from "node:fs/promises";
|
|
12
11
|
import { DEFAULT_ACCOUNT_ID } from "openclaw/plugin-sdk/routing";
|
|
13
12
|
//#region extensions/whatsapp/src/creds-persistence.ts
|
|
14
13
|
const CREDS_FILE_MODE = 384;
|
|
15
14
|
const CREDS_SAVE_FLUSH_TIMEOUT_MS = 15e3;
|
|
16
15
|
const credsSaveQueues = /* @__PURE__ */ new Map();
|
|
17
16
|
async function stringifyCreds(creds) {
|
|
18
|
-
const { BufferJSON } = await import("./session.runtime-
|
|
17
|
+
const { BufferJSON } = await import("./session.runtime-C6uBkEaI.js").then((n) => n.a);
|
|
19
18
|
return JSON.stringify(creds, BufferJSON.replacer);
|
|
20
19
|
}
|
|
21
|
-
async function
|
|
20
|
+
async function writeWebCredsRawAtomically(params) {
|
|
21
|
+
await assertWebCredsPathRegularFileOrMissing(params.filePath);
|
|
22
22
|
await replaceFileAtomic({
|
|
23
|
-
filePath:
|
|
24
|
-
content:
|
|
23
|
+
filePath: params.filePath,
|
|
24
|
+
content: params.content,
|
|
25
25
|
dirMode: 448,
|
|
26
26
|
mode: CREDS_FILE_MODE,
|
|
27
|
-
tempPrefix:
|
|
27
|
+
tempPrefix: params.tempPrefix,
|
|
28
28
|
syncTempFile: true,
|
|
29
|
-
syncParentDir: true
|
|
29
|
+
syncParentDir: true,
|
|
30
|
+
beforeRename: async ({ filePath }) => {
|
|
31
|
+
await assertWebCredsPathRegularFileOrMissing(filePath);
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
async function writeCredsJsonAtomically(authDir, creds) {
|
|
36
|
+
await writeWebCredsRawAtomically({
|
|
37
|
+
filePath: resolveWebCredsPath(authDir),
|
|
38
|
+
content: await stringifyCreds(creds),
|
|
39
|
+
tempPrefix: ".creds"
|
|
30
40
|
});
|
|
31
41
|
}
|
|
32
42
|
function enqueueCredsSave(authDir, saveCreds, onError) {
|
|
@@ -94,14 +104,7 @@ function resolveDefaultWebAuthDir() {
|
|
|
94
104
|
}
|
|
95
105
|
const WA_WEB_AUTH_DIR = resolveDefaultWebAuthDir();
|
|
96
106
|
function readCredsJsonRaw(filePath) {
|
|
97
|
-
|
|
98
|
-
if (!fs.existsSync(filePath)) return null;
|
|
99
|
-
const stats = fs.statSync(filePath);
|
|
100
|
-
if (!stats.isFile() || stats.size <= 1) return null;
|
|
101
|
-
return fs.readFileSync(filePath, "utf-8");
|
|
102
|
-
} catch {
|
|
103
|
-
return null;
|
|
104
|
-
}
|
|
107
|
+
return readWebCredsJsonRawSync(filePath);
|
|
105
108
|
}
|
|
106
109
|
async function waitForWebAuthBarrier(authDir, context) {
|
|
107
110
|
const result = await waitForCredsSaveQueueWithTimeout(authDir);
|
|
@@ -116,6 +119,11 @@ async function restoreCredsFromBackupIfNeeded(authDir) {
|
|
|
116
119
|
try {
|
|
117
120
|
const credsPath = resolveWebCredsPath(authDir);
|
|
118
121
|
const backupPath = resolveWebCredsBackupPath(authDir);
|
|
122
|
+
try {
|
|
123
|
+
await assertWebCredsPathRegularFileOrMissing(credsPath);
|
|
124
|
+
} catch {
|
|
125
|
+
return false;
|
|
126
|
+
}
|
|
119
127
|
const raw = readCredsJsonRaw(credsPath);
|
|
120
128
|
if (raw) {
|
|
121
129
|
JSON.parse(raw);
|
|
@@ -123,13 +131,10 @@ async function restoreCredsFromBackupIfNeeded(authDir) {
|
|
|
123
131
|
}
|
|
124
132
|
const backupRaw = readCredsJsonRaw(backupPath);
|
|
125
133
|
if (!backupRaw) return false;
|
|
126
|
-
if (!(await fs$1.lstat(backupPath).catch(() => null))?.isFile()) return false;
|
|
127
134
|
JSON.parse(backupRaw);
|
|
128
|
-
await
|
|
135
|
+
await writeWebCredsRawAtomically({
|
|
129
136
|
filePath: credsPath,
|
|
130
137
|
content: backupRaw,
|
|
131
|
-
dirMode: 448,
|
|
132
|
-
mode: 384,
|
|
133
138
|
tempPrefix: ".creds.restore"
|
|
134
139
|
});
|
|
135
140
|
logger.warn({ credsPath }, "restored corrupted WhatsApp creds.json from backup");
|
|
@@ -138,17 +143,9 @@ async function restoreCredsFromBackupIfNeeded(authDir) {
|
|
|
138
143
|
return false;
|
|
139
144
|
}
|
|
140
145
|
async function webAuthExists(authDir = resolveDefaultWebAuthDir()) {
|
|
141
|
-
const
|
|
142
|
-
|
|
143
|
-
try {
|
|
144
|
-
await fs$1.access(resolvedAuthDir);
|
|
145
|
-
} catch {
|
|
146
|
-
return false;
|
|
147
|
-
}
|
|
146
|
+
const raw = await readWebCredsJsonRaw(resolveWebCredsPath(resolveUserPath(authDir)));
|
|
147
|
+
if (!raw) return false;
|
|
148
148
|
try {
|
|
149
|
-
const stats = await fs$1.stat(credsPath);
|
|
150
|
-
if (!stats.isFile() || stats.size <= 1) return false;
|
|
151
|
-
const raw = await fs$1.readFile(credsPath, "utf-8");
|
|
152
149
|
JSON.parse(raw);
|
|
153
150
|
return true;
|
|
154
151
|
} catch {
|
|
@@ -222,25 +219,25 @@ function isBaileysAuthFileName(name) {
|
|
|
222
219
|
return /^(app-state-sync|session|sender-key|pre-key)-/.test(name);
|
|
223
220
|
}
|
|
224
221
|
async function clearBaileysAuthFiles(authDir) {
|
|
225
|
-
const rootStats = await fs
|
|
222
|
+
const rootStats = await fs.lstat(authDir).catch(() => null);
|
|
226
223
|
if (!rootStats?.isDirectory() || rootStats.isSymbolicLink()) return;
|
|
227
|
-
const entries = await fs
|
|
224
|
+
const entries = await fs.readdir(authDir, { withFileTypes: true });
|
|
228
225
|
await Promise.all(entries.map(async (entry) => {
|
|
229
226
|
if (!entry.isFile()) return;
|
|
230
227
|
if (!isBaileysAuthFileName(entry.name)) return;
|
|
231
|
-
await fs
|
|
228
|
+
await fs.rm(path.join(authDir, entry.name), { force: true });
|
|
232
229
|
}));
|
|
233
230
|
}
|
|
234
231
|
async function shouldClearOnLogout(authDir, isLegacyAuthDir) {
|
|
235
232
|
try {
|
|
236
|
-
const stats = await fs
|
|
233
|
+
const stats = await fs.lstat(authDir);
|
|
237
234
|
if (!stats.isDirectory() || stats.isSymbolicLink()) return false;
|
|
238
|
-
if (isLegacyAuthDir) return (await fs
|
|
235
|
+
if (isLegacyAuthDir) return (await fs.readdir(authDir, { withFileTypes: true })).some((entry) => {
|
|
239
236
|
if (!entry.isFile()) return false;
|
|
240
237
|
return isBaileysAuthFileName(entry.name);
|
|
241
238
|
});
|
|
242
|
-
if ((await fs
|
|
243
|
-
return (await fs
|
|
239
|
+
if ((await fs.lstat(resolveWebCredsPath(authDir)).catch(() => null))?.isFile()) return true;
|
|
240
|
+
return (await fs.lstat(resolveWebCredsBackupPath(authDir)).catch(() => null))?.isFile() === true;
|
|
244
241
|
} catch (error) {
|
|
245
242
|
const codeValue = error && typeof error === "object" && "code" in error ? error.code : void 0;
|
|
246
243
|
return (typeof codeValue === "string" ? codeValue : "") !== "ENOENT";
|
|
@@ -255,7 +252,7 @@ async function pathHasSymlinkComponent(baseDir, targetPath) {
|
|
|
255
252
|
let currentPath = baseDir;
|
|
256
253
|
for (const segment of relativePath.split(path.sep)) {
|
|
257
254
|
currentPath = path.join(currentPath, segment);
|
|
258
|
-
const stats = await fs
|
|
255
|
+
const stats = await fs.lstat(currentPath).catch(() => null);
|
|
259
256
|
if (!stats || stats.isSymbolicLink()) return true;
|
|
260
257
|
}
|
|
261
258
|
return false;
|
|
@@ -264,14 +261,14 @@ async function isLegacyWebAuthDir(authDir) {
|
|
|
264
261
|
const legacyAuthDir = path.resolve(resolveOAuthDir$1());
|
|
265
262
|
const resolvedAuthDir = path.resolve(authDir);
|
|
266
263
|
if (resolvedAuthDir !== legacyAuthDir) return false;
|
|
267
|
-
const stats = await fs
|
|
264
|
+
const stats = await fs.lstat(resolvedAuthDir).catch(() => null);
|
|
268
265
|
return stats?.isDirectory() === true && !stats.isSymbolicLink();
|
|
269
266
|
}
|
|
270
267
|
async function classifyWebAuthDirOwnership(authDir) {
|
|
271
268
|
const whatsappAuthBase = path.resolve(resolveOAuthDir$1(), "whatsapp");
|
|
272
269
|
const resolvedAuthDir = path.resolve(authDir);
|
|
273
270
|
if (!isPathInsideDirectory(whatsappAuthBase, resolvedAuthDir)) return { kind: "external" };
|
|
274
|
-
const [baseRealPath, authDirRealPath] = await Promise.all([fs
|
|
271
|
+
const [baseRealPath, authDirRealPath] = await Promise.all([fs.realpath(whatsappAuthBase).catch(() => null), fs.realpath(resolvedAuthDir).catch(() => null)]);
|
|
275
272
|
if (!baseRealPath || !authDirRealPath) return { kind: "unsafe-owned" };
|
|
276
273
|
if (!isPathInsideDirectory(baseRealPath, authDirRealPath)) return { kind: "unsafe-owned" };
|
|
277
274
|
if (await pathHasSymlinkComponent(whatsappAuthBase, resolvedAuthDir)) return { kind: "unsafe-owned" };
|
|
@@ -296,7 +293,7 @@ async function logoutWeb(params) {
|
|
|
296
293
|
await clearBaileysAuthFiles(resolvedAuthDir);
|
|
297
294
|
} else {
|
|
298
295
|
const ownership = await classifyWebAuthDirOwnership(resolvedAuthDir);
|
|
299
|
-
if (ownership.kind === "owned") await fs
|
|
296
|
+
if (ownership.kind === "owned") await fs.rm(ownership.authDir, {
|
|
300
297
|
recursive: true,
|
|
301
298
|
force: true
|
|
302
299
|
});
|
|
@@ -313,9 +310,8 @@ async function logoutWeb(params) {
|
|
|
313
310
|
}
|
|
314
311
|
function readWebSelfId(authDir = resolveDefaultWebAuthDir()) {
|
|
315
312
|
try {
|
|
316
|
-
const
|
|
317
|
-
if (!
|
|
318
|
-
const raw = fs.readFileSync(credsPath, "utf-8");
|
|
313
|
+
const raw = readCredsJsonRaw(resolveWebCredsPath(resolveUserPath(authDir)));
|
|
314
|
+
if (!raw) return emptyWebSelfId();
|
|
319
315
|
const parsed = JSON.parse(raw);
|
|
320
316
|
const identity = resolveComparableIdentity({
|
|
321
317
|
jid: parsed?.me?.id ?? null,
|
|
@@ -332,19 +328,18 @@ function readWebSelfId(authDir = resolveDefaultWebAuthDir()) {
|
|
|
332
328
|
}
|
|
333
329
|
async function readWebSelfIdentity(authDir = resolveDefaultWebAuthDir(), fallback) {
|
|
334
330
|
const resolvedAuthDir = resolveUserPath(authDir);
|
|
335
|
-
|
|
336
|
-
|
|
331
|
+
const raw = await readWebCredsJsonRaw(resolveWebCredsPath(resolvedAuthDir));
|
|
332
|
+
if (raw) try {
|
|
337
333
|
const parsed = JSON.parse(raw);
|
|
338
334
|
return resolveComparableIdentity({
|
|
339
335
|
jid: parsed?.me?.id ?? null,
|
|
340
336
|
lid: parsed?.me?.lid ?? null
|
|
341
337
|
}, resolvedAuthDir);
|
|
342
|
-
} catch {
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
}
|
|
338
|
+
} catch {}
|
|
339
|
+
return resolveComparableIdentity({
|
|
340
|
+
jid: fallback?.id ?? null,
|
|
341
|
+
lid: fallback?.lid ?? null
|
|
342
|
+
}, resolvedAuthDir);
|
|
348
343
|
}
|
|
349
344
|
async function readWebSelfIdentityForDecision(authDir = resolveDefaultWebAuthDir(), fallback) {
|
|
350
345
|
const resolvedAuthDir = resolveUserPath(authDir);
|
|
@@ -359,12 +354,8 @@ async function readWebSelfIdentityForDecision(authDir = resolveDefaultWebAuthDir
|
|
|
359
354
|
* Helpful for heartbeats/observability to spot stale credentials.
|
|
360
355
|
*/
|
|
361
356
|
function getWebAuthAgeMs(authDir = resolveDefaultWebAuthDir()) {
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
return Date.now() - stats.mtimeMs;
|
|
365
|
-
} catch {
|
|
366
|
-
return null;
|
|
367
|
-
}
|
|
357
|
+
const stats = statWebCredsFileSync(resolveWebCredsPath(resolveUserPath(authDir)));
|
|
358
|
+
return stats ? Math.max(0, Date.now() - stats.mtimeMs) : null;
|
|
368
359
|
}
|
|
369
360
|
function logWebSelfId(authDir = resolveDefaultWebAuthDir(), runtime = defaultRuntime, includeChannelPrefix = false) {
|
|
370
361
|
const { e164, jid, lid } = readWebSelfId(authDir);
|
|
@@ -381,4 +372,4 @@ async function pickWebChannel(pref, authDir = resolveDefaultWebAuthDir()) {
|
|
|
381
372
|
return choice;
|
|
382
373
|
}
|
|
383
374
|
//#endregion
|
|
384
|
-
export { waitForCredsSaveQueue as C, enqueueCredsSave as S, writeCredsJsonAtomically as T, readWebSelfIdentity as _, formatWhatsAppWebAuthStatusState as a, restoreCredsFromBackupIfNeeded as b, logoutWeb as c, readWebAuthExistsBestEffort as d, readWebAuthExistsForDecision as f, readWebSelfId as g, readWebAuthState as h, auth_store_exports as i, pickWebChannel as l, readWebAuthSnapshotBestEffort as m, WHATSAPP_AUTH_UNSTABLE_CODE as n, getWebAuthAgeMs as o, readWebAuthSnapshot as p, WhatsAppAuthUnstableError as r, logWebSelfId as s, WA_WEB_AUTH_DIR as t, readCredsJsonRaw as u, readWebSelfIdentityForDecision as v, waitForCredsSaveQueueWithTimeout as w, webAuthExists as x, resolveDefaultWebAuthDir as y };
|
|
375
|
+
export { waitForCredsSaveQueue as C, writeWebCredsRawAtomically as E, enqueueCredsSave as S, writeCredsJsonAtomically as T, readWebSelfIdentity as _, formatWhatsAppWebAuthStatusState as a, restoreCredsFromBackupIfNeeded as b, logoutWeb as c, readWebAuthExistsBestEffort as d, readWebAuthExistsForDecision as f, readWebSelfId as g, readWebAuthState as h, auth_store_exports as i, pickWebChannel as l, readWebAuthSnapshotBestEffort as m, WHATSAPP_AUTH_UNSTABLE_CODE as n, getWebAuthAgeMs as o, readWebAuthSnapshot as p, WhatsAppAuthUnstableError as r, logWebSelfId as s, WA_WEB_AUTH_DIR as t, readCredsJsonRaw as u, readWebSelfIdentityForDecision as v, waitForCredsSaveQueueWithTimeout as w, webAuthExists as x, resolveDefaultWebAuthDir as y };
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import { t as listAccountIds } from "./account-ids-
|
|
2
|
-
import { a as resolveWhatsAppAccount } from "./accounts-
|
|
3
|
-
import { c as normalizeWhatsAppTarget, i as looksLikeWhatsAppTargetId, n as isWhatsAppNewsletterJid, o as normalizeWhatsAppAllowFromEntry, s as normalizeWhatsAppMessagingTarget, t as isWhatsAppGroupJid } from "./normalize-target-
|
|
4
|
-
import { t as resolveWhatsAppOutboundTarget } from "./resolve-outbound-target-
|
|
5
|
-
import { t as resolveWhatsAppReactionLevel } from "./reaction-level-
|
|
6
|
-
import { r as normalizeWhatsAppPayloadTextPreservingIndentation } from "./outbound-media-contract-
|
|
7
|
-
import "./normalize-
|
|
8
|
-
import { i as sendTypingWhatsApp, n as sendPollWhatsApp, t as sendMessageWhatsApp } from "./send-
|
|
9
|
-
import { t as createWhatsAppLoginTool } from "./agent-tools-login-
|
|
10
|
-
import { t as createWhatsAppOutboundBase } from "./outbound-base-
|
|
11
|
-
import { t as getWhatsAppRuntime } from "./runtime-
|
|
12
|
-
import { t as whatsappCommandPolicy } from "./command-policy-
|
|
13
|
-
import { a as resolveWhatsAppGroupRequireMention, c as resolveWhatsAppMentionStripRegexes, i as whatsappSetupWizardProxy, l as formatWhatsAppConfigAllowFromEntries, n as createWhatsAppPluginBase, o as resolveWhatsAppGroupToolPolicy, r as loadWhatsAppChannelRuntime, s as resolveWhatsAppGroupIntroHint, t as whatsappSetupAdapter } from "./setup-core-
|
|
14
|
-
import { f as readWebAuthExistsForDecision, n as WHATSAPP_AUTH_UNSTABLE_CODE } from "./auth-store-
|
|
15
|
-
import { t as detectWhatsAppLegacyStateMigrations } from "./state-migrations-
|
|
1
|
+
import { t as listAccountIds } from "./account-ids-CB5SOWjc.js";
|
|
2
|
+
import { a as resolveWhatsAppAccount } from "./accounts-BPYgj8Fv.js";
|
|
3
|
+
import { c as normalizeWhatsAppTarget, i as looksLikeWhatsAppTargetId, n as isWhatsAppNewsletterJid, o as normalizeWhatsAppAllowFromEntry, s as normalizeWhatsAppMessagingTarget, t as isWhatsAppGroupJid } from "./normalize-target-bVWjgftN.js";
|
|
4
|
+
import { t as resolveWhatsAppOutboundTarget } from "./resolve-outbound-target-CV-iBmSG.js";
|
|
5
|
+
import { t as resolveWhatsAppReactionLevel } from "./reaction-level-BqMOEBeq.js";
|
|
6
|
+
import { r as normalizeWhatsAppPayloadTextPreservingIndentation } from "./outbound-media-contract-ioTkt8tn.js";
|
|
7
|
+
import "./normalize-Bxwqo-bW.js";
|
|
8
|
+
import { i as sendTypingWhatsApp, n as sendPollWhatsApp, t as sendMessageWhatsApp } from "./send-E_kMiuZP.js";
|
|
9
|
+
import { t as createWhatsAppLoginTool } from "./agent-tools-login-BDzvb3ee.js";
|
|
10
|
+
import { t as createWhatsAppOutboundBase } from "./outbound-base-E84SMkd9.js";
|
|
11
|
+
import { t as getWhatsAppRuntime } from "./runtime-CboC4QhQ.js";
|
|
12
|
+
import { t as whatsappCommandPolicy } from "./command-policy-BIOSHySD.js";
|
|
13
|
+
import { a as resolveWhatsAppGroupRequireMention, c as resolveWhatsAppMentionStripRegexes, i as whatsappSetupWizardProxy, l as formatWhatsAppConfigAllowFromEntries, n as createWhatsAppPluginBase, o as resolveWhatsAppGroupToolPolicy, r as loadWhatsAppChannelRuntime, s as resolveWhatsAppGroupIntroHint, t as whatsappSetupAdapter } from "./setup-core-Dm1hsI3r.js";
|
|
14
|
+
import { f as readWebAuthExistsForDecision, n as WHATSAPP_AUTH_UNSTABLE_CODE } from "./auth-store-GTQvJznL.js";
|
|
15
|
+
import { t as detectWhatsAppLegacyStateMigrations } from "./state-migrations-D_BmQUR9.js";
|
|
16
16
|
import { createActionGate as createActionGate$1 } from "openclaw/plugin-sdk/channel-actions";
|
|
17
17
|
import { asString, collectIssuesForEnabledAccounts, createAsyncComputedAccountStatusAdapter, createDefaultChannelRuntimeState, isRecord } from "openclaw/plugin-sdk/status-helpers";
|
|
18
18
|
import { formatCliCommand } from "openclaw/plugin-sdk/cli-runtime";
|
|
@@ -322,8 +322,8 @@ function collectWhatsAppStatusIssues(accounts) {
|
|
|
322
322
|
}
|
|
323
323
|
//#endregion
|
|
324
324
|
//#region extensions/whatsapp/src/channel.ts
|
|
325
|
-
const loadWhatsAppDirectoryConfig = createLazyRuntimeModule(() => import("./directory-config-
|
|
326
|
-
const loadWhatsAppChannelReactAction = createLazyRuntimeModule(() => import("./channel-react-action-
|
|
325
|
+
const loadWhatsAppDirectoryConfig = createLazyRuntimeModule(() => import("./directory-config-CfLFAK54.js").then((n) => n.t));
|
|
326
|
+
const loadWhatsAppChannelReactAction = createLazyRuntimeModule(() => import("./channel-react-action-CHdR3gbn.js"));
|
|
327
327
|
function parseWhatsAppExplicitTarget(raw) {
|
|
328
328
|
const normalized = normalizeWhatsAppTarget(raw);
|
|
329
329
|
if (!normalized) return null;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as WhatsAppChannelConfigSchema } from "./config-schema-
|
|
1
|
+
import { t as WhatsAppChannelConfigSchema } from "./config-schema-CsNDlDpL.js";
|
|
2
2
|
export { WhatsAppChannelConfigSchema };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as whatsappPlugin } from "./channel-
|
|
1
|
+
import { t as whatsappPlugin } from "./channel-BVMD1oZL.js";
|
|
2
2
|
export { whatsappPlugin };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { a as resolveWhatsAppAccount, s as resolveWhatsAppMediaMaxBytes } from "./accounts-
|
|
2
|
-
import { c as normalizeWhatsAppTarget, t as isWhatsAppGroupJid } from "./normalize-target-
|
|
3
|
-
import { r as resolveAuthorizedWhatsAppOutboundTarget, t as handleWhatsAppAction } from "./action-runtime-
|
|
4
|
-
import "./normalize-
|
|
5
|
-
import { t as sendMessageWhatsApp } from "./send-
|
|
1
|
+
import { a as resolveWhatsAppAccount, s as resolveWhatsAppMediaMaxBytes } from "./accounts-BPYgj8Fv.js";
|
|
2
|
+
import { c as normalizeWhatsAppTarget, t as isWhatsAppGroupJid } from "./normalize-target-bVWjgftN.js";
|
|
3
|
+
import { r as resolveAuthorizedWhatsAppOutboundTarget, t as handleWhatsAppAction } from "./action-runtime-D4UqEXqf.js";
|
|
4
|
+
import "./normalize-Bxwqo-bW.js";
|
|
5
|
+
import { t as sendMessageWhatsApp } from "./send-E_kMiuZP.js";
|
|
6
6
|
import { jsonResult, readStringOrNumberParam, readStringParam as readStringParam$1, resolveReactionMessageId } from "openclaw/plugin-sdk/channel-actions";
|
|
7
7
|
//#region extensions/whatsapp/src/channel-react-action.ts
|
|
8
8
|
const WHATSAPP_CHANNEL = "whatsapp";
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { startWebLoginWithQr as startWebLoginWithQr$1, waitForWebLogin as waitForWebLogin$1 } from "./login-qr-runtime.js";
|
|
2
|
-
import { c as logoutWeb$1, d as readWebAuthExistsBestEffort$1, f as readWebAuthExistsForDecision$1, g as readWebSelfId$1, h as readWebAuthState$1, m as readWebAuthSnapshotBestEffort$1, o as getWebAuthAgeMs$1, p as readWebAuthSnapshot$1, s as logWebSelfId$1, x as webAuthExists$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 { c as logoutWeb$1, d as readWebAuthExistsBestEffort$1, f as readWebAuthExistsForDecision$1, g as readWebSelfId$1, h as readWebAuthState$1, m as readWebAuthSnapshotBestEffort$1, o as getWebAuthAgeMs$1, p as readWebAuthSnapshot$1, s as logWebSelfId$1, x as webAuthExists$1 } from "./auth-store-GTQvJznL.js";
|
|
3
|
+
import { t as getActiveWebListener$1 } from "./active-listener-B4SDebQ6.js";
|
|
4
|
+
import { t as monitorWebChannel$1 } from "./monitor-Dw2i5QSQ.js";
|
|
5
|
+
import { t as loginWeb$1 } from "./login-nJwaNuC-.js";
|
|
6
|
+
import { whatsappSetupWizard as whatsappSetupWizard$1 } from "./setup-surface-DqY0LqAY.js";
|
|
7
7
|
//#region extensions/whatsapp/src/channel.runtime.ts
|
|
8
8
|
function getActiveWebListener(...args) {
|
|
9
9
|
return getActiveWebListener$1(...args);
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { a as resolveWhatsAppGroupRequireMention, i as whatsappSetupWizardProxy, n as createWhatsAppPluginBase, o as resolveWhatsAppGroupToolPolicy, s as resolveWhatsAppGroupIntroHint, t as whatsappSetupAdapter } from "./setup-core-
|
|
2
|
-
import { t as detectWhatsAppLegacyStateMigrations } from "./state-migrations-
|
|
1
|
+
import { a as resolveWhatsAppGroupRequireMention, i as whatsappSetupWizardProxy, n as createWhatsAppPluginBase, o as resolveWhatsAppGroupToolPolicy, s as resolveWhatsAppGroupIntroHint, t as whatsappSetupAdapter } from "./setup-core-Dm1hsI3r.js";
|
|
2
|
+
import { t as detectWhatsAppLegacyStateMigrations } from "./state-migrations-D_BmQUR9.js";
|
|
3
3
|
//#region extensions/whatsapp/src/channel.setup.ts
|
|
4
4
|
async function isWhatsAppAuthConfigured(account) {
|
|
5
|
-
const { readWebAuthState } = await import("./auth-store-
|
|
5
|
+
const { readWebAuthState } = await import("./auth-store-GTQvJznL.js").then((n) => n.i);
|
|
6
6
|
return await readWebAuthState(account.authDir) === "linked";
|
|
7
7
|
}
|
|
8
8
|
const whatsappSetupPlugin = {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { n as registerWhatsAppConnectionController, r as unregisterWhatsAppConnectionController } from "./connection-controller-registry-
|
|
2
|
-
import { n as getStatusCode, t as formatError } from "./session-errors-
|
|
3
|
-
import { c as logoutWeb } from "./auth-store-
|
|
4
|
-
import { r as waitForWaConnection, t as createWaSocket } from "./session-
|
|
1
|
+
import { n as registerWhatsAppConnectionController, r as unregisterWhatsAppConnectionController } from "./connection-controller-registry-TSX_udJp.js";
|
|
2
|
+
import { n as getStatusCode, t as formatError } from "./session-errors-BAj9D2La.js";
|
|
3
|
+
import { c as logoutWeb } from "./auth-store-GTQvJznL.js";
|
|
4
|
+
import { r as waitForWaConnection, t as createWaSocket } from "./session-CPsgRMMa.js";
|
|
5
5
|
import { computeBackoff, info, sleepWithAbort } from "openclaw/plugin-sdk/runtime-env";
|
|
6
6
|
import { clamp } from "openclaw/plugin-sdk/text-utility-runtime";
|
|
7
7
|
import { DisconnectReason } from "baileys";
|
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-HU41RHGI.js";
|
|
2
2
|
export { DEFAULT_WEB_MEDIA_BYTES };
|
package/dist/contract-api.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { c as normalizeWhatsAppTarget$1, t as isWhatsAppGroupJid$1 } from "./normalize-target-
|
|
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 { n as testing } from "./access-control-
|
|
1
|
+
import { c as normalizeWhatsAppTarget$1, t as isWhatsAppGroupJid$1 } from "./normalize-target-bVWjgftN.js";
|
|
2
|
+
import { t as whatsappCommandPolicy$1 } from "./command-policy-BIOSHySD.js";
|
|
3
|
+
import { t as resolveLegacyGroupSessionKey$1 } from "./group-session-contract-DDnZSsJ1.js";
|
|
4
|
+
import { n as unsupportedSecretRefSurfacePatterns, t as collectUnsupportedSecretRefConfigCandidates } from "./security-contract-nAzD945y.js";
|
|
5
|
+
import { r as isLegacyGroupSessionKey$1, t as canonicalizeLegacySessionKey$1 } from "./session-contract-DMTm6Q_L.js";
|
|
6
|
+
import { n as listWhatsAppDirectoryGroupsFromConfig, r as listWhatsAppDirectoryPeersFromConfig } from "./directory-config-CfLFAK54.js";
|
|
7
|
+
import { t as resolveWhatsAppRuntimeGroupPolicy$1 } from "./runtime-group-policy-DeSRFXEV.js";
|
|
8
|
+
import { n as testing } from "./access-control-p_vcYDW7.js";
|
|
9
9
|
//#region extensions/whatsapp/contract-api.ts
|
|
10
10
|
const canonicalizeLegacySessionKey = canonicalizeLegacySessionKey$1;
|
|
11
11
|
const isLegacyGroupSessionKey = isLegacyGroupSessionKey$1;
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import path from "node:path";
|
|
2
|
+
import { assertNoSymlinkParents, assertNoSymlinkParentsSync, readRegularFile, readRegularFileSync, statRegularFile, statRegularFileSync } from "openclaw/plugin-sdk/security-runtime";
|
|
3
|
+
//#region extensions/whatsapp/src/creds-files.ts
|
|
4
|
+
function resolveWebCredsPath(authDir) {
|
|
5
|
+
return path.join(authDir, "creds.json");
|
|
6
|
+
}
|
|
7
|
+
function resolveWebCredsBackupPath(authDir) {
|
|
8
|
+
return path.join(authDir, "creds.json.bak");
|
|
9
|
+
}
|
|
10
|
+
function resolveWebCredsParentCheck(filePath) {
|
|
11
|
+
const dir = path.resolve(path.dirname(filePath));
|
|
12
|
+
return {
|
|
13
|
+
rootDir: path.parse(dir).root,
|
|
14
|
+
targetPath: dir,
|
|
15
|
+
allowMissing: true,
|
|
16
|
+
allowRootChildSymlink: true,
|
|
17
|
+
requireDirectories: true,
|
|
18
|
+
messagePrefix: "WhatsApp credential file path"
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
async function assertWebCredsParentPathSafe(filePath) {
|
|
22
|
+
await assertNoSymlinkParents(resolveWebCredsParentCheck(filePath));
|
|
23
|
+
}
|
|
24
|
+
function assertWebCredsParentPathSafeSync(filePath) {
|
|
25
|
+
assertNoSymlinkParentsSync(resolveWebCredsParentCheck(filePath));
|
|
26
|
+
}
|
|
27
|
+
async function assertWebCredsPathRegularFileOrMissing(filePath) {
|
|
28
|
+
try {
|
|
29
|
+
await assertWebCredsParentPathSafe(filePath);
|
|
30
|
+
await statRegularFile(filePath);
|
|
31
|
+
} catch (error) {
|
|
32
|
+
throw new Error(`WhatsApp credential file path is unsafe; creds.json must be a regular file or missing: ${filePath}`, { cause: error });
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
function readWebCredsJsonRawSync(filePath) {
|
|
36
|
+
try {
|
|
37
|
+
assertWebCredsParentPathSafeSync(filePath);
|
|
38
|
+
const { buffer, stat } = readRegularFileSync({ filePath });
|
|
39
|
+
return stat.size > 1 ? buffer.toString("utf-8") : null;
|
|
40
|
+
} catch {
|
|
41
|
+
return null;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
async function readWebCredsJsonRaw(filePath) {
|
|
45
|
+
try {
|
|
46
|
+
await assertWebCredsParentPathSafe(filePath);
|
|
47
|
+
const { buffer, stat } = await readRegularFile({ filePath });
|
|
48
|
+
return stat.size > 1 ? buffer.toString("utf-8") : null;
|
|
49
|
+
} catch {
|
|
50
|
+
return null;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
function statWebCredsFileSync(filePath) {
|
|
54
|
+
try {
|
|
55
|
+
assertWebCredsParentPathSafeSync(filePath);
|
|
56
|
+
const result = statRegularFileSync(filePath);
|
|
57
|
+
if (result.missing || result.stat.size <= 1) return null;
|
|
58
|
+
return {
|
|
59
|
+
mtimeMs: result.stat.mtimeMs,
|
|
60
|
+
size: result.stat.size
|
|
61
|
+
};
|
|
62
|
+
} catch {
|
|
63
|
+
return null;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
function hasWebCredsRegularFileSync(authDir) {
|
|
67
|
+
try {
|
|
68
|
+
const credsPath = resolveWebCredsPath(authDir);
|
|
69
|
+
assertWebCredsParentPathSafeSync(credsPath);
|
|
70
|
+
return !statRegularFileSync(credsPath).missing;
|
|
71
|
+
} catch {
|
|
72
|
+
return false;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
function hasWebCredsSync(authDir) {
|
|
76
|
+
return statWebCredsFileSync(resolveWebCredsPath(authDir)) !== null;
|
|
77
|
+
}
|
|
78
|
+
//#endregion
|
|
79
|
+
export { readWebCredsJsonRawSync as a, statWebCredsFileSync as c, readWebCredsJsonRaw as i, hasWebCredsRegularFileSync as n, resolveWebCredsBackupPath as o, hasWebCredsSync as r, resolveWebCredsPath as s, assertWebCredsPathRegularFileOrMissing as t };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { t as __exportAll } from "./rolldown-runtime-
|
|
2
|
-
import { t as resolveMergedWhatsAppAccountConfig } from "./account-config-
|
|
3
|
-
import { c as normalizeWhatsAppTarget, t as isWhatsAppGroupJid } from "./normalize-target-
|
|
4
|
-
import "./normalize-
|
|
1
|
+
import { t as __exportAll } from "./rolldown-runtime-D7D4PA-g.js";
|
|
2
|
+
import { t as resolveMergedWhatsAppAccountConfig } from "./account-config-Bxl16soz.js";
|
|
3
|
+
import { c as normalizeWhatsAppTarget, t as isWhatsAppGroupJid } from "./normalize-target-bVWjgftN.js";
|
|
4
|
+
import "./normalize-Bxwqo-bW.js";
|
|
5
5
|
import { listResolvedDirectoryGroupEntriesFromMapKeys, listResolvedDirectoryUserEntriesFromAllowFrom } from "openclaw/plugin-sdk/directory-config-runtime";
|
|
6
6
|
//#region extensions/whatsapp/src/directory-config.ts
|
|
7
7
|
var directory_config_exports = /* @__PURE__ */ __exportAll({
|
|
@@ -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-CfLFAK54.js";
|
|
2
2
|
export { listWhatsAppDirectoryGroupsFromConfig, listWhatsAppDirectoryPeersFromConfig };
|