mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 15:20:44 +00:00
refactor: share channel action params
This commit is contained in:
@@ -17,6 +17,19 @@ type ChannelAgentToolMeta = {
|
||||
channelId: string;
|
||||
};
|
||||
|
||||
type ChannelMessageActionDiscoveryParams = {
|
||||
cfg?: OpenClawConfig;
|
||||
currentChannelId?: string | null;
|
||||
currentThreadTs?: string | null;
|
||||
currentMessageId?: string | number | null;
|
||||
accountId?: string | null;
|
||||
sessionKey?: string | null;
|
||||
sessionId?: string | null;
|
||||
agentId?: string | null;
|
||||
requesterSenderId?: string | null;
|
||||
senderIsOwner?: boolean;
|
||||
};
|
||||
|
||||
const channelAgentToolMeta = new WeakMap<ChannelAgentTool, ChannelAgentToolMeta>();
|
||||
|
||||
export function getChannelAgentToolMeta(tool: ChannelAgentTool): ChannelAgentToolMeta | undefined {
|
||||
@@ -34,19 +47,11 @@ export function copyChannelAgentToolMeta(source: ChannelAgentTool, target: Chann
|
||||
* Get the list of supported message actions for a specific channel.
|
||||
* Returns an empty array if channel is not found or has no actions configured.
|
||||
*/
|
||||
export function listChannelSupportedActions(params: {
|
||||
cfg?: OpenClawConfig;
|
||||
channel?: string;
|
||||
currentChannelId?: string | null;
|
||||
currentThreadTs?: string | null;
|
||||
currentMessageId?: string | number | null;
|
||||
accountId?: string | null;
|
||||
sessionKey?: string | null;
|
||||
sessionId?: string | null;
|
||||
agentId?: string | null;
|
||||
requesterSenderId?: string | null;
|
||||
senderIsOwner?: boolean;
|
||||
}): ChannelMessageActionName[] {
|
||||
export function listChannelSupportedActions(
|
||||
params: ChannelMessageActionDiscoveryParams & {
|
||||
channel?: string;
|
||||
},
|
||||
): ChannelMessageActionName[] {
|
||||
const channelId = resolveMessageActionDiscoveryChannelId(params.channel);
|
||||
if (!channelId) {
|
||||
return [];
|
||||
@@ -66,18 +71,9 @@ export function listChannelSupportedActions(params: {
|
||||
/**
|
||||
* Get the list of all supported message actions across all configured channels.
|
||||
*/
|
||||
export function listAllChannelSupportedActions(params: {
|
||||
cfg?: OpenClawConfig;
|
||||
currentChannelId?: string | null;
|
||||
currentThreadTs?: string | null;
|
||||
currentMessageId?: string | number | null;
|
||||
accountId?: string | null;
|
||||
sessionKey?: string | null;
|
||||
sessionId?: string | null;
|
||||
agentId?: string | null;
|
||||
requesterSenderId?: string | null;
|
||||
senderIsOwner?: boolean;
|
||||
}): ChannelMessageActionName[] {
|
||||
export function listAllChannelSupportedActions(
|
||||
params: ChannelMessageActionDiscoveryParams,
|
||||
): ChannelMessageActionName[] {
|
||||
const actions = new Set<ChannelMessageActionName>();
|
||||
for (const plugin of listChannelPlugins()) {
|
||||
const channelActions = resolveMessageActionDiscoveryForPlugin({
|
||||
|
||||
Reference in New Issue
Block a user