mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-05-01 10:06:51 +00:00
feat(sessions): Add automatic session cleanup and retention policy (#7662)
This commit is contained in:
@@ -16,6 +16,8 @@ import {
|
||||
DEFAULT_TRUNCATE_TOOL_OUTPUT_THRESHOLD,
|
||||
} from '@google/gemini-cli-core';
|
||||
import type { CustomTheme } from '../ui/themes/theme.js';
|
||||
import type { SessionRetentionSettings } from './settings.js';
|
||||
import { DEFAULT_MIN_RETENTION } from '../utils/sessionCleanup.js';
|
||||
|
||||
export type SettingsType =
|
||||
| 'boolean'
|
||||
@@ -185,6 +187,54 @@ const SETTINGS_SCHEMA = {
|
||||
description: 'Enable debug logging of keystrokes to the console.',
|
||||
showInDialog: true,
|
||||
},
|
||||
sessionRetention: {
|
||||
type: 'object',
|
||||
label: 'Session Retention',
|
||||
category: 'General',
|
||||
requiresRestart: false,
|
||||
default: undefined as SessionRetentionSettings | undefined,
|
||||
properties: {
|
||||
enabled: {
|
||||
type: 'boolean',
|
||||
label: 'Enable Session Cleanup',
|
||||
category: 'General',
|
||||
requiresRestart: false,
|
||||
default: false,
|
||||
description: 'Enable automatic session cleanup',
|
||||
showInDialog: true,
|
||||
},
|
||||
maxAge: {
|
||||
type: 'string',
|
||||
label: 'Max Session Age',
|
||||
category: 'General',
|
||||
requiresRestart: false,
|
||||
default: undefined as string | undefined,
|
||||
description:
|
||||
'Maximum age of sessions to keep (e.g., "30d", "7d", "24h", "1w")',
|
||||
showInDialog: false,
|
||||
},
|
||||
maxCount: {
|
||||
type: 'number',
|
||||
label: 'Max Session Count',
|
||||
category: 'General',
|
||||
requiresRestart: false,
|
||||
default: undefined as number | undefined,
|
||||
description:
|
||||
'Alternative: Maximum number of sessions to keep (most recent)',
|
||||
showInDialog: false,
|
||||
},
|
||||
minRetention: {
|
||||
type: 'string',
|
||||
label: 'Min Retention Period',
|
||||
category: 'General',
|
||||
requiresRestart: false,
|
||||
default: DEFAULT_MIN_RETENTION,
|
||||
description: `Minimum retention period (safety limit, defaults to "${DEFAULT_MIN_RETENTION}")`,
|
||||
showInDialog: false,
|
||||
},
|
||||
},
|
||||
description: 'Settings for automatic session cleanup.',
|
||||
},
|
||||
},
|
||||
},
|
||||
output: {
|
||||
|
||||
Reference in New Issue
Block a user