@openclaw/whatsapp 2026.9.1-beta.1 → 2026.9.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (62) hide show
  1. package/dist/{accounts-BX2fZUyR.js → accounts-CiKHiuEe.js} +10 -27
  2. package/dist/{action-runtime-C075e6OP.js → action-runtime-CRZLhN3f.js} +2 -2
  3. package/dist/action-runtime-api.js +1 -1
  4. package/dist/action-runtime.runtime.js +1 -1
  5. package/dist/agent-tools-api.js +3 -3
  6. package/dist/api.js +10 -10
  7. package/dist/{approval-handler.runtime-CljxfPJz.js → approval-handler.runtime-C2cpkbpY.js} +8 -4
  8. package/dist/{approval-reactions-Jyr1JaAK.js → approval-reactions-DrZe-NmN.js} +7 -5
  9. package/dist/auth-presence.js +1 -1
  10. package/dist/{auth-store-CtpBqH5S.js → auth-store-ZWaclAbd.js} +8 -6
  11. package/dist/{channel-C4FMOZTE.js → channel-DebjeuFC.js} +56 -62
  12. package/dist/channel-config-api.js +1 -1
  13. package/dist/channel-plugin-api.js +1 -1
  14. package/dist/{channel-react-action-Bhp2BYRr.js → channel-react-action-CHeJSG9F.js} +3 -3
  15. package/dist/{channel.runtime-CrahUvcb.js → channel.runtime-B90_wffD.js} +4 -4
  16. package/dist/{channel.setup-CGcBvnpP.js → channel.setup-D1-jE0aE.js} +1 -1
  17. package/dist/{config-schema-BQP5YCeK.js → config-schema-BYA6e_Ii.js} +6 -4
  18. package/dist/{connection-controller-CIYuBJrs.js → connection-controller-DNp6U1NN.js} +2 -2
  19. package/dist/{constants-HU41RHGI.js → constants-C7m81BNe.js} +1 -1
  20. package/dist/{creds-files-W6B3EMZ8.js → creds-files-Drg3usj1.js} +1 -1
  21. package/dist/{directory-config-P7_3U73Z.js → directory-config-CoWFw1zn.js} +3 -3
  22. package/dist/directory-contract-api.js +1 -1
  23. package/dist/doctor-BPb-SjdE.js +65 -0
  24. package/dist/doctor-contract-api.js +21 -3
  25. package/dist/{group-session-key-DmFc_Cqi.js → group-session-key-BmVDSPr1.js} +11 -12
  26. package/dist/light-runtime-api.js +1 -1
  27. package/dist/{login-BkpKpndm.js → login-6j2iP9nR.js} +6 -5
  28. package/dist/{login-qr-DY4VFgOq.js → login-qr-DRFgI6k1.js} +9 -7
  29. package/dist/login-qr-runtime.js +1 -1
  30. package/dist/{monitor-C_Nw23PZ.js → monitor-DyPdOPRx.js} +145 -130
  31. package/dist/{question-reactions-D3eAeB0i.js → question-reactions-bbe0Qnjn.js} +1 -1
  32. package/dist/runtime-api.js +9 -9
  33. package/dist/{send-DLMUc2uZ.js → send-BDDGPxav.js} +53 -28
  34. package/dist/{send-api-BtK45TmZ.js → send-api-C_Zn4Ij-.js} +48 -48
  35. package/dist/{setup-finalize-C1nij8NS.js → setup-finalize-C5QtbrWV.js} +7 -6
  36. package/dist/setup-plugin-api.js +1 -1
  37. package/dist/{setup-surface-CjjqIxQP.js → setup-surface-WsAzq337.js} +3 -3
  38. package/dist/{shared-BekHi69d.js → shared-BzKxoeKY.js} +8 -7
  39. package/dist/{socket-close-2T0_jZTN.js → socket-close-B3X9uerq.js} +10 -7
  40. package/dist/{targets-runtime-TMk0lGuy.js → targets-runtime-RBjx3pg_.js} +1 -2
  41. package/dist/{text-runtime-CaKLhowd.js → text-runtime-DyfmcATV.js} +1 -1
  42. package/node_modules/baileys/node_modules/process-warning/.github/dependabot.yml +42 -2
  43. package/node_modules/baileys/node_modules/process-warning/.github/workflows/ci.yml +12 -1
  44. package/node_modules/baileys/node_modules/process-warning/.github/workflows/lock-threads.yml +19 -0
  45. package/node_modules/baileys/node_modules/process-warning/LICENSE +1 -1
  46. package/node_modules/baileys/node_modules/process-warning/README.md +41 -2
  47. package/node_modules/baileys/node_modules/process-warning/index.js +85 -17
  48. package/node_modules/baileys/node_modules/process-warning/package.json +6 -7
  49. package/node_modules/baileys/node_modules/process-warning/test/emit-once-only.test.js +3 -3
  50. package/node_modules/baileys/node_modules/process-warning/test/emit-reset.test.js +4 -4
  51. package/node_modules/baileys/node_modules/process-warning/test/emit-unlimited.test.js +2 -2
  52. package/node_modules/baileys/node_modules/process-warning/test/spy-warning.test.js +143 -0
  53. package/node_modules/baileys/node_modules/process-warning/types/index.d.ts +15 -1
  54. package/node_modules/baileys/node_modules/process-warning/types/index.tst.ts +48 -0
  55. package/node_modules/baileys/node_modules/ws/lib/permessage-deflate.js +3 -1
  56. package/node_modules/baileys/node_modules/ws/package.json +1 -1
  57. package/node_modules/typebox/build/format/email.mjs +1 -1
  58. package/node_modules/typebox/build/format/idna/idn-hostname.mjs +19 -1
  59. package/node_modules/typebox/package.json +1 -1
  60. package/package.json +7 -6
  61. package/dist/doctor-CwzVXKoE.js +0 -10
  62. package/node_modules/baileys/node_modules/process-warning/types/index.test-d.ts +0 -36
@@ -1,23 +1,23 @@
1
- import { a as resolveWhatsAppAccount, s as resolveWhatsAppMediaMaxBytes } from "./accounts-BX2fZUyR.js";
2
- import { c as normalizeWhatsAppPayloadTextPreservingIndentation, d as listWhatsAppSendResultMessageIds, f as mergeWhatsAppAcceptedSendError, g as withWhatsAppLogicalDeliveryActivity, h as rememberWhatsAppPartialSend, l as prepareWhatsAppOutboundMedia, m as rememberWhatsAppAcceptedSend, o as normalizeWhatsAppOutboundPayload, p as normalizeWhatsAppSendResult, r as sendReactionWhatsApp, v as resolveWhatsAppReactionLevel } from "./send-DLMUc2uZ.js";
1
+ import { a as resolveWhatsAppAccount, s as resolveWhatsAppMediaMaxBytes } from "./accounts-CiKHiuEe.js";
2
+ import { c as normalizeWhatsAppPayloadTextPreservingIndentation, d as listWhatsAppSendResultMessageIds, f as mergeWhatsAppAcceptedSendError, g as withWhatsAppLogicalDeliveryActivity, h as rememberWhatsAppPartialSend, l as prepareWhatsAppOutboundMedia, m as rememberWhatsAppAcceptedSend, o as normalizeWhatsAppOutboundPayload, p as normalizeWhatsAppSendResult, r as sendReactionWhatsApp, v as resolveWhatsAppReactionLevel } from "./send-BDDGPxav.js";
3
3
  import { i as getWhatsAppRuntime } from "./runtime-BLlToOi6.js";
