Plugin SDK: consolidate shared channel exports

This commit is contained in:
Gustavo Madeira Santana 2026-03-16 10:05:40 +00:00
parent 92700940d9
commit 296083a49a
No known key found for this signature in database
10 changed files with 137 additions and 43 deletions

View File

@ -1,4 +1,8 @@
// Canonical shared prelude for channel-oriented plugin SDK surfaces.
// Keep `core` and channel-specific SDK entrypoints derived from this module
// so bundled channel entrypoints do not drift across overlapping exports.
export type { ChannelPlugin } from "../channels/plugins/types.plugin.js";
export type { ChannelMessageActionContext } from "../channels/plugins/types.js";
export type { PluginRuntime } from "../plugins/runtime/types.js";
export type { OpenClawPluginApi } from "../plugins/types.js";

View File

@ -1,6 +1,5 @@
export type {
AnyAgentTool,
OpenClawPluginApi,
OpenClawPluginConfigSchema,
ProviderDiscoveryContext,
ProviderCatalogContext,
@ -52,9 +51,6 @@ export type {
SshSandboxSession,
SshSandboxSettings,
} from "../agents/sandbox.js";
export type { ChannelPlugin } from "../channels/plugins/types.plugin.js";
export type { ChannelMessageActionContext } from "../channels/plugins/types.js";
export type { PluginRuntime } from "../plugins/runtime/types.js";
export type { OpenClawConfig } from "../config/config.js";
export type { GatewayRequestHandlerOptions } from "../gateway/server-methods/types.js";
export type {
@ -62,8 +58,14 @@ export type {
UsageProviderId,
UsageWindow,
} from "../infra/provider-usage.types.js";
export type {
ChannelMessageActionContext,
ChannelPlugin,
OpenClawPluginApi,
PluginRuntime,
} from "./channel-plugin-common.js";
export { emptyPluginConfigSchema } from "../plugins/config-schema.js";
export { emptyPluginConfigSchema } from "./channel-plugin-common.js";
export {
buildExecRemoteCommand,
buildRemoteCommand,

View File

@ -1,7 +1,25 @@
export type { ChannelMessageActionAdapter } from "../channels/plugins/types.js";
export type { OpenClawConfig } from "../config/config.js";
export type { DiscordAccountConfig, DiscordActionConfig } from "../config/types.js";
export * from "./channel-plugin-common.js";
export type {
ChannelMessageActionContext,
ChannelPlugin,
OpenClawPluginApi,
PluginRuntime,
} from "./channel-plugin-common.js";
export {
DEFAULT_ACCOUNT_ID,
PAIRING_APPROVED_MESSAGE,
applyAccountNameToChannelSection,
buildChannelConfigSchema,
deleteAccountFromConfigSection,
emptyPluginConfigSchema,
formatPairingApproveHint,
getChatChannelMeta,
migrateBaseNameToDefaultAccount,
normalizeAccountId,
setAccountEnabledInConfigSection,
} from "./channel-plugin-common.js";
export {
projectCredentialSnapshotFields,

View File

@ -1,5 +1,23 @@
export type { IMessageAccountConfig } from "../config/types.js";
export * from "./channel-plugin-common.js";
export type {
ChannelMessageActionContext,
ChannelPlugin,
OpenClawPluginApi,
PluginRuntime,
} from "./channel-plugin-common.js";
export {
DEFAULT_ACCOUNT_ID,
PAIRING_APPROVED_MESSAGE,
applyAccountNameToChannelSection,
buildChannelConfigSchema,
deleteAccountFromConfigSection,
emptyPluginConfigSchema,
formatPairingApproveHint,
getChatChannelMeta,
migrateBaseNameToDefaultAccount,
normalizeAccountId,
setAccountEnabledInConfigSection,
} from "./channel-plugin-common.js";
export {
formatTrimmedAllowFromEntries,
resolveIMessageConfigAllowFrom,

View File

@ -6,15 +6,14 @@ export type {
export type { ChannelPlugin } from "../channels/plugins/types.plugin.js";
export type { OpenClawConfig } from "../config/config.js";
export type { ReplyPayload } from "../auto-reply/types.js";
export type { PluginRuntime } from "../plugins/runtime/types.js";
export type { OpenClawPluginApi } from "../plugins/types.js";
export type { ChannelSetupAdapter } from "../channels/plugins/types.adapters.js";
export type { OpenClawPluginApi, PluginRuntime } from "./channel-plugin-common.js";
export { emptyPluginConfigSchema } from "../plugins/config-schema.js";
export { DEFAULT_ACCOUNT_ID } from "../routing/session-key.js";
export { buildChannelConfigSchema } from "../channels/plugins/config-schema.js";
export {
DEFAULT_ACCOUNT_ID,
buildChannelConfigSchema,
emptyPluginConfigSchema,
} from "./channel-plugin-common.js";
export { clearAccountEntryFields } from "../channels/plugins/config-helpers.js";
export {

View File

@ -1,6 +1,24 @@
export type { ChannelMessageActionAdapter } from "../channels/plugins/types.js";
export type { SignalAccountConfig } from "../config/types.js";
export * from "./channel-plugin-common.js";
export type {
ChannelMessageActionContext,
ChannelPlugin,
OpenClawPluginApi,
PluginRuntime,
} from "./channel-plugin-common.js";
export {
DEFAULT_ACCOUNT_ID,
PAIRING_APPROVED_MESSAGE,
applyAccountNameToChannelSection,
buildChannelConfigSchema,
deleteAccountFromConfigSection,
emptyPluginConfigSchema,
formatPairingApproveHint,
getChatChannelMeta,
migrateBaseNameToDefaultAccount,
normalizeAccountId,
setAccountEnabledInConfigSection,
} from "./channel-plugin-common.js";
export {
looksLikeSignalTargetId,

View File

@ -1,6 +1,24 @@
export type { OpenClawConfig } from "../config/config.js";
export type { SlackAccountConfig } from "../config/types.slack.js";
export * from "./channel-plugin-common.js";
export type {
ChannelMessageActionContext,
ChannelPlugin,
OpenClawPluginApi,
PluginRuntime,
} from "./channel-plugin-common.js";
export {
DEFAULT_ACCOUNT_ID,
PAIRING_APPROVED_MESSAGE,
applyAccountNameToChannelSection,
buildChannelConfigSchema,
deleteAccountFromConfigSection,
emptyPluginConfigSchema,
formatPairingApproveHint,
getChatChannelMeta,
migrateBaseNameToDefaultAccount,
normalizeAccountId,
setAccountEnabledInConfigSection,
} from "./channel-plugin-common.js";
export {
projectCredentialSnapshotFields,

View File

@ -19,6 +19,11 @@ import { describe, expect, expectTypeOf, it } from "vitest";
import type { ChannelMessageActionContext } from "../channels/plugins/types.js";
import type { PluginRuntime } from "../plugins/runtime/types.js";
import type { OpenClawPluginApi } from "../plugins/types.js";
import type {
ChannelMessageActionContext as SharedChannelMessageActionContext,
OpenClawPluginApi as SharedOpenClawPluginApi,
PluginRuntime as SharedPluginRuntime,
} from "./channel-plugin-common.js";
import { pluginSdkSubpaths } from "./entrypoints.js";
const importPluginSdkSubpath = (specifier: string) => import(/* @vite-ignore */ specifier);
@ -49,6 +54,12 @@ describe("plugin-sdk subpath exports", () => {
expectTypeOf<CoreChannelMessageActionContext>().toMatchTypeOf<ChannelMessageActionContext>();
});
it("keeps core shared types aligned with the channel prelude", () => {
expectTypeOf<CoreOpenClawPluginApi>().toMatchTypeOf<SharedOpenClawPluginApi>();
expectTypeOf<CorePluginRuntime>().toMatchTypeOf<SharedPluginRuntime>();
expectTypeOf<CoreChannelMessageActionContext>().toMatchTypeOf<SharedChannelMessageActionContext>();
});
it("exports Discord helpers", () => {
expect(typeof discordSdk.buildChannelConfigSchema).toBe("function");
expect(typeof discordSdk.DiscordConfigSchema).toBe("object");

View File

@ -3,28 +3,29 @@ export type {
ChannelGatewayContext,
ChannelMessageActionAdapter,
} from "../channels/plugins/types.js";
export type { ChannelPlugin } from "../channels/plugins/types.plugin.js";
export type { OpenClawConfig } from "../config/config.js";
export type { PluginRuntime } from "../plugins/runtime/types.js";
export type { OpenClawPluginApi } from "../plugins/types.js";
export type { TelegramAccountConfig, TelegramActionConfig } from "../config/types.js";
export { emptyPluginConfigSchema } from "../plugins/config-schema.js";
export { DEFAULT_ACCOUNT_ID, normalizeAccountId } from "../routing/session-key.js";
export type {
ChannelMessageActionContext,
ChannelPlugin,
OpenClawPluginApi,
PluginRuntime,
} from "./channel-plugin-common.js";
export {
DEFAULT_ACCOUNT_ID,
PAIRING_APPROVED_MESSAGE,
applyAccountNameToChannelSection,
migrateBaseNameToDefaultAccount,
} from "../channels/plugins/setup-helpers.js";
export { buildChannelConfigSchema } from "../channels/plugins/config-schema.js";
export {
buildChannelConfigSchema,
deleteAccountFromConfigSection,
clearAccountEntryFields,
emptyPluginConfigSchema,
formatPairingApproveHint,
getChatChannelMeta,
migrateBaseNameToDefaultAccount,
normalizeAccountId,
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";
} from "./channel-plugin-common.js";
export { clearAccountEntryFields } from "../channels/plugins/config-helpers.js";
export {
projectCredentialSnapshotFields,

View File

@ -1,20 +1,25 @@
export type { ChannelMessageActionName } from "../channels/plugins/types.js";
export type { ChannelPlugin } from "../channels/plugins/types.plugin.js";
export type { OpenClawConfig } from "../config/config.js";
export type { DmPolicy, GroupPolicy, WhatsAppAccountConfig } from "../config/types.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 type {
ChannelMessageActionContext,
ChannelPlugin,
OpenClawPluginApi,
PluginRuntime,
} from "./channel-plugin-common.js";
export {
DEFAULT_ACCOUNT_ID,
PAIRING_APPROVED_MESSAGE,
applyAccountNameToChannelSection,
buildChannelConfigSchema,
deleteAccountFromConfigSection,
emptyPluginConfigSchema,
formatPairingApproveHint,
getChatChannelMeta,
migrateBaseNameToDefaultAccount,
} from "../channels/plugins/setup-helpers.js";
export { buildChannelConfigSchema } from "../channels/plugins/config-schema.js";
export { formatPairingApproveHint } from "../channels/plugins/helpers.js";
export { getChatChannelMeta } from "../channels/registry.js";
normalizeAccountId,
setAccountEnabledInConfigSection,
} from "./channel-plugin-common.js";
export {
formatWhatsAppConfigAllowFromEntries,
resolveWhatsAppConfigAllowFrom,