@openclaw/whatsapp 2026.10.5-beta.4 → 2026.10.10-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/.setup/{action-runtime-DUSkWTiZ.mjs → action-runtime-B1UcIuRG.mjs} +1 -1
- package/dist/.setup/{active-listener-CDjoX9QR.mjs → active-listener-idMFscyE.mjs} +1 -1
- package/dist/.setup/{agent-tools-login-CB7OQbli.mjs → agent-tools-login-n7QVE3Am.mjs} +10 -1
- package/dist/.setup/{approval-handler.runtime-BEaAKSoU.mjs → approval-handler.runtime-DMDyXx9W.mjs} +5 -5
- package/dist/.setup/{approval-reactions-CWkZ_ham.mjs → approval-reactions-DYP0DYiU.mjs} +3 -3
- package/dist/.setup/audio-preflight.runtime-DOv4YzLh.mjs +1 -0
- package/dist/.setup/{channel-DcHw3Up2.mjs → channel-CecgCOxi.mjs} +13 -13
- package/dist/.setup/{channel-react-action-C5E8_iDk.mjs → channel-react-action-BkfwiSFM.mjs} +2 -2
- package/dist/.setup/{channel.runtime-DTj-wkEP.mjs → channel.runtime-BTx7s_SW.mjs} +4 -4
- package/dist/.setup/{channel.setup-BJWEyQlF.mjs → channel.setup-BACWTI6Q.mjs} +1 -1
- package/dist/.setup/{connection-controller-CejM7bhn.mjs → connection-controller-DpW6ILRo.mjs} +3 -3
- package/dist/.setup/{connection-controller-runtime-context-hgLJoRc8.mjs → connection-controller-runtime-context-x8C_unRx.mjs} +1 -1
- package/dist/.setup/{directory-config-DPLTUAqy.mjs → directory-config-CegsBv11.mjs} +4 -30
- package/dist/.setup/legacy-session-surface-api-BwP_Pgmu.mjs +1 -0
- package/dist/.setup/{login-DUx5JYuW.mjs → login-Bk8OQeE6.mjs} +4 -4
- package/dist/.setup/{login-qr-BAWbPonj.mjs → login-qr-B_6dpBr-.mjs} +6 -6
- package/dist/.setup/{monitor-CmXEQad9.mjs → monitor-5tf46zdS.mjs} +68 -147
- package/dist/.setup/{question-reactions-DywNaX8m.mjs → question-reactions-Rv9J2Lo1.mjs} +1 -1
- package/dist/.setup/reply-resolver.runtime-Byxo9w3l.mjs +1 -0
- package/dist/.setup/runtime-Botmatgn.mjs +17 -0
- package/dist/.setup/{send-CLBfAzd6.mjs → send-CIzCLFrJ.mjs} +1 -1
- package/dist/.setup/{send-api-COzRvqXx.mjs → send-api-Ck6tezjw.mjs} +1 -1
- package/dist/.setup/{setup-finalize-DSiP_-wa.mjs → setup-finalize-BtqJn6jL.mjs} +2 -2
- package/dist/.setup/setup-plugin-api-B6Nc07Ua.mjs +2 -0
- package/dist/.setup/{setup-surface-C_flQyHy.mjs → setup-surface-D6HuvKfd.mjs} +1 -1
- package/dist/.setup/{shared-SqcOkt51.mjs → shared-CbsgcYtM.mjs} +2 -2
- package/dist/.setup/{socket-close-C9OU9mVN.mjs → socket-close-BhMQls5y.mjs} +1 -6
- package/dist/action-runtime-api.js +1 -2
- package/dist/action-runtime.runtime.js +1 -2
- package/dist/agent-tools-api.js +2 -2
- package/dist/api.js +6 -6
- package/dist/channel-config-api.js +1 -2
- package/dist/channel-plugin-api.js +1 -2
- package/dist/directory-contract-api.js +1 -1
- package/dist/doctor-contract-api.js +6 -6
- package/dist/light-runtime-api.js +2 -2
- package/dist/login-qr-api.js +1 -2
- package/dist/login-qr-runtime.js +2 -2
- package/dist/runtime-api.js +9 -9
- package/dist/runtime-setter-api.js +1 -2
- package/dist/security-contract-api.js +1 -2
- package/dist/setup-entry.js +2 -2
- package/dist/setup-plugin-api.js +1 -2
- package/node_modules/typebox/build/value/clean/from_object.mjs +1 -1
- package/node_modules/typebox/package.json +1 -1
- package/package.json +11 -5
- package/dist/.setup/audio-preflight.runtime-Dg8oZgre.mjs +0 -2
- package/dist/.setup/legacy-session-surface-api-B2szjq4r.mjs +0 -2
- package/dist/.setup/reply-resolver.runtime-Ded8D58Y.mjs +0 -2
- package/dist/.setup/runtime-BLlToOi6.mjs +0 -21
- package/dist/.setup/setup-plugin-api-8WdNCjRW.mjs +0 -3
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import { n as __reExport, t as __exportAll } from "./rolldown-runtime-BBjsoOtd.mjs";
|
|
2
2
|
import { a as resolveWhatsAppAccount, s as resolveWhatsAppMediaMaxBytes } from "./accounts-F0vHuze2.mjs";
|
|
3
|
-
import { c as prepareWhatsAppOutboundMedia, d as listWhatsAppSendResultMessageIds, f as mergeWhatsAppAcceptedSendError, g as withWhatsAppLogicalDeliveryActivity, h as rememberWhatsAppPartialSend, m as rememberWhatsAppAcceptedSend, o as normalizeWhatsAppOutboundPayload, p as normalizeWhatsAppSendResult, r as sendReactionWhatsApp, s as normalizeWhatsAppPayloadTextPreservingIndentation, v as resolveWhatsAppReactionLevel } from "./send-
|
|
4
|
-
import { i as getWhatsAppRuntime } from "./runtime-
|
|
5
|
-
import { r as getWhatsAppConnectionController } from "./connection-controller-runtime-context-
|
|
3
|
+
import { c as prepareWhatsAppOutboundMedia, d as listWhatsAppSendResultMessageIds, f as mergeWhatsAppAcceptedSendError, g as withWhatsAppLogicalDeliveryActivity, h as rememberWhatsAppPartialSend, m as rememberWhatsAppAcceptedSend, o as normalizeWhatsAppOutboundPayload, p as normalizeWhatsAppSendResult, r as sendReactionWhatsApp, s as normalizeWhatsAppPayloadTextPreservingIndentation, v as resolveWhatsAppReactionLevel } from "./send-CIzCLFrJ.mjs";
|
|
4
|
+
import { i as getWhatsAppRuntime } from "./runtime-Botmatgn.mjs";
|
|
5
|
+
import { r as getWhatsAppConnectionController } from "./connection-controller-runtime-context-x8C_unRx.mjs";
|
|
6
6
|
import { a as markdownToWhatsAppChunks, c as toWhatsappJid, l as toWhatsappJidWithLid, n as isSelfChatMode, o as resolveEquivalentWhatsAppDirectChatJids, r as jidToE164, s as resolveJidToE164 } from "./targets-runtime-D5ryyPxh.mjs";
|
|
7
7
|
import { a as lookupInboundMessageMeta, i as cacheInboundMessageMeta, n as resolveWhatsAppGroupSessionRoute, r as buildQuotedMessageOptions } from "./group-session-key-BbTPosdy.mjs";
|
|
8
8
|
import { C as getPrimaryIdentityId, D as identitiesOverlap, E as getSenderIdentity, O as resolveComparableIdentity, S as getMentionIdentities, T as getSelfIdentity, _ as readWebSelfIdentityForDecision, h as readWebSelfId, o as getWebAuthAgeMs, r as WhatsAppAuthUnstableError, w as getReplyContext, x as getComparableIdentityValues } from "./auth-store-DOBi5BPe.mjs";
|
|
9
9
|
import { n as resolveWhatsAppGroupsConfigPath } from "./group-config-path-BPrak_bJ.mjs";
|
|
10
|
-
import { a as DEFAULT_RECONNECT_POLICY, c as resolveHeartbeatSeconds, f as createWhatsAppSocketOperationTimeoutAdapter, g as withWhatsAppSocketOperationTimeout, h as resolveWhatsAppSocketTiming, i as waitForWaConnection, l as resolveReconnectPolicy, m as resolveWhatsAppSocketOperationTimeoutMs, o as computeBackoff, p as isWhatsAppSocketOperationTimeoutError, r as createWaSocket, s as newConnectionId, u as sleepWithAbort$1 } from "./socket-close-
|
|
10
|
+
import { a as DEFAULT_RECONNECT_POLICY, c as resolveHeartbeatSeconds, f as createWhatsAppSocketOperationTimeoutAdapter, g as withWhatsAppSocketOperationTimeout, h as resolveWhatsAppSocketTiming, i as waitForWaConnection, l as resolveReconnectPolicy, m as resolveWhatsAppSocketOperationTimeoutMs, o as computeBackoff, p as isWhatsAppSocketOperationTimeoutError, r as createWaSocket, s as newConnectionId, u as sleepWithAbort$1 } from "./socket-close-BhMQls5y.mjs";
|
|
11
11
|
import { n as getStatusCode, t as formatError } from "./session-errors-B8UcAnZN.mjs";
|
|
12
12
|
import { t as BufferJSON } from "./session.runtime-st1konFI.mjs";
|
|
13
|
-
import { _ as resolveInboundMediaMimetype, a as addWhatsAppImagePreviewFields, c as extractContextInfo, d as extractMediaKind, f as extractMentionedJids, g as projectWhatsAppInboundMessage, h as hasInboundUserContent, i as resolveWhatsAppOutboundMentions, l as extractExternalAdReplyContext, n as addWhatsAppOutboundMentionsToContent, o as describeReplyContext, p as extractText, r as mayContainWhatsAppOutboundMention, s as extractContactContext, t as createWebSendApi, u as extractLocationData } from "./send-api-
|
|
14
|
-
import { n as WHATSAPP_WATCHDOG_TIMEOUT_ERROR, r as WhatsAppConnectionController } from "./connection-controller-
|
|
15
|
-
import { n as maybeResolveWhatsAppApprovalReaction } from "./approval-reactions-
|
|
16
|
-
import { t as maybeResolveWhatsAppQuestionReaction } from "./question-reactions-
|
|
13
|
+
import { _ as resolveInboundMediaMimetype, a as addWhatsAppImagePreviewFields, c as extractContextInfo, d as extractMediaKind, f as extractMentionedJids, g as projectWhatsAppInboundMessage, h as hasInboundUserContent, i as resolveWhatsAppOutboundMentions, l as extractExternalAdReplyContext, n as addWhatsAppOutboundMentionsToContent, o as describeReplyContext, p as extractText, r as mayContainWhatsAppOutboundMention, s as extractContactContext, t as createWebSendApi, u as extractLocationData } from "./send-api-Ck6tezjw.mjs";
|
|
14
|
+
import { n as WHATSAPP_WATCHDOG_TIMEOUT_ERROR, r as WhatsAppConnectionController } from "./connection-controller-DpW6ILRo.mjs";
|
|
15
|
+
import { n as maybeResolveWhatsAppApprovalReaction } from "./approval-reactions-DYP0DYiU.mjs";
|
|
16
|
+
import { t as maybeResolveWhatsAppQuestionReaction } from "./question-reactions-Rv9J2Lo1.mjs";
|
|
17
17
|
import { isRecord, normalizeLowercaseStringOrEmpty, normalizeOptionalString, uniqueStrings } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
18
18
|
import { createAckReactionHandle, createStatusReactionController, shouldAckReaction } from "openclaw/plugin-sdk/channel-feedback";
|
|
19
19
|
import { bindIngressLifecycleToReplyOptions, createChannelIngressMonitor, createChannelMessageReplyPipeline, createMessageReceiptFromOutboundResults, listMessageReceiptPlatformIds, resolveChannelMessageSourceReplyDeliveryMode, resolveChannelStreamingBlockEnabled } from "openclaw/plugin-sdk/channel-outbound";
|
|
@@ -31,7 +31,7 @@ import { normalizeE164, normalizeE164 as normalizeE164$1, normalizeE164 as norma
|
|
|
31
31
|
import { DisconnectReason, downloadMediaMessage, isHostedLidUser, isHostedPnUser, isJidGroup, isJidGroup as isJidGroup$1, jidDecode, jidEncode, jidNormalizedUser, normalizeMessageContent as normalizeMessageContent$1 } from "baileys";
|
|
32
32
|
import { pruneMapToMaxSize } from "openclaw/plugin-sdk/collection-runtime";
|
|
33
33
|
import { DEFAULT_MAIN_KEY, buildAgentMainSessionKey, buildAgentSessionKey, buildGroupHistoryKey, deriveLastRoutePolicy, resolveAgentRoute, resolveInboundLastRouteSessionKey } from "openclaw/plugin-sdk/routing";
|
|
34
|
-
import {
|
|
34
|
+
import { parseStrictFiniteNumber, resolvePromptHistoryLimit } from "openclaw/plugin-sdk/number-runtime";
|
|
35
35
|
import { filterSupplementalContextItems, resolvePinnedMainDmOwnerFromAllowlist } from "openclaw/plugin-sdk/security-runtime";
|
|
36
36
|
import { raceWithTimeout } from "openclaw/plugin-sdk/time-runtime";
|
|
37
37
|
import { resolveChannelGroupPolicy, resolveChannelGroupRequireMention } from "openclaw/plugin-sdk/channel-policy";
|
|
@@ -43,13 +43,13 @@ import { resolveChunkMode, resolveTextChunkLimit } from "openclaw/plugin-sdk/rep
|
|
|
43
43
|
import { CHANNEL_APPROVAL_NATIVE_RUNTIME_CONTEXT_CAPABILITY } from "openclaw/plugin-sdk/approval-handler-runtime";
|
|
44
44
|
import { drainPendingDeliveries } from "openclaw/plugin-sdk/delivery-queue-runtime";
|
|
45
45
|
import { enqueueSystemEvent } from "openclaw/plugin-sdk/system-event-runtime";
|
|
46
|
-
import {
|
|
46
|
+
import { getSessionEntryAsync, resolveGroupSessionKey, resolveStorePath, resolveStorePath as resolveStorePath$1, updateLastRoute } from "openclaw/plugin-sdk/session-store-runtime";
|
|
47
47
|
import { createInboundDebouncer, resolveInboundDebounceMs } from "openclaw/plugin-sdk/channel-inbound-debounce";
|
|
48
48
|
import { fanInChannelIngressLifecycles } from "openclaw/plugin-sdk/channel-ingress-runtime";
|
|
49
49
|
import { saveMediaStream } from "openclaw/plugin-sdk/media-store";
|
|
50
50
|
import { upsertChannelPairingRequest } from "openclaw/plugin-sdk/conversation-runtime";
|
|
51
51
|
import { createDedupeCache } from "openclaw/plugin-sdk/dedupe-runtime";
|
|
52
|
-
import {
|
|
52
|
+
import { readRuntimeConfig as getRuntimeConfig } from "openclaw/plugin-sdk/runtime-config-snapshot";
|
|
53
53
|
import { resolveChannelContextVisibilityMode } from "openclaw/plugin-sdk/context-visibility-runtime";
|
|
54
54
|
import { channelReadyPatch, channelStoppedPatch, createTransportActivityStatusPatch } from "openclaw/plugin-sdk/gateway-runtime";
|
|
55
55
|
import { ensureConfiguredBindingRouteReady, resolveConfiguredBindingRoute } from "openclaw/plugin-sdk/conversation-binding-runtime";
|
|
@@ -62,7 +62,6 @@ import { createInternalHookEvent, deriveInboundMessageHookContext, fireAndForget
|
|
|
62
62
|
import { getGlobalHookRunner } from "openclaw/plugin-sdk/plugin-runtime";
|
|
63
63
|
import { resolveBatchedReplyThreadingPolicy } from "openclaw/plugin-sdk/reply-reference";
|
|
64
64
|
import { LocalMediaAccessError, getDefaultLocalRoots, loadWebMedia, loadWebMediaRaw, optimizeImageToJpeg, optimizeImageToPng } from "openclaw/plugin-sdk/web-media";
|
|
65
|
-
import { createChannelApiRetryRunner } from "openclaw/plugin-sdk/retry-runtime";
|
|
66
65
|
//#region extensions/whatsapp/src/inbound/group-conversation.ts
|
|
67
66
|
function resolveWhatsAppGroupConversationId(conversationId) {
|
|
68
67
|
return resolveGroupSessionKey({
|
|
@@ -262,25 +261,15 @@ function readWhatsAppBaileysCacheEntry(cache, key) {
|
|
|
262
261
|
//#region extensions/whatsapp/src/inbound/group-metadata-cache.ts
|
|
263
262
|
const GROUP_META_TTL_MS = 3e5;
|
|
264
263
|
const WHATSAPP_GROUP_METADATA_CACHE_MAX_ENTRIES = 500;
|
|
265
|
-
function resolveGroupMetadataExpiresAt(nowRaw = Date.now()) {
|
|
266
|
-
const now = asDateTimestampMs(nowRaw);
|
|
267
|
-
return now === void 0 ? void 0 : resolveExpiresAtMsFromDurationMs(GROUP_META_TTL_MS, { nowMs: now });
|
|
268
|
-
}
|
|
269
264
|
function rememberGroupMetadataCacheEntry(cache, jid, entry) {
|
|
270
|
-
|
|
271
|
-
cache.delete(jid);
|
|
272
|
-
return;
|
|
273
|
-
}
|
|
274
|
-
if (cache.has(jid)) cache.delete(jid);
|
|
265
|
+
cache.delete(jid);
|
|
275
266
|
cache.set(jid, entry);
|
|
276
267
|
pruneMapToMaxSize(cache, WHATSAPP_GROUP_METADATA_CACHE_MAX_ENTRIES);
|
|
277
268
|
}
|
|
278
269
|
function readGroupMetadataCacheEntry(cache, jid) {
|
|
279
270
|
const entry = cache.get(jid);
|
|
280
271
|
if (!entry) return null;
|
|
281
|
-
|
|
282
|
-
const expires = asDateTimestampMs(entry.expires);
|
|
283
|
-
if (now === void 0 || expires === void 0 || expires <= now) {
|
|
272
|
+
if (entry.expires <= Date.now()) {
|
|
284
273
|
cache.delete(jid);
|
|
285
274
|
return null;
|
|
286
275
|
}
|
|
@@ -291,8 +280,8 @@ function readGroupMetadataCacheEntry(cache, jid) {
|
|
|
291
280
|
function createWhatsAppGroupMetadataCacheOwner(params) {
|
|
292
281
|
const reconnectCache = params.reconnectCache ?? /* @__PURE__ */ new Map();
|
|
293
282
|
const localCache = /* @__PURE__ */ new Map();
|
|
294
|
-
const groupMetadataGenerations = /* @__PURE__ */ new Map();
|
|
295
283
|
const detachListeners = [];
|
|
284
|
+
let cacheRevision = 0;
|
|
296
285
|
let closed = false;
|
|
297
286
|
let started = false;
|
|
298
287
|
const summarize = async (meta) => {
|
|
@@ -312,60 +301,56 @@ function createWhatsAppGroupMetadataCacheOwner(params) {
|
|
|
312
301
|
subject: meta.subject,
|
|
313
302
|
participants: participantEntries.map((entry) => entry.display).filter(Boolean),
|
|
314
303
|
mentionParticipants: participantEntries.map((entry) => entry.mention),
|
|
315
|
-
expires:
|
|
304
|
+
expires: Date.now() + GROUP_META_TTL_MS
|
|
316
305
|
};
|
|
317
306
|
};
|
|
318
307
|
const summarizeForReconnect = (meta) => ({
|
|
319
308
|
subject: meta.subject,
|
|
320
|
-
expires:
|
|
309
|
+
expires: Date.now() + GROUP_META_TTL_MS
|
|
321
310
|
});
|
|
322
311
|
const rememberFullUpdate = (jid, meta) => {
|
|
323
312
|
if (closed) return;
|
|
324
|
-
|
|
313
|
+
cacheRevision++;
|
|
325
314
|
rememberWhatsAppBaileysCacheEntry(params.baileysCache, jid, meta, GROUP_META_TTL_MS);
|
|
326
315
|
rememberGroupMetadataCacheEntry(reconnectCache, jid, summarizeForReconnect(meta));
|
|
327
316
|
localCache.delete(jid);
|
|
328
317
|
};
|
|
329
318
|
const forgetFullMetadata = (jid) => {
|
|
330
|
-
|
|
319
|
+
cacheRevision++;
|
|
331
320
|
params.baileysCache?.delete(jid);
|
|
332
321
|
reconnectCache.delete(jid);
|
|
333
322
|
localCache.delete(jid);
|
|
334
323
|
};
|
|
335
324
|
const get = async (jid) => {
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
rememberGroupMetadataCacheEntry(localCache, jid, hydrated);
|
|
363
|
-
params.logVerbose(`Using cached group metadata for ${jid} after fetch failure: ${String(error)}`);
|
|
364
|
-
return hydrated;
|
|
365
|
-
}
|
|
366
|
-
params.logVerbose(`Failed to fetch group metadata for ${jid}: ${String(error)}`);
|
|
367
|
-
return { expires: resolveGroupMetadataExpiresAt() ?? 0 };
|
|
325
|
+
if (closed) return { expires: Date.now() + GROUP_META_TTL_MS };
|
|
326
|
+
const cached = readGroupMetadataCacheEntry(localCache, jid);
|
|
327
|
+
if (cached) return cached;
|
|
328
|
+
const revision = cacheRevision;
|
|
329
|
+
try {
|
|
330
|
+
const hydratedEntry = params.baileysCache?.get(jid);
|
|
331
|
+
const providerMetadata = params.baileysCache ? readWhatsAppBaileysCacheEntry(params.baileysCache, jid) : void 0;
|
|
332
|
+
const hydratedMetadata = providerMetadata?.participants?.length ? providerMetadata : void 0;
|
|
333
|
+
const meta = hydratedMetadata ?? await (params.getCurrentSock() ?? params.sock).groupMetadata(jid);
|
|
334
|
+
const entry = await summarize(meta);
|
|
335
|
+
if (closed) return { expires: Date.now() + GROUP_META_TTL_MS };
|
|
336
|
+
if (revision !== cacheRevision) return entry;
|
|
337
|
+
if (hydratedMetadata && hydratedEntry) entry.expires = hydratedEntry.expiresAt;
|
|
338
|
+
else rememberWhatsAppBaileysCacheEntry(params.baileysCache, jid, meta, GROUP_META_TTL_MS);
|
|
339
|
+
rememberGroupMetadataCacheEntry(reconnectCache, jid, {
|
|
340
|
+
subject: entry.subject,
|
|
341
|
+
expires: entry.expires
|
|
342
|
+
});
|
|
343
|
+
rememberGroupMetadataCacheEntry(localCache, jid, entry);
|
|
344
|
+
return entry;
|
|
345
|
+
} catch (error) {
|
|
346
|
+
const hydrated = !closed && readGroupMetadataCacheEntry(reconnectCache, jid);
|
|
347
|
+
if (hydrated) {
|
|
348
|
+
rememberGroupMetadataCacheEntry(localCache, jid, hydrated);
|
|
349
|
+
params.logVerbose(`Using cached group metadata for ${jid} after fetch failure: ${String(error)}`);
|
|
350
|
+
return hydrated;
|
|
368
351
|
}
|
|
352
|
+
params.logVerbose(`Failed to fetch group metadata for ${jid}: ${String(error)}`);
|
|
353
|
+
return { expires: Date.now() + GROUP_META_TTL_MS };
|
|
369
354
|
}
|
|
370
355
|
};
|
|
371
356
|
const resolveOutboundMentions = async (jid, text) => {
|
|
@@ -413,13 +398,13 @@ function createWhatsAppGroupMetadataCacheOwner(params) {
|
|
|
413
398
|
forgetFullMetadata(update.id);
|
|
414
399
|
});
|
|
415
400
|
(async () => {
|
|
401
|
+
const revision = cacheRevision;
|
|
416
402
|
try {
|
|
417
403
|
const groups = await params.sock.groupFetchAllParticipating();
|
|
418
|
-
if (closed) return;
|
|
419
|
-
for (const [jid, meta] of Object.entries(groups ?? {})) if (meta
|
|
404
|
+
if (closed || revision !== cacheRevision) return;
|
|
405
|
+
for (const [jid, meta] of Object.entries(groups ?? {})) if (meta) {
|
|
420
406
|
rememberGroupMetadataCacheEntry(reconnectCache, jid, summarizeForReconnect(meta));
|
|
421
407
|
rememberWhatsAppBaileysCacheEntry(params.baileysCache, jid, meta, GROUP_META_TTL_MS);
|
|
422
|
-
groupMetadataGenerations.set(jid, {});
|
|
423
408
|
}
|
|
424
409
|
params.logVerbose(`Hydrated ${Object.keys(groups ?? {}).length} participating groups on connect`);
|
|
425
410
|
} catch (error) {
|
|
@@ -448,11 +433,7 @@ function attachEmitterListener(emitter, event, listener) {
|
|
|
448
433
|
return () => emitter.off(event, listener);
|
|
449
434
|
}
|
|
450
435
|
function closeInboundMonitorSocket(sock) {
|
|
451
|
-
|
|
452
|
-
sock.end(/* @__PURE__ */ new Error("OpenClaw WhatsApp listener close"));
|
|
453
|
-
return;
|
|
454
|
-
}
|
|
455
|
-
sock.ws?.close?.();
|
|
436
|
+
sock.end(/* @__PURE__ */ new Error("OpenClaw WhatsApp listener close"));
|
|
456
437
|
}
|
|
457
438
|
//#endregion
|
|
458
439
|
//#region extensions/whatsapp/src/inbound/durable-payload.ts
|
|
@@ -892,8 +873,7 @@ async function checkInboundAccessControl(params) {
|
|
|
892
873
|
accountId: params.accountId,
|
|
893
874
|
selfE164: params.selfE164
|
|
894
875
|
});
|
|
895
|
-
const
|
|
896
|
-
const suppressPairingReply = typeof params.connectedAtMs === "number" && typeof params.messageTimestampMs === "number" && params.messageTimestampMs < params.connectedAtMs - pairingGraceMs;
|
|
876
|
+
const suppressPairingReply = typeof params.connectedAtMs === "number" && typeof params.messageTimestampMs === "number" && params.messageTimestampMs < params.connectedAtMs - PAIRING_REPLY_HISTORY_GRACE_MS;
|
|
897
877
|
warnMissingProviderGroupPolicyFallbackOnce({
|
|
898
878
|
providerMissingFallbackApplied: policy.providerMissingFallbackApplied,
|
|
899
879
|
providerKey: "whatsapp",
|
|
@@ -2024,8 +2004,6 @@ function debugMention(msg, mentionCfg, authDir) {
|
|
|
2024
2004
|
wasMentioned: isBotMentionedFromTargets(msg, mentionCfg, mentionTargets),
|
|
2025
2005
|
details: {
|
|
2026
2006
|
from: requireWhatsAppInboundAdmission(msg).conversation.id,
|
|
2027
|
-
body: msg.payload.body,
|
|
2028
|
-
bodyClean: (0, channel_mention_gating_exports.normalizeMentionText)(msg.payload.body),
|
|
2029
2007
|
mentionedJids: msg.group?.mentions?.jids ?? null,
|
|
2030
2008
|
normalizedMentionedJids: mentionTargets.normalizedMentions.length ? mentionTargets.normalizedMentions.map((identity) => getComparableIdentityValues(identity)) : null,
|
|
2031
2009
|
selfJid: msg.platform.self?.jid ?? msg.platform.selfJid ?? null,
|
|
@@ -2050,7 +2028,7 @@ function resolveWhatsAppAckEmoji(params) {
|
|
|
2050
2028
|
//#region extensions/whatsapp/src/auto-reply/monitor/group-activation.ts
|
|
2051
2029
|
async function resolveGroupActivationFor(params) {
|
|
2052
2030
|
const storePath = resolveStorePath(params.cfg.session?.store, { agentId: params.agentId });
|
|
2053
|
-
const entry =
|
|
2031
|
+
const entry = await getSessionEntryAsync({
|
|
2054
2032
|
storePath,
|
|
2055
2033
|
agentId: params.agentId,
|
|
2056
2034
|
sessionKey: params.sessionKey
|
|
@@ -2149,7 +2127,7 @@ function hasWhatsAppAudioBody(msg) {
|
|
|
2149
2127
|
return (msg.payload.media?.kind === "audio" || msg.payload.media?.type?.startsWith("audio/") === true) && !msg.payload.body.trim();
|
|
2150
2128
|
}
|
|
2151
2129
|
async function transcribeWhatsAppAudioMessage(cfg, msg, accountId) {
|
|
2152
|
-
const { transcribeFirstAudio } = await import("./audio-preflight.runtime-
|
|
2130
|
+
const { transcribeFirstAudio } = await import("./audio-preflight.runtime-DOv4YzLh.mjs");
|
|
2153
2131
|
const media = msg.payload.media;
|
|
2154
2132
|
const conversationId = msg.admission.conversation.id;
|
|
2155
2133
|
return await transcribeFirstAudio({
|
|
@@ -2437,7 +2415,7 @@ async function applyGroupGating(params) {
|
|
|
2437
2415
|
}, `WhatsApp group ${conversationId}: skipping messages without a mention. Mention patterns can be derived from the agent identity name. Use /activation always for this session, or set ${groupsPath}[${JSON.stringify(conversationId)}].requireMention=false for the default. Preserve existing groups entries; when adding the first groups map, include "*": {} to keep other chats admitted.`);
|
|
2438
2416
|
}
|
|
2439
2417
|
const pendingHistoryBody = params.mentionText === void 0 ? void 0 : formatAudioTranscriptForAgent(params.mentionText);
|
|
2440
|
-
return skipGroupMessageAndStoreHistory(params, `Group message stored for context (no mention detected) in ${conversationId}
|
|
2418
|
+
return skipGroupMessageAndStoreHistory(params, `Group message stored for context (no mention detected) in ${conversationId}`, pendingHistoryBody);
|
|
2441
2419
|
}
|
|
2442
2420
|
return { shouldProcess: true };
|
|
2443
2421
|
}
|
|
@@ -2495,57 +2473,6 @@ function resolveWhatsAppDirectSystemPrompt(params) {
|
|
|
2495
2473
|
return resolveWhatsAppSystemPrompt(params.accountConfig?.direct, params.peerId);
|
|
2496
2474
|
}
|
|
2497
2475
|
//#endregion
|
|
2498
|
-
//#region extensions/whatsapp/src/outbound-retry.ts
|
|
2499
|
-
const WHATSAPP_OUTBOUND_MAX_ATTEMPTS = 3;
|
|
2500
|
-
const WHATSAPP_OUTBOUND_MIN_DELAY_MS = 500;
|
|
2501
|
-
const WHATSAPP_OUTBOUND_MAX_DELAY_MS = 1e3;
|
|
2502
|
-
const WHATSAPP_RETRYABLE_OUTBOUND_ERROR_PATTERN = /closed|reset|timed\s*out|disconnect/i;
|
|
2503
|
-
var WhatsAppOutboundRetryError = class extends Error {
|
|
2504
|
-
constructor(original) {
|
|
2505
|
-
super(formatError(original), { cause: original });
|
|
2506
|
-
this.original = original;
|
|
2507
|
-
}
|
|
2508
|
-
};
|
|
2509
|
-
function isRetryableWhatsAppOutboundError(error) {
|
|
2510
|
-
if (isChannelPartialDeliveryError(error) || isWhatsAppSocketOperationTimeoutError(error)) return false;
|
|
2511
|
-
return WHATSAPP_RETRYABLE_OUTBOUND_ERROR_PATTERN.test(formatError(error));
|
|
2512
|
-
}
|
|
2513
|
-
async function sendWhatsAppOutboundWithRetry(params) {
|
|
2514
|
-
const runWithRetry = createChannelApiRetryRunner({
|
|
2515
|
-
retry: {
|
|
2516
|
-
attempts: WHATSAPP_OUTBOUND_MAX_ATTEMPTS,
|
|
2517
|
-
minDelayMs: WHATSAPP_OUTBOUND_MIN_DELAY_MS,
|
|
2518
|
-
maxDelayMs: WHATSAPP_OUTBOUND_MAX_DELAY_MS,
|
|
2519
|
-
jitter: 0
|
|
2520
|
-
},
|
|
2521
|
-
strictShouldRetry: true,
|
|
2522
|
-
retryAfterMs: () => void 0,
|
|
2523
|
-
shouldRetry: (error, attempt) => {
|
|
2524
|
-
if (!(error instanceof WhatsAppOutboundRetryError) || !isRetryableWhatsAppOutboundError(error.original)) return false;
|
|
2525
|
-
params.onRetry?.({
|
|
2526
|
-
attempt,
|
|
2527
|
-
maxAttempts: WHATSAPP_OUTBOUND_MAX_ATTEMPTS,
|
|
2528
|
-
backoffMs: Math.min(WHATSAPP_OUTBOUND_MIN_DELAY_MS * 2 ** (attempt - 1), WHATSAPP_OUTBOUND_MAX_DELAY_MS),
|
|
2529
|
-
error: error.original,
|
|
2530
|
-
errorText: formatError(error.original)
|
|
2531
|
-
});
|
|
2532
|
-
return true;
|
|
2533
|
-
}
|
|
2534
|
-
});
|
|
2535
|
-
try {
|
|
2536
|
-
return await runWithRetry(async () => {
|
|
2537
|
-
try {
|
|
2538
|
-
return await params.send();
|
|
2539
|
-
} catch (error) {
|
|
2540
|
-
throw new WhatsAppOutboundRetryError(error);
|
|
2541
|
-
}
|
|
2542
|
-
});
|
|
2543
|
-
} catch (error) {
|
|
2544
|
-
if (error instanceof WhatsAppOutboundRetryError) throw error.original;
|
|
2545
|
-
throw error;
|
|
2546
|
-
}
|
|
2547
|
-
}
|
|
2548
|
-
//#endregion
|
|
2549
2476
|
//#region extensions/whatsapp/src/auto-reply/util.ts
|
|
2550
2477
|
function elide(text, limit = 400) {
|
|
2551
2478
|
if (!text) return text;
|
|
@@ -2706,28 +2633,23 @@ async function deliverWebReplyInActivityScope(params) {
|
|
|
2706
2633
|
media: cached?.media
|
|
2707
2634
|
});
|
|
2708
2635
|
};
|
|
2709
|
-
const
|
|
2636
|
+
const send = async (fn, kind, mediaUrl) => {
|
|
2710
2637
|
try {
|
|
2711
|
-
return await
|
|
2712
|
-
send: fn,
|
|
2713
|
-
onRetry: ({ attempt, maxAttempts: retryMaxAttempts, backoffMs, errorText }) => {
|
|
2714
|
-
logVerbose(`Retrying ${label} to ${conversationId} after failure (${attempt}/${retryMaxAttempts - 1}) in ${backoffMs}ms: ${errorText}`);
|
|
2715
|
-
}
|
|
2716
|
-
});
|
|
2638
|
+
return await fn();
|
|
2717
2639
|
} catch (error) {
|
|
2718
2640
|
if (isChannelPartialDeliveryError(error) || sendResults.some((result) => result.providerAccepted)) throw preserveAcceptedDeliveryError(error, kind, mediaUrl);
|
|
2719
2641
|
throw error;
|
|
2720
2642
|
}
|
|
2721
2643
|
};
|
|
2722
|
-
const sendText = async (chunk,
|
|
2723
|
-
rememberSendResult(await
|
|
2644
|
+
const sendText = async (chunk, quote = getQuote) => {
|
|
2645
|
+
rememberSendResult(await send(() => transport.reply(chunk, quote()), "text"));
|
|
2724
2646
|
};
|
|
2725
2647
|
if (mediaList.length === 0 && textChunks.length) {
|
|
2726
2648
|
const totalChunks = textChunks.length;
|
|
2727
2649
|
for (const [index, chunk] of textChunks.entries()) {
|
|
2728
2650
|
const chunkStarted = Date.now();
|
|
2729
2651
|
const quote = getQuote();
|
|
2730
|
-
await sendText(chunk,
|
|
2652
|
+
await sendText(chunk, () => quote);
|
|
2731
2653
|
if (!skipLog) {
|
|
2732
2654
|
const durationMs = Date.now() - chunkStarted;
|
|
2733
2655
|
whatsappOutboundLog.debug(`Sent chunk ${index + 1}/${totalChunks} to ${conversationId} (${durationMs.toFixed(0)}ms)`);
|
|
@@ -2778,11 +2700,11 @@ async function deliverWebReplyInActivityScope(params) {
|
|
|
2778
2700
|
fileName: media.fileName,
|
|
2779
2701
|
caption
|
|
2780
2702
|
};
|
|
2781
|
-
rememberSendResult(await
|
|
2703
|
+
rememberSendResult(await send(() => transport.sendMedia({
|
|
2782
2704
|
...mediaContent,
|
|
2783
2705
|
mimetype: media.mimetype
|
|
2784
|
-
}, quote),
|
|
2785
|
-
if (media.kind === "audio" && caption) await sendText(caption,
|
|
2706
|
+
}, quote), "media", mediaUrl), mediaUrl);
|
|
2707
|
+
if (media.kind === "audio" && caption) await sendText(caption, () => quote);
|
|
2786
2708
|
whatsappOutboundLog.info(`Sent media reply to ${conversationId} (${(media.buffer.length / 1048576).toFixed(2)}MB)`);
|
|
2787
2709
|
replyLogger.info({
|
|
2788
2710
|
correlationId: transport.correlationId ?? newConnectionId(),
|
|
@@ -2805,10 +2727,10 @@ async function deliverWebReplyInActivityScope(params) {
|
|
|
2805
2727
|
}, "failed to send web media reply");
|
|
2806
2728
|
const fallbackText = isFirst ? [caption ?? "", "⚠️ Media failed."].filter(Boolean).join("\n") : "⚠️ Media unavailable.";
|
|
2807
2729
|
whatsappOutboundLog.warn(isFirst ? `Media skipped; sent text-only to ${conversationId}` : `Trailing media failed; sent warning to ${conversationId}`);
|
|
2808
|
-
await sendText(fallbackText
|
|
2730
|
+
await sendText(fallbackText);
|
|
2809
2731
|
}
|
|
2810
2732
|
});
|
|
2811
|
-
for (const chunk of remainingText) await sendText(chunk
|
|
2733
|
+
for (const chunk of remainingText) await sendText(chunk);
|
|
2812
2734
|
return finishDelivery();
|
|
2813
2735
|
}
|
|
2814
2736
|
//#endregion
|
|
@@ -3519,13 +3441,12 @@ async function processMessage(params) {
|
|
|
3519
3441
|
correlationId,
|
|
3520
3442
|
from: conversationId,
|
|
3521
3443
|
to: params.msg.platform.recipientJid,
|
|
3522
|
-
|
|
3444
|
+
bodyLength: combinedBody.length,
|
|
3523
3445
|
mediaType: params.msg.payload.media?.type ?? null,
|
|
3524
3446
|
mediaPath: params.msg.payload.media?.path ?? null
|
|
3525
3447
|
}, "inbound web message");
|
|
3526
3448
|
const kindLabel = params.msg.payload.media?.type ? `, ${params.msg.payload.media?.type}` : "";
|
|
3527
3449
|
whatsappInboundLog.info(`Inbound message ${conversationId} -> ${params.msg.platform.recipientJid} (${conversationKind}${kindLabel}, ${combinedBody.length} chars)`);
|
|
3528
|
-
if (shouldLogVerbose$1()) whatsappInboundLog.debug(`Inbound body: ${elide(combinedBody, 400)}`);
|
|
3529
3450
|
const sender = getSenderIdentity(params.msg);
|
|
3530
3451
|
const commandBody = params.msg.payload.commandBody ?? params.msg.payload.body;
|
|
3531
3452
|
const dmRouteTarget = resolveWhatsAppDmRouteTarget({
|
|
@@ -3950,7 +3871,7 @@ function isRetryableAuthUnstableError(error) {
|
|
|
3950
3871
|
const DEFAULT_TRANSPORT_TIMEOUT_MS = 3e5;
|
|
3951
3872
|
const WHATSAPP_RECONNECT_CATCH_UP_MAX_MS = 12e5;
|
|
3952
3873
|
async function monitorWebChannel(verbose, listenerFactory = attachWebInboxToSocket, keepAlive = true, replyResolver, runtime = defaultRuntime, abortSignal, tuning = {}) {
|
|
3953
|
-
const activeReplyResolver = replyResolver ?? (await import("./reply-resolver.runtime-
|
|
3874
|
+
const activeReplyResolver = replyResolver ?? (await import("./reply-resolver.runtime-Byxo9w3l.mjs")).getReplyFromConfig;
|
|
3954
3875
|
const runId = newConnectionId();
|
|
3955
3876
|
const replyLogger = getChildLogger$1({
|
|
3956
3877
|
module: "web-auto-reply",
|
|
@@ -3965,11 +3886,11 @@ async function monitorWebChannel(verbose, listenerFactory = attachWebInboxToSock
|
|
|
3965
3886
|
runId
|
|
3966
3887
|
});
|
|
3967
3888
|
const { cfg, account } = resolveWebMonitorConfigSnapshot({
|
|
3968
|
-
cfg: getRuntimeConfig
|
|
3889
|
+
cfg: getRuntimeConfig(),
|
|
3969
3890
|
accountId: tuning.accountId
|
|
3970
3891
|
});
|
|
3971
3892
|
const loadCurrentMonitorConfig = () => resolveWebMonitorConfigSnapshot({
|
|
3972
|
-
cfg: getRuntimeConfig
|
|
3893
|
+
cfg: getRuntimeConfig(),
|
|
3973
3894
|
accountId: account.accountId
|
|
3974
3895
|
}).cfg;
|
|
3975
3896
|
const maxMediaBytes = resolveWhatsAppMediaMaxBytes(account);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-BBjsoOtd.mjs";
|
|
2
2
|
import { a as resolveWhatsAppAccount } from "./accounts-F0vHuze2.mjs";
|
|
3
|
-
import { u as listWhatsAppDeliveredMessageIdentities } from "./send-
|
|
3
|
+
import { u as listWhatsAppDeliveredMessageIdentities } from "./send-CIzCLFrJ.mjs";
|
|
4
4
|
import { t as buildWhatsAppReactionTargetKey } from "./reaction-target-CSPO7gtu.mjs";
|
|
5
5
|
import { normalizeUniqueTrimmedStringList } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
6
6
|
import { createQuestionReactionTargetStore, questionGatewayRuntime } from "openclaw/plugin-sdk/question-gateway-runtime";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { getReplyFromConfig } from "openclaw/plugin-sdk/reply-runtime";
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { createPluginRuntimeStore } from "openclaw/plugin-sdk/runtime-store";
|
|
2
|
+
//#region extensions/whatsapp/src/runtime.ts
|
|
3
|
+
const runtimeStore = createPluginRuntimeStore({
|
|
4
|
+
pluginId: "whatsapp",
|
|
5
|
+
errorMessage: "WhatsApp runtime not initialized"
|
|
6
|
+
});
|
|
7
|
+
const setWhatsAppRuntime = runtimeStore.setRuntime;
|
|
8
|
+
const getWhatsAppRuntime = runtimeStore.getRuntime;
|
|
9
|
+
const getOptionalWhatsAppRuntime = runtimeStore.tryGetRuntime;
|
|
10
|
+
const getOptionalWhatsAppChannelRuntime = () => getOptionalWhatsAppRuntime()?.channel;
|
|
11
|
+
const getWhatsAppChannelRuntime = () => {
|
|
12
|
+
const channel = getOptionalWhatsAppChannelRuntime();
|
|
13
|
+
if (!channel) throw new Error("WhatsApp channel runtime not initialized");
|
|
14
|
+
return channel;
|
|
15
|
+
};
|
|
16
|
+
//#endregion
|
|
17
|
+
export { setWhatsAppRuntime as a, getWhatsAppRuntime as i, getOptionalWhatsAppRuntime as n, getWhatsAppChannelRuntime as r, getOptionalWhatsAppChannelRuntime as t };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { a as resolveWhatsAppAccount, c as resolveMergedWhatsAppAccountConfig, s as resolveWhatsAppMediaMaxBytes } from "./accounts-F0vHuze2.mjs";
|
|
2
2
|
import { r as resolveDefaultWhatsAppAccountId } from "./account-ids-CB5SOWjc.mjs";
|
|
3
3
|
import { n as isWhatsAppNewsletterJid } from "./normalize-target-D67Kc3g6.mjs";
|
|
4
|
-
import { r as getWhatsAppConnectionController } from "./connection-controller-runtime-context-
|
|
4
|
+
import { r as getWhatsAppConnectionController } from "./connection-controller-runtime-context-x8C_unRx.mjs";
|
|
5
5
|
import { a as markdownToWhatsAppChunks, c as toWhatsappJid } from "./targets-runtime-D5ryyPxh.mjs";
|
|
6
6
|
import path from "node:path";
|
|
7
7
|
import { normalizeStringEntries, normalizeUniqueStringEntries, uniqueStrings } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { n as isWhatsAppNewsletterJid } from "./normalize-target-D67Kc3g6.mjs";
|
|
2
|
-
import { _ as resolveWhatsAppDocumentFileName, f as mergeWhatsAppAcceptedSendError, l as combineWhatsAppSendResults, m as rememberWhatsAppAcceptedSend, p as normalizeWhatsAppSendResult } from "./send-
|
|
2
|
+
import { _ as resolveWhatsAppDocumentFileName, f as mergeWhatsAppAcceptedSendError, l as combineWhatsAppSendResults, m as rememberWhatsAppAcceptedSend, p as normalizeWhatsAppSendResult } from "./send-CIzCLFrJ.mjs";
|
|
3
3
|
import { c as toWhatsappJid, l as toWhatsappJidWithLid, r as jidToE164 } from "./targets-runtime-D5ryyPxh.mjs";
|
|
4
4
|
import { r as buildQuotedMessageOptions } from "./group-session-key-BbTPosdy.mjs";
|
|
5
5
|
import { O as resolveComparableIdentity } from "./auth-store-DOBi5BPe.mjs";
|
|
@@ -2,7 +2,7 @@ import { a as resolveWhatsAppAccount, o as resolveWhatsAppAuthDir } from "./acco
|
|
|
2
2
|
import { r as resolveDefaultWhatsAppAccountId } from "./account-ids-CB5SOWjc.mjs";
|
|
3
3
|
import { n as hasWebCredsSync } from "./creds-files-B8WcOAmE.mjs";
|
|
4
4
|
import { a as normalizeWhatsAppAllowFromEntries, o as normalizeWhatsAppAllowFromEntry } from "./normalize-target-D67Kc3g6.mjs";
|
|
5
|
-
import { n as whatsappSetupAdapter } from "./shared-
|
|
5
|
+
import { n as whatsappSetupAdapter } from "./shared-CbsgcYtM.mjs";
|
|
6
6
|
import { formatCliCommand, formatDocsLink } from "openclaw/plugin-sdk/setup-tools";
|
|
7
7
|
import { DEFAULT_ACCOUNT_ID, createSetupTranslator, splitSetupEntries } from "openclaw/plugin-sdk/setup";
|
|
8
8
|
//#region extensions/whatsapp/src/setup-finalize.ts
|
|
@@ -235,7 +235,7 @@ async function finalizeWhatsAppSetup(params) {
|
|
|
235
235
|
})) {
|
|
236
236
|
let persistenceGuardFailure;
|
|
237
237
|
try {
|
|
238
|
-
const { loginWeb } = await import("./login-
|
|
238
|
+
const { loginWeb } = await import("./login-Bk8OQeE6.mjs").then((n) => n.n);
|
|
239
239
|
const beforeCredentialPersistence = params.options?.beforePersistentEffect ? async () => {
|
|
240
240
|
try {
|
|
241
241
|
await params.options?.beforePersistentEffect?.();
|
|
@@ -36,7 +36,7 @@ const whatsappSetupWizard = {
|
|
|
36
36
|
},
|
|
37
37
|
resolveShouldPromptAccountIds: ({ shouldPromptAccountIds }) => shouldPromptAccountIds,
|
|
38
38
|
credentials: [],
|
|
39
|
-
finalize: async (params) => await (await import("./setup-finalize-
|
|
39
|
+
finalize: async (params) => await (await import("./setup-finalize-BtqJn6jL.mjs")).finalizeWhatsAppSetup(params),
|
|
40
40
|
disable: (cfg) => setSetupChannelEnabled(cfg, channel, false),
|
|
41
41
|
onAccountRecorded: (accountId, options) => {
|
|
42
42
|
options?.onAccountId?.(channel, accountId);
|
|
@@ -27,7 +27,7 @@ async function readWhatsAppAccountLinkState(authDir) {
|
|
|
27
27
|
}
|
|
28
28
|
const loadWhatsAppChannelRuntime = createLazyRuntimeModule(async () => {
|
|
29
29
|
await loadWhatsAppAuthStore();
|
|
30
|
-
return await import("./channel.runtime-
|
|
30
|
+
return await import("./channel.runtime-BTx7s_SW.mjs");
|
|
31
31
|
});
|
|
32
32
|
//#endregion
|
|
33
33
|
//#region extensions/whatsapp/src/group-policy.ts
|
|
@@ -132,7 +132,7 @@ const whatsappResolveDmPolicy = createScopedDmSecurityResolver({
|
|
|
132
132
|
});
|
|
133
133
|
const whatsappSetupWizardProxy = createDelegatedSetupWizardProxy({
|
|
134
134
|
channel: WHATSAPP_CHANNEL,
|
|
135
|
-
loadWizard: async () => (await import("./setup-surface-
|
|
135
|
+
loadWizard: async () => (await import("./setup-surface-D6HuvKfd.mjs")).whatsappSetupWizard,
|
|
136
136
|
status: {
|
|
137
137
|
configuredLabel: "linked",
|
|
138
138
|
unconfiguredLabel: "not linked",
|
|
@@ -524,7 +524,6 @@ async function waitForTransportClose(ws, operation, operationName) {
|
|
|
524
524
|
const closed = ws.isClosed ? Promise.resolve() : new Promise((resolve) => {
|
|
525
525
|
onClose = resolve;
|
|
526
526
|
ws.once("close", onClose);
|
|
527
|
-
if (ws.isClosed) onClose();
|
|
528
527
|
});
|
|
529
528
|
try {
|
|
530
529
|
await withCloseTimeout(Promise.all([Promise.resolve(operation), closed]), operationName);
|
|
@@ -537,11 +536,7 @@ async function closeWhatsAppSocketAndWait(sock, reason) {
|
|
|
537
536
|
const errors = [];
|
|
538
537
|
try {
|
|
539
538
|
const endResult = sock.end(new Error(reason));
|
|
540
|
-
if (sock.ws.isClosed)
|
|
541
|
-
await waitForTransportClose(sock.ws, endResult, "socket end");
|
|
542
|
-
return;
|
|
543
|
-
}
|
|
544
|
-
if (sock.ws.isClosing) await waitForTransportClose(sock.ws, endResult, "socket end");
|
|
539
|
+
if (sock.ws.isClosed || sock.ws.isClosing) await waitForTransportClose(sock.ws, endResult, "socket end");
|
|
545
540
|
else await withCloseTimeout(Promise.resolve(endResult), "socket end");
|
|
546
541
|
} catch (error) {
|
|
547
542
|
errors.push(error);
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export { handleWhatsAppAction };
|
|
1
|
+
export { t as handleWhatsAppAction } from "./.setup/action-runtime-B1UcIuRG.mjs";
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export { handleWhatsAppAction };
|
|
1
|
+
export { t as handleWhatsAppAction } from "./.setup/action-runtime-B1UcIuRG.mjs";
|
package/dist/agent-tools-api.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { a as resolveWhatsAppAccount } from "./.setup/accounts-F0vHuze2.mjs";
|
|
2
|
-
import { r as getWhatsAppConnectionController } from "./.setup/connection-controller-runtime-context-
|
|
2
|
+
import { r as getWhatsAppConnectionController } from "./.setup/connection-controller-runtime-context-x8C_unRx.mjs";
|
|
3
3
|
import { s as resolveJidToE164 } from "./.setup/targets-runtime-D5ryyPxh.mjs";
|
|
4
|
-
import { n as registerWhatsAppLoginTool } from "./.setup/agent-tools-login-
|
|
4
|
+
import { n as registerWhatsAppLoginTool } from "./.setup/agent-tools-login-n7QVE3Am.mjs";
|
|
5
5
|
import { createActionGate, stringEnum } from "openclaw/plugin-sdk/channel-actions";
|
|
6
6
|
import path from "node:path";
|
|
7
7
|
import { resolveOAuthDir } from "openclaw/plugin-sdk/state-paths";
|
package/dist/api.js
CHANGED
|
@@ -3,15 +3,15 @@ import { r as resolveDefaultWhatsAppAccountId, t as listAccountIds } from "./.se
|
|
|
3
3
|
import { a as normalizeWhatsAppAllowFromEntries, c as normalizeWhatsAppTarget, i as looksLikeWhatsAppTargetId, r as isWhatsAppUserTarget, s as normalizeWhatsAppMessagingTarget, t as isWhatsAppGroupJid } from "./.setup/normalize-target-D67Kc3g6.mjs";
|
|
4
4
|
import { t as resolveWhatsAppOutboundTarget } from "./.setup/resolve-outbound-target-qikGL4r0.mjs";
|
|
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 "./.setup/targets-runtime-D5ryyPxh.mjs";
|
|
6
|
-
import { n as WHATSAPP_LEGACY_OUTBOUND_SEND_DEP_KEYS, t as whatsappPlugin } from "./.setup/channel-
|
|
7
|
-
import { i as resolveWhatsAppGroupToolPolicy, r as resolveWhatsAppGroupRequireMention } from "./.setup/shared-
|
|
6
|
+
import { n as WHATSAPP_LEGACY_OUTBOUND_SEND_DEP_KEYS, t as whatsappPlugin } from "./.setup/channel-CecgCOxi.mjs";
|
|
7
|
+
import { i as resolveWhatsAppGroupToolPolicy, r as resolveWhatsAppGroupRequireMention } from "./.setup/shared-CbsgcYtM.mjs";
|
|
8
8
|
import { t as whatsappCommandPolicy } from "./.setup/command-policy-BIOSHySD.mjs";
|
|
9
|
-
import { t as whatsappSetupPlugin } from "./.setup/channel.setup-
|
|
9
|
+
import { t as whatsappSetupPlugin } from "./.setup/channel.setup-BACWTI6Q.mjs";
|
|
10
10
|
import { t as DEFAULT_WEB_MEDIA_BYTES } from "./.setup/constants-C7m81BNe.mjs";
|
|
11
|
-
import { d as DEFAULT_WHATSAPP_SOCKET_TIMING, f as createWhatsAppSocketOperationTimeoutAdapter, i as waitForWaConnection, r as createWaSocket } from "./.setup/socket-close-
|
|
11
|
+
import { d as DEFAULT_WHATSAPP_SOCKET_TIMING, f as createWhatsAppSocketOperationTimeoutAdapter, i as waitForWaConnection, r as createWaSocket } from "./.setup/socket-close-BhMQls5y.mjs";
|
|
12
12
|
import { n as getStatusCode, t as formatError } from "./.setup/session-errors-B8UcAnZN.mjs";
|
|
13
|
-
import { n as listWhatsAppDirectoryGroupsFromConfig, r as listWhatsAppDirectoryPeersFromConfig } from "./.setup/directory-config-
|
|
14
|
-
import { _ as resolveInboundMediaMimetype, c as extractContextInfo, m as findMessageSection, o as describeReplyContext, p as extractText, t as createWebSendApi, u as extractLocationData } from "./.setup/send-api-
|
|
13
|
+
import { n as listWhatsAppDirectoryGroupsFromConfig, r as listWhatsAppDirectoryPeersFromConfig } from "./.setup/directory-config-CegsBv11.mjs";
|
|
14
|
+
import { _ as resolveInboundMediaMimetype, c as extractContextInfo, m as findMessageSection, o as describeReplyContext, p as extractText, t as createWebSendApi, u as extractLocationData } from "./.setup/send-api-Ck6tezjw.mjs";
|
|
15
15
|
import { asBoolean, isRecord, normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
16
16
|
import { formatLocationText } from "openclaw/plugin-sdk/channel-inbound";
|
|
17
17
|
import { normalizeE164, resolveUserPath } from "openclaw/plugin-sdk/text-utility-runtime";
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export { WhatsAppChannelConfigSchema };
|
|
1
|
+
export { t as WhatsAppChannelConfigSchema } from "./.setup/config-schema-BYA6e_Ii.mjs";
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export { whatsappPlugin };
|
|
1
|
+
export { t as whatsappPlugin } from "./.setup/channel-CecgCOxi.mjs";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as listWhatsAppDirectoryGroupsFromConfig, r as listWhatsAppDirectoryPeersFromConfig } from "./.setup/directory-config-
|
|
1
|
+
import { n as listWhatsAppDirectoryGroupsFromConfig, r as listWhatsAppDirectoryPeersFromConfig } from "./.setup/directory-config-CegsBv11.mjs";
|
|
2
2
|
//#region extensions/whatsapp/directory-contract-api.ts
|
|
3
3
|
const whatsappDirectoryContractPlugin = {
|
|
4
4
|
id: "whatsapp",
|