fix(actions): layer per-account gate fallback

This commit is contained in:
Sebastian
2026-02-16 20:59:23 -05:00
parent 616c0bd4c7
commit 2b3ecee7c5
10 changed files with 203 additions and 25 deletions

View File

@@ -1,7 +1,7 @@
import type { AgentToolResult } from "@mariozechner/pi-agent-core";
import type { OpenClawConfig } from "../../config/config.js";
import { resolveTelegramAccount } from "../../telegram/accounts.js";
import type { TelegramButtonStyle, TelegramInlineButtons } from "../../telegram/button-types.js";
import { createTelegramActionGate } from "../../telegram/accounts.js";
import {
resolveTelegramInlineButtonsScope,
resolveTelegramTargetChatType,
@@ -18,7 +18,6 @@ import {
import { getCacheStats, searchStickers } from "../../telegram/sticker-cache.js";
import { resolveTelegramToken } from "../../telegram/token.js";
import {
createActionGate,
jsonResult,
readNumberParam,
readReactionParams,
@@ -89,8 +88,7 @@ export async function handleTelegramAction(
): Promise<AgentToolResult<unknown>> {
const action = readStringParam(params, "action", { required: true });
const accountId = readStringParam(params, "accountId");
const account = resolveTelegramAccount({ cfg, accountId });
const isActionEnabled = createActionGate(account.config.actions);
const isActionEnabled = createTelegramActionGate({ cfg, accountId });
if (action === "react") {
// Check reaction level first