@openclaw/whatsapp 2026.8.1-beta.2 → 2026.8.1-beta.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/action-runtime-api.js +1 -1
- package/dist/{action-runtime-B4e3XFOY.js → action-runtime-pM-ExU0l.js} +1 -1
- package/dist/action-runtime.runtime.js +1 -1
- package/dist/api.js +6 -6
- package/dist/{approval-handler.runtime-fgGZhALv.js → approval-handler.runtime-CkMMvUjk.js} +2 -2
- package/dist/{approval-reactions-CmtJCxe_.js → approval-reactions-Jyr1JaAK.js} +9 -13
- package/dist/{auth-store-B_DQIdzp.js → auth-store-CtpBqH5S.js} +3 -6
- package/dist/{channel-DJVQHz_V.js → channel-DRMYRfZ8.js} +7 -7
- package/dist/channel-plugin-api.js +1 -1
- package/dist/{channel-react-action-d6OacTNj.js → channel-react-action-CstrR0CT.js} +13 -11
- package/dist/{channel.runtime-RxuNGZ7w.js → channel.runtime-X3JC2gaq.js} +4 -4
- package/dist/{channel.setup-Cmvd967u.js → channel.setup-DhBBhbQv.js} +1 -1
- package/dist/{connection-controller-CUyZgGpf.js → connection-controller-CIYuBJrs.js} +2 -2
- package/dist/{directory-config-Pc4f07wB.js → directory-config-P7_3U73Z.js} +2 -2
- package/dist/directory-contract-api.js +1 -1
- package/dist/light-runtime-api.js +1 -1
- package/dist/{login-D6_rfxTZ.js → login-BkpKpndm.js} +3 -3
- package/dist/{login-qr-B0VyVSqQ.js → login-qr-1dpv6jjT.js} +3 -3
- package/dist/login-qr-runtime.js +1 -1
- package/dist/{monitor-BCe5Mm-1.js → monitor-IzwQKizW.js} +44 -459
- package/dist/runtime-api.js +7 -7
- package/dist/{send-prK8F7Vj.js → send-CwvTU4RI.js} +22 -8
- package/dist/{send-api-DimZST3E.js → send-api-obOSm2cC.js} +44 -34
- package/dist/{setup-finalize-D3n71Uyx.js → setup-finalize-n4K2I2gJ.js} +2 -2
- package/dist/setup-plugin-api.js +1 -1
- package/dist/{setup-surface-BCZszf3l.js → setup-surface-Cwn3zyxK.js} +2 -2
- package/dist/{shared-Dp9M3ZPX.js → shared-wg42NKFB.js} +11 -5
- package/dist/{socket-close-09FojDO2.js → socket-close-2T0_jZTN.js} +1 -1
- package/package.json +4 -4
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as handleWhatsAppAction } from "./action-runtime-
|
|
1
|
+
import { t as handleWhatsAppAction } from "./action-runtime-pM-ExU0l.js";
|
|
2
2
|
export { handleWhatsAppAction };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { a as resolveWhatsAppAccount } from "./accounts-BX2fZUyR.js";
|
|
2
2
|
import { t as resolveWhatsAppOutboundTarget } from "./resolve-outbound-target-1GqbT1uX.js";
|
|
3
|
-
import {
|
|
3
|
+
import { r as sendReactionWhatsApp, v as resolveWhatsAppReactionLevel } from "./send-CwvTU4RI.js";
|
|
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) {
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as handleWhatsAppAction } from "./action-runtime-
|
|
1
|
+
import { t as handleWhatsAppAction } from "./action-runtime-pM-ExU0l.js";
|
|
2
2
|
export { handleWhatsAppAction };
|
package/dist/api.js
CHANGED
|
@@ -4,15 +4,15 @@ import { a as normalizeWhatsAppAllowFromEntries, c as normalizeWhatsAppTarget, i
|
|
|
4
4
|
import { t as resolveWhatsAppOutboundTarget } from "./resolve-outbound-target-1GqbT1uX.js";
|
|
5
5
|
import { c as toWhatsappJid, i as markdownToWhatsApp, l as toWhatsappJidWithLid, n as isSelfChatMode, r as jidToE164, s as resolveJidToE164, t as assertWebChannel } from "./targets-runtime-TMk0lGuy.js";
|
|
6
6
|
import { n as resolveUserPath, t as normalizeE164 } from "./text-runtime-CaKLhowd.js";
|
|
7
|
-
import { n as WHATSAPP_LEGACY_OUTBOUND_SEND_DEP_KEYS, t as whatsappPlugin } from "./channel-
|
|
8
|
-
import { a as resolveWhatsAppGroupRequireMention, o as resolveWhatsAppGroupToolPolicy } from "./shared-
|
|
7
|
+
import { n as WHATSAPP_LEGACY_OUTBOUND_SEND_DEP_KEYS, t as whatsappPlugin } from "./channel-DRMYRfZ8.js";
|
|
8
|
+
import { a as resolveWhatsAppGroupRequireMention, o as resolveWhatsAppGroupToolPolicy } from "./shared-wg42NKFB.js";
|
|
9
9
|
import { t as whatsappCommandPolicy } from "./command-policy-BIOSHySD.js";
|
|
10
|
-
import { t as whatsappSetupPlugin } from "./channel.setup-
|
|
10
|
+
import { t as whatsappSetupPlugin } from "./channel.setup-DhBBhbQv.js";
|
|
11
11
|
import { t as DEFAULT_WEB_MEDIA_BYTES } from "./constants-HU41RHGI.js";
|
|
12
|
-
import { a as waitForWaConnection, o as DEFAULT_WHATSAPP_SOCKET_TIMING, r as createWaSocket, s as createWhatsAppSocketOperationTimeoutAdapter } from "./socket-close-
|
|
12
|
+
import { a as waitForWaConnection, o as DEFAULT_WHATSAPP_SOCKET_TIMING, r as createWaSocket, s as createWhatsAppSocketOperationTimeoutAdapter } from "./socket-close-2T0_jZTN.js";
|
|
13
13
|
import { n as getStatusCode, t as formatError } from "./session-errors-JuazczrA.js";
|
|
14
|
-
import { n as listWhatsAppDirectoryGroupsFromConfig, r as listWhatsAppDirectoryPeersFromConfig } from "./directory-config-
|
|
15
|
-
import {
|
|
14
|
+
import { n as listWhatsAppDirectoryGroupsFromConfig, r as listWhatsAppDirectoryPeersFromConfig } from "./directory-config-P7_3U73Z.js";
|
|
15
|
+
import { _ as resolveInboundMediaMimetype, c as extractContextInfo, m as findMessageSection, o as describeReplyContext, p as extractText, t as createWebSendApi, u as extractLocationData } from "./send-api-obOSm2cC.js";
|
|
16
16
|
import { asBoolean, isRecord, normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
17
17
|
import { formatLocationText } from "openclaw/plugin-sdk/channel-inbound";
|
|
18
18
|
//#region extensions/whatsapp/src/qa-driver.runtime.ts
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import "./accounts-BX2fZUyR.js";
|
|
2
2
|
import { r as resolveDefaultWhatsAppAccountId } from "./account-ids-CB5SOWjc.js";
|
|
3
3
|
import { s as normalizeWhatsAppMessagingTarget } from "./normalize-target-CugRyONv.js";
|
|
4
|
-
import { i as sendTypingWhatsApp, t as sendMessageWhatsApp } from "./send-
|
|
4
|
+
import { i as sendTypingWhatsApp, t as sendMessageWhatsApp } from "./send-CwvTU4RI.js";
|
|
5
5
|
import { i as getWhatsAppRuntime } from "./runtime-BLlToOi6.js";
|
|
6
6
|
import "./normalize-C7Hkc_vE.js";
|
|
7
|
-
import { i as unregisterWhatsAppApprovalReactionTarget, r as registerWhatsAppApprovalReactionTarget } from "./approval-reactions-
|
|
7
|
+
import { i as unregisterWhatsAppApprovalReactionTarget, r as registerWhatsAppApprovalReactionTarget } from "./approval-reactions-Jyr1JaAK.js";
|
|
8
8
|
import { createSubsystemLogger } from "openclaw/plugin-sdk/runtime-env";
|
|
9
9
|
import { DEFAULT_ACCOUNT_ID } from "openclaw/plugin-sdk/account-id";
|
|
10
10
|
import { buildApprovalReactionPendingContent } from "openclaw/plugin-sdk/approval-reaction-runtime";
|
|
@@ -4,7 +4,7 @@ import { n as getOptionalWhatsAppRuntime } from "./runtime-BLlToOi6.js";
|
|
|
4
4
|
import { c as getWhatsAppApprovalApprovers, l as whatsappApprovalAuth } from "./group-session-key-DmFc_Cqi.js";
|
|
5
5
|
import { isApprovalNotFoundError } from "openclaw/plugin-sdk/error-runtime";
|
|
6
6
|
import { createLazyRuntimeSurface } from "openclaw/plugin-sdk/lazy-runtime";
|
|
7
|
-
import { approvalReactionDecisionSetsMatch, createApprovalReactionTargetStore, listApprovalReactionBindings, readApprovalReactionDecisionList, readApprovalReactionDeliveredBinding, readApprovalReactionPresentationBinding, resolveTypedApprovalReactionTarget } from "openclaw/plugin-sdk/approval-reaction-runtime";
|
|
7
|
+
import { approvalReactionDecisionSetsMatch, buildApprovalReactionDeliveredBindingMarker, createApprovalReactionTargetStore, listApprovalReactionBindings, readApprovalReactionDecisionList, readApprovalReactionDeliveredBinding, readApprovalReactionPresentationBinding, resolveTypedApprovalReactionTarget } from "openclaw/plugin-sdk/approval-reaction-runtime";
|
|
8
8
|
import { createPluginStateErrorReporter } from "openclaw/plugin-sdk/plugin-state-runtime";
|
|
9
9
|
//#region extensions/whatsapp/src/approval-reactions.ts
|
|
10
10
|
var approval_reactions_exports = /* @__PURE__ */ __exportAll({
|
|
@@ -53,16 +53,15 @@ function reportApprovalBindingCorrelationMismatch(binding) {
|
|
|
53
53
|
}
|
|
54
54
|
function readPersistedTarget(target) {
|
|
55
55
|
const value = target;
|
|
56
|
-
if (!value || typeof value.approvalId !== "string" ||
|
|
56
|
+
if (!value || typeof value.approvalId !== "string" || value.approvalKind !== "exec" && value.approvalKind !== "plugin") return null;
|
|
57
|
+
const allowedDecisions = readApprovalReactionDecisionList(value.allowedDecisions);
|
|
58
|
+
if (!allowedDecisions) return null;
|
|
57
59
|
return {
|
|
58
60
|
approvalId: value.approvalId,
|
|
59
61
|
approvalKind: value.approvalKind,
|
|
60
|
-
allowedDecisions
|
|
62
|
+
allowedDecisions
|
|
61
63
|
};
|
|
62
64
|
}
|
|
63
|
-
function listWhatsAppApprovalReactionBindings(allowedDecisions) {
|
|
64
|
-
return listApprovalReactionBindings({ allowedDecisions });
|
|
65
|
-
}
|
|
66
65
|
const APPROVAL_ID_LINE_RE = /^\s*ID:\s*(\S(?:.*\S)?)\s*$/i;
|
|
67
66
|
const APPROVAL_KIND_LINE_RE = /^\s*(?:\S+\s+)?(Exec|Plugin) approval required\s*$/i;
|
|
68
67
|
function visibleApprovalBindingMatches(text, binding) {
|
|
@@ -84,11 +83,11 @@ function visibleApprovalBindingMatches(text, binding) {
|
|
|
84
83
|
decisionLines.push(decisionLine);
|
|
85
84
|
cursor += 1;
|
|
86
85
|
}
|
|
87
|
-
const knownBindings =
|
|
86
|
+
const knownBindings = listApprovalReactionBindings({ allowedDecisions: [
|
|
88
87
|
"allow-once",
|
|
89
88
|
"allow-always",
|
|
90
89
|
"deny"
|
|
91
|
-
]);
|
|
90
|
+
] });
|
|
92
91
|
const decisions = readApprovalReactionDecisionList(decisionLines.map((line) => knownBindings.find((entry) => `${entry.emoji} ${entry.label}` === line)?.decision));
|
|
93
92
|
if (!decisions) return false;
|
|
94
93
|
return approvalReactionDecisionSetsMatch(binding.allowedDecisions, decisions);
|
|
@@ -105,17 +104,14 @@ function prepareWhatsAppApprovalPayloadForDelivery(params) {
|
|
|
105
104
|
...params.payload,
|
|
106
105
|
channelData: {
|
|
107
106
|
...params.payload.channelData,
|
|
108
|
-
[DELIVERY_BINDING_CHANNEL_DATA_KEY]:
|
|
109
|
-
version: 1,
|
|
110
|
-
...binding
|
|
111
|
-
}
|
|
107
|
+
[DELIVERY_BINDING_CHANNEL_DATA_KEY]: buildApprovalReactionDeliveredBindingMarker(binding)
|
|
112
108
|
}
|
|
113
109
|
};
|
|
114
110
|
}
|
|
115
111
|
function registerWhatsAppApprovalReactionTarget(params) {
|
|
116
112
|
const key = buildReactionTargetKey(params);
|
|
117
113
|
const approvalId = params.approvalId.trim();
|
|
118
|
-
const allowedDecisions =
|
|
114
|
+
const allowedDecisions = listApprovalReactionBindings({ allowedDecisions: params.allowedDecisions }).map((binding) => binding.decision);
|
|
119
115
|
if (!key || !approvalId || params.approvalKind !== "exec" && params.approvalKind !== "plugin" || allowedDecisions.length === 0) return null;
|
|
120
116
|
const target = {
|
|
121
117
|
approvalId,
|
|
@@ -8,6 +8,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
10
|
import fs from "node:fs/promises";
|
|
11
|
+
import { isPathStrictlyInside } from "openclaw/plugin-sdk/file-access-runtime";
|
|
11
12
|
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";
|
|
@@ -333,10 +334,6 @@ async function shouldClearOnLogout(authDir, isLegacyAuthDir) {
|
|
|
333
334
|
return (typeof codeValue === "string" ? codeValue : "") !== "ENOENT";
|
|
334
335
|
}
|
|
335
336
|
}
|
|
336
|
-
function isPathInsideDirectory(baseDir, targetPath) {
|
|
337
|
-
const relativePath = path.relative(baseDir, targetPath);
|
|
338
|
-
return relativePath !== "" && !relativePath.startsWith("..") && !path.isAbsolute(relativePath);
|
|
339
|
-
}
|
|
340
337
|
async function pathHasSymlinkComponent(baseDir, targetPath) {
|
|
341
338
|
const relativePath = path.relative(baseDir, targetPath);
|
|
342
339
|
let currentPath = baseDir;
|
|
@@ -357,10 +354,10 @@ async function isLegacyWebAuthDir(authDir) {
|
|
|
357
354
|
async function classifyWebAuthDirOwnership(authDir) {
|
|
358
355
|
const whatsappAuthBase = path.resolve(resolveOAuthDir$1(), "whatsapp");
|
|
359
356
|
const resolvedAuthDir = path.resolve(authDir);
|
|
360
|
-
if (!
|
|
357
|
+
if (!isPathStrictlyInside(whatsappAuthBase, resolvedAuthDir)) return { kind: "external" };
|
|
361
358
|
const [baseRealPath, authDirRealPath] = await Promise.all([fs.realpath(whatsappAuthBase).catch(() => null), fs.realpath(resolvedAuthDir).catch(() => null)]);
|
|
362
359
|
if (!baseRealPath || !authDirRealPath) return { kind: "unsafe-owned" };
|
|
363
|
-
if (!
|
|
360
|
+
if (!isPathStrictlyInside(baseRealPath, authDirRealPath)) return { kind: "unsafe-owned" };
|
|
364
361
|
if (await pathHasSymlinkComponent(whatsappAuthBase, resolvedAuthDir)) return { kind: "unsafe-owned" };
|
|
365
362
|
return {
|
|
366
363
|
kind: "owned",
|
|
@@ -2,16 +2,16 @@ import { a as resolveWhatsAppAccount } from "./accounts-BX2fZUyR.js";
|
|
|
2
2
|
import { r as resolveDefaultWhatsAppAccountId, t as listAccountIds } from "./account-ids-CB5SOWjc.js";
|
|
3
3
|
import { c as normalizeWhatsAppTarget, i as looksLikeWhatsAppTargetId, n as isWhatsAppNewsletterJid, o as normalizeWhatsAppAllowFromEntry, s as normalizeWhatsAppMessagingTarget, t as isWhatsAppGroupJid } from "./normalize-target-CugRyONv.js";
|
|
4
4
|
import { t as resolveWhatsAppOutboundTarget } from "./resolve-outbound-target-1GqbT1uX.js";
|
|
5
|
-
import {
|
|
5
|
+
import { c as normalizeWhatsAppPayloadTextPreservingIndentation, i as sendTypingWhatsApp, n as sendPollWhatsApp, o as normalizeWhatsAppOutboundPayload, s as normalizeWhatsAppPayloadText, t as sendMessageWhatsApp, v as resolveWhatsAppReactionLevel } from "./send-CwvTU4RI.js";
|
|
6
6
|
import { i as getWhatsAppRuntime } from "./runtime-BLlToOi6.js";
|
|
7
7
|
import "./normalize-C7Hkc_vE.js";
|
|
8
8
|
import { c as toWhatsappJid } from "./targets-runtime-TMk0lGuy.js";
|
|
9
9
|
import "./text-runtime-CaKLhowd.js";
|
|
10
10
|
import { t as createWhatsAppLoginTool } from "./agent-tools-login-BjRpD-JQ.js";
|
|
11
11
|
import { c as getWhatsAppApprovalApprovers, l as whatsappApprovalAuth, s as lookupInboundMessageMetaForTarget, t as resolveWhatsAppGroupSessionKey } from "./group-session-key-DmFc_Cqi.js";
|
|
12
|
-
import { a as resolveWhatsAppGroupRequireMention, c as loadWhatsAppChannelRuntime, i as whatsappSetupContract, l as readWhatsAppAccountLinkState, n as whatsappSetupWizardProxy, o as resolveWhatsAppGroupToolPolicy, s as formatWhatsAppConfigAllowFromEntries, t as createWhatsAppPluginBase } from "./shared-
|
|
12
|
+
import { a as resolveWhatsAppGroupRequireMention, c as loadWhatsAppChannelRuntime, i as whatsappSetupContract, l as readWhatsAppAccountLinkState, n as whatsappSetupWizardProxy, o as resolveWhatsAppGroupToolPolicy, s as formatWhatsAppConfigAllowFromEntries, t as createWhatsAppPluginBase } from "./shared-wg42NKFB.js";
|
|
13
13
|
import { t as whatsappCommandPolicy } from "./command-policy-BIOSHySD.js";
|
|
14
|
-
import { f as readWebAuthExistsForDecision, n as WHATSAPP_AUTH_UNSTABLE_CODE } from "./auth-store-
|
|
14
|
+
import { f as readWebAuthExistsForDecision, n as WHATSAPP_AUTH_UNSTABLE_CODE } from "./auth-store-CtpBqH5S.js";
|
|
15
15
|
import { createActionGate as createActionGate$1 } from "openclaw/plugin-sdk/channel-actions";
|
|
16
16
|
import { normalizeOptionalAccountId } from "openclaw/plugin-sdk/account-core";
|
|
17
17
|
import { normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
@@ -80,7 +80,7 @@ const whatsappApproval = createApproverRestrictedNativeApprovalCapabilityFromFor
|
|
|
80
80
|
approvalKind,
|
|
81
81
|
request
|
|
82
82
|
}),
|
|
83
|
-
load: async () => (await import("./approval-handler.runtime-
|
|
83
|
+
load: async () => (await import("./approval-handler.runtime-CkMMvUjk.js")).whatsappApprovalNativeRuntime
|
|
84
84
|
})
|
|
85
85
|
});
|
|
86
86
|
function buildWhatsAppPendingPayload(params, approvalKind) {
|
|
@@ -260,7 +260,7 @@ function createWhatsAppOutboundBase({ chunker, sendMessageWhatsApp, sendPollWhat
|
|
|
260
260
|
}
|
|
261
261
|
//#endregion
|
|
262
262
|
//#region extensions/whatsapp/src/channel-outbound.ts
|
|
263
|
-
const loadWhatsAppApprovalReactionsModule = createLazyRuntimeModule(() => import("./approval-reactions-
|
|
263
|
+
const loadWhatsAppApprovalReactionsModule = createLazyRuntimeModule(() => import("./approval-reactions-Jyr1JaAK.js").then((n) => n.t));
|
|
264
264
|
const loadWhatsAppQuestionReactionsModule = createLazyRuntimeModule(() => import("./question-reactions-D3eAeB0i.js").then((n) => n.n));
|
|
265
265
|
function normalizeWhatsAppChannelPayloadText(text) {
|
|
266
266
|
return normalizeWhatsAppPayloadTextPreservingIndentation(text);
|
|
@@ -525,8 +525,8 @@ function collectWhatsAppStatusIssues(accounts) {
|
|
|
525
525
|
}
|
|
526
526
|
//#endregion
|
|
527
527
|
//#region extensions/whatsapp/src/channel.ts
|
|
528
|
-
const loadWhatsAppDirectoryConfig = createLazyRuntimeModule(() => import("./directory-config-
|
|
529
|
-
const loadWhatsAppChannelReactAction = createLazyRuntimeModule(() => import("./channel-react-action-
|
|
528
|
+
const loadWhatsAppDirectoryConfig = createLazyRuntimeModule(() => import("./directory-config-P7_3U73Z.js").then((n) => n.t));
|
|
529
|
+
const loadWhatsAppChannelReactAction = createLazyRuntimeModule(() => import("./channel-react-action-CstrR0CT.js"));
|
|
530
530
|
function resolveWhatsAppTargetInfo(raw) {
|
|
531
531
|
const normalized = normalizeWhatsAppTarget(raw);
|
|
532
532
|
if (!normalized) return null;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as whatsappPlugin } from "./channel-
|
|
1
|
+
import { t as whatsappPlugin } from "./channel-DRMYRfZ8.js";
|
|
2
2
|
export { whatsappPlugin };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { a as resolveWhatsAppAccount, s as resolveWhatsAppMediaMaxBytes } from "./accounts-BX2fZUyR.js";
|
|
2
2
|
import { c as normalizeWhatsAppTarget, t as isWhatsAppGroupJid } from "./normalize-target-CugRyONv.js";
|
|
3
|
-
import { r as resolveAuthorizedWhatsAppOutboundTarget, t as handleWhatsAppAction } from "./action-runtime-
|
|
4
|
-
import {
|
|
3
|
+
import { r as resolveAuthorizedWhatsAppOutboundTarget, t as handleWhatsAppAction } from "./action-runtime-pM-ExU0l.js";
|
|
4
|
+
import { a as sendWhatsAppUploadFile } from "./send-CwvTU4RI.js";
|
|
5
5
|
import "./normalize-C7Hkc_vE.js";
|
|
6
6
|
import { jsonResult, readStringOrNumberParam, readStringParam as readStringParam$1, resolveReactionMessageId } from "openclaw/plugin-sdk/channel-actions";
|
|
7
7
|
import { canonicalizeBase64, estimateBase64DecodedBytes } from "openclaw/plugin-sdk/media-runtime";
|
|
@@ -23,17 +23,14 @@ function readWhatsAppActionChatJid(params) {
|
|
|
23
23
|
if (params.toolContext?.currentChannelProvider !== WHATSAPP_CHANNEL || !params.toolContext.currentChannelId) return;
|
|
24
24
|
return normalizeWhatsAppTarget(params.toolContext.currentChannelId) ?? void 0;
|
|
25
25
|
}
|
|
26
|
-
function extractBase64Payload(encoded) {
|
|
27
|
-
return /^data:[^;]+;base64,(.*)$/is.exec(encoded.trim())?.[1] ?? encoded;
|
|
28
|
-
}
|
|
29
26
|
function decodeUploadFileMediaPayload(params) {
|
|
30
|
-
const
|
|
27
|
+
const dataUrl = /^data:([^;]+);base64,(.*)$/is.exec(params.encoded.trim());
|
|
28
|
+
const payload = dataUrl?.[2] ?? params.encoded;
|
|
31
29
|
if (params.maxBytes !== void 0) {
|
|
32
30
|
const estimatedBytes = estimateBase64DecodedBytes(payload);
|
|
33
31
|
if (estimatedBytes > params.maxBytes) throw new Error(`WhatsApp upload-file buffer exceeds configured media limit (${estimatedBytes} bytes > ${params.maxBytes} bytes).`);
|
|
34
32
|
}
|
|
35
|
-
const contentType =
|
|
36
|
-
const fileName = readStringParam$1(params.args, "filename") ?? readStringParam$1(params.args, "fileName");
|
|
33
|
+
const contentType = params.contentType ?? dataUrl?.[1];
|
|
37
34
|
const canonicalPayload = canonicalizeBase64(payload);
|
|
38
35
|
if (!canonicalPayload) throw new Error("WhatsApp upload-file buffer must be valid base64 or a base64 data URL.");
|
|
39
36
|
const buffer = Buffer.from(canonicalPayload, "base64");
|
|
@@ -41,12 +38,14 @@ function decodeUploadFileMediaPayload(params) {
|
|
|
41
38
|
return {
|
|
42
39
|
buffer,
|
|
43
40
|
...contentType ? { contentType } : {},
|
|
44
|
-
...fileName ? { fileName } : {}
|
|
41
|
+
...params.fileName ? { fileName: params.fileName } : {}
|
|
45
42
|
};
|
|
46
43
|
}
|
|
47
44
|
async function handleWhatsAppUploadFileAction(params) {
|
|
48
45
|
const mediaUrl = readUploadFileMediaSource(params.params);
|
|
49
46
|
const encodedPayload = readStringParam$1(params.params, "buffer", { trim: false });
|
|
47
|
+
const contentType = readStringParam$1(params.params, "contentType") ?? readStringParam$1(params.params, "mimeType");
|
|
48
|
+
const fileName = readStringParam$1(params.params, "filename") ?? readStringParam$1(params.params, "fileName");
|
|
50
49
|
if (!mediaUrl && !hasUploadFileBufferPayload(params.params)) throw new Error("WhatsApp upload-file requires media, mediaUrl, filePath, path, fileUrl, or buffer.");
|
|
51
50
|
const to = readWhatsAppActionChatJid(params) ?? readStringParam$1(params.params, "to", { required: true });
|
|
52
51
|
const resolved = resolveAuthorizedWhatsAppOutboundTarget({
|
|
@@ -60,15 +59,18 @@ async function handleWhatsAppUploadFileAction(params) {
|
|
|
60
59
|
accountId: resolved.accountId
|
|
61
60
|
});
|
|
62
61
|
const mediaPayload = encodedPayload ? decodeUploadFileMediaPayload({
|
|
63
|
-
args: params.params,
|
|
64
62
|
encoded: encodedPayload,
|
|
63
|
+
contentType,
|
|
64
|
+
fileName,
|
|
65
65
|
maxBytes: resolveWhatsAppMediaMaxBytes(account)
|
|
66
66
|
}) : void 0;
|
|
67
|
-
const result = await
|
|
67
|
+
const result = await sendWhatsAppUploadFile(resolved.to, readUploadFileCaptionText(params.params), {
|
|
68
68
|
verbose: false,
|
|
69
69
|
cfg: params.cfg,
|
|
70
70
|
...mediaUrl && !mediaPayload ? { mediaUrl } : {},
|
|
71
71
|
...mediaPayload ? { mediaPayload } : {},
|
|
72
|
+
...mediaUrl && !mediaPayload && fileName ? { fileName } : {},
|
|
73
|
+
...mediaUrl && !mediaPayload && contentType ? { contentType } : {},
|
|
72
74
|
mediaAccess: params.mediaAccess,
|
|
73
75
|
mediaLocalRoots: params.mediaLocalRoots,
|
|
74
76
|
mediaReadFile: params.mediaReadFile,
|
|
@@ -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-
|
|
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-CtpBqH5S.js";
|
|
3
3
|
import { t as getActiveWebListener$1 } from "./active-listener-BEjWsCNM.js";
|
|
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-
|
|
4
|
+
import { t as monitorWebChannel$1 } from "./monitor-IzwQKizW.js";
|
|
5
|
+
import { t as loginWeb$1 } from "./login-BkpKpndm.js";
|
|
6
|
+
import { whatsappSetupWizard as whatsappSetupWizard$1 } from "./setup-surface-Cwn3zyxK.js";
|
|
7
7
|
//#region extensions/whatsapp/src/channel.runtime.ts
|
|
8
8
|
function getActiveWebListener(...args) {
|
|
9
9
|
return getActiveWebListener$1(...args);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as resolveWhatsAppGroupRequireMention, i as whatsappSetupContract, l as readWhatsAppAccountLinkState, n as whatsappSetupWizardProxy, o as resolveWhatsAppGroupToolPolicy, t as createWhatsAppPluginBase } from "./shared-
|
|
1
|
+
import { a as resolveWhatsAppGroupRequireMention, i as whatsappSetupContract, l as readWhatsAppAccountLinkState, n as whatsappSetupWizardProxy, o as resolveWhatsAppGroupToolPolicy, t as createWhatsAppPluginBase } from "./shared-wg42NKFB.js";
|
|
2
2
|
//#region extensions/whatsapp/src/channel.setup.ts
|
|
3
3
|
const whatsappSetupPlugin = { ...createWhatsAppPluginBase({
|
|
4
4
|
groups: {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { r as getWhatsAppChannelRuntime } from "./runtime-BLlToOi6.js";
|
|
2
2
|
import { n as WHATSAPP_CONNECTION_OWNER_PENDING_CAPABILITY, t as WHATSAPP_CONNECTION_CONTROLLER_CAPABILITY } from "./connection-controller-runtime-context-DG0tuYuw.js";
|
|
3
|
-
import { M as waitForCredsSaveQueueWithTimeout, c as logoutWeb, f as readWebAuthExistsForDecision, k as resolveComparableIdentity, r as WhatsAppAuthUnstableError } from "./auth-store-
|
|
4
|
-
import { a as waitForWaConnection, m as acquireWhatsAppGatewayConnectionOwner, o as DEFAULT_WHATSAPP_SOCKET_TIMING, r as createWaSocket, t as closeWhatsAppSocketAndWait } from "./socket-close-
|
|
3
|
+
import { M as waitForCredsSaveQueueWithTimeout, c as logoutWeb, f as readWebAuthExistsForDecision, k as resolveComparableIdentity, r as WhatsAppAuthUnstableError } from "./auth-store-CtpBqH5S.js";
|
|
4
|
+
import { a as waitForWaConnection, m as acquireWhatsAppGatewayConnectionOwner, o as DEFAULT_WHATSAPP_SOCKET_TIMING, r as createWaSocket, t as closeWhatsAppSocketAndWait } from "./socket-close-2T0_jZTN.js";
|
|
5
5
|
import { n as getStatusCode, t as formatError } from "./session-errors-JuazczrA.js";
|
|
6
6
|
import { computeBackoff, info, sleepWithAbort } from "openclaw/plugin-sdk/runtime-env";
|
|
7
7
|
import { registerChannelRuntimeContext } from "openclaw/plugin-sdk/channel-runtime-context";
|
|
@@ -3,9 +3,9 @@ import { c as resolveMergedWhatsAppAccountConfig, o as resolveWhatsAppAuthDir }
|
|
|
3
3
|
import { c as normalizeWhatsAppTarget, t as isWhatsAppGroupJid } from "./normalize-target-CugRyONv.js";
|
|
4
4
|
import { i as hasPendingWhatsAppConnectionOwner, r as getWhatsAppConnectionController } from "./connection-controller-runtime-context-DG0tuYuw.js";
|
|
5
5
|
import "./normalize-C7Hkc_vE.js";
|
|
6
|
-
import { M as waitForCredsSaveQueueWithTimeout, f as readWebAuthExistsForDecision } from "./auth-store-
|
|
6
|
+
import { M as waitForCredsSaveQueueWithTimeout, f as readWebAuthExistsForDecision } from "./auth-store-CtpBqH5S.js";
|
|
7
7
|
import { n as resolveWebAccountId } from "./active-listener-BEjWsCNM.js";
|
|
8
|
-
import { a as waitForWaConnection, h as acquireWhatsAppStandaloneConnectionOwner, n as createWaDirectorySocket, p as WhatsAppConnectionOwnerBusyError, t as closeWhatsAppSocketAndWait } from "./socket-close-
|
|
8
|
+
import { a as waitForWaConnection, h as acquireWhatsAppStandaloneConnectionOwner, n as createWaDirectorySocket, p as WhatsAppConnectionOwnerBusyError, t as closeWhatsAppSocketAndWait } from "./socket-close-2T0_jZTN.js";
|
|
9
9
|
import { listResolvedDirectoryGroupEntriesFromMapKeys, listResolvedDirectoryUserEntriesFromAllowFrom } from "openclaw/plugin-sdk/directory-config-runtime";
|
|
10
10
|
//#region extensions/whatsapp/src/directory-config.ts
|
|
11
11
|
var directory_config_exports = /* @__PURE__ */ __exportAll({
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as listWhatsAppDirectoryGroupsFromConfig, r as listWhatsAppDirectoryPeersFromConfig } from "./directory-config-
|
|
1
|
+
import { n as listWhatsAppDirectoryGroupsFromConfig, r as listWhatsAppDirectoryPeersFromConfig } from "./directory-config-P7_3U73Z.js";
|
|
2
2
|
//#region extensions/whatsapp/directory-contract-api.ts
|
|
3
3
|
const whatsappDirectoryContractPlugin = {
|
|
4
4
|
id: "whatsapp",
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as createWhatsAppLoginTool } from "./agent-tools-login-BjRpD-JQ.js";
|
|
2
|
-
import { c as logoutWeb, g as readWebSelfId, l as pickWebChannel, o as getWebAuthAgeMs, s as logWebSelfId, t as WA_WEB_AUTH_DIR, x as webAuthExists, y as resolveDefaultWebAuthDir } from "./auth-store-
|
|
2
|
+
import { c as logoutWeb, g as readWebSelfId, l as pickWebChannel, o as getWebAuthAgeMs, s as logWebSelfId, t as WA_WEB_AUTH_DIR, x as webAuthExists, y as resolveDefaultWebAuthDir } from "./auth-store-CtpBqH5S.js";
|
|
3
3
|
import { t as getActiveWebListener } from "./active-listener-BEjWsCNM.js";
|
|
4
4
|
import { n as getStatusCode, t as formatError } from "./session-errors-JuazczrA.js";
|
|
5
5
|
export { WA_WEB_AUTH_DIR, createWhatsAppLoginTool, formatError, getActiveWebListener, getStatusCode, getWebAuthAgeMs, logWebSelfId, logoutWeb, pickWebChannel, readWebSelfId, resolveDefaultWebAuthDir, webAuthExists };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-D7D4PA-g.js";
|
|
2
2
|
import { a as resolveWhatsAppAccount } from "./accounts-BX2fZUyR.js";
|
|
3
|
-
import { b as restoreCredsFromBackupIfNeeded } from "./auth-store-
|
|
4
|
-
import { f as renderQrTerminal, r as createWaSocket, u as resolveWhatsAppSocketTiming } from "./socket-close-
|
|
5
|
-
import { a as closeWaSocketSoon, o as waitForWhatsAppLoginResult } from "./connection-controller-
|
|
3
|
+
import { b as restoreCredsFromBackupIfNeeded } from "./auth-store-CtpBqH5S.js";
|
|
4
|
+
import { f as renderQrTerminal, r as createWaSocket, u as resolveWhatsAppSocketTiming } from "./socket-close-2T0_jZTN.js";
|
|
5
|
+
import { a as closeWaSocketSoon, o as waitForWhatsAppLoginResult } from "./connection-controller-CIYuBJrs.js";
|
|
6
6
|
import { formatCliCommand } from "openclaw/plugin-sdk/cli-runtime";
|
|
7
7
|
import { logInfo } from "openclaw/plugin-sdk/logging-core";
|
|
8
8
|
import { danger, defaultRuntime, success } from "openclaw/plugin-sdk/runtime-env";
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { a as resolveWhatsAppAccount } from "./accounts-BX2fZUyR.js";
|
|
2
|
-
import { c as logoutWeb, f as readWebAuthExistsForDecision, g as readWebSelfId, n as WHATSAPP_AUTH_UNSTABLE_CODE } from "./auth-store-
|
|
2
|
+
import { c as logoutWeb, f as readWebAuthExistsForDecision, g as readWebSelfId, n as WHATSAPP_AUTH_UNSTABLE_CODE } from "./auth-store-CtpBqH5S.js";
|
|
3
3
|
import { t as getActiveWebListener } from "./active-listener-BEjWsCNM.js";
|
|
4
|
-
import { r as createWaSocket, u as resolveWhatsAppSocketTiming } from "./socket-close-
|
|
4
|
+
import { r as createWaSocket, u as resolveWhatsAppSocketTiming } from "./socket-close-2T0_jZTN.js";
|
|
5
5
|
import { t as formatError } from "./session-errors-JuazczrA.js";
|
|
6
|
-
import { i as closeWaSocket, o as waitForWhatsAppLoginResult, t as WHATSAPP_LOGGED_OUT_QR_MESSAGE } from "./connection-controller-
|
|
6
|
+
import { i as closeWaSocket, o as waitForWhatsAppLoginResult, t as WHATSAPP_LOGGED_OUT_QR_MESSAGE } from "./connection-controller-CIYuBJrs.js";
|
|
7
7
|
import { logInfo } from "openclaw/plugin-sdk/logging-core";
|
|
8
8
|
import { danger, defaultRuntime, info, success } from "openclaw/plugin-sdk/runtime-env";
|
|
9
9
|
import { renderQrPngDataUrl } from "openclaw/plugin-sdk/media-runtime";
|
package/dist/login-qr-runtime.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createLazyRuntimeModule } from "openclaw/plugin-sdk/lazy-runtime";
|
|
2
2
|
//#region extensions/whatsapp/login-qr-runtime.ts
|
|
3
|
-
const loadLoginQrModule = createLazyRuntimeModule(() => import("./login-qr-
|
|
3
|
+
const loadLoginQrModule = createLazyRuntimeModule(() => import("./login-qr-1dpv6jjT.js"));
|
|
4
4
|
async function startWebLoginWithQr(...args) {
|
|
5
5
|
const { startWebLoginWithQr: startWebLoginWithQrLocal } = await loadLoginQrModule();
|
|
6
6
|
return await startWebLoginWithQrLocal(...args);
|