mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-03 03:03:24 -04:00
chore: Enable "experimentalSortImports" in Oxfmt and reformat all imorts.
This commit is contained in:
@@ -1,9 +1,8 @@
|
||||
import fs from "node:fs";
|
||||
import path from "node:path";
|
||||
|
||||
import type { OpenClawConfig } from "../config/config.js";
|
||||
import { resolveOAuthDir } from "../config/paths.js";
|
||||
import type { DmPolicy, GroupPolicy, WhatsAppAccountConfig } from "../config/types.js";
|
||||
import { resolveOAuthDir } from "../config/paths.js";
|
||||
import { DEFAULT_ACCOUNT_ID } from "../routing/session-key.js";
|
||||
import { resolveUserPath } from "../utils.js";
|
||||
import { hasWebCredsSync } from "./auth-store.js";
|
||||
|
||||
@@ -2,7 +2,6 @@ import fs from "node:fs";
|
||||
import os from "node:os";
|
||||
import path from "node:path";
|
||||
import { afterEach, beforeEach, describe, expect, it } from "vitest";
|
||||
|
||||
import { hasAnyWhatsAppAuth, listWhatsAppAuthDirs } from "./accounts.js";
|
||||
|
||||
describe("hasAnyWhatsAppAuth", () => {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { formatCliCommand } from "../cli/command-format.js";
|
||||
import type { PollInput } from "../polls.js";
|
||||
import { formatCliCommand } from "../cli/command-format.js";
|
||||
import { DEFAULT_ACCOUNT_ID } from "../routing/session-key.js";
|
||||
|
||||
export type ActiveWebSendOptions = {
|
||||
|
||||
@@ -1,14 +1,13 @@
|
||||
import fsSync from "node:fs";
|
||||
import fs from "node:fs/promises";
|
||||
import path from "node:path";
|
||||
|
||||
import type { WebChannel } from "../utils.js";
|
||||
import { formatCliCommand } from "../cli/command-format.js";
|
||||
import { resolveOAuthDir } from "../config/paths.js";
|
||||
import { info, success } from "../globals.js";
|
||||
import { getChildLogger } from "../logging.js";
|
||||
import { DEFAULT_ACCOUNT_ID } from "../routing/session-key.js";
|
||||
import { defaultRuntime, type RuntimeEnv } from "../runtime.js";
|
||||
import { formatCliCommand } from "../cli/command-format.js";
|
||||
import type { WebChannel } from "../utils.js";
|
||||
import { jidToE164, resolveUserPath } from "../utils.js";
|
||||
|
||||
export function resolveDefaultWebAuthDir(): string {
|
||||
|
||||
@@ -13,8 +13,8 @@ vi.mock("../agents/pi-embedded.js", () => ({
|
||||
resolveEmbeddedSessionLane: (key: string) => `session:${key.trim() || "main"}`,
|
||||
}));
|
||||
|
||||
import { resetInboundDedupe } from "../auto-reply/reply/inbound-dedupe.js";
|
||||
import type { OpenClawConfig } from "../config/config.js";
|
||||
import { resetInboundDedupe } from "../auto-reply/reply/inbound-dedupe.js";
|
||||
import { monitorWebChannel } from "./auto-reply.js";
|
||||
import { resetLoadConfigMock, setLoadConfigMock } from "./test-helpers.js";
|
||||
|
||||
|
||||
@@ -13,8 +13,8 @@ vi.mock("../agents/pi-embedded.js", () => ({
|
||||
resolveEmbeddedSessionLane: (key: string) => `session:${key.trim() || "main"}`,
|
||||
}));
|
||||
|
||||
import { resetInboundDedupe } from "../auto-reply/reply/inbound-dedupe.js";
|
||||
import type { OpenClawConfig } from "../config/config.js";
|
||||
import { resetInboundDedupe } from "../auto-reply/reply/inbound-dedupe.js";
|
||||
import { monitorWebChannel } from "./auto-reply.js";
|
||||
import { resetLoadConfigMock, setLoadConfigMock } from "./test-helpers.js";
|
||||
|
||||
|
||||
@@ -13,10 +13,10 @@ vi.mock("../agents/pi-embedded.js", () => ({
|
||||
resolveEmbeddedSessionLane: (key: string) => `session:${key.trim() || "main"}`,
|
||||
}));
|
||||
|
||||
import { runEmbeddedPiAgent } from "../agents/pi-embedded.js";
|
||||
import { resetInboundDedupe } from "../auto-reply/reply/inbound-dedupe.js";
|
||||
import { getReplyFromConfig } from "../auto-reply/reply.js";
|
||||
import type { OpenClawConfig } from "../config/config.js";
|
||||
import { runEmbeddedPiAgent } from "../agents/pi-embedded.js";
|
||||
import { getReplyFromConfig } from "../auto-reply/reply.js";
|
||||
import { resetInboundDedupe } from "../auto-reply/reply/inbound-dedupe.js";
|
||||
import { monitorWebChannel } from "./auto-reply.js";
|
||||
import { resetLoadConfigMock, setLoadConfigMock } from "./test-helpers.js";
|
||||
|
||||
|
||||
@@ -13,8 +13,8 @@ vi.mock("../agents/pi-embedded.js", () => ({
|
||||
resolveEmbeddedSessionLane: (key: string) => `session:${key.trim() || "main"}`,
|
||||
}));
|
||||
|
||||
import { resetInboundDedupe } from "../auto-reply/reply/inbound-dedupe.js";
|
||||
import type { OpenClawConfig } from "../config/config.js";
|
||||
import { resetInboundDedupe } from "../auto-reply/reply/inbound-dedupe.js";
|
||||
import { monitorWebChannel } from "./auto-reply.js";
|
||||
import { resetLoadConfigMock, setLoadConfigMock } from "./test-helpers.js";
|
||||
|
||||
|
||||
@@ -14,8 +14,8 @@ vi.mock("../agents/pi-embedded.js", () => ({
|
||||
resolveEmbeddedSessionLane: (key: string) => `session:${key.trim() || "main"}`,
|
||||
}));
|
||||
|
||||
import { resetInboundDedupe } from "../auto-reply/reply/inbound-dedupe.js";
|
||||
import { expectInboundContextContract } from "../../test/helpers/inbound-contract.js";
|
||||
import { resetInboundDedupe } from "../auto-reply/reply/inbound-dedupe.js";
|
||||
import { resetLogger, setLoggerOverride } from "../logging.js";
|
||||
import { monitorWebChannel, SILENT_REPLY_TOKEN } from "./auto-reply.js";
|
||||
import { resetBaileysMocks, resetLoadConfigMock, setLoadConfigMock } from "./test-helpers.js";
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
import { chunkMarkdownTextWithMode, type ChunkMode } from "../../auto-reply/chunk.js";
|
||||
import type { MarkdownTableMode } from "../../config/types.base.js";
|
||||
import { convertMarkdownTables } from "../../markdown/tables.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 { 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,11 +1,11 @@
|
||||
import type { ReplyPayload } from "../../auto-reply/types.js";
|
||||
import {
|
||||
DEFAULT_HEARTBEAT_ACK_MAX_CHARS,
|
||||
resolveHeartbeatPrompt,
|
||||
stripHeartbeatToken,
|
||||
} from "../../auto-reply/heartbeat.js";
|
||||
import { HEARTBEAT_TOKEN } from "../../auto-reply/tokens.js";
|
||||
import { getReplyFromConfig } from "../../auto-reply/reply.js";
|
||||
import type { ReplyPayload } from "../../auto-reply/types.js";
|
||||
import { HEARTBEAT_TOKEN } from "../../auto-reply/tokens.js";
|
||||
import { resolveWhatsAppHeartbeatRecipients } from "../../channels/plugins/whatsapp-heartbeat.js";
|
||||
import { loadConfig } from "../../config/config.js";
|
||||
import {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
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";
|
||||
import { buildMentionRegexes, normalizeMentionText } from "../../auto-reply/reply/mentions.js";
|
||||
import { isSelfChatMode, jidToE164, normalizeE164 } from "../../utils.js";
|
||||
|
||||
export type MentionConfig = {
|
||||
mentionRegexes: RegExp[];
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
import { DEFAULT_GROUP_HISTORY_LIMIT } from "../../auto-reply/reply/history.js";
|
||||
import { getReplyFromConfig } from "../../auto-reply/reply.js";
|
||||
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";
|
||||
import { DEFAULT_GROUP_HISTORY_LIMIT } from "../../auto-reply/reply/history.js";
|
||||
import { formatCliCommand } from "../../cli/command-format.js";
|
||||
import { waitForever } from "../../cli/wait.js";
|
||||
import { loadConfig } from "../../config/config.js";
|
||||
import { logVerbose } from "../../globals.js";
|
||||
@@ -11,7 +13,6 @@ import { registerUnhandledRejectionHandler } from "../../infra/unhandled-rejecti
|
||||
import { getChildLogger } from "../../logging.js";
|
||||
import { resolveAgentRoute } from "../../routing/resolve-route.js";
|
||||
import { defaultRuntime, type RuntimeEnv } from "../../runtime.js";
|
||||
import { formatCliCommand } from "../../cli/command-format.js";
|
||||
import { resolveWhatsAppAccount } from "../accounts.js";
|
||||
import { setActiveWebListener } from "../active-listener.js";
|
||||
import { monitorWebInbox } from "../inbound.js";
|
||||
@@ -28,7 +29,6 @@ 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 { logVerbose } from "../../../globals.js";
|
||||
import type { WebInboundMsg } from "../types.js";
|
||||
import { shouldAckReactionForWhatsApp } from "../../../channels/ack-reactions.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,5 +1,7 @@
|
||||
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,
|
||||
@@ -8,8 +10,6 @@ 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 { normalizeGroupActivation } from "../../../auto-reply/group-activation.js";
|
||||
import type { loadConfig } from "../../../config/config.js";
|
||||
import { normalizeGroupActivation } from "../../../auto-reply/group-activation.js";
|
||||
import {
|
||||
resolveChannelGroupPolicy,
|
||||
resolveChannelGroupRequireMention,
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
|
||||
import { applyGroupGating } from "./group-gating.js";
|
||||
|
||||
const baseConfig = {
|
||||
|
||||
@@ -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 type { loadConfig } from "../../../config/config.js";
|
||||
import { normalizeE164 } from "../../../utils.js";
|
||||
import { resolveMentionGating } from "../../../channels/mention-gating.js";
|
||||
import type { MentionConfig } from "../mentions.js";
|
||||
import { buildMentionConfig, debugMention, resolveOwnerList } from "../mentions.js";
|
||||
import type { WebInboundMsg } from "../types.js";
|
||||
import { recordPendingHistoryEntryIfEnabled } from "../../../auto-reply/reply/history.js";
|
||||
import { resolveMentionGating } from "../../../channels/mention-gating.js";
|
||||
import { normalizeE164 } from "../../../utils.js";
|
||||
import { buildMentionConfig, debugMention, resolveOwnerList } from "../mentions.js";
|
||||
import { stripMentionsForCommand } from "./commands.js";
|
||||
import { resolveGroupActivationFor, resolveGroupPolicyFor } from "./group-activation.js";
|
||||
import { noteGroupMember } from "./group-members.js";
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
|
||||
import { buildInboundLine } from "./message-line.js";
|
||||
|
||||
describe("buildInboundLine", () => {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
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";
|
||||
import { resolveMessagePrefix } from "../../../agents/identity.js";
|
||||
import { formatInboundEnvelope, type EnvelopeFormatOptions } from "../../../auto-reply/envelope.js";
|
||||
|
||||
export function formatReplyContext(msg: WebInboundMsg) {
|
||||
if (!msg.replyToBody) {
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
import type { MsgContext } from "../../../auto-reply/templating.js";
|
||||
import type { getReplyFromConfig } from "../../../auto-reply/reply.js";
|
||||
import type { MsgContext } from "../../../auto-reply/templating.js";
|
||||
import type { loadConfig } from "../../../config/config.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 { 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 { jidToE164, normalizeE164 } from "../../../utils.js";
|
||||
import type { WebInboundMsg } from "../types.js";
|
||||
import { jidToE164, normalizeE164 } from "../../../utils.js";
|
||||
|
||||
export function resolvePeerId(msg: WebInboundMsg) {
|
||||
if (msg.chatType === "group") {
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import { describe, expect, it, vi } from "vitest";
|
||||
|
||||
import { expectInboundContextContract } from "../../../../test/helpers/inbound-contract.js";
|
||||
|
||||
let capturedCtx: unknown;
|
||||
|
||||
@@ -1,5 +1,12 @@
|
||||
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";
|
||||
import {
|
||||
formatInboundEnvelope,
|
||||
resolveEnvelopeFormatOptions,
|
||||
@@ -8,30 +15,23 @@ import {
|
||||
buildHistoryContextFromEntries,
|
||||
type HistoryEntry,
|
||||
} from "../../../auto-reply/reply/history.js";
|
||||
import { dispatchReplyWithBufferedBlockDispatcher } from "../../../auto-reply/reply/provider-dispatcher.js";
|
||||
import type { getReplyFromConfig } from "../../../auto-reply/reply.js";
|
||||
import type { ReplyPayload } from "../../../auto-reply/types.js";
|
||||
import { shouldComputeCommandAuthorized } from "../../../auto-reply/command-detection.js";
|
||||
import { finalizeInboundContext } from "../../../auto-reply/reply/inbound-context.js";
|
||||
import { dispatchReplyWithBufferedBlockDispatcher } from "../../../auto-reply/reply/provider-dispatcher.js";
|
||||
import { toLocationContext } from "../../../channels/location.js";
|
||||
import { createReplyPrefixContext } from "../../../channels/reply-prefix.js";
|
||||
import type { loadConfig } from "../../../config/config.js";
|
||||
import { resolveMarkdownTableMode } from "../../../config/markdown-tables.js";
|
||||
import {
|
||||
readSessionUpdatedAt,
|
||||
recordSessionMetaFromInbound,
|
||||
resolveStorePath,
|
||||
} from "../../../config/sessions.js";
|
||||
import { resolveMarkdownTableMode } from "../../../config/markdown-tables.js";
|
||||
import { logVerbose, shouldLogVerbose } from "../../../globals.js";
|
||||
import type { getChildLogger } from "../../../logging.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";
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
import fs from "node:fs/promises";
|
||||
import os from "node:os";
|
||||
import path from "node:path";
|
||||
|
||||
import { describe, expect, it, vi } from "vitest";
|
||||
|
||||
import { saveSessionStore } from "../../config/sessions.js";
|
||||
import { getSessionSnapshot } from "./session-snapshot.js";
|
||||
|
||||
|
||||
@@ -2,7 +2,6 @@ import crypto from "node:crypto";
|
||||
import fs from "node:fs/promises";
|
||||
import os from "node:os";
|
||||
import path from "node:path";
|
||||
|
||||
import { afterAll, beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
|
||||
|
||||
const readAllowFromStoreMock = vi.fn().mockResolvedValue([]);
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
|
||||
import { extractLocationData, extractMediaPlaceholder, extractText } from "./inbound.js";
|
||||
|
||||
describe("web inbound helpers", () => {
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import { beforeEach, describe, expect, it, vi } from "vitest";
|
||||
|
||||
import { checkInboundAccessControl } from "./access-control.js";
|
||||
|
||||
const sendMessageMock = vi.fn();
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import type { proto, WAMessage } from "@whiskeysockets/baileys";
|
||||
import { downloadMediaMessage, normalizeMessageContent } from "@whiskeysockets/baileys";
|
||||
import { logVerbose } from "../../globals.js";
|
||||
import type { createWaSocket } from "../session.js";
|
||||
import { logVerbose } from "../../globals.js";
|
||||
|
||||
function unwrapMessage(message: proto.IMessage | undefined): proto.IMessage | undefined {
|
||||
const normalized = normalizeMessageContent(message);
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
import type { AnyMessageContent, proto, WAMessage } from "@whiskeysockets/baileys";
|
||||
import { DisconnectReason, isJidGroup } from "@whiskeysockets/baileys";
|
||||
import type { WebInboundMessage, WebListenerCloseReason } from "./types.js";
|
||||
import { createInboundDebouncer } from "../../auto-reply/inbound-debounce.js";
|
||||
import { formatLocationText } from "../../channels/location.js";
|
||||
import { logVerbose, shouldLogVerbose } from "../../globals.js";
|
||||
import { recordChannelActivity } from "../../infra/channel-activity.js";
|
||||
import { getChildLogger } from "../../logging/logger.js";
|
||||
import { createSubsystemLogger } from "../../logging/subsystem.js";
|
||||
import { saveMediaBuffer } from "../../media/store.js";
|
||||
import { createInboundDebouncer } from "../../auto-reply/inbound-debounce.js";
|
||||
import { jidToE164, resolveJidToE164 } from "../../utils.js";
|
||||
import { createWaSocket, getStatusCode, waitForWaConnection } from "../session.js";
|
||||
import { checkInboundAccessControl } from "./access-control.js";
|
||||
@@ -20,7 +21,6 @@ import {
|
||||
} from "./extract.js";
|
||||
import { downloadInboundMedia } from "./media.js";
|
||||
import { createWebSendApi } from "./send-api.js";
|
||||
import type { WebInboundMessage, WebListenerCloseReason } from "./types.js";
|
||||
|
||||
export async function monitorWebInbox(options: {
|
||||
verbose: boolean;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import type { AnyMessageContent, WAPresence } from "@whiskeysockets/baileys";
|
||||
import type { ActiveWebSendOptions } from "../active-listener.js";
|
||||
import { recordChannelActivity } from "../../infra/channel-activity.js";
|
||||
import { toWhatsappJid } from "../../utils.js";
|
||||
import type { ActiveWebSendOptions } from "../active-listener.js";
|
||||
|
||||
export function createWebSendApi(params: {
|
||||
sock: {
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import { randomUUID } from "node:crypto";
|
||||
|
||||
import { DisconnectReason } from "@whiskeysockets/baileys";
|
||||
import { randomUUID } from "node:crypto";
|
||||
import { loadConfig } from "../config/config.js";
|
||||
import { danger, info, success } from "../globals.js";
|
||||
import { logInfo } from "../logger.js";
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
import { DisconnectReason } from "@whiskeysockets/baileys";
|
||||
import fs from "node:fs/promises";
|
||||
import os from "node:os";
|
||||
import path from "node:path";
|
||||
|
||||
import { DisconnectReason } from "@whiskeysockets/baileys";
|
||||
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
|
||||
|
||||
const rmMock = vi.spyOn(fs, "rm");
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
import { EventEmitter } from "node:events";
|
||||
|
||||
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
|
||||
|
||||
import { resetLogger, setLoggerOverride } from "../logging.js";
|
||||
|
||||
vi.mock("./session.js", () => {
|
||||
@@ -18,8 +16,8 @@ vi.mock("./session.js", () => {
|
||||
};
|
||||
});
|
||||
|
||||
import { loginWeb } from "./login.js";
|
||||
import type { waitForWaConnection } from "./session.js";
|
||||
import { loginWeb } from "./login.js";
|
||||
|
||||
const { createWaSocket } = await import("./session.js");
|
||||
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import { DisconnectReason } from "@whiskeysockets/baileys";
|
||||
import { formatCliCommand } from "../cli/command-format.js";
|
||||
import { loadConfig } from "../config/config.js";
|
||||
import { danger, info, success } from "../globals.js";
|
||||
import { logInfo } from "../logger.js";
|
||||
import { defaultRuntime, type RuntimeEnv } from "../runtime.js";
|
||||
import { formatCliCommand } from "../cli/command-format.js";
|
||||
import { resolveWhatsAppAccount } from "./accounts.js";
|
||||
import { createWaSocket, formatError, logoutWeb, waitForWaConnection } from "./session.js";
|
||||
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
import fs from "node:fs";
|
||||
import path from "node:path";
|
||||
|
||||
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
|
||||
|
||||
import { isPathWithinBase } from "../../test/helpers/paths.js";
|
||||
import { withTempHome } from "../../test/helpers/temp-home.js";
|
||||
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
import fs from "node:fs/promises";
|
||||
import os from "node:os";
|
||||
import path from "node:path";
|
||||
|
||||
import sharp from "sharp";
|
||||
import { afterEach, describe, expect, it, vi } from "vitest";
|
||||
|
||||
import { optimizeImageToPng } from "../media/image-ops.js";
|
||||
import { loadWebMedia, optimizeImageToJpeg } from "./media.js";
|
||||
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
import fs from "node:fs/promises";
|
||||
import path from "node:path";
|
||||
import { fileURLToPath } from "node:url";
|
||||
|
||||
import { logVerbose, shouldLogVerbose } from "../globals.js";
|
||||
import { type MediaKind, maxBytesForKind, mediaKindFromMime } from "../media/constants.js";
|
||||
import { resolveUserPath } from "../utils.js";
|
||||
import { fetchRemoteMedia } from "../media/fetch.js";
|
||||
import {
|
||||
convertHeicToJpeg,
|
||||
@@ -13,6 +11,7 @@ import {
|
||||
resizeToJpeg,
|
||||
} from "../media/image-ops.js";
|
||||
import { detectMime, extensionForMime } from "../media/mime.js";
|
||||
import { resolveUserPath } from "../utils.js";
|
||||
|
||||
export type WebMediaResult = {
|
||||
buffer: Buffer;
|
||||
|
||||
@@ -69,9 +69,7 @@ const _getSock = () => (createWaSocket as unknown as () => Promise<ReturnType<ty
|
||||
import fsSync from "node:fs";
|
||||
import os from "node:os";
|
||||
import path from "node:path";
|
||||
|
||||
import { afterEach, beforeEach, describe, expect, it } from "vitest";
|
||||
|
||||
import { resetLogger, setLoggerOverride } from "../logging.js";
|
||||
import { monitorWebInbox, resetWebInboundDedupe } from "./inbound.js";
|
||||
|
||||
|
||||
@@ -69,9 +69,7 @@ const _getSock = () => (createWaSocket as unknown as () => Promise<ReturnType<ty
|
||||
import fsSync from "node:fs";
|
||||
import os from "node:os";
|
||||
import path from "node:path";
|
||||
|
||||
import { afterEach, beforeEach, describe, expect, it } from "vitest";
|
||||
|
||||
import { resetLogger, setLoggerOverride } from "../logging.js";
|
||||
import { monitorWebInbox, resetWebInboundDedupe } from "./inbound.js";
|
||||
|
||||
|
||||
@@ -70,9 +70,7 @@ import crypto from "node:crypto";
|
||||
import fsSync from "node:fs";
|
||||
import os from "node:os";
|
||||
import path from "node:path";
|
||||
|
||||
import { afterEach, beforeEach, describe, expect, it } from "vitest";
|
||||
|
||||
import { resetLogger, setLoggerOverride } from "../logging.js";
|
||||
import { monitorWebInbox, resetWebInboundDedupe } from "./inbound.js";
|
||||
|
||||
|
||||
@@ -69,9 +69,7 @@ const _getSock = () => (createWaSocket as unknown as () => Promise<ReturnType<ty
|
||||
import fsSync from "node:fs";
|
||||
import os from "node:os";
|
||||
import path from "node:path";
|
||||
|
||||
import { afterEach, beforeEach, describe, expect, it } from "vitest";
|
||||
|
||||
import { resetLogger, setLoggerOverride } from "../logging.js";
|
||||
import { monitorWebInbox, resetWebInboundDedupe } from "./inbound.js";
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
|
||||
|
||||
import { resetLogger, setLoggerOverride } from "../logging.js";
|
||||
import { setActiveWebListener } from "./active-listener.js";
|
||||
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
import { randomUUID } from "node:crypto";
|
||||
|
||||
import { getChildLogger } from "../logging/logger.js";
|
||||
import { createSubsystemLogger } from "../logging/subsystem.js";
|
||||
import { normalizePollInput, type PollInput } from "../polls.js";
|
||||
import { toWhatsappJid } from "../utils.js";
|
||||
import { loadConfig } from "../config/config.js";
|
||||
import { resolveMarkdownTableMode } from "../config/markdown-tables.js";
|
||||
import { getChildLogger } from "../logging/logger.js";
|
||||
import { createSubsystemLogger } from "../logging/subsystem.js";
|
||||
import { convertMarkdownTables } from "../markdown/tables.js";
|
||||
import { normalizePollInput, type PollInput } from "../polls.js";
|
||||
import { toWhatsappJid } from "../utils.js";
|
||||
import { type ActiveWebSendOptions, requireActiveWebListener } from "./active-listener.js";
|
||||
import { loadWebMedia } from "./media.js";
|
||||
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
import { readFile } from "node:fs/promises";
|
||||
import { resolve } from "node:path";
|
||||
|
||||
import { describe, expect, it } from "vitest";
|
||||
|
||||
import { renderQrPngBase64 } from "./qr-image.js";
|
||||
|
||||
describe("renderQrPngBase64", () => {
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
|
||||
import type { OpenClawConfig } from "../config/config.js";
|
||||
import {
|
||||
computeBackoff,
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import { randomUUID } from "node:crypto";
|
||||
|
||||
import type { OpenClawConfig } from "../config/config.js";
|
||||
import type { BackoffPolicy } from "../infra/backoff.js";
|
||||
import { computeBackoff, sleepWithAbort } from "../infra/backoff.js";
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
import { randomUUID } from "node:crypto";
|
||||
import fsSync from "node:fs";
|
||||
import {
|
||||
DisconnectReason,
|
||||
fetchLatestBaileysVersion,
|
||||
@@ -7,13 +5,14 @@ import {
|
||||
makeWASocket,
|
||||
useMultiFileAuthState,
|
||||
} from "@whiskeysockets/baileys";
|
||||
import { randomUUID } from "node:crypto";
|
||||
import fsSync from "node:fs";
|
||||
import qrcode from "qrcode-terminal";
|
||||
import { formatCliCommand } from "../cli/command-format.js";
|
||||
import { danger, success } from "../globals.js";
|
||||
import { getChildLogger, toPinoLikeLogger } from "../logging.js";
|
||||
import { ensureDir, resolveUserPath } from "../utils.js";
|
||||
import { VERSION } from "../version.js";
|
||||
import { formatCliCommand } from "../cli/command-format.js";
|
||||
|
||||
import {
|
||||
maybeRestoreCredsFromBackup,
|
||||
resolveDefaultWebAuthDir,
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import { vi } from "vitest";
|
||||
|
||||
import type { MockBaileysSocket } from "../../test/mocks/baileys.js";
|
||||
import { createMockBaileys } from "../../test/mocks/baileys.js";
|
||||
|
||||
|
||||
Reference in New Issue
Block a user