diff --git a/extensions/slack/src/monitor/slash.ts b/extensions/slack/src/monitor/slash.ts index 7c8733256a9..188214f89f5 100644 --- a/extensions/slack/src/monitor/slash.ts +++ b/extensions/slack/src/monitor/slash.ts @@ -9,6 +9,7 @@ import { resolveNativeCommandsEnabled, resolveNativeSkillsEnabled, } from "openclaw/plugin-sdk/config-runtime"; +import { getPluginCommandSpecs } from "openclaw/plugin-sdk/command-auth"; import type { ReplyPayload } from "openclaw/plugin-sdk/reply-runtime"; import { danger, logVerbose } from "openclaw/plugin-sdk/runtime-env"; import { chunkItems, normalizeLowercaseStringOrEmpty } from "openclaw/plugin-sdk/text-runtime"; @@ -670,6 +671,15 @@ export async function registerSlackMonitorSlashCommands(params: { skillCommands, provider: "slack", }); + const existingNativeNames = new Set( + nativeCommands.map((c) => normalizeLowercaseStringOrEmpty(c.name)).filter(Boolean), + ); + for (const pluginCommand of getPluginCommandSpecs("slack")) { + const normalizedName = normalizeLowercaseStringOrEmpty(pluginCommand.name); + if (!normalizedName || existingNativeNames.has(normalizedName)) continue; + existingNativeNames.add(normalizedName); + nativeCommands.push(pluginCommand); + } } if (nativeCommands.length > 0) { diff --git a/src/plugin-sdk/command-auth.ts b/src/plugin-sdk/command-auth.ts index 6c50e38d5a1..25ff938aee0 100644 --- a/src/plugin-sdk/command-auth.ts +++ b/src/plugin-sdk/command-auth.ts @@ -76,6 +76,7 @@ export { listSkillCommandsForWorkspace, resolveSkillCommandInvocation, } from "../auto-reply/skill-commands.js"; +export { getPluginCommandSpecs } from "../plugins/command-registration.js"; export type { SkillCommandSpec } from "../agents/skills.js"; export { buildModelsProviderData, diff --git a/src/plugins/command-registry-state.ts b/src/plugins/command-registry-state.ts index 2b2637ba867..92bf3a7637d 100644 --- a/src/plugins/command-registry-state.ts +++ b/src/plugins/command-registry-state.ts @@ -73,11 +73,15 @@ export function getPluginCommandSpecs(provider?: string): Array<{ acceptsArgs: boolean; }> { const providerName = normalizeOptionalLowercaseString(provider); - if ( - providerName && - getChannelPlugin(providerName)?.commands?.nativeCommandsAutoEnabled !== true - ) { - return []; + if (providerName) { + const channelPlugin = getChannelPlugin(providerName); + if ( + channelPlugin && + !channelPlugin.capabilities?.nativeCommands && + !channelPlugin.commands?.nativeCommandsAutoEnabled + ) { + return []; + } } return Array.from(pluginCommands.values()).map((cmd) => ({ name: resolvePluginNativeName(cmd, provider), diff --git a/src/plugins/commands.test.ts b/src/plugins/commands.test.ts index f64fedbacef..f04d7e4cdc0 100644 --- a/src/plugins/commands.test.ts +++ b/src/plugins/commands.test.ts @@ -296,7 +296,7 @@ describe("registerPluginCommand", () => { { provider: undefined, expectedNames: ["talkvoice"] }, { provider: "discord", expectedNames: ["discordvoice"] }, { provider: "telegram", expectedNames: ["talkvoice"] }, - { provider: "slack", expectedNames: [] }, + { provider: "slack", expectedNames: ["talkvoice"] }, ]); });