@@ -23,11 +23,40 @@ import { languagesSchema } from "./vscode.js"
2323export const DEFAULT_WRITE_DELAY_MS = 1000
2424
2525/**
26- * Default terminal output character limit constant.
27- * This provides a reasonable default that aligns with typical terminal usage
28- * while preventing context window explosions from extremely long lines.
26+ * Terminal output preview size options for persisted command output.
27+ *
28+ * Controls how much command output is kept in memory as a "preview" before
29+ * the LLM decides to retrieve more via `read_command_output`. Larger previews
30+ * mean more immediate context but consume more of the context window.
31+ *
32+ * - `small`: 5KB preview - Best for long-running commands with verbose output
33+ * - `medium`: 10KB preview - Balanced default for most use cases
34+ * - `large`: 20KB preview - Best when commands produce critical info early
35+ *
36+ * @see OutputInterceptor - Uses this setting to determine when to spill to disk
37+ * @see PersistedCommandOutput - Contains the resulting preview and artifact reference
2938 */
30- export const DEFAULT_TERMINAL_OUTPUT_CHARACTER_LIMIT = 50_000
39+ export type TerminalOutputPreviewSize = "small" | "medium" | "large"
40+
41+ /**
42+ * Byte limits for each terminal output preview size.
43+ *
44+ * Maps preview size names to their corresponding byte thresholds.
45+ * When command output exceeds these thresholds, the excess is persisted
46+ * to disk and made available via the `read_command_output` tool.
47+ */
48+ export const TERMINAL_PREVIEW_BYTES : Record < TerminalOutputPreviewSize , number > = {
49+ small : 5 * 1024 , // 5KB
50+ medium : 10 * 1024 , // 10KB
51+ large : 20 * 1024 , // 20KB
52+ }
53+
54+ /**
55+ * Default terminal output preview size.
56+ * The "medium" (10KB) setting provides a good balance between immediate
57+ * visibility and context window conservation for most use cases.
58+ */
59+ export const DEFAULT_TERMINAL_OUTPUT_PREVIEW_SIZE : TerminalOutputPreviewSize = "medium"
3160
3261/**
3362 * Minimum checkpoint timeout in seconds.
@@ -147,8 +176,7 @@ export const globalSettingsSchema = z.object({
147176 maxImageFileSize : z . number ( ) . optional ( ) ,
148177 maxTotalImageSize : z . number ( ) . optional ( ) ,
149178
150- terminalOutputLineLimit : z . number ( ) . optional ( ) ,
151- terminalOutputCharacterLimit : z . number ( ) . optional ( ) ,
179+ terminalOutputPreviewSize : z . enum ( [ "small" , "medium" , "large" ] ) . optional ( ) ,
152180 terminalShellIntegrationTimeout : z . number ( ) . optional ( ) ,
153181 terminalShellIntegrationDisabled : z . boolean ( ) . optional ( ) ,
154182 terminalCommandDelay : z . number ( ) . optional ( ) ,
@@ -157,7 +185,6 @@ export const globalSettingsSchema = z.object({
157185 terminalZshOhMy : z . boolean ( ) . optional ( ) ,
158186 terminalZshP10k : z . boolean ( ) . optional ( ) ,
159187 terminalZdotdir : z . boolean ( ) . optional ( ) ,
160- terminalCompressProgressBar : z . boolean ( ) . optional ( ) ,
161188
162189 diagnosticsEnabled : z . boolean ( ) . optional ( ) ,
163190
@@ -338,16 +365,13 @@ export const EVALS_SETTINGS: RooCodeSettings = {
338365 soundEnabled : false ,
339366 soundVolume : 0.5 ,
340367
341- terminalOutputLineLimit : 500 ,
342- terminalOutputCharacterLimit : DEFAULT_TERMINAL_OUTPUT_CHARACTER_LIMIT ,
343368 terminalShellIntegrationTimeout : 30000 ,
344369 terminalCommandDelay : 0 ,
345370 terminalPowershellCounter : false ,
346371 terminalZshOhMy : true ,
347372 terminalZshClearEolMark : true ,
348373 terminalZshP10k : false ,
349374 terminalZdotdir : true ,
350- terminalCompressProgressBar : true ,
351375 terminalShellIntegrationDisabled : true ,
352376
353377 diagnosticsEnabled : true ,
0 commit comments