4
4
  import { r as getWhatsAppConnectionController } from "./connection-controller-runtime-context-DG0tuYuw.js";
5
- 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-TMk0lGuy.js";
6
- import { t as normalizeE164 } from "./text-runtime-CaKLhowd.js";
7
- import { a as cacheInboundMessageMeta, i as buildQuotedMessageOptions, n as resolveWhatsAppGroupSessionRoute, o as lookupInboundMessageMeta, r as resolveWhatsAppLegacyGroupSessionKey } from "./group-session-key-DmFc_Cqi.js";
8
- import { C as getMentionIdentities, D as getSenderIdentity, E as getSelfIdentity, O as identitiesOverlap, S as getComparableIdentityValues, T as getReplyContext, g as readWebSelfId, k as resolveComparableIdentity, o as getWebAuthAgeMs, r as WhatsAppAuthUnstableError, v as readWebSelfIdentityForDecision, w as getPrimaryIdentityId } from "./auth-store-CtpBqH5S.js";
5
+ 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-RBjx3pg_.js";
6
+ import { t as normalizeE164 } from "./text-runtime-DyfmcATV.js";
7
+ import { a as cacheInboundMessageMeta, i as buildQuotedMessageOptions, n as resolveWhatsAppGroupSessionRoute, o as lookupInboundMessageMeta, r as resolveWhatsAppLegacyGroupSessionKey } from "./group-session-key-BmVDSPr1.js";
8
+ import { C as getMentionIdentities, D as getSenderIdentity, E as getSelfIdentity, O as identitiesOverlap, S as getComparableIdentityValues, T as getReplyContext, g as readWebSelfId, k as resolveComparableIdentity, o as getWebAuthAgeMs, r as WhatsAppAuthUnstableError, v as readWebSelfIdentityForDecision, w as getPrimaryIdentityId } from "./auth-store-ZWaclAbd.js";
9
9
  import { n as resolveWhatsAppGroupsConfigPath } from "./group-config-path-BGyzT9Lg.js";
10
- import { a as waitForWaConnection, c as isWhatsAppSocketOperationTimeoutError, d as withWhatsAppSocketOperationTimeout, l as resolveWhatsAppSocketOperationTimeoutMs, r as createWaSocket, s as createWhatsAppSocketOperationTimeoutAdapter, u as resolveWhatsAppSocketTiming } from "./socket-close-2T0_jZTN.js";
10
+ import { a as waitForWaConnection, c as isWhatsAppSocketOperationTimeoutError, d as withWhatsAppSocketOperationTimeout, l as resolveWhatsAppSocketOperationTimeoutMs, r as createWaSocket, s as createWhatsAppSocketOperationTimeoutAdapter, u as resolveWhatsAppSocketTiming } from "./socket-close-B3X9uerq.js";
11
11
  import { n as getStatusCode, t as formatError } from "./session-errors-JuazczrA.js";
12
12
  import { t as BufferJSON } from "./session.runtime-Nsqaehbd.js";
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-BtK45TmZ.js";
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-C_Zn4Ij-.js";
14
14
  import { t as resolveWhatsAppRuntimeGroupPolicy } from "./runtime-group-policy-DeSRFXEV.js";
