mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-04-25 12:34:38 -07:00
fix(a2a-server): pass allowedTools settings to core Config (#19680)
This commit is contained in:
@@ -267,4 +267,47 @@ describe('loadConfig', () => {
|
|||||||
customIgnoreFilePaths: [testPath],
|
customIgnoreFilePaths: [testPath],
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe('tool configuration', () => {
|
||||||
|
it('should pass V1 allowedTools to Config properly', async () => {
|
||||||
|
const settings: Settings = {
|
||||||
|
allowedTools: ['shell', 'edit'],
|
||||||
|
};
|
||||||
|
await loadConfig(settings, mockExtensionLoader, taskId);
|
||||||
|
expect(Config).toHaveBeenCalledWith(
|
||||||
|
expect.objectContaining({
|
||||||
|
allowedTools: ['shell', 'edit'],
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should pass V2 tools.allowed to Config properly', async () => {
|
||||||
|
const settings: Settings = {
|
||||||
|
tools: {
|
||||||
|
allowed: ['shell', 'fetch'],
|
||||||
|
},
|
||||||
|
};
|
||||||
|
await loadConfig(settings, mockExtensionLoader, taskId);
|
||||||
|
expect(Config).toHaveBeenCalledWith(
|
||||||
|
expect.objectContaining({
|
||||||
|
allowedTools: ['shell', 'fetch'],
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should prefer V1 allowedTools over V2 tools.allowed if both present', async () => {
|
||||||
|
const settings: Settings = {
|
||||||
|
allowedTools: ['v1-tool'],
|
||||||
|
tools: {
|
||||||
|
allowed: ['v2-tool'],
|
||||||
|
},
|
||||||
|
};
|
||||||
|
await loadConfig(settings, mockExtensionLoader, taskId);
|
||||||
|
expect(Config).toHaveBeenCalledWith(
|
||||||
|
expect.objectContaining({
|
||||||
|
allowedTools: ['v1-tool'],
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -68,8 +68,9 @@ export async function loadConfig(
|
|||||||
debugMode: process.env['DEBUG'] === 'true' || false,
|
debugMode: process.env['DEBUG'] === 'true' || false,
|
||||||
question: '', // Not used in server mode directly like CLI
|
question: '', // Not used in server mode directly like CLI
|
||||||
|
|
||||||
coreTools: settings.coreTools || undefined,
|
coreTools: settings.coreTools || settings.tools?.core || undefined,
|
||||||
excludeTools: settings.excludeTools || undefined,
|
excludeTools: settings.excludeTools || settings.tools?.exclude || undefined,
|
||||||
|
allowedTools: settings.allowedTools || settings.tools?.allowed || undefined,
|
||||||
showMemoryUsage: settings.showMemoryUsage || false,
|
showMemoryUsage: settings.showMemoryUsage || false,
|
||||||
approvalMode:
|
approvalMode:
|
||||||
process.env['GEMINI_YOLO_MODE'] === 'true'
|
process.env['GEMINI_YOLO_MODE'] === 'true'
|
||||||
|
|||||||
@@ -27,6 +27,12 @@ export interface Settings {
|
|||||||
mcpServers?: Record<string, MCPServerConfig>;
|
mcpServers?: Record<string, MCPServerConfig>;
|
||||||
coreTools?: string[];
|
coreTools?: string[];
|
||||||
excludeTools?: string[];
|
excludeTools?: string[];
|
||||||
|
allowedTools?: string[];
|
||||||
|
tools?: {
|
||||||
|
allowed?: string[];
|
||||||
|
exclude?: string[];
|
||||||
|
core?: string[];
|
||||||
|
};
|
||||||
telemetry?: TelemetrySettings;
|
telemetry?: TelemetrySettings;
|
||||||
showMemoryUsage?: boolean;
|
showMemoryUsage?: boolean;
|
||||||
checkpointing?: CheckpointingSettings;
|
checkpointing?: CheckpointingSettings;
|
||||||
|
|||||||
Reference in New Issue
Block a user