Plugins: remove first-party legacy message discovery shims

This commit is contained in:
Gustavo Madeira Santana 2026-03-18 02:17:40 +00:00
parent ed7269518f
commit 1c6676cd57
No known key found for this signature in database
12 changed files with 32 additions and 76 deletions

View File

@ -1,5 +1,4 @@
import {
createLegacyMessageToolDiscoveryMethods,
createDiscordMessageToolComponentsSchema,
createUnionActionGate,
listTokenSourcedAccounts,
@ -133,7 +132,6 @@ function describeDiscordMessageTool({
export const discordMessageActions: ChannelMessageActionAdapter = {
describeMessageTool: describeDiscordMessageTool,
...createLegacyMessageToolDiscoveryMethods(describeDiscordMessageTool),
extractToolSend: ({ args }) => {
const action = typeof args.action === "string" ? args.action.trim() : "";
if (action === "sendMessage") {

View File

@ -79,12 +79,6 @@ function formatDiscordIntents(intents?: {
const discordMessageActions: ChannelMessageActionAdapter = {
describeMessageTool: (ctx) =>
getDiscordRuntime().channel.discord.messageActions?.describeMessageTool?.(ctx) ?? null,
listActions: (ctx) =>
getDiscordRuntime().channel.discord.messageActions?.listActions?.(ctx) ?? [],
getCapabilities: (ctx) =>
getDiscordRuntime().channel.discord.messageActions?.getCapabilities?.(ctx) ?? [],
getToolSchema: (ctx) =>
getDiscordRuntime().channel.discord.messageActions?.getToolSchema?.(ctx) ?? null,
extractToolSend: (ctx) =>
getDiscordRuntime().channel.discord.messageActions?.extractToolSend?.(ctx) ?? null,
handleAction: async (ctx) => {

View File

@ -1,10 +1,7 @@
import { formatAllowFromLowercase } from "openclaw/plugin-sdk/allow-from";
import { mapAllowFromEntries } from "openclaw/plugin-sdk/channel-config-helpers";
import { collectAllowlistProviderRestrictSendersWarnings } from "openclaw/plugin-sdk/channel-policy";
import {
createLegacyMessageToolDiscoveryMethods,
createMessageToolCardSchema,
} from "openclaw/plugin-sdk/channel-runtime";
import { createMessageToolCardSchema } from "openclaw/plugin-sdk/channel-runtime";
import type {
ChannelMessageActionAdapter,
ChannelMessageToolDiscovery,
@ -453,7 +450,6 @@ export const feishuPlugin: ChannelPlugin<ResolvedFeishuAccount> = {
},
actions: {
describeMessageTool: describeFeishuMessageTool,
...createLegacyMessageToolDiscoveryMethods(describeFeishuMessageTool),
handleAction: async (ctx) => {
const account = resolveFeishuAccount({ cfg: ctx.cfg, accountId: ctx.accountId ?? undefined });
if (

View File

@ -4,24 +4,8 @@ import {
buildAccountScopedDmSecurityPolicy,
collectAllowlistProviderRestrictSendersWarnings,
} from "openclaw/plugin-sdk/channel-policy";
import {
createLegacyMessageToolDiscoveryMethods,
createMessageToolButtonsSchema,
} from "openclaw/plugin-sdk/channel-runtime";
import { createMessageToolButtonsSchema } from "openclaw/plugin-sdk/channel-runtime";
import type { ChannelMessageToolDiscovery } from "openclaw/plugin-sdk/channel-runtime";
import {
buildComputedAccountStatusSnapshot,
buildChannelConfigSchema,
createAccountStatusSink,
DEFAULT_ACCOUNT_ID,
deleteAccountFromConfigSection,
resolveAllowlistProviderRuntimeGroupPolicy,
resolveDefaultGroupPolicy,
setAccountEnabledInConfigSection,
type ChannelMessageActionAdapter,
type ChannelMessageActionName,
type ChannelPlugin,
} from "./runtime-api.js";
import { buildPassiveProbedChannelStatusSummary } from "../../shared/channel-status-summary.js";
import { MattermostConfigSchema } from "./config-schema.js";
import { resolveMattermostGroupRequireMention } from "./group-mentions.js";
@ -42,6 +26,19 @@ import { addMattermostReaction, removeMattermostReaction } from "./mattermost/re
import { sendMessageMattermost } from "./mattermost/send.js";
import { resolveMattermostOpaqueTarget } from "./mattermost/target-resolution.js";
import { looksLikeMattermostTargetId, normalizeMattermostMessagingTarget } from "./normalize.js";
import {
buildComputedAccountStatusSnapshot,
buildChannelConfigSchema,
createAccountStatusSink,
DEFAULT_ACCOUNT_ID,
deleteAccountFromConfigSection,
resolveAllowlistProviderRuntimeGroupPolicy,
resolveDefaultGroupPolicy,
setAccountEnabledInConfigSection,
type ChannelMessageActionAdapter,
type ChannelMessageActionName,
type ChannelPlugin,
} from "./runtime-api.js";
import { getMattermostRuntime } from "./runtime.js";
import { mattermostSetupAdapter } from "./setup-core.js";
import { mattermostSetupWizard } from "./setup-surface.js";
@ -88,7 +85,6 @@ function describeMattermostMessageTool({
const mattermostMessageActions: ChannelMessageActionAdapter = {
describeMessageTool: describeMattermostMessageTool,
...createLegacyMessageToolDiscoveryMethods(describeMattermostMessageTool),
supportsAction: ({ action }) => {
return action === "send" || action === "react";
},

View File

@ -1,9 +1,6 @@
import { formatAllowFromLowercase } from "openclaw/plugin-sdk/allow-from";
import { collectAllowlistProviderRestrictSendersWarnings } from "openclaw/plugin-sdk/channel-policy";
import {
createLegacyMessageToolDiscoveryMethods,
createMessageToolCardSchema,
} from "openclaw/plugin-sdk/channel-runtime";
import { createMessageToolCardSchema } from "openclaw/plugin-sdk/channel-runtime";
import type {
ChannelMessageActionAdapter,
ChannelMessageToolDiscovery,
@ -398,7 +395,6 @@ export const msteamsPlugin: ChannelPlugin<ResolvedMSTeamsAccount> = {
},
actions: {
describeMessageTool: describeMSTeamsMessageTool,
...createLegacyMessageToolDiscoveryMethods(describeMSTeamsMessageTool),
handleAction: async (ctx) => {
// Handle send action with card parameter
if (ctx.action === "send" && ctx.params.card) {

View File

@ -7,7 +7,6 @@ import {
import { readBooleanParam } from "openclaw/plugin-sdk/boolean-param";
import { resolveReactionMessageId } from "openclaw/plugin-sdk/channel-runtime";
import {
createLegacyMessageToolDiscoveryMethods,
createMessageToolButtonsSchema,
createTelegramPollExtraToolSchemas,
createUnionActionGate,
@ -178,7 +177,6 @@ function readTelegramMessageIdParam(params: Record<string, unknown>): number {
export const telegramMessageActions: ChannelMessageActionAdapter = {
describeMessageTool: describeTelegramMessageTool,
...createLegacyMessageToolDiscoveryMethods(describeTelegramMessageTool),
extractToolSend: ({ args }) => {
return extractToolSend(args, "sendMessage");
},

View File

@ -250,12 +250,6 @@ function hasTelegramExecApprovalDmRoute(cfg: OpenClawConfig): boolean {
const telegramMessageActions: ChannelMessageActionAdapter = {
describeMessageTool: (ctx) =>
getTelegramRuntime().channel.telegram.messageActions?.describeMessageTool?.(ctx) ?? null,
listActions: (ctx) =>
getTelegramRuntime().channel.telegram.messageActions?.listActions?.(ctx) ?? [],
getCapabilities: (ctx) =>
getTelegramRuntime().channel.telegram.messageActions?.getCapabilities?.(ctx) ?? [],
getToolSchema: (ctx) =>
getTelegramRuntime().channel.telegram.messageActions?.getToolSchema?.(ctx) ?? null,
extractToolSend: (ctx) =>
getTelegramRuntime().channel.telegram.messageActions?.extractToolSend?.(ctx) ?? null,
handleAction: async (ctx) => {

View File

@ -1,13 +0,0 @@
import type { ChannelMessageActionAdapter } from "./types.js";
export function createLegacyMessageToolDiscoveryMethods(
describeMessageTool: NonNullable<ChannelMessageActionAdapter["describeMessageTool"]>,
): Pick<ChannelMessageActionAdapter, "listActions" | "getCapabilities" | "getToolSchema"> {
const describe = (ctx: Parameters<typeof describeMessageTool>[0]) =>
describeMessageTool(ctx) ?? null;
return {
listActions: (ctx) => [...(describe(ctx)?.actions ?? [])],
getCapabilities: (ctx) => [...(describe(ctx)?.capabilities ?? [])],
getToolSchema: (ctx) => describe(ctx)?.schema ?? null,
};
}

View File

@ -10,7 +10,6 @@ import {
resolveSlackChannelId,
handleSlackMessageAction,
} from "../../plugin-sdk/slack.js";
import { createLegacyMessageToolDiscoveryMethods } from "./message-tool-legacy.js";
import { createSlackMessageToolBlocksSchema } from "./message-tool-schema.js";
import type { ChannelMessageActionAdapter, ChannelMessageToolDiscovery } from "./types.js";
@ -52,7 +51,6 @@ export function createSlackActions(
return {
describeMessageTool,
...createLegacyMessageToolDiscoveryMethods(describeMessageTool),
extractToolSend: ({ args }) => extractSlackToolSend(args),
handleAction: async (ctx) => {
return await handleSlackMessageAction({

View File

@ -1,5 +1,9 @@
import { resolveChannelDefaultAccountId } from "../../channels/plugins/helpers.js";
import { getChannelPlugin, listChannelPlugins } from "../../channels/plugins/index.js";
import {
createMessageActionDiscoveryContext,
resolveMessageActionDiscoveryForPlugin,
} from "../../channels/plugins/message-action-discovery.js";
import type {
ChannelCapabilities,
ChannelCapabilitiesDiagnostics,
@ -133,10 +137,6 @@ async function resolveChannelReports(params: {
: [resolveChannelDefaultAccountId({ plugin, cfg, accountIds: ids })];
})();
const reports: ChannelCapabilitiesReport[] = [];
const listedActions = plugin.actions?.listActions?.({ cfg }) ?? [];
const actions = Array.from(
new Set<string>(["send", "broadcast", ...listedActions.map((action) => String(action))]),
);
for (const accountId of accountIds) {
const resolvedAccount = plugin.config.resolveAccount(cfg, accountId);
@ -169,6 +169,18 @@ async function resolveChannelReports(params: {
target: params.target,
})
: undefined;
const discoveredActions = resolveMessageActionDiscoveryForPlugin({
pluginId: plugin.id,
actions: plugin.actions,
context: createMessageActionDiscoveryContext({
cfg,
accountId,
}),
includeActions: true,
}).actions;
const actions = Array.from(
new Set<string>(["send", "broadcast", ...discoveredActions.map((action) => String(action))]),
);
reports.push({
channel: plugin.id,

View File

@ -23,15 +23,3 @@ export * from "../agents/vllm-defaults.js";
// Intentional public runtime surface: channel plugins use ingress agent helpers directly.
export * from "../agents/agent-command.js";
export * from "../tts/tts.js";
// Legacy channel action runtime re-exports. New bundled plugin code should use
// local extension-owned modules instead of adding more public SDK surface here.
export {
handleDiscordAction,
readDiscordParentIdParam,
isDiscordModerationAction,
readDiscordModerationCommand,
} from "../../extensions/discord/runtime-api.js";
export {
handleTelegramAction,
readTelegramButtons,
} from "../../extensions/telegram/runtime-api.js";

View File

@ -34,7 +34,6 @@ export type * from "../channels/plugins/types.js";
export * from "../channels/plugins/config-writes.js";
export * from "../channels/plugins/directory-config.js";
export * from "../channels/plugins/media-payload.js";
export * from "../channels/plugins/message-tool-legacy.js";
export * from "../channels/plugins/message-tool-schema.js";
export * from "../channels/plugins/normalize/signal.js";
export * from "../channels/plugins/normalize/whatsapp.js";