mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-09 03:18:26 +00:00
chore: Enable "experimentalSortImports" in Oxfmt and reformat all imorts.
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
|
||||
import { fetchDiscord } from "./api.js";
|
||||
|
||||
function jsonResponse(body: unknown, status = 200) {
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
|
||||
import { chunkDiscordText, chunkDiscordTextWithMode } from "./chunk.js";
|
||||
|
||||
function countLines(text: string) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import type { ChannelDirectoryEntry } from "../channels/plugins/types.js";
|
||||
import type { DirectoryConfigParams } from "../channels/plugins/directory-config.js";
|
||||
import type { ChannelDirectoryEntry } from "../channels/plugins/types.js";
|
||||
import { resolveDiscordAccount } from "./accounts.js";
|
||||
import { fetchDiscord } from "./api.js";
|
||||
import { normalizeDiscordSlug } from "./monitor/allow-list.js";
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import { EventEmitter } from "node:events";
|
||||
|
||||
import { afterEach, describe, expect, it, vi } from "vitest";
|
||||
|
||||
vi.mock("../globals.js", () => ({
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import type { EventEmitter } from "node:events";
|
||||
|
||||
import { logVerbose } from "../globals.js";
|
||||
import type { RuntimeEnv } from "../runtime.js";
|
||||
import { logVerbose } from "../globals.js";
|
||||
|
||||
type GatewayEmitter = Pick<EventEmitter, "on" | "removeListener">;
|
||||
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
import { EventEmitter } from "node:events";
|
||||
|
||||
import { describe, expect, it, vi } from "vitest";
|
||||
|
||||
import { waitForDiscordGatewayStop } from "./monitor.gateway.js";
|
||||
|
||||
describe("waitForDiscordGatewayStop", () => {
|
||||
|
||||
@@ -2,7 +2,6 @@ import type { Client } from "@buape/carbon";
|
||||
import { ChannelType, MessageType } from "@buape/carbon";
|
||||
import { Routes } from "discord-api-types/v10";
|
||||
import { beforeEach, describe, expect, it, vi } from "vitest";
|
||||
|
||||
import { __resetDiscordChannelInfoCacheForTest } from "./monitor/message-utils.js";
|
||||
|
||||
const sendMock = vi.fn();
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
import type { Guild, User } from "@buape/carbon";
|
||||
|
||||
import type { AllowlistMatch } from "../../channels/allowlist-match.js";
|
||||
import {
|
||||
buildChannelKeyCandidates,
|
||||
resolveChannelEntryMatchWithFallback,
|
||||
resolveChannelMatchConfig,
|
||||
type ChannelMatchSource,
|
||||
} from "../../channels/channel-config.js";
|
||||
import type { AllowlistMatch } from "../../channels/allowlist-match.js";
|
||||
import { formatDiscordUserTag } from "./format.js";
|
||||
|
||||
export type DiscordAllowList = {
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import type { DiscordExecApprovalConfig } from "../../config/types.discord.js";
|
||||
import {
|
||||
buildExecApprovalCustomId,
|
||||
parseExecApprovalData,
|
||||
type ExecApprovalRequest,
|
||||
DiscordExecApprovalHandler,
|
||||
} from "./exec-approvals.js";
|
||||
import type { DiscordExecApprovalConfig } from "../../config/types.discord.js";
|
||||
|
||||
describe("buildExecApprovalCustomId", () => {
|
||||
it("encodes approval id and action", () => {
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
import { Button, type ButtonInteraction, type ComponentData } from "@buape/carbon";
|
||||
import { ButtonStyle, Routes } from "discord-api-types/v10";
|
||||
import type { OpenClawConfig } from "../../config/config.js";
|
||||
import { GatewayClient } from "../../gateway/client.js";
|
||||
import { GATEWAY_CLIENT_MODES, GATEWAY_CLIENT_NAMES } from "../../utils/message-channel.js";
|
||||
import type { DiscordExecApprovalConfig } from "../../config/types.discord.js";
|
||||
import type { EventFrame } from "../../gateway/protocol/index.js";
|
||||
import type { ExecApprovalDecision } from "../../infra/exec-approvals.js";
|
||||
import { createDiscordClient } from "../send.shared.js";
|
||||
import { logDebug, logError } from "../../logger.js";
|
||||
import type { DiscordExecApprovalConfig } from "../../config/types.discord.js";
|
||||
import type { RuntimeEnv } from "../../runtime.js";
|
||||
import { GatewayClient } from "../../gateway/client.js";
|
||||
import { logDebug, logError } from "../../logger.js";
|
||||
import { GATEWAY_CLIENT_MODES, GATEWAY_CLIENT_NAMES } from "../../utils/message-channel.js";
|
||||
import { createDiscordClient } from "../send.shared.js";
|
||||
|
||||
const EXEC_APPROVAL_KEY = "execapproval";
|
||||
|
||||
|
||||
@@ -6,11 +6,9 @@ import {
|
||||
MessageReactionRemoveListener,
|
||||
PresenceUpdateListener,
|
||||
} from "@buape/carbon";
|
||||
|
||||
import { danger } from "../../globals.js";
|
||||
import { formatDurationSeconds } from "../../infra/format-duration.js";
|
||||
import { enqueueSystemEvent } from "../../infra/system-events.js";
|
||||
import { setPresence } from "./presence-cache.js";
|
||||
import { createSubsystemLogger } from "../../logging/subsystem.js";
|
||||
import { resolveAgentRoute } from "../../routing/resolve-route.js";
|
||||
import {
|
||||
@@ -21,6 +19,7 @@ import {
|
||||
} from "./allow-list.js";
|
||||
import { formatDiscordReactionEmoji, formatDiscordUserTag } from "./format.js";
|
||||
import { resolveDiscordChannelInfo } from "./message-utils.js";
|
||||
import { setPresence } from "./presence-cache.js";
|
||||
|
||||
type LoadedConfig = ReturnType<typeof import("../../config/config.js").loadConfig>;
|
||||
type RuntimeEnv = import("../../runtime.js").RuntimeEnv;
|
||||
|
||||
@@ -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 type { MsgContext } from "../../auto-reply/templating.js";
|
||||
import { expectInboundContextContract } from "../../../test/helpers/inbound-contract.js";
|
||||
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
import { ChannelType, MessageType, type User } from "@buape/carbon";
|
||||
|
||||
import type {
|
||||
DiscordMessagePreflightContext,
|
||||
DiscordMessagePreflightParams,
|
||||
} from "./message-handler.preflight.types.js";
|
||||
import { hasControlCommand } from "../../auto-reply/command-detection.js";
|
||||
import { shouldHandleTextCommands } from "../../auto-reply/commands-registry.js";
|
||||
import {
|
||||
@@ -10,6 +13,10 @@ import {
|
||||
buildMentionRegexes,
|
||||
matchesMentionWithExplicit,
|
||||
} from "../../auto-reply/reply/mentions.js";
|
||||
import { formatAllowlistMatchMeta } from "../../channels/allowlist-match.js";
|
||||
import { resolveControlCommandGate } from "../../channels/command-gating.js";
|
||||
import { logInboundDrop } from "../../channels/logging.js";
|
||||
import { resolveMentionGatingWithBypass } from "../../channels/mention-gating.js";
|
||||
import { logVerbose, shouldLogVerbose } from "../../globals.js";
|
||||
import { recordChannelActivity } from "../../infra/channel-activity.js";
|
||||
import { enqueueSystemEvent } from "../../infra/system-events.js";
|
||||
@@ -20,11 +27,7 @@ import {
|
||||
upsertChannelPairingRequest,
|
||||
} from "../../pairing/pairing-store.js";
|
||||
import { resolveAgentRoute } from "../../routing/resolve-route.js";
|
||||
import { resolveMentionGatingWithBypass } from "../../channels/mention-gating.js";
|
||||
import { formatAllowlistMatchMeta } from "../../channels/allowlist-match.js";
|
||||
import { sendMessageDiscord } from "../send.js";
|
||||
import { resolveControlCommandGate } from "../../channels/command-gating.js";
|
||||
import { logInboundDrop } from "../../channels/logging.js";
|
||||
import {
|
||||
allowListMatches,
|
||||
isDiscordGroupAllowedByPolicy,
|
||||
@@ -42,10 +45,6 @@ import {
|
||||
resolveDiscordSystemLocation,
|
||||
resolveTimestampMs,
|
||||
} from "./format.js";
|
||||
import type {
|
||||
DiscordMessagePreflightContext,
|
||||
DiscordMessagePreflightParams,
|
||||
} from "./message-handler.preflight.types.js";
|
||||
import { resolveDiscordChannelInfo, resolveDiscordMessageText } from "./message-utils.js";
|
||||
import { resolveDiscordSystemEvent } from "./system-events.js";
|
||||
import { resolveDiscordThreadChannel, resolveDiscordThreadParentInfo } from "./threading.js";
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import fs from "node:fs/promises";
|
||||
import os from "node:os";
|
||||
import path from "node:path";
|
||||
|
||||
import { beforeEach, describe, expect, it, vi } from "vitest";
|
||||
|
||||
const reactMessageDiscord = vi.fn(async () => {});
|
||||
|
||||
@@ -1,29 +1,30 @@
|
||||
import { ChannelType } from "@buape/carbon";
|
||||
import type { ReplyPayload } from "../../auto-reply/types.js";
|
||||
import type { DiscordMessagePreflightContext } from "./message-handler.preflight.js";
|
||||
import { resolveAckReaction, resolveHumanDelayConfig } from "../../agents/identity.js";
|
||||
import {
|
||||
removeAckReactionAfterReply,
|
||||
shouldAckReaction as shouldAckReactionGate,
|
||||
} from "../../channels/ack-reactions.js";
|
||||
import { logTypingFailure, logAckFailure } from "../../channels/logging.js";
|
||||
import { createReplyPrefixContext } from "../../channels/reply-prefix.js";
|
||||
import { createTypingCallbacks } from "../../channels/typing.js";
|
||||
import { resolveChunkMode } from "../../auto-reply/chunk.js";
|
||||
import { dispatchInboundMessage } from "../../auto-reply/dispatch.js";
|
||||
import {
|
||||
formatInboundEnvelope,
|
||||
formatThreadStarterEnvelope,
|
||||
resolveEnvelopeFormatOptions,
|
||||
} from "../../auto-reply/envelope.js";
|
||||
import { dispatchInboundMessage } from "../../auto-reply/dispatch.js";
|
||||
import {
|
||||
buildPendingHistoryContextFromMap,
|
||||
clearHistoryEntriesIfEnabled,
|
||||
} from "../../auto-reply/reply/history.js";
|
||||
import { finalizeInboundContext } from "../../auto-reply/reply/inbound-context.js";
|
||||
import { createReplyDispatcherWithTyping } from "../../auto-reply/reply/reply-dispatcher.js";
|
||||
import type { ReplyPayload } from "../../auto-reply/types.js";
|
||||
import {
|
||||
removeAckReactionAfterReply,
|
||||
shouldAckReaction as shouldAckReactionGate,
|
||||
} from "../../channels/ack-reactions.js";
|
||||
import { logTypingFailure, logAckFailure } from "../../channels/logging.js";
|
||||
import { createReplyPrefixContext } from "../../channels/reply-prefix.js";
|
||||
import { recordInboundSession } from "../../channels/session.js";
|
||||
import { readSessionUpdatedAt, resolveStorePath } from "../../config/sessions.js";
|
||||
import { resolveChunkMode } from "../../auto-reply/chunk.js";
|
||||
import { createTypingCallbacks } from "../../channels/typing.js";
|
||||
import { resolveMarkdownTableMode } from "../../config/markdown-tables.js";
|
||||
import { readSessionUpdatedAt, resolveStorePath } from "../../config/sessions.js";
|
||||
import { danger, logVerbose, shouldLogVerbose } from "../../globals.js";
|
||||
import { buildAgentSessionKey } from "../../routing/resolve-route.js";
|
||||
import { resolveThreadSessionKeys } from "../../routing/session-key.js";
|
||||
@@ -31,7 +32,6 @@ import { truncateUtf16Safe } from "../../utils.js";
|
||||
import { reactMessageDiscord, removeReactionDiscord } from "../send.js";
|
||||
import { normalizeDiscordSlug } from "./allow-list.js";
|
||||
import { formatDiscordUserTag, resolveTimestampMs } from "./format.js";
|
||||
import type { DiscordMessagePreflightContext } from "./message-handler.preflight.js";
|
||||
import {
|
||||
buildDiscordMediaPayload,
|
||||
resolveDiscordMessageText,
|
||||
|
||||
@@ -1,16 +1,15 @@
|
||||
import type { Client } from "@buape/carbon";
|
||||
|
||||
import type { HistoryEntry } from "../../auto-reply/reply/history.js";
|
||||
import type { ReplyToMode } from "../../config/config.js";
|
||||
import type { RuntimeEnv } from "../../runtime.js";
|
||||
import type { DiscordGuildEntryResolved } from "./allow-list.js";
|
||||
import type { DiscordMessageEvent, DiscordMessageHandler } from "./listeners.js";
|
||||
import { hasControlCommand } from "../../auto-reply/command-detection.js";
|
||||
import {
|
||||
createInboundDebouncer,
|
||||
resolveInboundDebounceMs,
|
||||
} from "../../auto-reply/inbound-debounce.js";
|
||||
import type { HistoryEntry } from "../../auto-reply/reply/history.js";
|
||||
import type { ReplyToMode } from "../../config/config.js";
|
||||
import { danger } from "../../globals.js";
|
||||
import type { RuntimeEnv } from "../../runtime.js";
|
||||
import type { DiscordGuildEntryResolved } from "./allow-list.js";
|
||||
import type { DiscordMessageEvent, DiscordMessageHandler } from "./listeners.js";
|
||||
import { preflightDiscordMessage } from "./message-handler.preflight.js";
|
||||
import { processDiscordMessage } from "./message-handler.process.js";
|
||||
import { resolveDiscordMessageText } from "./message-utils.js";
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import type { ChannelType, Client, Message } from "@buape/carbon";
|
||||
import type { APIAttachment } from "discord-api-types/v10";
|
||||
|
||||
import { logVerbose } from "../../globals.js";
|
||||
import { fetchRemoteMedia } from "../../media/fetch.js";
|
||||
import { saveMediaBuffer } from "../../media/store.js";
|
||||
|
||||
@@ -10,7 +10,15 @@ import {
|
||||
type ComponentData,
|
||||
} from "@buape/carbon";
|
||||
import { ApplicationCommandOptionType, ButtonStyle } from "discord-api-types/v10";
|
||||
|
||||
import type {
|
||||
ChatCommandDefinition,
|
||||
CommandArgDefinition,
|
||||
CommandArgValues,
|
||||
CommandArgs,
|
||||
NativeCommandSpec,
|
||||
} from "../../auto-reply/commands-registry.js";
|
||||
import type { ReplyPayload } from "../../auto-reply/types.js";
|
||||
import type { OpenClawConfig, loadConfig } from "../../config/config.js";
|
||||
import { resolveEffectiveMessagesConfig, resolveHumanDelayConfig } from "../../agents/identity.js";
|
||||
import { resolveChunkMode, resolveTextChunkLimit } from "../../auto-reply/chunk.js";
|
||||
import {
|
||||
@@ -22,17 +30,9 @@ import {
|
||||
resolveCommandArgMenu,
|
||||
serializeCommandArgs,
|
||||
} from "../../auto-reply/commands-registry.js";
|
||||
import type {
|
||||
ChatCommandDefinition,
|
||||
CommandArgDefinition,
|
||||
CommandArgValues,
|
||||
CommandArgs,
|
||||
NativeCommandSpec,
|
||||
} from "../../auto-reply/commands-registry.js";
|
||||
import { dispatchReplyWithDispatcher } from "../../auto-reply/reply/provider-dispatcher.js";
|
||||
import { finalizeInboundContext } from "../../auto-reply/reply/inbound-context.js";
|
||||
import type { ReplyPayload } from "../../auto-reply/types.js";
|
||||
import type { OpenClawConfig, loadConfig } from "../../config/config.js";
|
||||
import { dispatchReplyWithDispatcher } from "../../auto-reply/reply/provider-dispatcher.js";
|
||||
import { resolveCommandAuthorizedFromAuthorizers } from "../../channels/command-gating.js";
|
||||
import { buildPairingReply } from "../../pairing/pairing-messages.js";
|
||||
import {
|
||||
readChannelAllowFromStore,
|
||||
@@ -41,7 +41,6 @@ import {
|
||||
import { resolveAgentRoute } from "../../routing/resolve-route.js";
|
||||
import { loadWebMedia } from "../../web/media.js";
|
||||
import { chunkDiscordTextWithMode } from "../chunk.js";
|
||||
import { resolveCommandAuthorizedFromAuthorizers } from "../../channels/command-gating.js";
|
||||
import {
|
||||
allowListMatches,
|
||||
isDiscordGroupAllowedByPolicy,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { beforeEach, describe, expect, it } from "vitest";
|
||||
import type { GatewayPresenceUpdate } from "discord-api-types/v10";
|
||||
import { beforeEach, describe, expect, it } from "vitest";
|
||||
import { clearPresences, getPresence, presenceCacheSize, setPresence } from "./presence-cache.js";
|
||||
|
||||
describe("presence-cache", () => {
|
||||
|
||||
@@ -1,24 +1,24 @@
|
||||
import { inspect } from "node:util";
|
||||
import { Client } from "@buape/carbon";
|
||||
import { GatewayIntents, GatewayPlugin } from "@buape/carbon/gateway";
|
||||
import { Routes } from "discord-api-types/v10";
|
||||
import { inspect } from "node:util";
|
||||
import type { HistoryEntry } from "../../auto-reply/reply/history.js";
|
||||
import type { OpenClawConfig, ReplyToMode } from "../../config/config.js";
|
||||
import type { RuntimeEnv } from "../../runtime.js";
|
||||
import { resolveTextChunkLimit } from "../../auto-reply/chunk.js";
|
||||
import { listNativeCommandSpecsForConfig } from "../../auto-reply/commands-registry.js";
|
||||
import { listSkillCommandsForAgents } from "../../auto-reply/skill-commands.js";
|
||||
import type { HistoryEntry } from "../../auto-reply/reply/history.js";
|
||||
import { mergeAllowlist, summarizeMapping } from "../../channels/allowlists/resolve-utils.js";
|
||||
import {
|
||||
isNativeCommandsExplicitlyDisabled,
|
||||
resolveNativeCommandsEnabled,
|
||||
resolveNativeSkillsEnabled,
|
||||
} from "../../config/commands.js";
|
||||
import type { OpenClawConfig, ReplyToMode } from "../../config/config.js";
|
||||
import { loadConfig } from "../../config/config.js";
|
||||
import { danger, logVerbose, shouldLogVerbose, warn } from "../../globals.js";
|
||||
import { formatErrorMessage } from "../../infra/errors.js";
|
||||
import { createDiscordRetryRunner } from "../../infra/retry-policy.js";
|
||||
import { createSubsystemLogger } from "../../logging/subsystem.js";
|
||||
import type { RuntimeEnv } from "../../runtime.js";
|
||||
import { resolveDiscordAccount } from "../accounts.js";
|
||||
import { attachDiscordGatewayLogging } from "../gateway-logging.js";
|
||||
import { getDiscordGatewayEmitter, waitForDiscordGatewayStop } from "../monitor.gateway.js";
|
||||
@@ -26,6 +26,7 @@ import { fetchDiscordApplicationId } from "../probe.js";
|
||||
import { resolveDiscordChannelAllowlist } from "../resolve-channels.js";
|
||||
import { resolveDiscordUserAllowlist } from "../resolve-users.js";
|
||||
import { normalizeDiscordToken } from "../token.js";
|
||||
import { createExecApprovalButton, DiscordExecApprovalHandler } from "./exec-approvals.js";
|
||||
import {
|
||||
DiscordMessageListener,
|
||||
DiscordPresenceListener,
|
||||
@@ -38,7 +39,6 @@ import {
|
||||
createDiscordCommandArgFallbackButton,
|
||||
createDiscordNativeCommand,
|
||||
} from "./native-command.js";
|
||||
import { createExecApprovalButton, DiscordExecApprovalHandler } from "./exec-approvals.js";
|
||||
|
||||
export type MonitorDiscordOpts = {
|
||||
token?: string;
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import type { Guild, Message, User } from "@buape/carbon";
|
||||
|
||||
import { formatAgentEnvelope, type EnvelopeFormatOptions } from "../../auto-reply/envelope.js";
|
||||
import { formatDiscordUserTag, resolveTimestampMs } from "./format.js";
|
||||
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
import type { RequestClient } from "@buape/carbon";
|
||||
|
||||
import type { ChunkMode } from "../../auto-reply/chunk.js";
|
||||
import type { ReplyPayload } from "../../auto-reply/types.js";
|
||||
import type { MarkdownTableMode } from "../../config/types.base.js";
|
||||
import { convertMarkdownTables } from "../../markdown/tables.js";
|
||||
import type { RuntimeEnv } from "../../runtime.js";
|
||||
import { convertMarkdownTables } from "../../markdown/tables.js";
|
||||
import { chunkDiscordTextWithMode } from "../chunk.js";
|
||||
import { sendMessageDiscord } from "../send.js";
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import { type Message, MessageType } from "@buape/carbon";
|
||||
|
||||
import { formatDiscordUserTag } from "./format.js";
|
||||
|
||||
export function resolveDiscordSystemEvent(message: Message, location: string): string | null {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import type { Client } from "@buape/carbon";
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { buildAgentSessionKey } from "../../routing/resolve-route.js";
|
||||
import type { Client } from "@buape/carbon";
|
||||
import {
|
||||
resolveDiscordAutoThreadContext,
|
||||
resolveDiscordAutoThreadReplyPlan,
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
import { ChannelType, type Client } from "@buape/carbon";
|
||||
import { Routes } from "discord-api-types/v10";
|
||||
import { createReplyReferencePlanner } from "../../auto-reply/reply/reply-reference.js";
|
||||
import type { ReplyToMode } from "../../config/config.js";
|
||||
import type { DiscordChannelConfigResolved } from "./allow-list.js";
|
||||
import type { DiscordMessageEvent } from "./listeners.js";
|
||||
import { createReplyReferencePlanner } from "../../auto-reply/reply/reply-reference.js";
|
||||
import { logVerbose } from "../../globals.js";
|
||||
import { buildAgentSessionKey } from "../../routing/resolve-route.js";
|
||||
import { truncateUtf16Safe } from "../../utils.js";
|
||||
import type { DiscordChannelConfigResolved } from "./allow-list.js";
|
||||
import type { DiscordMessageEvent } from "./listeners.js";
|
||||
import { resolveDiscordChannelInfo } from "./message-utils.js";
|
||||
|
||||
export type DiscordThreadChannel = {
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
|
||||
import { resolveDiscordPrivilegedIntentsFromFlags } from "./probe.js";
|
||||
|
||||
describe("resolveDiscordPrivilegedIntentsFromFlags", () => {
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
|
||||
import { resolveDiscordChannelAllowlist } from "./resolve-channels.js";
|
||||
|
||||
function jsonResponse(body: unknown) {
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import type { APIChannel } from "discord-api-types/v10";
|
||||
import { Routes } from "discord-api-types/v10";
|
||||
import { resolveDiscordRest } from "./send.shared.js";
|
||||
import type {
|
||||
DiscordChannelCreate,
|
||||
DiscordChannelEdit,
|
||||
@@ -8,6 +7,7 @@ import type {
|
||||
DiscordChannelPermissionSet,
|
||||
DiscordReactOpts,
|
||||
} from "./send.types.js";
|
||||
import { resolveDiscordRest } from "./send.shared.js";
|
||||
|
||||
export async function createChannelDiscord(
|
||||
payload: DiscordChannelCreate,
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import { RateLimitError } from "@buape/carbon";
|
||||
import { Routes } from "discord-api-types/v10";
|
||||
import { beforeEach, describe, expect, it, vi } from "vitest";
|
||||
|
||||
import {
|
||||
addRoleDiscord,
|
||||
banMemberDiscord,
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
import { Routes } from "discord-api-types/v10";
|
||||
|
||||
import type { DiscordEmojiUpload, DiscordReactOpts, DiscordStickerUpload } from "./send.types.js";
|
||||
import { loadWebMediaRaw } from "../web/media.js";
|
||||
import { normalizeEmojiName, resolveDiscordRest } from "./send.shared.js";
|
||||
import type { DiscordEmojiUpload, DiscordReactOpts, DiscordStickerUpload } from "./send.types.js";
|
||||
import { DISCORD_MAX_EMOJI_BYTES, DISCORD_MAX_STICKER_BYTES } from "./send.types.js";
|
||||
|
||||
export async function listGuildEmojisDiscord(guildId: string, opts: DiscordReactOpts = {}) {
|
||||
|
||||
@@ -7,13 +7,13 @@ import type {
|
||||
RESTPostAPIGuildScheduledEventJSONBody,
|
||||
} from "discord-api-types/v10";
|
||||
import { Routes } from "discord-api-types/v10";
|
||||
import { resolveDiscordRest } from "./send.shared.js";
|
||||
import type {
|
||||
DiscordModerationTarget,
|
||||
DiscordReactOpts,
|
||||
DiscordRoleChange,
|
||||
DiscordTimeoutTarget,
|
||||
} from "./send.types.js";
|
||||
import { resolveDiscordRest } from "./send.shared.js";
|
||||
|
||||
export async function fetchMemberInfoDiscord(
|
||||
guildId: string,
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import type { APIMessage } from "discord-api-types/v10";
|
||||
import { Routes } from "discord-api-types/v10";
|
||||
import { resolveDiscordRest } from "./send.shared.js";
|
||||
import type {
|
||||
DiscordMessageEdit,
|
||||
DiscordMessageQuery,
|
||||
@@ -9,6 +8,7 @@ import type {
|
||||
DiscordThreadCreate,
|
||||
DiscordThreadList,
|
||||
} from "./send.types.js";
|
||||
import { resolveDiscordRest } from "./send.shared.js";
|
||||
|
||||
export async function readMessagesDiscord(
|
||||
channelId: string,
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
import type { RequestClient } from "@buape/carbon";
|
||||
import { Routes } from "discord-api-types/v10";
|
||||
import type { RetryConfig } from "../infra/retry.js";
|
||||
import type { PollInput } from "../polls.js";
|
||||
import type { DiscordSendResult } from "./send.types.js";
|
||||
import { resolveChunkMode } from "../auto-reply/chunk.js";
|
||||
import { loadConfig } from "../config/config.js";
|
||||
import { resolveMarkdownTableMode } from "../config/markdown-tables.js";
|
||||
import { recordChannelActivity } from "../infra/channel-activity.js";
|
||||
import { convertMarkdownTables } from "../markdown/tables.js";
|
||||
import type { RetryConfig } from "../infra/retry.js";
|
||||
import type { PollInput } from "../polls.js";
|
||||
import { resolveDiscordAccount } from "./accounts.js";
|
||||
import {
|
||||
buildDiscordSendError,
|
||||
@@ -18,7 +19,6 @@ import {
|
||||
sendDiscordMedia,
|
||||
sendDiscordText,
|
||||
} from "./send.shared.js";
|
||||
import type { DiscordSendResult } from "./send.types.js";
|
||||
|
||||
type DiscordSendOpts = {
|
||||
token?: string;
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
import { RequestClient } from "@buape/carbon";
|
||||
import type { APIChannel, APIGuild, APIGuildMember, APIRole } from "discord-api-types/v10";
|
||||
import { RequestClient } from "@buape/carbon";
|
||||
import { ChannelType, PermissionFlagsBits, Routes } from "discord-api-types/v10";
|
||||
|
||||
import { loadConfig } from "../config/config.js";
|
||||
import type { RetryConfig } from "../infra/retry.js";
|
||||
import { resolveDiscordAccount } from "./accounts.js";
|
||||
import type { DiscordPermissionsSummary, DiscordReactOpts } from "./send.types.js";
|
||||
import { loadConfig } from "../config/config.js";
|
||||
import { resolveDiscordAccount } from "./accounts.js";
|
||||
import { normalizeDiscordToken } from "./token.js";
|
||||
|
||||
const PERMISSION_ENTRIES = Object.entries(PermissionFlagsBits).filter(
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { Routes } from "discord-api-types/v10";
|
||||
|
||||
import type { DiscordReactionSummary, DiscordReactOpts } from "./send.types.js";
|
||||
import { loadConfig } from "../config/config.js";
|
||||
import {
|
||||
buildReactionIdentifier,
|
||||
@@ -8,7 +8,6 @@ import {
|
||||
normalizeReactionEmoji,
|
||||
resolveDiscordRest,
|
||||
} from "./send.shared.js";
|
||||
import type { DiscordReactionSummary, DiscordReactOpts } from "./send.types.js";
|
||||
|
||||
export async function reactMessageDiscord(
|
||||
channelId: string,
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import { PermissionFlagsBits, Routes } from "discord-api-types/v10";
|
||||
import { beforeEach, describe, expect, it, vi } from "vitest";
|
||||
|
||||
import {
|
||||
deleteMessageDiscord,
|
||||
editMessageDiscord,
|
||||
|
||||
@@ -1,15 +1,14 @@
|
||||
import type { RESTAPIPoll } from "discord-api-types/rest/v10";
|
||||
import { RequestClient } from "@buape/carbon";
|
||||
import { PollLayoutType } from "discord-api-types/payloads/v10";
|
||||
import type { RESTAPIPoll } from "discord-api-types/rest/v10";
|
||||
import { Routes } from "discord-api-types/v10";
|
||||
|
||||
import { loadConfig } from "../config/config.js";
|
||||
import type { ChunkMode } from "../auto-reply/chunk.js";
|
||||
import type { RetryConfig } from "../infra/retry.js";
|
||||
import { loadConfig } from "../config/config.js";
|
||||
import { createDiscordRetryRunner, type RetryRunner } from "../infra/retry-policy.js";
|
||||
import { normalizePollDurationHours, normalizePollInput, type PollInput } from "../polls.js";
|
||||
import { loadWebMedia } from "../web/media.js";
|
||||
import { resolveDiscordAccount } from "./accounts.js";
|
||||
import type { ChunkMode } from "../auto-reply/chunk.js";
|
||||
import { chunkDiscordTextWithMode } from "./chunk.js";
|
||||
import { fetchChannelPermissionsDiscord, isThreadChannelType } from "./send.permissions.js";
|
||||
import { DiscordSendError } from "./send.types.js";
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import type { RequestClient } from "@buape/carbon";
|
||||
|
||||
import type { RetryConfig } from "../infra/retry.js";
|
||||
|
||||
export class DiscordSendError extends Error {
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import { beforeEach, describe, expect, it, vi } from "vitest";
|
||||
|
||||
import type { OpenClawConfig } from "../config/config.js";
|
||||
import { normalizeDiscordMessagingTarget } from "../channels/plugins/normalize/discord.js";
|
||||
import { listDiscordDirectoryPeersLive } from "./directory-live.js";
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import type { DirectoryConfigParams } from "../channels/plugins/directory-config.js";
|
||||
import {
|
||||
buildMessagingTarget,
|
||||
ensureTargetId,
|
||||
@@ -6,9 +7,6 @@ import {
|
||||
type MessagingTargetKind,
|
||||
type MessagingTargetParseOptions,
|
||||
} from "../channels/targets.js";
|
||||
|
||||
import type { DirectoryConfigParams } from "../channels/plugins/directory-config.js";
|
||||
|
||||
import { listDiscordDirectoryPeersLive } from "./directory-live.js";
|
||||
|
||||
export type DiscordTargetKind = MessagingTargetKind;
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import { afterEach, describe, expect, it, vi } from "vitest";
|
||||
|
||||
import type { OpenClawConfig } from "../config/config.js";
|
||||
import { resolveDiscordToken } from "./token.js";
|
||||
|
||||
|
||||
Reference in New Issue
Block a user