refactor(security): unify gateway scope authorization flows

This commit is contained in:
Peter Steinberger
2026-02-19 15:06:28 +01:00
parent f4b288b8f7
commit 2777d8ad93
14 changed files with 202 additions and 86 deletions

View File

@@ -1,4 +1,4 @@
import type { AnyAgentTool } from "./tools/common.js";
import { OWNER_ONLY_TOOL_ERROR, type AnyAgentTool } from "./tools/common.js";
export type ToolProfileId = "minimal" | "coding" | "messaging" | "full";
@@ -101,7 +101,7 @@ export function applyOwnerOnlyToolPolicy(tools: AnyAgentTool[], senderIsOwner: b
return {
...tool,
execute: async () => {
throw new Error("Tool restricted to owner senders.");
throw new Error(OWNER_ONLY_TOOL_ERROR);
},
};
});