mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-04-24 03:54:43 -07:00
feat(core): Add configurable inactivity timeout for shell commands (#13531)
This commit is contained in:
@@ -750,6 +750,22 @@ describe('Server Config (config.ts)', () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe('Shell Tool Inactivity Timeout', () => {
|
||||
it('should default to 300000ms (300 seconds) when not provided', () => {
|
||||
const config = new Config(baseParams);
|
||||
expect(config.getShellToolInactivityTimeout()).toBe(300000);
|
||||
});
|
||||
|
||||
it('should convert provided seconds to milliseconds', () => {
|
||||
const params: ConfigParameters = {
|
||||
...baseParams,
|
||||
shellToolInactivityTimeout: 10, // 10 seconds
|
||||
};
|
||||
const config = new Config(params);
|
||||
expect(config.getShellToolInactivityTimeout()).toBe(10000);
|
||||
});
|
||||
});
|
||||
|
||||
describe('ContinueOnFailedApiCall Configuration', () => {
|
||||
it('should default continueOnFailedApiCall to false when not provided', () => {
|
||||
const config = new Config(baseParams);
|
||||
|
||||
@@ -297,6 +297,7 @@ export interface ConfigParameters {
|
||||
continueOnFailedApiCall?: boolean;
|
||||
retryFetchErrors?: boolean;
|
||||
enableShellOutputEfficiency?: boolean;
|
||||
shellToolInactivityTimeout?: number;
|
||||
fakeResponses?: string;
|
||||
recordResponses?: string;
|
||||
ptyInfo?: string;
|
||||
@@ -411,6 +412,7 @@ export class Config {
|
||||
private readonly continueOnFailedApiCall: boolean;
|
||||
private readonly retryFetchErrors: boolean;
|
||||
private readonly enableShellOutputEfficiency: boolean;
|
||||
private readonly shellToolInactivityTimeout: number;
|
||||
readonly fakeResponses?: string;
|
||||
readonly recordResponses?: string;
|
||||
private readonly disableYoloMode: boolean;
|
||||
@@ -547,6 +549,8 @@ export class Config {
|
||||
this.continueOnFailedApiCall = params.continueOnFailedApiCall ?? true;
|
||||
this.enableShellOutputEfficiency =
|
||||
params.enableShellOutputEfficiency ?? true;
|
||||
this.shellToolInactivityTimeout =
|
||||
(params.shellToolInactivityTimeout ?? 300) * 1000; // 5 minutes
|
||||
this.extensionManagement = params.extensionManagement ?? true;
|
||||
this.enableExtensionReloading = params.enableExtensionReloading ?? false;
|
||||
this.storage = new Storage(this.targetDir);
|
||||
@@ -1308,6 +1312,10 @@ export class Config {
|
||||
return this.enableShellOutputEfficiency;
|
||||
}
|
||||
|
||||
getShellToolInactivityTimeout(): number {
|
||||
return this.shellToolInactivityTimeout;
|
||||
}
|
||||
|
||||
getShellExecutionConfig(): ShellExecutionConfig {
|
||||
return this.shellExecutionConfig;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user