Skip to content

Commit 1c6676c

Browse files
committed
Plugins: remove first-party legacy message discovery shims
1 parent ed72695 commit 1c6676c

File tree

12 files changed

+32
-76
lines changed

12 files changed

+32
-76
lines changed

extensions/discord/src/channel-actions.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import {
2-
createLegacyMessageToolDiscoveryMethods,
32
createDiscordMessageToolComponentsSchema,
43
createUnionActionGate,
54
listTokenSourcedAccounts,
@@ -133,7 +132,6 @@ function describeDiscordMessageTool({
133132

134133
export const discordMessageActions: ChannelMessageActionAdapter = {
135134
describeMessageTool: describeDiscordMessageTool,
136-
...createLegacyMessageToolDiscoveryMethods(describeDiscordMessageTool),
137135
extractToolSend: ({ args }) => {
138136
const action = typeof args.action === "string" ? args.action.trim() : "";
139137
if (action === "sendMessage") {

extensions/discord/src/channel.ts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -79,12 +79,6 @@ function formatDiscordIntents(intents?: {
7979
const discordMessageActions: ChannelMessageActionAdapter = {
8080
describeMessageTool: (ctx) =>
8181
getDiscordRuntime().channel.discord.messageActions?.describeMessageTool?.(ctx) ?? null,
82-
listActions: (ctx) =>
83-
getDiscordRuntime().channel.discord.messageActions?.listActions?.(ctx) ?? [],
84-
getCapabilities: (ctx) =>
85-
getDiscordRuntime().channel.discord.messageActions?.getCapabilities?.(ctx) ?? [],
86-
getToolSchema: (ctx) =>
87-
getDiscordRuntime().channel.discord.messageActions?.getToolSchema?.(ctx) ?? null,
8882
extractToolSend: (ctx) =>
8983
getDiscordRuntime().channel.discord.messageActions?.extractToolSend?.(ctx) ?? null,
9084
handleAction: async (ctx) => {

extensions/feishu/src/channel.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
11
import { formatAllowFromLowercase } from "openclaw/plugin-sdk/allow-from";
22
import { mapAllowFromEntries } from "openclaw/plugin-sdk/channel-config-helpers";
33
import { collectAllowlistProviderRestrictSendersWarnings } from "openclaw/plugin-sdk/channel-policy";
4-
import {
5-
createLegacyMessageToolDiscoveryMethods,
6-
createMessageToolCardSchema,
7-
} from "openclaw/plugin-sdk/channel-runtime";
4+
import { createMessageToolCardSchema } from "openclaw/plugin-sdk/channel-runtime";
85
import type {
96
ChannelMessageActionAdapter,
107
ChannelMessageToolDiscovery,
@@ -453,7 +450,6 @@ export const feishuPlugin: ChannelPlugin<ResolvedFeishuAccount> = {
453450
},
454451
actions: {
455452
describeMessageTool: describeFeishuMessageTool,
456-
...createLegacyMessageToolDiscoveryMethods(describeFeishuMessageTool),
457453
handleAction: async (ctx) => {
458454
const account = resolveFeishuAccount({ cfg: ctx.cfg, accountId: ctx.accountId ?? undefined });
459455
if (

extensions/mattermost/src/channel.ts

Lines changed: 14 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -4,24 +4,8 @@ import {
44
buildAccountScopedDmSecurityPolicy,
55
collectAllowlistProviderRestrictSendersWarnings,
66
} from "openclaw/plugin-sdk/channel-policy";
7-
import {
8-
createLegacyMessageToolDiscoveryMethods,
9-
createMessageToolButtonsSchema,
10-
} from "openclaw/plugin-sdk/channel-runtime";
7+
import { createMessageToolButtonsSchema } from "openclaw/plugin-sdk/channel-runtime";
118
import type { ChannelMessageToolDiscovery } from "openclaw/plugin-sdk/channel-runtime";
12-
import {
13-
buildComputedAccountStatusSnapshot,
14-
buildChannelConfigSchema,
15-
createAccountStatusSink,
16-
DEFAULT_ACCOUNT_ID,
17-
deleteAccountFromConfigSection,
18-
resolveAllowlistProviderRuntimeGroupPolicy,
19-
resolveDefaultGroupPolicy,
20-
setAccountEnabledInConfigSection,
21-
type ChannelMessageActionAdapter,
22-
type ChannelMessageActionName,
23-
type ChannelPlugin,
24-
} from "./runtime-api.js";
259
import { buildPassiveProbedChannelStatusSummary } from "../../shared/channel-status-summary.js";
2610
import { MattermostConfigSchema } from "./config-schema.js";
2711
import { resolveMattermostGroupRequireMention } from "./group-mentions.js";
@@ -42,6 +26,19 @@ import { addMattermostReaction, removeMattermostReaction } from "./mattermost/re
4226
import { sendMessageMattermost } from "./mattermost/send.js";
4327
import { resolveMattermostOpaqueTarget } from "./mattermost/target-resolution.js";
4428
import { looksLikeMattermostTargetId, normalizeMattermostMessagingTarget } from "./normalize.js";
29+
import {
30+
buildComputedAccountStatusSnapshot,
31+
buildChannelConfigSchema,
32+
createAccountStatusSink,
33+
DEFAULT_ACCOUNT_ID,
34+
deleteAccountFromConfigSection,
35+
resolveAllowlistProviderRuntimeGroupPolicy,
36+
resolveDefaultGroupPolicy,
37+
setAccountEnabledInConfigSection,
38+
type ChannelMessageActionAdapter,
39+
type ChannelMessageActionName,
40+
type ChannelPlugin,
41+
} from "./runtime-api.js";
4542
import { getMattermostRuntime } from "./runtime.js";
4643
import { mattermostSetupAdapter } from "./setup-core.js";
4744
import { mattermostSetupWizard } from "./setup-surface.js";
@@ -88,7 +85,6 @@ function describeMattermostMessageTool({
8885

8986
const mattermostMessageActions: ChannelMessageActionAdapter = {
9087
describeMessageTool: describeMattermostMessageTool,
91-
...createLegacyMessageToolDiscoveryMethods(describeMattermostMessageTool),
9288
supportsAction: ({ action }) => {
9389
return action === "send" || action === "react";
9490
},

extensions/msteams/src/channel.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
import { formatAllowFromLowercase } from "openclaw/plugin-sdk/allow-from";
22
import { collectAllowlistProviderRestrictSendersWarnings } from "openclaw/plugin-sdk/channel-policy";
3-
import {
4-
createLegacyMessageToolDiscoveryMethods,
5-
createMessageToolCardSchema,
6-
} from "openclaw/plugin-sdk/channel-runtime";
3+
import { createMessageToolCardSchema } from "openclaw/plugin-sdk/channel-runtime";
74
import type {
85
ChannelMessageActionAdapter,
96
ChannelMessageToolDiscovery,
@@ -398,7 +395,6 @@ export const msteamsPlugin: ChannelPlugin<ResolvedMSTeamsAccount> = {
398395
},
399396
actions: {
400397
describeMessageTool: describeMSTeamsMessageTool,
401-
...createLegacyMessageToolDiscoveryMethods(describeMSTeamsMessageTool),
402398
handleAction: async (ctx) => {
403399
// Handle send action with card parameter
404400
if (ctx.action === "send" && ctx.params.card) {

extensions/telegram/src/channel-actions.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import {
77
import { readBooleanParam } from "openclaw/plugin-sdk/boolean-param";
88
import { resolveReactionMessageId } from "openclaw/plugin-sdk/channel-runtime";
99
import {
10-
createLegacyMessageToolDiscoveryMethods,
1110
createMessageToolButtonsSchema,
1211
createTelegramPollExtraToolSchemas,
1312
createUnionActionGate,
@@ -178,7 +177,6 @@ function readTelegramMessageIdParam(params: Record<string, unknown>): number {
178177

179178
export const telegramMessageActions: ChannelMessageActionAdapter = {
180179
describeMessageTool: describeTelegramMessageTool,
181-
...createLegacyMessageToolDiscoveryMethods(describeTelegramMessageTool),
182180
extractToolSend: ({ args }) => {
183181
return extractToolSend(args, "sendMessage");
184182
},

extensions/telegram/src/channel.ts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -250,12 +250,6 @@ function hasTelegramExecApprovalDmRoute(cfg: OpenClawConfig): boolean {
250250
const telegramMessageActions: ChannelMessageActionAdapter = {
251251
describeMessageTool: (ctx) =>
252252
getTelegramRuntime().channel.telegram.messageActions?.describeMessageTool?.(ctx) ?? null,
253-
listActions: (ctx) =>
254-
getTelegramRuntime().channel.telegram.messageActions?.listActions?.(ctx) ?? [],
255-
getCapabilities: (ctx) =>
256-
getTelegramRuntime().channel.telegram.messageActions?.getCapabilities?.(ctx) ?? [],
257-
getToolSchema: (ctx) =>
258-
getTelegramRuntime().channel.telegram.messageActions?.getToolSchema?.(ctx) ?? null,
259253
extractToolSend: (ctx) =>
260254
getTelegramRuntime().channel.telegram.messageActions?.extractToolSend?.(ctx) ?? null,
261255
handleAction: async (ctx) => {

src/channels/plugins/message-tool-legacy.ts

Lines changed: 0 additions & 13 deletions
This file was deleted.

src/channels/plugins/slack.actions.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ import {
1010
resolveSlackChannelId,
1111
handleSlackMessageAction,
1212
} from "../../plugin-sdk/slack.js";
13-
import { createLegacyMessageToolDiscoveryMethods } from "./message-tool-legacy.js";
1413
import { createSlackMessageToolBlocksSchema } from "./message-tool-schema.js";
1514
import type { ChannelMessageActionAdapter, ChannelMessageToolDiscovery } from "./types.js";
1615

@@ -52,7 +51,6 @@ export function createSlackActions(
5251

5352
return {
5453
describeMessageTool,
55-
...createLegacyMessageToolDiscoveryMethods(describeMessageTool),
5654
extractToolSend: ({ args }) => extractSlackToolSend(args),
5755
handleAction: async (ctx) => {
5856
return await handleSlackMessageAction({

src/commands/channels/capabilities.ts

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
import { resolveChannelDefaultAccountId } from "../../channels/plugins/helpers.js";
22
import { getChannelPlugin, listChannelPlugins } from "../../channels/plugins/index.js";
3+
import {
4+
createMessageActionDiscoveryContext,
5+
resolveMessageActionDiscoveryForPlugin,
6+
} from "../../channels/plugins/message-action-discovery.js";
37
import type {
48
ChannelCapabilities,
59
ChannelCapabilitiesDiagnostics,
@@ -133,10 +137,6 @@ async function resolveChannelReports(params: {
133137
: [resolveChannelDefaultAccountId({ plugin, cfg, accountIds: ids })];
134138
})();
135139
const reports: ChannelCapabilitiesReport[] = [];
136-
const listedActions = plugin.actions?.listActions?.({ cfg }) ?? [];
137-
const actions = Array.from(
138-
new Set<string>(["send", "broadcast", ...listedActions.map((action) => String(action))]),
139-
);
140140

141141
for (const accountId of accountIds) {
142142
const resolvedAccount = plugin.config.resolveAccount(cfg, accountId);
@@ -169,6 +169,18 @@ async function resolveChannelReports(params: {
169169
target: params.target,
170170
})
171171
: undefined;
172+
const discoveredActions = resolveMessageActionDiscoveryForPlugin({
173+
pluginId: plugin.id,
174+
actions: plugin.actions,
175+
context: createMessageActionDiscoveryContext({
176+
cfg,
177+
accountId,
178+
}),
179+
includeActions: true,
180+
}).actions;
181+
const actions = Array.from(
182+
new Set<string>(["send", "broadcast", ...discoveredActions.map((action) => String(action))]),
183+
);
172184

173185
reports.push({
174186
channel: plugin.id,

0 commit comments

Comments
 (0)