Files
wehub-resource-sync c48612c494
CI / E2E Tests (push) Has been cancelled
CI / Lint, Typecheck & Unit Tests (push) Has been cancelled
Docs Build / Build docs site (push) Has been cancelled
Publish @openmaic packages / Build, validate & publish (push) Has been cancelled
chore: import upstream snapshot with attribution
2026-07-13 13:03:23 +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.` };
};
}