feat: add tool-specific approval overrides

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
David Kaya
2026-03-24 20:02:29 +01:00
co-authored by Copilot
parent f896fa6442
commit d5c538eed9
22 changed files with 897 additions and 221 deletions
+20
View File
@@ -125,4 +125,24 @@ describe('pattern validation', () => {
'Approval checkpoint "tool-call" references unknown agent "agent-missing".',
);
});
test('approval policy rejects unknown auto-approved tool references when tool names are provided', () => {
const singlePattern = createBuiltinPatterns(BUILTIN_TIMESTAMP).find(
(pattern) => pattern.mode === 'single',
);
expect(singlePattern).toBeDefined();
const issues = validatePatternDefinition({
...singlePattern!,
approvalPolicy: {
rules: [{ kind: 'tool-call' }],
autoApprovedToolNames: ['git.status', 'unknown.tool'],
},
}, ['git.status']);
expect(issues.find((issue) => issue.field === 'approvalPolicy')?.message).toBe(
'Approval auto-approve references unknown tool "unknown.tool".',
);
});
});