mirror of https://github.com/openclaw/openclaw.git
fix: honor signal action discovery account config
This commit is contained in:
parent
9fbf501d5a
commit
fb4127082a
|
|
@ -14,6 +14,7 @@ function createSignalAccountOverrideCfg(): OpenClawConfig {
|
|||
return {
|
||||
channels: {
|
||||
signal: {
|
||||
account: "+15550002222",
|
||||
actions: { reactions: false },
|
||||
accounts: {
|
||||
work: { account: "+15550001111", actions: { reactions: true } },
|
||||
|
|
@ -48,6 +49,17 @@ describe("signalMessageActions", () => {
|
|||
).toEqual(["send", "react"]);
|
||||
});
|
||||
|
||||
it("honors account-scoped reaction gates during discovery", () => {
|
||||
const cfg = createSignalAccountOverrideCfg();
|
||||
|
||||
expect(signalMessageActions.describeMessageTool?.({ cfg, accountId: "default" })?.actions).toEqual(
|
||||
["send"],
|
||||
);
|
||||
expect(signalMessageActions.describeMessageTool?.({ cfg, accountId: "work" })?.actions).toEqual(
|
||||
["send", "react"],
|
||||
);
|
||||
});
|
||||
|
||||
it("skips send for plugin dispatch", () => {
|
||||
expect(signalMessageActions.supportsAction?.({ action: "send" })).toBe(false);
|
||||
expect(signalMessageActions.supportsAction?.({ action: "react" })).toBe(true);
|
||||
|
|
|
|||
|
|
@ -73,18 +73,17 @@ async function mutateSignalReaction(params: {
|
|||
}
|
||||
|
||||
export const signalMessageActions: ChannelMessageActionAdapter = {
|
||||
describeMessageTool: ({ cfg }) => {
|
||||
const accounts = listEnabledSignalAccounts(cfg);
|
||||
if (accounts.length === 0) {
|
||||
return null;
|
||||
}
|
||||
const configuredAccounts = accounts.filter((account) => account.configured);
|
||||
describeMessageTool: ({ cfg, accountId }) => {
|
||||
const configuredAccounts = accountId
|
||||
? [resolveSignalAccount({ cfg, accountId })].filter(
|
||||
(account) => account.enabled && account.configured,
|
||||
)
|
||||
: listEnabledSignalAccounts(cfg).filter((account) => account.configured);
|
||||
if (configuredAccounts.length === 0) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const actions = new Set<ChannelMessageActionName>(["send"]);
|
||||
|
||||
const reactionsEnabled = configuredAccounts.some((account) =>
|
||||
createActionGate(account.config.actions)("reactions"),
|
||||
);
|
||||
|
|
|
|||
Loading…
Reference in New Issue