refactor(discord): narrow channel runtime imports

This commit is contained in:
Vincent Koc
2026-04-04 12:05:45 +09:00
parent 9bfaf7b681
commit 61f93540b2
4 changed files with 27 additions and 17 deletions

View File

@@ -0,0 +1,11 @@
export { DEFAULT_ACCOUNT_ID } from "openclaw/plugin-sdk/account-id";
export {
buildTokenChannelStatusSummary,
PAIRING_APPROVED_MESSAGE,
projectCredentialSnapshotFields,
resolveConfiguredFromCredentialStatuses,
} from "openclaw/plugin-sdk/channel-status";
export { createScopedChannelConfigAdapter } from "openclaw/plugin-sdk/channel-config-helpers";
export { getChatChannelMeta } from "openclaw/plugin-sdk/core";
export type { ChannelPlugin } from "openclaw/plugin-sdk/core";
export type { OpenClawConfig } from "openclaw/plugin-sdk/config-runtime";

View File

@@ -1,5 +1,5 @@
import { type ResolvedDiscordAccount } from "./accounts.js";
import { type ChannelPlugin } from "./runtime-api.js";
import { type ChannelPlugin } from "./channel-api.js";
import { discordSetupAdapter } from "./setup-core.js";
import { createDiscordPluginBase } from "./shared.js";

View File

@@ -35,6 +35,16 @@ import {
} from "./accounts.js";
import { getDiscordApprovalCapability } from "./approval-native.js";
import { discordMessageActions as discordMessageActionsImpl } from "./channel-actions.js";
import {
buildTokenChannelStatusSummary,
type ChannelPlugin,
DEFAULT_ACCOUNT_ID,
getChatChannelMeta,
PAIRING_APPROVED_MESSAGE,
projectCredentialSnapshotFields,
resolveConfiguredFromCredentialStatuses,
type OpenClawConfig,
} from "./channel-api.js";
import { shouldSuppressLocalDiscordExecApprovalPrompt } from "./exec-approvals.js";
import {
resolveDiscordGroupRequireMention,
@@ -52,16 +62,6 @@ import {
} from "./normalize.js";
import { resolveDiscordOutboundSessionRoute } from "./outbound-session-route.js";
import type { DiscordProbe } from "./probe.js";
import {
buildTokenChannelStatusSummary,
type ChannelPlugin,
DEFAULT_ACCOUNT_ID,
getChatChannelMeta,
PAIRING_APPROVED_MESSAGE,
projectCredentialSnapshotFields,
resolveConfiguredFromCredentialStatuses,
type OpenClawConfig,
} from "./runtime-api.js";
import { getDiscordRuntime } from "./runtime.js";
import { collectDiscordSecurityAuditFindings } from "./security-audit.js";
import { normalizeExplicitDiscordSessionKey } from "./session-key-normalization.js";
@@ -125,7 +125,9 @@ function loadDiscordCarbonModule() {
return discordCarbonModuleCache;
}
const meta = getChatChannelMeta("discord");
const meta = {
...getChatChannelMeta("discord"),
};
const REQUIRED_DISCORD_PERMISSIONS = ["ViewChannel", "SendMessages"] as const;
const DISCORD_ACCOUNT_STARTUP_STAGGER_MS = 10_000;

View File

@@ -1,6 +1,7 @@
import { describeAccountSnapshot } from "openclaw/plugin-sdk/account-helpers";
import { formatAllowFromLowercase } from "openclaw/plugin-sdk/allow-from";
import { adaptScopedAccountAccessor } from "openclaw/plugin-sdk/channel-config-helpers";
import { createScopedChannelConfigAdapter } from "openclaw/plugin-sdk/channel-config-helpers";
import { createChannelPluginBase } from "openclaw/plugin-sdk/core";
import { inspectDiscordAccount } from "./account-inspect.js";
import {
@@ -9,13 +10,9 @@ import {
resolveDiscordAccount,
type ResolvedDiscordAccount,
} from "./accounts.js";
import { getChatChannelMeta, type ChannelPlugin } from "./channel-api.js";
import { DiscordChannelConfigSchema } from "./config-schema.js";
import { discordDoctor } from "./doctor.js";
import {
createScopedChannelConfigAdapter,
getChatChannelMeta,
type ChannelPlugin,
} from "./runtime-api.js";
import { createDiscordSetupWizardProxy } from "./setup-core.js";
export const DISCORD_CHANNEL = "discord" as const;