@wednesdayai/whatsapp 0.4.12-dev.706 → 0.4.12-dev.708
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/index.js +16 -4
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { C as listWhatsAppAccountIds, E as resolveWhatsAppAuthDir, S as stopActiveWebListener, T as resolveWhatsAppAccount$1, _ as webAuthExists, a as waitForWebLogin, b as getActiveWebListener, c as formatError, d as getBaileys, f as getWebAuthAgeMs, g as waitForWebCredsSaveQueue, h as readWebSelfId, i as tryCanonicalWhatsAppAuthDir, l as getStatusCode, m as logoutWeb, o as closeWaSocket, p as logWebSelfId, r as startWebLoginWithQr, s as createWaSocket, t as closeActiveWebLoginsForAuthDir, u as waitForWaConnection, v as getWhatsAppRuntime, w as resolveDefaultWhatsAppAccountId, x as setActiveWebListener, y as setWhatsAppRuntime } from "./login-qr-B5goEXCP.js";
|
|
2
|
-
import { DEFAULT_ACCOUNT_ID, DEFAULT_GROUP_HISTORY_LIMIT, DEFAULT_MAIN_KEY, SILENT_REPLY_TOKEN, ToolAuthorizationError, Type, WhatsAppConfigSchema, applyAccountNameToChannelSection, applyMessageSendingHook, buildAgentMainSessionKey, buildAgentSessionKey, buildChannelConfigSchema, buildGroupHistoryKey, buildHistoryContextFromEntries, buildMentionRegexes, buildPairingReply, chunkMarkdownTextWithMode, computeBackoff, convertMarkdownTables, createActionGate, createDedupeCache, createInboundDebouncer, createMessageSentEmitter, createReplyPrefixOptions, createSubsystemLogger, danger, defaultRuntime, dispatchReplyWithBufferedBlockDispatcher, emptyPluginConfigSchema, enqueueSystemEvent, escapeRegExp, finalizeInboundContext, formatCliCommand, formatDocsLink, formatDurationPrecise, formatInboundEnvelope, formatLocationText, formatPairingApproveHint, getAgentScopedMediaLocalRoots, getChildLogger, getGlobalHookRunner, getReplyFromConfig, hasControlCommand, info, isSelfChatMode, isSilentReplyText, jidToE164, jsonResult, loadConfig, loadSessionStore, loadWebMedia, logInfo, logVerbose, markdownToWhatsApp, mergeWhatsAppConfig, migrateBaseNameToDefaultAccount, missingTargetError, normalizeAccountId, normalizeAgentId, normalizeAllowFromEntries, normalizeE164, normalizeGroupActivation, normalizeMentionText, parseActivationCommand, pathExists, readChannelAllowFromStoreSync, readReactionParams, readStoreAllowFromForDmPolicy, readStringParam, recordChannelActivity, recordPendingHistoryEntryIfEnabled, recordSessionMetaFromInbound, registerUnhandledRejectionHandler, resolveAccountIdForConfigure, resolveAgentRoute, resolveAllowlistProviderRuntimeGroupPolicy, resolveChannelGroupPolicy, resolveChannelGroupRequireMention, resolveChunkMode, resolveChunkNewlinePacking, resolveDefaultGroupPolicy, resolveDmGroupAccessWithCommandGate, resolveDmGroupAccessWithLists, resolveGroupSessionKey, resolveIdentityNamePrefix, resolveInboundDebounceMs, resolveInboundSessionEnvelopeContext, resolveJidToE164, resolveMarkdownTableMode, resolveMentionGating, resolveMessagePrefix, resolveOnboardingAccountId, resolveOpenProviderRuntimeGroupPolicy, resolvePinnedMainDmOwnerFromAllowlist, resolveStorePath, resolveTextChunkLimit, resolveWhatsAppAccount, resolveWhatsAppGroupRequireMention, resolveWhatsAppGroupToolPolicy, saveMediaBuffer, shouldAckReactionForWhatsApp, shouldComputeCommandAuthorized, shouldLogVerbose, sleep, sleepWithAbort, splitOnboardingEntries, success, toLocationContext, toWhatsappJid, transcribeFirstAudio, updateLastRoute, upsertChannelPairingRequest, waitForever, warnMissingProviderGroupPolicyFallbackOnce } from "openclaw/plugin-sdk";
|
|
2
|
+
import { DEFAULT_ACCOUNT_ID, DEFAULT_GROUP_HISTORY_LIMIT, DEFAULT_MAIN_KEY, SILENT_REPLY_TOKEN, ToolAuthorizationError, Type, WhatsAppConfigSchema, applyAccountNameToChannelSection, applyMessageSendingHook, buildAgentMainSessionKey, buildAgentSessionKey, buildChannelConfigSchema, buildGroupHistoryKey, buildHistoryContextFromEntries, buildMentionRegexes, buildPairingReply, chunkMarkdownTextWithMode, computeBackoff, convertMarkdownTables, createActionGate, createDedupeCache, createInboundDebouncer, createMessageSentEmitter, createReplyPrefixOptions, createSubsystemLogger, danger, defaultRuntime, dispatchReplyWithBufferedBlockDispatcher, emptyPluginConfigSchema, enqueueSystemEvent, escapeRegExp, finalizeInboundContext, formatCliCommand, formatDocsLink, formatDurationPrecise, formatInboundEnvelope, formatLocationText, formatPairingApproveHint, getAgentScopedMediaLocalRoots, getChildLogger, getGlobalHookRunner, getReplyFromConfig, hasControlCommand, info, isSelfChatMode, isSilentReplyText, jidToE164, jsonResult, loadConfig, loadSessionStore, loadWebMedia, logInfo, logVerbose, markdownToWhatsApp, mergeWhatsAppConfig, migrateBaseNameToDefaultAccount, missingTargetError, normalizeAccountId, normalizeAgentId, normalizeAllowFromEntries, normalizeE164, normalizeGroupActivation, normalizeMentionText, parseActivationCommand, pathExists, readChannelAllowFromStoreSync, readReactionParams, readStoreAllowFromForDmPolicy, readStringParam, recordChannelActivity, recordPendingHistoryEntryIfEnabled, recordSessionMetaFromInbound, registerUnhandledRejectionHandler, resolveAccountIdForConfigure, resolveAgentRoute, resolveAllowlistProviderRuntimeGroupPolicy, resolveChannelGroupPolicy, resolveChannelGroupRequireMention, resolveChunkMode, resolveChunkNewlinePacking, resolveDefaultGroupPolicy, resolveDmGroupAccessWithCommandGate, resolveDmGroupAccessWithLists, resolveGroupSessionKey, resolveIdentityNamePrefix, resolveInboundDebounceMs, resolveInboundSessionEnvelopeContext, resolveJidToE164, resolveMarkdownTableMode, resolveMentionGating, resolveMessagePrefix, resolveOnboardingAccountId, resolveOpenProviderRuntimeGroupPolicy, resolveOutboundSessionId, resolvePinnedMainDmOwnerFromAllowlist, resolveStorePath, resolveTextChunkLimit, resolveWhatsAppAccount, resolveWhatsAppGroupRequireMention, resolveWhatsAppGroupToolPolicy, saveMediaBuffer, shouldAckReactionForWhatsApp, shouldComputeCommandAuthorized, shouldLogVerbose, sleep, sleepWithAbort, splitOnboardingEntries, success, toLocationContext, toWhatsappJid, transcribeFirstAudio, updateLastRoute, upsertChannelPairingRequest, waitForever, warnMissingProviderGroupPolicyFallbackOnce } from "openclaw/plugin-sdk";
|
|
3
3
|
import path from "node:path";
|
|
4
4
|
import { createHash, randomUUID } from "node:crypto";
|
|
5
5
|
import { escapeRegExp as escapeRegExp$1 } from "openclaw/plugin-sdk/escape-regexp";
|
|
@@ -1991,10 +1991,18 @@ async function deliverWebReply(params) {
|
|
|
1991
1991
|
const pack = params.pack;
|
|
1992
1992
|
const mediaList = replyResult.mediaUrls?.length ? replyResult.mediaUrls : replyResult.mediaUrl ? [replyResult.mediaUrl] : [];
|
|
1993
1993
|
const hookRunner = getGlobalHookRunner();
|
|
1994
|
+
const outboundSessionId = hookRunner?.hasHooks("message_sent") ?? false ? await resolveOutboundSessionId({
|
|
1995
|
+
agentId: params.agentId,
|
|
1996
|
+
sessionKey: params.sessionKey
|
|
1997
|
+
}) : void 0;
|
|
1994
1998
|
const { emitMessageSent } = createMessageSentEmitter({
|
|
1995
1999
|
hookRunner,
|
|
1996
2000
|
channel: "whatsapp",
|
|
1997
|
-
to: msg.from
|
|
2001
|
+
to: msg.from,
|
|
2002
|
+
accountId: params.accountId,
|
|
2003
|
+
agentId: params.agentId,
|
|
2004
|
+
sessionKey: params.sessionKey,
|
|
2005
|
+
sessionId: outboundSessionId
|
|
1998
2006
|
});
|
|
1999
2007
|
const hookResult = await applyMessageSendingHook({
|
|
2000
2008
|
hookRunner,
|
|
@@ -2005,7 +2013,8 @@ async function deliverWebReply(params) {
|
|
|
2005
2013
|
mediaUrls: mediaList
|
|
2006
2014
|
},
|
|
2007
2015
|
to: msg.from,
|
|
2008
|
-
channel: "whatsapp"
|
|
2016
|
+
channel: "whatsapp",
|
|
2017
|
+
accountId: params.accountId
|
|
2009
2018
|
});
|
|
2010
2019
|
if (hookResult.cancelled) return;
|
|
2011
2020
|
const hookedText = hookResult.payload.text ?? "";
|
|
@@ -2481,7 +2490,10 @@ async function processMessage(params) {
|
|
|
2481
2490
|
replyLogger: params.replyLogger,
|
|
2482
2491
|
connectionId: params.connectionId,
|
|
2483
2492
|
skipLog: false,
|
|
2484
|
-
tableMode
|
|
2493
|
+
tableMode,
|
|
2494
|
+
agentId: params.route.agentId,
|
|
2495
|
+
sessionKey: params.route.sessionKey,
|
|
2496
|
+
accountId: params.route.accountId
|
|
2485
2497
|
});
|
|
2486
2498
|
didSendReply = true;
|
|
2487
2499
|
const shouldLog = payload.text ? true : void 0;
|