fix(agents): scope message tool schema by channel (#18215)

Co-authored-by: Shadow <shadow@openclaw.ai>
This commit is contained in:
Ayaan Zaidi
2026-02-16 22:04:18 +05:30
committed by GitHub
parent 3a2fffefdb
commit c8a536e30a
4 changed files with 189 additions and 9 deletions

View File

@@ -26,6 +26,17 @@ export function supportsChannelMessageButtons(cfg: OpenClawConfig): boolean {
return false;
}
export function supportsChannelMessageButtonsForChannel(params: {
cfg: OpenClawConfig;
channel?: string;
}): boolean {
if (!params.channel) {
return false;
}
const plugin = getChannelPlugin(params.channel as Parameters<typeof getChannelPlugin>[0]);
return plugin?.actions?.supportsButtons?.({ cfg: params.cfg }) === true;
}
export function supportsChannelMessageCards(cfg: OpenClawConfig): boolean {
for (const plugin of listChannelPlugins()) {
if (plugin.actions?.supportsCards?.({ cfg })) {
@@ -35,6 +46,17 @@ export function supportsChannelMessageCards(cfg: OpenClawConfig): boolean {
return false;
}
export function supportsChannelMessageCardsForChannel(params: {
cfg: OpenClawConfig;
channel?: string;
}): boolean {
if (!params.channel) {
return false;
}
const plugin = getChannelPlugin(params.channel as Parameters<typeof getChannelPlugin>[0]);
return plugin?.actions?.supportsCards?.({ cfg: params.cfg }) === true;
}
export async function dispatchChannelMessageAction(
ctx: ChannelMessageActionContext,
): Promise<AgentToolResult<unknown> | null> {