Files
openmaic/OpenMAIC/lib/agent/runtime/allowlist.ts
2026-08-16 14:58:47 +08:00

11 lines
543 B
TypeScript

import type { BeforeToolCallContext, BeforeToolCallResult } from '@earendil-works/pi-agent-core';
/** v0 capability restriction = tool allowlist (NOT a hardcoded workflow).
* Widening capability = adding a name here. */
export function makeAllowlistGate(allowed: ReadonlySet<string>) {
return async (ctx: BeforeToolCallContext): Promise<BeforeToolCallResult | undefined> => {
if (allowed.has(ctx.toolCall.name)) return undefined;
return { block: true, reason: `Tool "${ctx.toolCall.name}" is not enabled in this build.` };
};
}