15
- import { c as computeBackoff, d as resolveReconnectPolicy, f as sleepWithAbort, l as newConnectionId, n as WHATSAPP_WATCHDOG_TIMEOUT_ERROR, r as WhatsAppConnectionController, s as DEFAULT_RECONNECT_POLICY, u as resolveHeartbeatSeconds } from "./connection-controller-CIYuBJrs.js";
16
- import { n as maybeResolveWhatsAppApprovalReaction } from "./approval-reactions-Jyr1JaAK.js";
17
- import { t as maybeResolveWhatsAppQuestionReaction } from "./question-reactions-D3eAeB0i.js";
18
- import { normalizeLowercaseStringOrEmpty, normalizeOptionalString, normalizeStringEntries } from "openclaw/plugin-sdk/string-coerce-runtime";
19
- import { filterSupplementalContextItems, resolvePinnedMainDmOwnerFromAllowlist } from "openclaw/plugin-sdk/security-runtime";
15
+ import { c as computeBackoff, d as resolveReconnectPolicy, f as sleepWithAbort, l as newConnectionId, n as WHATSAPP_WATCHDOG_TIMEOUT_ERROR, r as WhatsAppConnectionController, s as DEFAULT_RECONNECT_POLICY, u as resolveHeartbeatSeconds } from "./connection-controller-DNp6U1NN.js";
16
+ import { n as maybeResolveWhatsAppApprovalReaction } from "./approval-reactions-DrZe-NmN.js";
17
+ import { t as maybeResolveWhatsAppQuestionReaction } from "./question-reactions-bbe0Qnjn.js";
18
+ import { normalizeLowercaseStringOrEmpty, normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
20
19
  import { createAckReactionHandle, createStatusReactionController, logAckFailure, removeAckReactionHandleAfterReply, shouldAckReaction } from "openclaw/plugin-sdk/channel-feedback";
20
+ import { bindIngressLifecycleToReplyOptions, createChannelIngressMonitor, createChannelMessageReplyPipeline, createMessageReceiptFromOutboundResults, listMessageReceiptPlatformIds, resolveChannelMessageSourceReplyDeliveryMode, resolveChannelStreamingBlockEnabled } from "openclaw/plugin-sdk/channel-outbound";
21
21
  import { formatCliCommand } from "openclaw/plugin-sdk/cli-runtime";
22
22
  import { PlatformMessageNotDispatchedError } from "openclaw/plugin-sdk/error-runtime";
23
23
  import { createSubsystemLogger, getChildLogger, redactToolPayloadText } from "openclaw/plugin-sdk/logging-core";
@@ -26,7 +26,6 @@ import { createSubsystemLogger as createSubsystemLogger$1, defaultRuntime, forma
26
26
  import { registerChannelRuntimeContext } from "openclaw/plugin-sdk/channel-runtime-context";
27
27
  import { recordChannelActivity } from "openclaw/plugin-sdk/channel-activity-runtime";
28
28
  import { buildChannelInboundEventContext, createChannelPartialDeliveryError, filterChannelInboundQuoteContext, formatInboundEnvelope, formatInboundEnvelope as formatInboundEnvelope$1, formatInboundMediaUnavailableText, formatLocationText, formatMediaPlaceholderText, hasVisibleInboundReplyDispatch, isChannelPartialDeliveryError, readAgentRunTerminalOutcome, resolveInboundSessionEnvelopeContext, resolveInboundSupplementalSenderAllowed, runChannelInboundEvent, shouldDebounceTextInbound, toInboundMediaFactsWithMetadata, toLocationContext } from "openclaw/plugin-sdk/channel-inbound";
29
- import { bindIngressLifecycleToReplyOptions, createChannelIngressMonitor, createChannelMessageReplyPipeline, createMessageReceiptFromOutboundResults, listMessageReceiptPlatformIds, resolveChannelMessageSourceReplyDeliveryMode, resolveChannelStreamingBlockEnabled } from "openclaw/plugin-sdk/channel-outbound";
30
29
  import { getAgentScopedMediaLocalRoots } from "openclaw/plugin-sdk/media-runtime";
31
30
  import { isReasoningReplyPayload, resolveSendableOutboundReplyParts, resolveTextChunksWithFallback, sendMediaWithLeadingCaption } from "openclaw/plugin-sdk/reply-payload";
32
31
  import { truncateUtf16Safe } from "openclaw/plugin-sdk/text-utility-runtime";
@@ -35,6 +34,7 @@ import { DisconnectReason, downloadMediaMessage, isHostedLidUser, isHostedPnUser
35
34
  import { resolveChannelGroupPolicy, resolveChannelGroupRequireMention } from "openclaw/plugin-sdk/channel-policy";
36
35
  import { DEFAULT_ACCOUNT_ID, DEFAULT_MAIN_KEY, buildAgentMainSessionKey, buildAgentSessionKey, buildGroupHistoryKey, deriveLastRoutePolicy, normalizeAccountId, normalizeAgentId, resolveAgentRoute, resolveInboundLastRouteSessionKey } from "openclaw/plugin-sdk/routing";
37
36
  import { asDateTimestampMs, parseStrictFiniteNumber, resolveExpiresAtMsFromDurationMs } from "openclaw/plugin-sdk/number-runtime";
37
+ import { filterSupplementalContextItems, resolvePinnedMainDmOwnerFromAllowlist } from "openclaw/plugin-sdk/security-runtime";
38
38
  import { createChannelPairingChallengeIssuer } from "openclaw/plugin-sdk/channel-pairing";
39
39
  import { createHash } from "node:crypto";
40
40
  import { resolveDefaultGroupPolicy, warnMissingProviderGroupPolicyFallbackOnce } from "openclaw/plugin-sdk/runtime-group-policy";
@@ -357,7 +357,7 @@ function createWhatsAppIngressMonitor(params) {
357
357
  deliver: (admission, lifecycle) => params.dispatch(admission, lifecycle),
358
358
  pollIntervalMs: params.pollIntervalMs,
359
359
  retention: {
360
- completedTtlMs: 10080 * 60 * 1e3,
360
+ completedTtlMs: 6048e5,
361
361
  completedMaxEntries: 5e3,
362
362
  failedMaxEntries: 450
363
363
  },
@@ -381,7 +381,7 @@ function createWhatsAppIngressMonitor(params) {
381
381
  }
382
382
  //#endregion
383
383
  //#region extensions/whatsapp/src/inbound/group-metadata-cache.ts
384
- const GROUP_META_TTL_MS = 300 * 1e3;
384
+ const GROUP_META_TTL_MS = 3e5;
385
385
  const WHATSAPP_GROUP_METADATA_CACHE_MAX_ENTRIES = 500;
386
386
  function resolveGroupMetadataExpiresAt(nowRaw = Date.now()) {
387
387
  const now = asDateTimestampMs(nowRaw);
@@ -498,10 +498,11 @@ function createWhatsAppGroupMetadataCacheOwner(params) {
498
498
  text,
499
499
  mentionedJids: []
500
500
  };
501
+ const meta = await get(jid);
501
502
  return resolveWhatsAppOutboundMentions({
502
503
  chatJid: jid,
503
504
  text,
504
- participants: (await get(jid)).mentionParticipants
505
+ participants: meta.mentionParticipants
505
506
  });
506
507
  };
507
508
  const applyOutboundMentions = async (jid, content) => {
@@ -748,26 +749,25 @@ function createWhatsAppInboundMessageDebouncer(options) {
748
749
  function unwrapMessage(message) {
749
750
  return normalizeMessageContent$1(message);
750
751
  }
751
- async function downloadInboundMedia(msg, sock, maxBytes = 50 * 1024 * 1024, normalizedMessage) {
752
+ async function downloadInboundMedia(msg, sock, maxBytes = 52428800, normalizedMessage) {
752
753
  const message = normalizedMessage ?? unwrapMessage(msg.message);
753
754
  if (!message) return;
754
755
  const mimetype = resolveInboundMediaMimetype(message);
755
756
  const fileName = message.documentMessage?.fileName ?? void 0;
756
757
  if (!message.imageMessage && !message.videoMessage && !message.ptvMessage && !message.documentMessage && !message.audioMessage && !message.stickerMessage) return;
758
+ const stream = await downloadMediaMessage(msg, "stream", {}, {
759
+ reuploadRequest: sock.updateMediaMessage,
760
+ logger: sock.logger
761
+ });
757
762
  return {
758
- saved: await saveMediaStream(await downloadMediaMessage(msg, "stream", {}, {
759
- reuploadRequest: sock.updateMediaMessage,
760
- logger: sock.logger
761
- }), mimetype, "inbound", maxBytes, fileName).catch((err) => {
762
- if (err instanceof Error && /Media exceeds/i.test(err.message)) throw new Error(`Media exceeds ${Math.round(maxBytes / (1024 * 1024))}MB limit`);
763
- throw err;
764
- }),
763
+ saved: await saveMediaStream(stream, mimetype, "inbound", maxBytes, fileName),
765
764
  mimetype,
766
765
  fileName
767
766
  };
768
767
  }
769
- async function downloadQuotedInboundMedia(msg, sock, maxBytes = 50 * 1024 * 1024) {
770
- const contextInfo = extractContextInfo(unwrapMessage(msg.message));
768
+ async function downloadQuotedInboundMedia(msg, sock, maxBytes = 52428800) {
769
+ const message = unwrapMessage(msg.message);
770
+ const contextInfo = extractContextInfo(message);
771
771
  if (!contextInfo?.quotedMessage) return;
772
772
  const quotedMessage = contextInfo.quotedMessage;
773
773
  const self = sock.user;
@@ -792,7 +792,9 @@ async function downloadQuotedInboundMedia(msg, sock, maxBytes = 50 * 1024 * 1024
792
792
  const inboundMediaLogger = createSubsystemLogger("gateway/channels/whatsapp").child("inbound");
793
793
  const MAX_MEDIA_ERROR_MESSAGE_CHARS = 256;
794
794
  function sanitizeMediaErrorMessage(error) {
795
- return truncateUtf16Safe(redactToolPayloadText(error instanceof Error ? error.message : String(error)).replace(/https?:\/\/\S+/giu, "[redacted-url]").replace(/\b[^@\s]+@[a-z][a-z\d.-]*\b/giu, "[redacted-jid]").replace(/\+?\d[\d ().-]{6,}\d/gu, "[redacted-phone]").split("\n", 1)[0]?.trim() || "unknown error", MAX_MEDIA_ERROR_MESSAGE_CHARS);
795
+ const rawMessage = error instanceof Error ? error.message : String(error);
796
+ const redacted = redactToolPayloadText(rawMessage).replace(/https?:\/\/\S+/giu, "[redacted-url]").replace(/\b[^@\s]+@[a-z][a-z\d.-]*\b/giu, "[redacted-jid]").replace(/\+?\d[\d ().-]{6,}\d/gu, "[redacted-phone]");
797
+ return truncateUtf16Safe(redacted.split("\n", 1)[0]?.trim() || "unknown error", MAX_MEDIA_ERROR_MESSAGE_CHARS);
796
798
  }
797
799
  function logMediaMaterializationFailure(params) {
798
800
  const errorClass = params.error instanceof Error && /^[A-Za-z][A-Za-z0-9_.-]{0,63}$/u.test(params.error.name) ? params.error.name : "Error";
@@ -1001,7 +1003,7 @@ async function checkInboundAccessControl(params) {
1001
1003
  //#endregion
1002
1004
  //#region extensions/whatsapp/src/inbound/dedupe.ts
1003
1005
  const recentOutboundMessages = createDedupeCache({
1004
- ttlMs: 20 * 6e4,
1006
+ ttlMs: 12e5,
1005
1007
  maxSize: 5e3
1006
1008
  });
1007
1009
  function buildMessageKey(params) {
@@ -1215,11 +1217,13 @@ function createWhatsAppMessageDeliveryCoordinator(options) {
1215
1217
  };
1216
1218
  const reply = async (text, optionsResult) => {
1217
1219
  const resolved = await groupMetadata.resolveOutboundMentions(chatJid, text);
1218
- return normalizeWhatsAppSendResult(await sendTrackedMessage(chatJid, addWhatsAppOutboundMentionsToContent({ text: resolved.text }, resolved.mentionedJids), optionsResult), "text");
1220
+ const result = await sendTrackedMessage(chatJid, addWhatsAppOutboundMentionsToContent({ text: resolved.text }, resolved.mentionedJids), optionsResult);
1221
+ return normalizeWhatsAppSendResult(result, "text");
1219
1222
  };
1220
1223
  const sendMedia = async (payload, optionsValue) => {
1221
1224
  const previewPayload = await addWhatsAppImagePreviewFields(payload);
1222
- return normalizeWhatsAppSendResult(await sendTrackedMessage(chatJid, await groupMetadata.applyOutboundMentions(chatJid, previewPayload), optionsValue), "media");
1225
+ const result = await sendTrackedMessage(chatJid, await groupMetadata.applyOutboundMentions(chatJid, previewPayload), optionsValue);
1226
+ return normalizeWhatsAppSendResult(result, "media");
1223
1227
  };
1224
1228
  const timestamp = inbound.messageTimestampMs;
1225
1229
  const mentionedJids = enriched.mentionedJids;
@@ -1439,14 +1443,15 @@ function createWhatsAppMessageDeliveryCoordinator(options) {
1439
1443
  finishPreparation(void 0);
1440
1444
  const inbound = await normalizeInboundMessage(msg);
1441
1445
  if (inbound) await maybeMarkNonSelfChatReadReceipt(inbound, buildReadReceiptTarget(inbound));
1442
- } else if (result.kind === "durable" && result.queueResult.kind === "accepted") if (skipRecentOutboundEcho) finishPreparation(null);
1443
- else try {
1444
- finishPreparation(await normalizeInboundMessage(msg), true);
1445
- } catch (error) {
1446
- finishPreparation(void 0);
1447
- inboundLogger.warn({ error: formatError(error) }, "failed preparing WhatsApp inbound identity; durable drain will normalize again");
1448
- }
1449
- else finishPreparation(void 0);
1446
+ } else if (result.kind === "durable" && result.queueResult.kind === "accepted") {
1447
+ if (skipRecentOutboundEcho) finishPreparation(null);
1448
+ else try {
1449
+ finishPreparation(await normalizeInboundMessage(msg), true);
1450
+ } catch (error) {
1451
+ finishPreparation(void 0);
1452
+ inboundLogger.warn({ error: formatError(error) }, "failed preparing WhatsApp inbound identity; durable drain will normalize again");
1453
+ }
1454
+ } else finishPreparation(void 0);
1450
1455
  }
1451
1456
  };
1452
1457
  const handleMessagesUpsertEvent = (upsert) => {
@@ -1514,7 +1519,7 @@ function createWhatsAppMessageDeliveryCoordinator(options) {
1514
1519
  //#region extensions/whatsapp/src/inbound/socket-session.ts
1515
1520
  const LOGGED_OUT_STATUS = DisconnectReason.loggedOut;
1516
1521
  const RECONNECT_IN_PROGRESS_ERROR = "no active socket - reconnection in progress";
1517
- const BAILEYS_MESSAGE_TTL_MS = 600 * 1e3;
1522
+ const BAILEYS_MESSAGE_TTL_MS = 6e5;
1518
1523
  function isDirectUserJid(jid) {
1519
1524
  return /^(\d+)(?::\d+)?@(s\.whatsapp\.net|c\.us|lid|hosted|hosted\.lid)$/i.test(jid.trim());
1520
1525
  }
@@ -2470,11 +2475,13 @@ async function applyGroupGating(params) {
2470
2475
  conversationId
2471
2476
  }) !== "always";
2472
2477
  const replyContext = getReplyContext(params.msg, params.authDir);
2478
+ const implicitReplyToSelf = params.selfChatMode === true && identitiesOverlap(self, sender);
2479
+ const implicitMentionKinds = implicitMentionKindWhen("quoted_bot", !implicitReplyToSelf && identitiesOverlap(self, replyContext?.sender));
2473
2480
  const mentionDecision = resolveInboundMentionDecision({
2474
2481
  facts: {
2475
2482
  canDetectMention: true,
2476
2483
  wasMentioned,
2477
- implicitMentionKinds: implicitMentionKindWhen("quoted_bot", !(params.selfChatMode === true && identitiesOverlap(self, sender)) && identitiesOverlap(self, replyContext?.sender))
2484
+ implicitMentionKinds
2478
2485
  },
2479
2486
  policy: {
2480
2487
  isGroup: true,
@@ -2652,7 +2659,8 @@ function isLikelyWhatsAppCryptoError(reason) {
2652
2659
  if (typeof value === "function") return value.name ? `[function ${value.name}]` : "[function]";
2653
2660
  return Object.prototype.toString.call(value);
2654
2661
  };
2655
- const haystack = normalizeLowercaseStringOrEmpty(reason instanceof Error ? `${reason.message}\n${reason.stack ?? ""}` : formatReason(reason));
2662
+ const raw = reason instanceof Error ? `${reason.message}\n${reason.stack ?? ""}` : formatReason(reason);
2663
+ const haystack = normalizeLowercaseStringOrEmpty(raw);
2656
2664
  if (!(haystack.includes("unsupported state or unable to authenticate data") || haystack.includes("bad mac"))) return false;
2657
2665
  return haystack.includes("baileys") || haystack.includes("noise-handler") || haystack.includes("aesdecryptgcm");
2658
2666
  }
@@ -2717,6 +2725,11 @@ async function deliverWebReplyInActivityScope(params) {
2717
2725
  const isGroupConversation = transport.conversationKind === "group";
2718
2726
  const replyStarted = Date.now();
2719
2727
  const sendResults = [];
2728
+ const acceptedMediaUrls = /* @__PURE__ */ new Set();
2729
+ const recordMediaAccepted = (mediaUrl) => {
2730
+ acceptedMediaUrls.add(mediaUrl);
2731
+ params.onMediaAccepted?.(mediaUrl);
2732
+ };
2720
2733
  const finishDelivery = () => {
2721
2734
  const receipt = createWhatsAppReplyDeliveryReceipt(sendResults);
2722
2735
  return {
@@ -2725,20 +2738,22 @@ async function deliverWebReplyInActivityScope(params) {
2725
2738
  providerAccepted: sendResults.some((result) => result.providerAccepted)
2726
2739
  };
2727
2740
  };
2728
- const preserveAcceptedDeliveryError = (error, kind) => {
2741
+ const preserveAcceptedDeliveryError = (error, kind, mediaUrl) => {
2729
2742
  const sendKind = kind ?? sendResults[0]?.kind ?? "text";
2730
- if (isChannelPartialDeliveryError(error)) rememberWhatsAppPartialSend({
2731
- error,
2732
- kind: sendKind,
2733
- results: sendResults
2734
- });
2743
+ if (isChannelPartialDeliveryError(error)) {
2744
+ if (rememberWhatsAppPartialSend({
2745
+ error,
2746
+ kind: sendKind,
2747
+ results: sendResults
2748
+ }) && mediaUrl) recordMediaAccepted(mediaUrl);
2749
+ }
2735
2750
  return mergeWhatsAppAcceptedSendError({
2736
2751
  error,
2737
2752
  kind: sendKind,
2738
2753
  results: sendResults
2739
2754
  });
2740
2755
  };
2741
- const rememberSendResult = (result) => {
2756
+ const rememberSendResult = (result, mediaUrl) => {
2742
2757
  if (!result) return;
2743
2758
  try {
2744
2759
  rememberWhatsAppAcceptedSend({
@@ -2749,6 +2764,8 @@ async function deliverWebReplyInActivityScope(params) {
2749
2764
  } catch (error) {
2750
2765
  if (sendResults.some((accepted) => accepted.providerAccepted)) throw preserveAcceptedDeliveryError(error, result.kind);
2751
2766
  throw error;
2767
+ } finally {
2768
+ if (mediaUrl && sendResults.includes(result)) recordMediaAccepted(mediaUrl);
2752
2769
  }
2753
2770
  };
2754
2771
  if (isReasoningReplyPayload(replyResult)) {
@@ -2773,7 +2790,7 @@ async function deliverWebReplyInActivityScope(params) {
2773
2790
  media: cached?.media
2774
2791
  });
2775
2792
  };
2776
- const sendWithRetry = async (fn, label, kind) => {
2793
+ const sendWithRetry = async (fn, label, kind, mediaUrl) => {
2777
2794
  try {
2778
2795
  return await sendWhatsAppOutboundWithRetry({
2779
2796
  send: fn,
@@ -2782,7 +2799,7 @@ async function deliverWebReplyInActivityScope(params) {
2782
2799
  }
2783
2800
  });
2784
2801
  } catch (error) {
2785
- if (isChannelPartialDeliveryError(error) || sendResults.some((result) => result.providerAccepted)) throw preserveAcceptedDeliveryError(error, kind);
2802
+ if (isChannelPartialDeliveryError(error) || sendResults.some((result) => result.providerAccepted)) throw preserveAcceptedDeliveryError(error, kind, mediaUrl);
2786
2803
  throw error;
2787
2804
  }
2788
2805
  };
@@ -2815,52 +2832,39 @@ async function deliverWebReplyInActivityScope(params) {
2815
2832
  }
2816
2833
  const remainingText = [...textChunks];
2817
2834
  const leadingCaption = remainingText.shift() || "";
2818
- let acceptedIdsBeforeCurrentMedia = /* @__PURE__ */ new Set();
2819
2835
  await sendMediaWithLeadingCaption({
2820
2836
  mediaUrls: mediaList,
2821
2837
  caption: leadingCaption,
2822
2838
  send: async ({ mediaUrl, caption }) => {
2823
- acceptedIdsBeforeCurrentMedia = new Set(sendResults.flatMap(listWhatsAppSendResultMessageIds));
2824
2839
  const media = await prepareWhatsAppOutboundMedia(await loadWebMedia(mediaUrl, {
2825
2840
  maxBytes: maxMediaBytes,
2826
2841
  localRoots: params.mediaLocalRoots
2827
2842
  }), mediaUrl);
2828
2843
  if (shouldLogVerbose()) {
2829
- logVerbose(`Web auto-reply media size: ${(media.buffer.length / (1024 * 1024)).toFixed(2)}MB`);
2844
+ logVerbose(`Web auto-reply media size: ${(media.buffer.length / 1048576).toFixed(2)}MB`);
2830
2845
  logVerbose(`Web auto-reply media source: ${mediaUrl} (kind ${media.kind})`);
2831
2846
  }
2832
- if (media.kind === "image") {
2833
- const quote = getQuote();
2834
- rememberSendResult(await sendWithRetry(() => transport.sendMedia({
2835
- image: media.buffer,
2836
- caption,
2837
- mimetype: media.mimetype
2838
- }, quote), "media:image", "media"));
2839
- } else if (media.kind === "audio") {
2840
- const quote = getQuote();
2841
- rememberSendResult(await sendWithRetry(() => transport.sendMedia({
2842
- audio: media.buffer,
2843
- ptt: true,
2844
- mimetype: media.mimetype
2845
- }, quote), "media:audio", "media"));
2846
- if (caption) rememberSendResult(await sendWithRetry(() => transport.reply(caption, quote), "media:audio-text", "text"));
2847
- } else if (media.kind === "video") {
2848
- const quote = getQuote();
2849
- rememberSendResult(await sendWithRetry(() => transport.sendMedia({
2850
- video: media.buffer,
2851
- caption,
2852
- mimetype: media.mimetype
2853
- }, quote), "media:video", "media"));
2854
- } else {
2855
- const quote = getQuote();
2856
- rememberSendResult(await sendWithRetry(() => transport.sendMedia({
2857
- document: media.buffer,
2858
- fileName: media.fileName,
2859
- caption,
2860
- mimetype: media.mimetype
2861
- }, quote), "media:document", "media"));
2862
- }
2863
- whatsappOutboundLog.info(`Sent media reply to ${conversationId} (${(media.buffer.length / (1024 * 1024)).toFixed(2)}MB)`);
2847
+ const quote = getQuote();
2848
+ const mediaContent = media.kind === "image" ? {
2849
+ image: media.buffer,
2850
+ caption
2851
+ } : media.kind === "audio" ? {
2852
+ audio: media.buffer,
2853
+ ptt: true
2854
+ } : media.kind === "video" ? {
2855
+ video: media.buffer,
2856
+ caption
2857
+ } : {
2858
+ document: media.buffer,
2859
+ fileName: media.fileName,
2860
+ caption
2861
+ };
2862
+ rememberSendResult(await sendWithRetry(() => transport.sendMedia({
2863
+ ...mediaContent,
2864
+ mimetype: media.mimetype
2865
+ }, quote), `media:${media.kind}`, "media", mediaUrl), mediaUrl);
2866
+ if (media.kind === "audio" && caption) rememberSendResult(await sendWithRetry(() => transport.reply(caption, quote), "media:audio-text", "text"));
2867
+ whatsappOutboundLog.info(`Sent media reply to ${conversationId} (${(media.buffer.length / 1048576).toFixed(2)}MB)`);
2864
2868
  replyLogger.info({
2865
2869
  correlationId: transport.correlationId ?? newConnectionId(),
2866
2870
  connectionId: connectionId ?? null,
@@ -2874,7 +2878,7 @@ async function deliverWebReplyInActivityScope(params) {
2874
2878
  }, "auto-reply sent (media)");
2875
2879
  },
2876
2880
  onError: async ({ error, mediaUrl, caption, isFirst }) => {
2877
- if (sendResults.some((result) => listWhatsAppSendResultMessageIds(result).some((messageId) => !acceptedIdsBeforeCurrentMedia.has(messageId)))) throw preserveAcceptedDeliveryError(error);
2881
+ if (acceptedMediaUrls.has(mediaUrl)) throw preserveAcceptedDeliveryError(error);
2878
2882
  whatsappOutboundLog.error(`Failed sending web media to ${conversationId}: ${formatError(error)}`);
2879
2883
  replyLogger.warn({
2880
2884
  err: error,
@@ -3077,9 +3081,6 @@ function resolveWhatsAppDeliverablePayload(payload, info) {
3077
3081
  }
3078
3082
  return payload;
3079
3083
  }
3080
- function getWhatsAppPayloadMediaUrls(payload) {
3081
- return new Set(normalizeStringEntries([...Array.isArray(payload.mediaUrls) ? payload.mediaUrls : [], ...typeof payload.mediaUrl === "string" ? [payload.mediaUrl] : []]));
3082
- }
3083
3084
  function hasWhatsAppMediaUrlOverlap(left, right) {
3084
3085
  for (const url of left) if (right.has(url)) return true;
3085
3086
  return false;
@@ -3127,16 +3128,28 @@ function createWhatsAppMediaOnlyReplyCoalescer(params) {
3127
3128
  return finalization;
3128
3129
  },
3129
3130
  flushNonDuplicateMedia: (mediaUrls) => flushWhere((pending) => !hasWhatsAppMediaUrlOverlap(pending.mediaUrls, mediaUrls)),
3130
- dropDuplicateMedia(mediaUrls) {
3131
+ supersedeMedia(mediaUrl) {
3131
3132
  const flushResult = {
3132
3133
  delivered: 0,
3133
3134
  droppedDuplicateMedia: 0
3134
3135
  };
3135
3136
  const retained = [];
3136
- for (const pending of pendingMediaOnlyPayloads.splice(0)) if (hasWhatsAppMediaUrlOverlap(pending.mediaUrls, mediaUrls)) {
3137
- pending.resolveFinalization(whatsAppReplyDeliveryVisibility(false));
3138
- flushResult.droppedDuplicateMedia += 1;
3139
- } else retained.push(pending);
3137
+ for (const pending of pendingMediaOnlyPayloads.splice(0)) {
3138
+ if (pending.mediaUrls.delete(mediaUrl)) {
3139
+ flushResult.droppedDuplicateMedia += 1;
3140
+ const mediaUrls = [...pending.mediaUrls];
3141
+ pending.payload = {
3142
+ ...pending.payload,
3143
+ mediaUrl: mediaUrls[0],
3144
+ mediaUrls
3145
+ };
3146
+ }
3147
+ if (pending.mediaUrls.size === 0) {
3148
+ pending.resolveFinalization(whatsAppReplyDeliveryVisibility(false));
3149
+ continue;
3150
+ }
3151
+ retained.push(pending);
3152
+ }
3140
3153
  pendingMediaOnlyPayloads.push(...retained);
3141
3154
  return flushResult;
3142
3155
  },
@@ -3145,7 +3158,7 @@ function createWhatsAppMediaOnlyReplyCoalescer(params) {
3145
3158
  }
3146
3159
  function logWhatsAppMediaOnlyFlushResult(result) {
3147
3160
  if (!shouldLogVerbose$1()) return;
3148
- if (result.droppedDuplicateMedia > 0) logVerbose$1(`Dropped ${result.droppedDuplicateMedia} deferred media-only WhatsApp reply payload(s) superseded by captioned media`);
3161
+ if (result.droppedDuplicateMedia > 0) logVerbose$1(`Superseded ${result.droppedDuplicateMedia} deferred WhatsApp attachment(s) with accepted replacement media`);
3149
3162
  if (result.delivered > 0) logVerbose$1(`Flushed ${result.delivered} deferred media-only WhatsApp reply payload(s)`);
3150
3163
  }
3151
3164
  function resolveWhatsAppResponsePrefix(params) {
@@ -3207,7 +3220,8 @@ async function prepareWhatsAppInboundContext(params) {
3207
3220
  from: conversationId,
3208
3221
  sender: {
3209
3222
  id: params.sender.id ?? params.sender.e164,
3210
- name: params.sender.name
3223
+ name: params.sender.name,
3224
+ isSelf: params.msg.platform.fromMe === true
3211
3225
  },
3212
3226
  conversation: {
3213
3227
  kind: conversationKind,
@@ -3316,7 +3330,8 @@ function createWhatsAppReplyPlan(params) {
3316
3330
  didSendReply = true;
3317
3331
  if (shouldLogVerbose$1()) {
3318
3332
  const reply = resolveSendableOutboundReplyParts(payload);
3319
- logVerbose$1(`Reply body: ${payload.text != null ? reply.text : "<media>"}${reply.hasMedia ? " (media)" : ""} -> ${conversationId}`);
3333
+ const preview = payload.text != null ? reply.text : "<media>";
3334
+ logVerbose$1(`Reply body: ${preview}${reply.hasMedia ? " (media)" : ""} -> ${conversationId}`);
3320
3335
  }
3321
3336
  };
3322
3337
  const deliverNormalizedPayload = async (normalizedDeliveryPayload, info, options) => {
@@ -3335,7 +3350,8 @@ function createWhatsAppReplyPlan(params) {
3335
3350
  replyLogger: params.replyLogger,
3336
3351
  connectionId: params.connectionId,
3337
3352
  skipLog: false,
3338
- tableMode
3353
+ tableMode,
3354
+ onMediaAccepted: options?.onMediaAccepted
3339
3355
  });
3340
3356
  } catch (error) {
3341
3357
  if (isWhatsAppVisibleDeliveryError(error) && !isChannelPartialDeliveryError(error)) throw createChannelPartialDeliveryError(error, {
@@ -3397,7 +3413,7 @@ function createWhatsAppReplyPlan(params) {
3397
3413
  } : normalizedOutboundPayload;
3398
3414
  const reply = resolveSendableOutboundReplyParts(normalizedDeliveryPayload);
3399
3415
  if (!reply.hasMedia && !reply.text.trim()) return normalizedDeliveryPayload;
3400
- const mediaUrls = getWhatsAppPayloadMediaUrls(normalizedDeliveryPayload);
3416
+ const mediaUrls = new Set(normalizedDeliveryPayload.mediaUrls);
3401
3417
  logWhatsAppMediaOnlyFlushResult(reply.hasMedia ? shouldDeferWhatsAppMediaOnlyPayload({
3402
3418
  info,
3403
3419
  mediaUrls,
@@ -3431,7 +3447,7 @@ function createWhatsAppReplyPlan(params) {
3431
3447
  const reply = resolveSendableOutboundReplyParts(normalizedDeliveryPayload);
3432
3448
  if (!reply.hasMedia && !reply.text.trim()) return whatsAppReplyDeliveryVisibility(false);
3433
3449
  if (!reply.hasMedia) return await deliverNormalizedPayload(normalizedDeliveryPayload, info, { recordDelivery: false });
3434
- const mediaUrls = getWhatsAppPayloadMediaUrls(normalizedDeliveryPayload);
3450
+ const mediaUrls = new Set(normalizedDeliveryPayload.mediaUrls);
3435
3451
  if (shouldDeferWhatsAppMediaOnlyPayload({
3436
3452
  info,
3437
3453
  mediaUrls,
@@ -3444,14 +3460,10 @@ function createWhatsAppReplyPlan(params) {
3444
3460
  payload: normalizedDeliveryPayload
3445
3461
  })
3446
3462
  };
3447
- try {
3448
- const result = await deliverNormalizedPayload(normalizedDeliveryPayload, info);
3449
- if (result.visibleReplySent) logWhatsAppMediaOnlyFlushResult(mediaOnlyCoalescer.dropDuplicateMedia(mediaUrls));
3450
- return result;
3451
- } catch (error) {
3452
- if (isWhatsAppVisibleDeliveryError(error)) logWhatsAppMediaOnlyFlushResult(mediaOnlyCoalescer.dropDuplicateMedia(mediaUrls));
3453
- throw error;
3454
- }
3463
+ return await deliverNormalizedPayload(normalizedDeliveryPayload, info, { onMediaAccepted: (mediaUrl) => {
3464
+ didSendReply = true;
3465
+ logWhatsAppMediaOnlyFlushResult(mediaOnlyCoalescer.supersedeMedia(mediaUrl));
3466
+ } });
3455
3467
  },
3456
3468
  onDelivered: (payload, _info, result) => {
3457
3469
  if (!resolveSendableOutboundReplyParts(payload).hasMedia && result?.visibleReplySent === true) recordDeliveredPayload(payload);
@@ -3716,27 +3728,30 @@ async function processMessage(params) {
3716
3728
  }) : void 0;
3717
3729
  if (conversationKind === "group") {
3718
3730
  const history = visibleGroupHistory ?? [];
3719
- if (history.length > 0) combinedBody = buildHistoryContextFromEntries({
3720
- entries: history.map((m) => ({
3731
+ if (history.length > 0) {
3732
+ const historyEntries = history.map((m) => ({
3721
3733
  sender: m.sender,
3722
3734
  body: m.body,
3723
3735
  timestamp: m.timestamp,
3724
3736
  media: m.media
3725
- })),
3726
- currentMessage: combinedBody,
3727
- excludeLast: false,
3728
- formatEntry: (entry) => {
3729
- return formatInboundEnvelope$1({
3730
- channel: "WhatsApp",
3731
- from: conversationId,
3732
- timestamp: entry.timestamp,
3733
- body: [entry.body, formatMediaPlaceholderText(entry.media ?? [])].filter(Boolean).join("\n"),
3734
- chatType: "group",
3735
- senderLabel: entry.sender,
3736
- envelope: envelopeOptions
3737
- });
3738
- }
3739
- });
3737
+ }));
3738
+ combinedBody = buildHistoryContextFromEntries({
3739
+ entries: historyEntries,
3740
+ currentMessage: combinedBody,
3741
+ excludeLast: false,
3742
+ formatEntry: (entry) => {
3743
+ return formatInboundEnvelope$1({
3744
+ channel: "WhatsApp",
3745
+ from: conversationId,
3746
+ timestamp: entry.timestamp,
3747
+ body: [entry.body, formatMediaPlaceholderText(entry.media ?? [])].filter(Boolean).join("\n"),
3748
+ chatType: "group",
3749
+ senderLabel: entry.sender,
3750
+ envelope: envelopeOptions
3751
+ });
3752
+ }
3753
+ });
3754
+ }
3740
3755
  shouldClearGroupHistory = !(params.suppressGroupHistoryClear ?? false);
3741
3756
  }
3742
3757
  const statusReactionController = params.statusReactionController ?? (params.cfg.messages?.statusReactions?.enabled === true && !params.ackAlreadySent ? await createWhatsAppStatusReactionController({
@@ -4263,8 +4278,8 @@ function normalizeReconnectAccountId(accountId) {
4263
4278
  function isRetryableAuthUnstableError(error) {
4264
4279
  return error instanceof WhatsAppAuthUnstableError || typeof error === "object" && error !== null && "code" in error && error.code === "whatsapp-auth-unstable";
4265
4280
  }
4266
- const DEFAULT_TRANSPORT_TIMEOUT_MS = 300 * 1e3;
4267
- const WHATSAPP_RECONNECT_CATCH_UP_MAX_MS = 20 * 6e4;
4281
+ const DEFAULT_TRANSPORT_TIMEOUT_MS = 3e5;
4282
+ const WHATSAPP_RECONNECT_CATCH_UP_MAX_MS = 12e5;
4268
4283
  async function monitorWebChannel(verbose, listenerFactory = attachWebInboxToSocket, keepAlive = true, replyResolver, runtime = defaultRuntime, abortSignal, tuning = {}) {
4269
4284
  const activeReplyResolver = replyResolver ?? (await loadReplyResolverRuntime()).getReplyFromConfig;
4270
4285
  const runId = newConnectionId();
@@ -4309,9 +4324,9 @@ async function monitorWebChannel(verbose, listenerFactory = attachWebInboxToSock
4309
4324
  };
4310
4325
  process.once("SIGINT", handleSigint);
4311
4326
  const transportTimeoutMs = tuning.transportTimeoutMs ?? DEFAULT_TRANSPORT_TIMEOUT_MS;
4312
- const messageTimeoutMs = tuning.messageTimeoutMs ?? 1800 * 1e3;
4327
+ const messageTimeoutMs = tuning.messageTimeoutMs ?? 18e5;
4313
4328
  const reconnectCatchUpWindowMs = Math.min(Math.max(messageTimeoutMs, 6e4), WHATSAPP_RECONNECT_CATCH_UP_MAX_MS);
4314
- const watchdogCheckMs = tuning.watchdogCheckMs ?? 60 * 1e3;
4329
+ const watchdogCheckMs = tuning.watchdogCheckMs ?? 6e4;
4315
4330
  const controller = new WhatsAppConnectionController({
4316
4331
  accountId: account.accountId,
4317
4332
  authDir: account.authDir,
@@ -1,5 +1,5 @@
1
1
  import { t as __exportAll } from "./rolldown-runtime-D7D4PA-g.js";
2
- import { a as resolveWhatsAppAccount } from "./accounts-BX2fZUyR.js";
2
+ import { a as resolveWhatsAppAccount } from "./accounts-CiKHiuEe.js";
3
3
  import { createQuestionReactionTargetStore, questionGatewayRuntime } from "openclaw/plugin-sdk/question-gateway-runtime";
4
4
  //#region extensions/whatsapp/src/question-reactions.ts
5
5
  var question_reactions_exports = /* @__PURE__ */ __exportAll({
@@ -1,16 +1,16 @@
1
- import { c as resolveWebCredsPath, r as hasWebCredsSync, s as resolveWebCredsBackupPath } from "./creds-files-W6B3EMZ8.js";
2
- import { n as whatsAppActionRuntime, t as handleWhatsAppAction } from "./action-runtime-C075e6OP.js";
3
- import { i as sendTypingWhatsApp, n as sendPollWhatsApp, r as sendReactionWhatsApp, t as sendMessageWhatsApp } from "./send-DLMUc2uZ.js";
1
+ import { c as resolveWebCredsPath, r as hasWebCredsSync, s as resolveWebCredsBackupPath } from "./creds-files-Drg3usj1.js";
2
+ import { n as whatsAppActionRuntime, t as handleWhatsAppAction } from "./action-runtime-CRZLhN3f.js";
3
+ import { i as sendTypingWhatsApp, n as sendPollWhatsApp, r as sendReactionWhatsApp, t as sendMessageWhatsApp } from "./send-BDDGPxav.js";
4
4
  import { a as setWhatsAppRuntime } from "./runtime-BLlToOi6.js";
5
5
  import { startWebLoginWithQr, waitForWebLogin } from "./login-qr-runtime.js";
6
6
  import { t as createWhatsAppLoginTool } from "./agent-tools-login-B-2qZPzc.js";
7
- import { M as waitForCredsSaveQueueWithTimeout, N as writeCredsJsonAtomically, _ as readWebSelfIdentity, a as formatWhatsAppWebAuthStatusState, b as restoreCredsFromBackupIfNeeded, c as logoutWeb, d as readWebAuthExistsBestEffort, f as readWebAuthExistsForDecision, g as readWebSelfId, h as readWebAuthState, j as waitForCredsSaveQueue, l as pickWebChannel, m as readWebAuthSnapshotBestEffort, n as WHATSAPP_AUTH_UNSTABLE_CODE, o as getWebAuthAgeMs, p as readWebAuthSnapshot, r as WhatsAppAuthUnstableError, s as logWebSelfId, t as WA_WEB_AUTH_DIR, u as readCredsJsonRaw, v as readWebSelfIdentityForDecision, x as webAuthExists, y as resolveDefaultWebAuthDir } from "./auth-store-CtpBqH5S.js";
8
- import { t as DEFAULT_WEB_MEDIA_BYTES } from "./constants-HU41RHGI.js";
7
+ import { M as waitForCredsSaveQueueWithTimeout, N as writeCredsJsonAtomically, _ as readWebSelfIdentity, a as formatWhatsAppWebAuthStatusState, b as restoreCredsFromBackupIfNeeded, c as logoutWeb, d as readWebAuthExistsBestEffort, f as readWebAuthExistsForDecision, g as readWebSelfId, h as readWebAuthState, j as waitForCredsSaveQueue, l as pickWebChannel, m as readWebAuthSnapshotBestEffort, n as WHATSAPP_AUTH_UNSTABLE_CODE, o as getWebAuthAgeMs, p as readWebAuthSnapshot, r as WhatsAppAuthUnstableError, s as logWebSelfId, t as WA_WEB_AUTH_DIR, u as readCredsJsonRaw, v as readWebSelfIdentityForDecision, x as webAuthExists, y as resolveDefaultWebAuthDir } from "./auth-store-ZWaclAbd.js";
8
+ import { t as DEFAULT_WEB_MEDIA_BYTES } from "./constants-C7m81BNe.js";
9
9
  import { n as resolveWebAccountId, t as getActiveWebListener } from "./active-listener-BEjWsCNM.js";
10
- import { a as waitForWaConnection, i as newConnectionId, r as createWaSocket } from "./socket-close-2T0_jZTN.js";
10
+ import { a as waitForWaConnection, i as newConnectionId, r as createWaSocket } from "./socket-close-B3X9uerq.js";
11
11
  import { n as getStatusCode, t as formatError } from "./session-errors-JuazczrA.js";
12
- import { p as extractText, s as extractContactContext, u as extractLocationData } from "./send-api-BtK45TmZ.js";
13
- import { a as loadWebMediaRaw, c as monitorWebInbox, i as loadWebMedia, l as resetWebInboundDedupe, n as LocalMediaAccessError, o as optimizeImageToJpeg, r as getDefaultLocalRoots, s as optimizeImageToPng, t as monitorWebChannel } from "./monitor-C_Nw23PZ.js";
14
- import { t as loginWeb } from "./login-BkpKpndm.js";
12
+ import { p as extractText, s as extractContactContext, u as extractLocationData } from "./send-api-C_Zn4Ij-.js";
13
+ import { a as loadWebMediaRaw, c as monitorWebInbox, i as loadWebMedia, l as resetWebInboundDedupe, n as LocalMediaAccessError, o as optimizeImageToJpeg, r as getDefaultLocalRoots, s as optimizeImageToPng, t as monitorWebChannel } from "./monitor-DyPdOPRx.js";
14
+ import { t as loginWeb } from "./login-6j2iP9nR.js";
15
15
  import { HEARTBEAT_PROMPT, HEARTBEAT_TOKEN, SILENT_REPLY_TOKEN, stripHeartbeatToken } from "openclaw/plugin-sdk/reply-runtime";
16
16
  export { DEFAULT_WEB_MEDIA_BYTES, HEARTBEAT_PROMPT, HEARTBEAT_TOKEN, LocalMediaAccessError, SILENT_REPLY_TOKEN, WA_WEB_AUTH_DIR, WHATSAPP_AUTH_UNSTABLE_CODE, WhatsAppAuthUnstableError, createWaSocket, createWhatsAppLoginTool, extractContactContext, extractLocationData, extractText, formatError, formatWhatsAppWebAuthStatusState, getActiveWebListener, getDefaultLocalRoots, getStatusCode, getWebAuthAgeMs, handleWhatsAppAction, hasWebCredsSync, loadWebMedia, loadWebMediaRaw, logWebSelfId, loginWeb, logoutWeb, monitorWebChannel, monitorWebInbox, newConnectionId, optimizeImageToJpeg, optimizeImageToPng, pickWebChannel, readCredsJsonRaw, readWebAuthExistsBestEffort, readWebAuthExistsForDecision, readWebAuthSnapshot, readWebAuthSnapshotBestEffort, readWebAuthState, readWebSelfId, readWebSelfIdentity, readWebSelfIdentityForDecision, resetWebInboundDedupe, resolveDefaultWebAuthDir, resolveWebAccountId, resolveWebCredsBackupPath, resolveWebCredsPath, restoreCredsFromBackupIfNeeded, sendMessageWhatsApp, sendPollWhatsApp, sendReactionWhatsApp, sendTypingWhatsApp, setWhatsAppRuntime, startWebLoginWithQr, stripHeartbeatToken, waitForCredsSaveQueue, waitForCredsSaveQueueWithTimeout, waitForWaConnection, waitForWebLogin, webAuthExists, whatsAppActionRuntime, writeCredsJsonAtomically };