mirror of
https://github.com/davidkaya/aryx.git
synced 2026-08-08 12:48:48 +02:00
feat: category-based approval for runtime tools
Replace 20+ individual runtime tool toggles with 5 permission categories (read, write, shell, web_fetch, store_memory) matching how Copilot CLI, Cline, and other coding agents handle approvals. - Add resolveApprovalToolKey() to map permission kinds to category IDs - Simplify fallbackRuntimeApprovalTools to 5 categories - Thread alwaysApprove through PendingApprovalHandle → sidecar resolve - Update ApprovalBanner to use category labels for Always Approve button - Update ResolveApprovalCommand contract with alwaysApprove field - Update tests for category-based model Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
@@ -193,6 +193,28 @@ export function approvalPolicyRequiresCheckpoint(
|
||||
return rule.agentIds.includes(normalizedAgentId);
|
||||
}
|
||||
|
||||
const runtimePermissionKinds: ReadonlySet<string> = new Set(['read', 'write', 'shell', 'memory', 'url']);
|
||||
|
||||
/**
|
||||
* Resolves the canonical approval key for a pending approval.
|
||||
*
|
||||
* Runtime tools always use their permission-kind category (`read`, `write`, `shell`)
|
||||
* mapped to the corresponding approval-tool id. MCP/custom/hook tools use their
|
||||
* specific tool name.
|
||||
*/
|
||||
export function resolveApprovalToolKey(
|
||||
toolName: string | undefined,
|
||||
permissionKind: string | undefined,
|
||||
): string | undefined {
|
||||
if (permissionKind && runtimePermissionKinds.has(permissionKind)) {
|
||||
if (permissionKind === 'memory') return 'store_memory';
|
||||
if (permissionKind === 'url') return 'web_fetch';
|
||||
return permissionKind;
|
||||
}
|
||||
|
||||
return toolName;
|
||||
}
|
||||
|
||||
export function approvalPolicyAutoApprovesTool(
|
||||
policy: ApprovalPolicy | undefined,
|
||||
toolName?: string,
|
||||
|
||||
Reference in New Issue
Block a user