import type { MCPServerConfig } from '@vybestack/llxprt-code-core'; import type { SessionRetentionSettings } from '../settings.js'; import { MergeStrategy } from './types.js'; export const CORE_SETTINGS_SCHEMA = { accessibility: { type: 'object', label: 'Accessibility', category: 'Accessibility', requiresRestart: true, default: {}, description: 'Accessibility settings.', showInDialog: false, properties: { enableLoadingPhrases: { type: 'boolean', label: 'Enable Loading Phrases', category: 'Accessibility', requiresRestart: true, default: true, description: 'Enable loading phrases during operations.', showInDialog: true, }, screenReader: { type: 'boolean', label: 'Screen Reader Mode', category: 'Accessibility', requiresRestart: true, default: false, description: 'Render output in plain-text to be more screen reader accessible', showInDialog: true, }, }, }, checkpointing: { type: 'object', label: 'Checkpointing', category: 'Checkpointing', requiresRestart: true, default: {}, description: 'Session checkpointing settings.', showInDialog: false, properties: { enabled: { type: 'boolean', label: 'Enable Checkpointing', category: 'Checkpointing', requiresRestart: true, default: false, description: 'Enable session checkpointing for recovery', showInDialog: false, }, }, }, lsp: { type: 'boolean', label: 'Experimental LSP Servers', category: 'Advanced', requiresRestart: true, default: false, ref: 'BooleanOrLspConfig', description: 'Enable experimental Language Server Protocol integration for real-time type-error diagnostics after file edits.', showInDialog: true, }, emojifilter: { type: 'string', label: 'Emoji Filter', category: 'Content Filtering', requiresRestart: false, default: 'auto' as 'allowed' | 'auto' | 'warn' | 'error', description: 'Filter emojis from AI-generated content and file operations. Options: allowed (no filtering), auto (silent filtering), warn (filter with warnings to AI), error (block operations with emojis).', showInDialog: true, }, fileFiltering: { type: 'object', label: 'File Filtering', category: 'File Filtering', requiresRestart: true, default: {}, description: 'Settings for git-aware file filtering.', showInDialog: false, properties: { respectGitIgnore: { type: 'boolean', label: 'Respect .gitignore', category: 'File Filtering', requiresRestart: true, default: true, description: 'Respect .gitignore files when searching', showInDialog: true, }, respectLlxprtIgnore: { type: 'boolean', label: 'Respect .llxprtignore', category: 'File Filtering', requiresRestart: true, default: true, description: 'Respect .llxprtignore files when searching', showInDialog: true, }, enableRecursiveFileSearch: { type: 'boolean', label: 'Enable Recursive File Search', category: 'File Filtering', requiresRestart: true, default: true, description: 'Enable recursive file search functionality', showInDialog: true, }, enableFuzzySearch: { type: 'boolean', label: 'Enable Fuzzy Search', category: 'File Filtering', requiresRestart: true, default: true, description: 'Enable fuzzy search when searching for files.', showInDialog: true, }, maxFileCount: { type: 'number', label: 'Max File Count', category: 'File Filtering', requiresRestart: true, default: 20000, description: 'Maximum number of files to index during file search. Prevents OOM on large projects.', showInDialog: true, }, searchTimeout: { type: 'number', label: 'Search Timeout (ms)', category: 'File Filtering', requiresRestart: true, default: 5000, description: 'Timeout in milliseconds for file search operations.', showInDialog: true, }, }, }, enableAutoUpdate: { type: 'boolean', label: 'Enable Auto Update', category: 'Updates', requiresRestart: false, default: true, description: 'Enable automatic updates.', showInDialog: true, }, shouldUseNodePtyShell: { type: 'boolean', label: 'Enable Interactive Shell (node-pty)', category: 'Shell', requiresRestart: true, default: false, description: 'Allow fully interactive shell commands (vim, git rebase -i, etc.) by running tools through node-pty. Falls back to child_process when disabled.', showInDialog: true, }, allowPtyThemeOverride: { type: 'boolean', label: 'Allow PTY to Override Theme', category: 'Shell', requiresRestart: true, default: false, description: 'Allow ANSI colors from PTY output to override the UI theme. When disabled, PTY output uses the current theme colors.', showInDialog: true, }, ptyScrollbackLimit: { type: 'number', label: 'PTY Scrollback Limit', category: 'Shell', requiresRestart: true, default: 600000, description: 'Maximum number of lines to keep in the PTY scrollback buffer for interactive shell output.', showInDialog: true, }, streamIdleTimeoutMs: { type: 'number', label: 'Stream Idle Timeout (ms)', category: 'Streaming', requiresRestart: false, default: 0, description: 'Stream idle timeout in milliseconds. Disabled by default (0). Set to a positive number of milliseconds to enable the watchdog; zero or negative disables it. Any finite number is valid.', showInDialog: false, }, streamFirstResponseTimeoutMs: { type: 'number', label: 'Stream First-Response Timeout (ms)', category: 'Streaming', requiresRestart: false, default: undefined as number | undefined, documentedDefault: 300000, description: 'First-response (time-to-first-content) watchdog in milliseconds. Enabled by default (300000 = 5 minutes). A provider liveness signal (e.g. response.created) disarms it even before semantic content arrives. Set to 0 or a negative number to disable.', showInDialog: false, }, useExternalAuth: { type: 'boolean', label: 'Use External Auth', category: 'Advanced', requiresRestart: true, default: undefined as boolean | undefined, description: 'Whether to use an external authentication flow.', showInDialog: false, }, sandbox: { type: 'string', label: 'Sandbox', category: 'Advanced', requiresRestart: true, default: undefined as boolean | string | undefined, ref: 'BooleanOrString', description: 'Sandbox execution environment (can be a boolean or a path string).', showInDialog: false, }, coreTools: { type: 'array', label: 'Core Tools', category: 'Advanced', requiresRestart: true, default: undefined as string[] | undefined, description: 'Paths to core tool definitions.', showInDialog: false, }, allowedTools: { type: 'array', label: 'Allowed Tools', category: 'Advanced', requiresRestart: true, default: undefined as string[] | undefined, description: 'A list of tool names that will bypass the confirmation dialog.', showInDialog: false, }, excludeTools: { type: 'array', label: 'Exclude Tools', category: 'Advanced', requiresRestart: true, default: undefined as string[] | undefined, description: 'Tool names to exclude from discovery.', showInDialog: false, }, defaultDisabledTools: { type: 'array', label: 'Default Disabled Tools', category: 'Advanced', requiresRestart: true, default: [] as string[] | undefined, description: 'Tool names disabled by default. Users can re-enable them with /tools enable.', showInDialog: false, }, coreToolSettings: { type: 'object', label: 'Tool Management', category: 'Advanced', requiresRestart: true, default: {} as Record, description: 'Manage core tool availability', showInDialog: true, subSettings: {}, // Will be populated dynamically based on loaded tools }, toolDiscoveryCommand: { type: 'string', label: 'Tool Discovery Command', category: 'Advanced', requiresRestart: true, default: undefined as string | undefined, description: 'Command to run for tool discovery.', showInDialog: false, }, toolCallCommand: { type: 'string', label: 'Tool Call Command', category: 'Advanced', requiresRestart: true, default: undefined as string | undefined, description: 'Command to run for tool calls.', showInDialog: false, }, mcpServerCommand: { type: 'string', label: 'MCP Server Command', category: 'Advanced', requiresRestart: true, default: undefined as string | undefined, description: 'Command to start an MCP server.', showInDialog: false, }, mcpServers: { type: 'object', label: 'MCP Servers', category: 'Advanced', requiresRestart: true, default: {} as Record, description: 'Configuration for MCP servers.', showInDialog: false, mergeStrategy: MergeStrategy.SHALLOW_MERGE, additionalProperties: { type: 'object', ref: 'MCPServerConfig', }, }, sessionRetention: { type: 'object', label: 'Session Retention', category: 'General', requiresRestart: false, default: undefined as SessionRetentionSettings | undefined, description: 'Settings for automatic session cleanup. Cleanup is enabled by default with a machine-wide 4 GiB aggregate size budget.', properties: { enabled: { type: 'boolean', label: 'Enabled', category: 'General', requiresRestart: false, default: true, description: 'Enable automatic session cleanup. Set to false to disable all janitorial mutations.', showInDialog: true, }, maxTotalSizeMB: { type: 'number', label: 'Max Total Size (MiB)', category: 'General', requiresRestart: false, default: 4096, description: 'Machine-wide aggregate size limit for all session recordings and cold archives, in MiB (see the default property).', showInDialog: true, }, maxAge: { type: 'string', label: 'Max Age', category: 'General', requiresRestart: false, default: undefined, description: 'Maximum age of sessions to keep (e.g. "30d", "7d", "24h"). No default age limit.', showInDialog: true, }, maxCount: { type: 'number', label: 'Max Count', category: 'General', requiresRestart: false, default: undefined, description: 'Maximum number of sessions to keep (most recent). No default count limit.', showInDialog: true, }, minRetention: { type: 'string', label: 'Min Retention', category: 'General', requiresRestart: false, default: '1d', description: 'Minimum retention period (safety floor, defaults to "1d").', showInDialog: true, }, }, }, output: { type: 'object', label: 'Output', category: 'General', requiresRestart: false, default: {}, description: 'Settings for the CLI output.', showInDialog: false, properties: { format: { type: 'enum', label: 'Output Format', category: 'General', requiresRestart: false, default: 'text', description: 'The format of the CLI output. Can be `text` or `json`.', showInDialog: true, options: [ { value: 'text', label: 'Text' }, { value: 'json', label: 'JSON' }, ], }, }, }, } as const;