mirror of
https://github.com/openclaw/openclaw.git
synced 2026-03-24 00:11:31 +00:00
chore: wtf.
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import { describe, expect, it, vi } from "vitest";
|
||||
import type { WebInboundMsg } from "./types.js";
|
||||
import { deliverWebReply } from "./deliver-reply.js";
|
||||
import type { WebInboundMsg } from "./types.js";
|
||||
|
||||
vi.mock("../../globals.js", async (importOriginal) => {
|
||||
const actual = await importOriginal<typeof import("../../globals.js")>();
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import { chunkMarkdownTextWithMode, type ChunkMode } from "../../auto-reply/chunk.js";
|
||||
import type { ReplyPayload } from "../../auto-reply/types.js";
|
||||
import type { MarkdownTableMode } from "../../config/types.base.js";
|
||||
import type { WebInboundMsg } from "./types.js";
|
||||
import { chunkMarkdownTextWithMode, type ChunkMode } from "../../auto-reply/chunk.js";
|
||||
import { logVerbose, shouldLogVerbose } from "../../globals.js";
|
||||
import { convertMarkdownTables } from "../../markdown/tables.js";
|
||||
import { markdownToWhatsApp } from "../../markdown/whatsapp.js";
|
||||
@@ -10,6 +9,7 @@ import { loadWebMedia } from "../media.js";
|
||||
import { newConnectionId } from "../reconnect.js";
|
||||
import { formatError } from "../session.js";
|
||||
import { whatsappOutboundLog } from "./loggers.js";
|
||||
import type { WebInboundMsg } from "./types.js";
|
||||
import { elide } from "./util.js";
|
||||
|
||||
export async function deliverWebReply(params: {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { beforeEach, describe, expect, it, vi } from "vitest";
|
||||
import type { getReplyFromConfig } from "../../auto-reply/reply.js";
|
||||
import type { sendMessageWhatsApp } from "../outbound.js";
|
||||
import { HEARTBEAT_TOKEN } from "../../auto-reply/tokens.js";
|
||||
import type { sendMessageWhatsApp } from "../outbound.js";
|
||||
|
||||
const state = vi.hoisted(() => ({
|
||||
visibility: { showAlerts: true, showOk: true, useIndicator: false },
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import type { loadConfig } from "../../config/config.js";
|
||||
import type { WebInboundMsg } from "./types.js";
|
||||
import { buildMentionRegexes, normalizeMentionText } from "../../auto-reply/reply/mentions.js";
|
||||
import type { loadConfig } from "../../config/config.js";
|
||||
import { isSelfChatMode, jidToE164, normalizeE164 } from "../../utils.js";
|
||||
import type { WebInboundMsg } from "./types.js";
|
||||
|
||||
export type MentionConfig = {
|
||||
mentionRegexes: RegExp[];
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import type { WebChannelStatus, WebInboundMsg, WebMonitorTuning } from "./types.js";
|
||||
import { hasControlCommand } from "../../auto-reply/command-detection.js";
|
||||
import { resolveInboundDebounceMs } from "../../auto-reply/inbound-debounce.js";
|
||||
import { getReplyFromConfig } from "../../auto-reply/reply.js";
|
||||
@@ -29,6 +28,7 @@ import { whatsappHeartbeatLog, whatsappLog } from "./loggers.js";
|
||||
import { buildMentionConfig } from "./mentions.js";
|
||||
import { createEchoTracker } from "./monitor/echo.js";
|
||||
import { createWebOnMessageHandler } from "./monitor/on-message.js";
|
||||
import type { WebChannelStatus, WebInboundMsg, WebMonitorTuning } from "./types.js";
|
||||
import { isLikelyWhatsAppCryptoError } from "./util.js";
|
||||
|
||||
export async function monitorWebChannel(
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import type { loadConfig } from "../../../config/config.js";
|
||||
import type { WebInboundMsg } from "../types.js";
|
||||
import { shouldAckReactionForWhatsApp } from "../../../channels/ack-reactions.js";
|
||||
import type { loadConfig } from "../../../config/config.js";
|
||||
import { logVerbose } from "../../../globals.js";
|
||||
import { sendReactionWhatsApp } from "../../outbound.js";
|
||||
import { formatError } from "../../session.js";
|
||||
import type { WebInboundMsg } from "../types.js";
|
||||
import { resolveGroupActivationFor } from "./group-activation.js";
|
||||
|
||||
export function maybeSendAckReaction(params: {
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
import type { loadConfig } from "../../../config/config.js";
|
||||
import type { resolveAgentRoute } from "../../../routing/resolve-route.js";
|
||||
import type { WebInboundMsg } from "../types.js";
|
||||
import type { GroupHistoryEntry } from "./process-message.js";
|
||||
import { buildAgentSessionKey } from "../../../routing/resolve-route.js";
|
||||
import {
|
||||
buildAgentMainSessionKey,
|
||||
@@ -10,6 +8,8 @@ import {
|
||||
} from "../../../routing/session-key.js";
|
||||
import { formatError } from "../../session.js";
|
||||
import { whatsappInboundLog } from "../loggers.js";
|
||||
import type { WebInboundMsg } from "../types.js";
|
||||
import type { GroupHistoryEntry } from "./process-message.js";
|
||||
|
||||
export async function maybeBroadcastMessage(params: {
|
||||
cfg: ReturnType<typeof loadConfig>;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import type { loadConfig } from "../../../config/config.js";
|
||||
import { normalizeGroupActivation } from "../../../auto-reply/group-activation.js";
|
||||
import type { loadConfig } from "../../../config/config.js";
|
||||
import {
|
||||
resolveChannelGroupPolicy,
|
||||
resolveChannelGroupRequireMention,
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
import type { loadConfig } from "../../../config/config.js";
|
||||
import type { MentionConfig } from "../mentions.js";
|
||||
import type { WebInboundMsg } from "../types.js";
|
||||
import { hasControlCommand } from "../../../auto-reply/command-detection.js";
|
||||
import { parseActivationCommand } from "../../../auto-reply/group-activation.js";
|
||||
import { recordPendingHistoryEntryIfEnabled } from "../../../auto-reply/reply/history.js";
|
||||
import { resolveMentionGating } from "../../../channels/mention-gating.js";
|
||||
import type { loadConfig } from "../../../config/config.js";
|
||||
import { normalizeE164 } from "../../../utils.js";
|
||||
import type { MentionConfig } from "../mentions.js";
|
||||
import { buildMentionConfig, debugMention, resolveOwnerList } from "../mentions.js";
|
||||
import type { WebInboundMsg } from "../types.js";
|
||||
import { stripMentionsForCommand } from "./commands.js";
|
||||
import { resolveGroupActivationFor, resolveGroupPolicyFor } from "./group-activation.js";
|
||||
import { noteGroupMember } from "./group-members.js";
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import type { loadConfig } from "../../../config/config.js";
|
||||
import type { WebInboundMsg } from "../types.js";
|
||||
import { resolveMessagePrefix } from "../../../agents/identity.js";
|
||||
import { formatInboundEnvelope, type EnvelopeFormatOptions } from "../../../auto-reply/envelope.js";
|
||||
import type { loadConfig } from "../../../config/config.js";
|
||||
import type { WebInboundMsg } from "../types.js";
|
||||
|
||||
export function formatReplyContext(msg: WebInboundMsg) {
|
||||
if (!msg.replyToBody) {
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
import type { getReplyFromConfig } from "../../../auto-reply/reply.js";
|
||||
import type { MsgContext } from "../../../auto-reply/templating.js";
|
||||
import type { MentionConfig } from "../mentions.js";
|
||||
import type { WebInboundMsg } from "../types.js";
|
||||
import type { EchoTracker } from "./echo.js";
|
||||
import type { GroupHistoryEntry } from "./group-gating.js";
|
||||
import { loadConfig } from "../../../config/config.js";
|
||||
import { logVerbose } from "../../../globals.js";
|
||||
import { resolveAgentRoute } from "../../../routing/resolve-route.js";
|
||||
import { buildGroupHistoryKey } from "../../../routing/session-key.js";
|
||||
import { normalizeE164 } from "../../../utils.js";
|
||||
import type { MentionConfig } from "../mentions.js";
|
||||
import type { WebInboundMsg } from "../types.js";
|
||||
import { maybeBroadcastMessage } from "./broadcast.js";
|
||||
import type { EchoTracker } from "./echo.js";
|
||||
import type { GroupHistoryEntry } from "./group-gating.js";
|
||||
import { applyGroupGating } from "./group-gating.js";
|
||||
import { updateLastRouteInBackground } from "./last-route.js";
|
||||
import { resolvePeerId } from "./peer.js";
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import type { WebInboundMsg } from "../types.js";
|
||||
import { jidToE164, normalizeE164 } from "../../../utils.js";
|
||||
import type { WebInboundMsg } from "../types.js";
|
||||
|
||||
export function resolvePeerId(msg: WebInboundMsg) {
|
||||
if (msg.chatType === "group") {
|
||||
|
||||
@@ -1,9 +1,3 @@
|
||||
import type { getReplyFromConfig } from "../../../auto-reply/reply.js";
|
||||
import type { ReplyPayload } from "../../../auto-reply/types.js";
|
||||
import type { loadConfig } from "../../../config/config.js";
|
||||
import type { getChildLogger } from "../../../logging.js";
|
||||
import type { resolveAgentRoute } from "../../../routing/resolve-route.js";
|
||||
import type { WebInboundMsg } from "../types.js";
|
||||
import { resolveIdentityNamePrefix } from "../../../agents/identity.js";
|
||||
import { resolveChunkMode, resolveTextChunkLimit } from "../../../auto-reply/chunk.js";
|
||||
import { shouldComputeCommandAuthorized } from "../../../auto-reply/command-detection.js";
|
||||
@@ -11,14 +5,17 @@ import {
|
||||
formatInboundEnvelope,
|
||||
resolveEnvelopeFormatOptions,
|
||||
} from "../../../auto-reply/envelope.js";
|
||||
import type { getReplyFromConfig } from "../../../auto-reply/reply.js";
|
||||
import {
|
||||
buildHistoryContextFromEntries,
|
||||
type HistoryEntry,
|
||||
} from "../../../auto-reply/reply/history.js";
|
||||
import { finalizeInboundContext } from "../../../auto-reply/reply/inbound-context.js";
|
||||
import { dispatchReplyWithBufferedBlockDispatcher } from "../../../auto-reply/reply/provider-dispatcher.js";
|
||||
import type { ReplyPayload } from "../../../auto-reply/types.js";
|
||||
import { toLocationContext } from "../../../channels/location.js";
|
||||
import { createReplyPrefixOptions } from "../../../channels/reply-prefix.js";
|
||||
import type { loadConfig } from "../../../config/config.js";
|
||||
import { resolveMarkdownTableMode } from "../../../config/markdown-tables.js";
|
||||
import {
|
||||
readSessionUpdatedAt,
|
||||
@@ -26,13 +23,16 @@ import {
|
||||
resolveStorePath,
|
||||
} from "../../../config/sessions.js";
|
||||
import { logVerbose, shouldLogVerbose } from "../../../globals.js";
|
||||
import type { getChildLogger } from "../../../logging.js";
|
||||
import { getAgentScopedMediaLocalRoots } from "../../../media/local-roots.js";
|
||||
import { readChannelAllowFromStore } from "../../../pairing/pairing-store.js";
|
||||
import type { resolveAgentRoute } from "../../../routing/resolve-route.js";
|
||||
import { jidToE164, normalizeE164 } from "../../../utils.js";
|
||||
import { newConnectionId } from "../../reconnect.js";
|
||||
import { formatError } from "../../session.js";
|
||||
import { deliverWebReply } from "../deliver-reply.js";
|
||||
import { whatsappInboundLog, whatsappOutboundLog } from "../loggers.js";
|
||||
import type { WebInboundMsg } from "../types.js";
|
||||
import { elide } from "../util.js";
|
||||
import { maybeSendAckReaction } from "./ack-reaction.js";
|
||||
import { formatGroupMembers } from "./group-members.js";
|
||||
|
||||
@@ -2,10 +2,10 @@ import fs from "node:fs/promises";
|
||||
import os from "node:os";
|
||||
import path from "node:path";
|
||||
import { describe, expect, it, vi } from "vitest";
|
||||
import type { WebInboundMsg } from "./types.js";
|
||||
import { saveSessionStore } from "../../config/sessions.js";
|
||||
import { isBotMentionedFromTargets, resolveMentionTargets } from "./mentions.js";
|
||||
import { getSessionSnapshot } from "./session-snapshot.js";
|
||||
import type { WebInboundMsg } from "./types.js";
|
||||
import { elide, isLikelyWhatsAppCryptoError } from "./util.js";
|
||||
|
||||
const makeMsg = (overrides: Partial<WebInboundMsg>): WebInboundMsg =>
|
||||
|
||||
Reference in New Issue
Block a user