← back to Ventura Claw
app/lib/mcp/approval-gate.ts
8 lines
import { isSensitive } from "@/lib/auth/rbac";
export interface ApprovalRequest { userId:number; connector:string; action:string; payload:unknown; }
export type ApprovalDecision = { ok:true; approvalId:number } | { ok:false; reason:string };
export async function gate(req: ApprovalRequest): Promise<ApprovalDecision> {
if (!isSensitive(req.action)) return { ok:true, approvalId: 0 };
return { ok:false, reason:"queued_for_admin_approval" };
}