From 08aae60dc9196bb2b8f7d3d1a4a59be23766f098 Mon Sep 17 00:00:00 2001 From: Peter Steinberger Date: Sat, 7 Mar 2026 16:48:02 +0000 Subject: [PATCH] refactor(plugin-sdk): extract shared channel prelude exports --- src/plugin-sdk/channel-plugin-common.ts | 21 +++++++++++++++++++++ src/plugin-sdk/discord.ts | 22 +--------------------- src/plugin-sdk/imessage.ts | 22 +--------------------- src/plugin-sdk/signal.ts | 22 +--------------------- src/plugin-sdk/slack.ts | 22 +--------------------- 5 files changed, 25 insertions(+), 84 deletions(-) create mode 100644 src/plugin-sdk/channel-plugin-common.ts diff --git a/src/plugin-sdk/channel-plugin-common.ts b/src/plugin-sdk/channel-plugin-common.ts new file mode 100644 index 00000000000..59c347c8f0c --- /dev/null +++ b/src/plugin-sdk/channel-plugin-common.ts @@ -0,0 +1,21 @@ +export type { ChannelPlugin } from "../channels/plugins/types.plugin.js"; +export type { PluginRuntime } from "../plugins/runtime/types.js"; +export type { OpenClawPluginApi } from "../plugins/types.js"; + +export { emptyPluginConfigSchema } from "../plugins/config-schema.js"; + +export { DEFAULT_ACCOUNT_ID, normalizeAccountId } from "../routing/session-key.js"; + +export { + applyAccountNameToChannelSection, + migrateBaseNameToDefaultAccount, +} from "../channels/plugins/setup-helpers.js"; +export { buildChannelConfigSchema } from "../channels/plugins/config-schema.js"; +export { + deleteAccountFromConfigSection, + setAccountEnabledInConfigSection, +} from "../channels/plugins/config-helpers.js"; +export { formatPairingApproveHint } from "../channels/plugins/helpers.js"; +export { PAIRING_APPROVED_MESSAGE } from "../channels/plugins/pairing-message.js"; + +export { getChatChannelMeta } from "../channels/registry.js"; diff --git a/src/plugin-sdk/discord.ts b/src/plugin-sdk/discord.ts index f9c4b6051df..d0408c604bf 100644 --- a/src/plugin-sdk/discord.ts +++ b/src/plugin-sdk/discord.ts @@ -1,28 +1,8 @@ export type { ChannelMessageActionAdapter } from "../channels/plugins/types.js"; -export type { ChannelPlugin } from "../channels/plugins/types.plugin.js"; export type { OpenClawConfig } from "../config/config.js"; export type { InspectedDiscordAccount } from "../discord/account-inspect.js"; export type { ResolvedDiscordAccount } from "../discord/accounts.js"; -export type { PluginRuntime } from "../plugins/runtime/types.js"; -export type { OpenClawPluginApi } from "../plugins/types.js"; - -export { emptyPluginConfigSchema } from "../plugins/config-schema.js"; - -export { DEFAULT_ACCOUNT_ID, normalizeAccountId } from "../routing/session-key.js"; - -export { - applyAccountNameToChannelSection, - migrateBaseNameToDefaultAccount, -} from "../channels/plugins/setup-helpers.js"; -export { buildChannelConfigSchema } from "../channels/plugins/config-schema.js"; -export { - deleteAccountFromConfigSection, - setAccountEnabledInConfigSection, -} from "../channels/plugins/config-helpers.js"; -export { formatPairingApproveHint } from "../channels/plugins/helpers.js"; -export { PAIRING_APPROVED_MESSAGE } from "../channels/plugins/pairing-message.js"; - -export { getChatChannelMeta } from "../channels/registry.js"; +export * from "./channel-plugin-common.js"; export { listDiscordAccountIds, diff --git a/src/plugin-sdk/imessage.ts b/src/plugin-sdk/imessage.ts index 44dfbd4a149..dd181fee26c 100644 --- a/src/plugin-sdk/imessage.ts +++ b/src/plugin-sdk/imessage.ts @@ -1,25 +1,5 @@ -export type { ChannelPlugin } from "../channels/plugins/types.plugin.js"; export type { ResolvedIMessageAccount } from "../imessage/accounts.js"; -export type { PluginRuntime } from "../plugins/runtime/types.js"; -export type { OpenClawPluginApi } from "../plugins/types.js"; - -export { emptyPluginConfigSchema } from "../plugins/config-schema.js"; - -export { DEFAULT_ACCOUNT_ID, normalizeAccountId } from "../routing/session-key.js"; - -export { - applyAccountNameToChannelSection, - migrateBaseNameToDefaultAccount, -} from "../channels/plugins/setup-helpers.js"; -export { buildChannelConfigSchema } from "../channels/plugins/config-schema.js"; -export { - deleteAccountFromConfigSection, - setAccountEnabledInConfigSection, -} from "../channels/plugins/config-helpers.js"; -export { formatPairingApproveHint } from "../channels/plugins/helpers.js"; -export { PAIRING_APPROVED_MESSAGE } from "../channels/plugins/pairing-message.js"; - -export { getChatChannelMeta } from "../channels/registry.js"; +export * from "./channel-plugin-common.js"; export { listIMessageAccountIds, resolveDefaultIMessageAccountId, diff --git a/src/plugin-sdk/signal.ts b/src/plugin-sdk/signal.ts index d15d35ee1dc..32f291913a5 100644 --- a/src/plugin-sdk/signal.ts +++ b/src/plugin-sdk/signal.ts @@ -1,26 +1,6 @@ export type { ChannelMessageActionAdapter } from "../channels/plugins/types.js"; -export type { ChannelPlugin } from "../channels/plugins/types.plugin.js"; export type { ResolvedSignalAccount } from "../signal/accounts.js"; -export type { PluginRuntime } from "../plugins/runtime/types.js"; -export type { OpenClawPluginApi } from "../plugins/types.js"; - -export { emptyPluginConfigSchema } from "../plugins/config-schema.js"; - -export { DEFAULT_ACCOUNT_ID, normalizeAccountId } from "../routing/session-key.js"; - -export { - applyAccountNameToChannelSection, - migrateBaseNameToDefaultAccount, -} from "../channels/plugins/setup-helpers.js"; -export { buildChannelConfigSchema } from "../channels/plugins/config-schema.js"; -export { - deleteAccountFromConfigSection, - setAccountEnabledInConfigSection, -} from "../channels/plugins/config-helpers.js"; -export { formatPairingApproveHint } from "../channels/plugins/helpers.js"; -export { PAIRING_APPROVED_MESSAGE } from "../channels/plugins/pairing-message.js"; - -export { getChatChannelMeta } from "../channels/registry.js"; +export * from "./channel-plugin-common.js"; export { listSignalAccountIds, resolveDefaultSignalAccountId, diff --git a/src/plugin-sdk/slack.ts b/src/plugin-sdk/slack.ts index b0df1329bb9..debb4b75fea 100644 --- a/src/plugin-sdk/slack.ts +++ b/src/plugin-sdk/slack.ts @@ -1,27 +1,7 @@ -export type { ChannelPlugin } from "../channels/plugins/types.plugin.js"; export type { OpenClawConfig } from "../config/config.js"; export type { InspectedSlackAccount } from "../slack/account-inspect.js"; export type { ResolvedSlackAccount } from "../slack/accounts.js"; -export type { PluginRuntime } from "../plugins/runtime/types.js"; -export type { OpenClawPluginApi } from "../plugins/types.js"; - -export { emptyPluginConfigSchema } from "../plugins/config-schema.js"; - -export { DEFAULT_ACCOUNT_ID, normalizeAccountId } from "../routing/session-key.js"; - -export { - applyAccountNameToChannelSection, - migrateBaseNameToDefaultAccount, -} from "../channels/plugins/setup-helpers.js"; -export { buildChannelConfigSchema } from "../channels/plugins/config-schema.js"; -export { - deleteAccountFromConfigSection, - setAccountEnabledInConfigSection, -} from "../channels/plugins/config-helpers.js"; -export { formatPairingApproveHint } from "../channels/plugins/helpers.js"; -export { PAIRING_APPROVED_MESSAGE } from "../channels/plugins/pairing-message.js"; - -export { getChatChannelMeta } from "../channels/registry.js"; +export * from "./channel-plugin-common.js"; export { listSlackAccountIds, resolveDefaultSlackAccountId,