fix(a2a-server): replace ApprovalMode.YOLO with wildcard policy check

This commit is contained in:
Spencer
2026-03-20 06:09:14 +00:00
parent 12c43c1922
commit 402553be41
4 changed files with 7 additions and 11 deletions
+2 -4
View File
@@ -10,7 +10,6 @@ import {
type GeminiClient,
GeminiEventType,
ToolConfirmationOutcome,
ApprovalMode,
getAllMCPServerStatuses,
MCPServerStatus,
isNodeError,
@@ -89,7 +88,8 @@ export class Task {
autoExecute: boolean;
private get isYoloMatch(): boolean {
return (
this.autoExecute || this.config.getApprovalMode() === ApprovalMode.YOLO
this.autoExecute ||
(this.config.getAllowedTools()?.includes('*') ?? false)
);
}
@@ -880,9 +880,7 @@ export class Task {
if (
part.kind !== 'data' ||
!part.data ||
// eslint-disable-next-line no-restricted-syntax
typeof part.data['callId'] !== 'string' ||
// eslint-disable-next-line no-restricted-syntax
typeof part.data['outcome'] !== 'string'
) {
return false;
+1
View File
@@ -121,6 +121,7 @@ describe('E2E Tests', () => {
beforeEach(() => {
getApprovalModeSpy.mockReturnValue(ApprovalMode.DEFAULT);
getAllowedToolsSpy.mockReturnValue([]);
getAllowedToolsSpy.mockReturnValue([]);
});
afterAll(
@@ -4033,7 +4033,6 @@ describe('InputPrompt', () => {
unmount();
});
it('should not show inverted cursor when shell is focused', async () => {
props.isEmbeddedShellFocused = true;
props.focus = false;
@@ -106,12 +106,10 @@ const MockedGeminiClientClass = vi.hoisted(() =>
);
const MockedUserPromptEvent = vi.hoisted(() =>
vi
.fn()
.mockImplementation(() => ({
toLogBody: vi.fn(),
toOpenTelemetryAttributes: vi.fn(),
})),
vi.fn().mockImplementation(() => ({
toLogBody: vi.fn(),
toOpenTelemetryAttributes: vi.fn(),
})),
);
const mockParseAndFormatApiError = vi.hoisted(() => vi.fn());
const mockIsBackgroundExecutionData = vi.hoisted(