From cbee6bd4dfe8df187b867598d346859891b2fc45 Mon Sep 17 00:00:00 2001 From: jnjpng Date: Fri, 6 Feb 2026 22:18:31 -0800 Subject: [PATCH] feat: hide compaction messages setting (#857) --- src/cli/App.tsx | 21 +++++++++++++++++++-- src/index.ts | 2 ++ src/settings-manager.ts | 2 ++ 3 files changed, 23 insertions(+), 2 deletions(-) diff --git a/src/cli/App.tsx b/src/cli/App.tsx index 9d40d36..59f7f02 100644 --- a/src/cli/App.tsx +++ b/src/cli/App.tsx @@ -771,6 +771,7 @@ export default function App({ messageHistory = [], resumedExistingConversation = false, tokenStreaming = false, + showCompactions = false, agentProvenance = null, releaseNotes = null, }: { @@ -789,6 +790,7 @@ export default function App({ messageHistory?: Message[]; resumedExistingConversation?: boolean; // True if we explicitly resumed via --resume tokenStreaming?: boolean; + showCompactions?: boolean; agentProvenance?: AgentProvenance | null; releaseNotes?: string | null; // Markdown release notes to display above header }) { @@ -1266,6 +1268,10 @@ export default function App({ const [tokenStreamingEnabled, setTokenStreamingEnabled] = useState(tokenStreaming); + // Show compaction messages preference (can be toggled at runtime) + const [showCompactionsEnabled, _setShowCompactionsEnabled] = + useState(showCompactions); + // Live, approximate token counter (resets each turn) const [tokenCount, setTokenCount] = useState(0); @@ -9879,12 +9885,20 @@ Plan file path: ${planFilePath}`; } // Events (like compaction) show while running if (ln.kind === "event") { + if (!showCompactionsEnabled && ln.eventType === "compaction") + return false; return ln.phase === "running"; } if (!tokenStreamingEnabled && ln.phase === "streaming") return false; return ln.phase === "streaming"; }); - }, [lines, tokenStreamingEnabled, staticItems.length, deferredCommitAt]); + }, [ + lines, + tokenStreamingEnabled, + showCompactionsEnabled, + staticItems.length, + deferredCommitAt, + ]); // Subscribe to subagent state for reactive overflow detection const { agents: subagents } = useSyncExternalStore( @@ -10093,7 +10107,10 @@ Plan file path: ${planFilePath}`; ) : item.kind === "status" ? ( ) : item.kind === "event" ? ( - + !showCompactionsEnabled && + item.eventType === "compaction" ? null : ( + + ) ) : item.kind === "separator" ? ( {"─".repeat(columns)} diff --git a/src/index.ts b/src/index.ts index 1ab58b0..5d6f7ad 100755 --- a/src/index.ts +++ b/src/index.ts @@ -1996,6 +1996,7 @@ async function main(): Promise { messageHistory: resumeData?.messageHistory ?? EMPTY_MESSAGE_ARRAY, resumedExistingConversation, tokenStreaming: settings.tokenStreaming, + showCompactions: settings.showCompactions, agentProvenance, releaseNotes, }); @@ -2012,6 +2013,7 @@ async function main(): Promise { messageHistory: resumeData?.messageHistory ?? EMPTY_MESSAGE_ARRAY, resumedExistingConversation, tokenStreaming: settings.tokenStreaming, + showCompactions: settings.showCompactions, agentProvenance, releaseNotes, }); diff --git a/src/settings-manager.ts b/src/settings-manager.ts index fcf69a8..7cee4bb 100644 --- a/src/settings-manager.ts +++ b/src/settings-manager.ts @@ -39,6 +39,7 @@ export interface Settings { lastAgent: string | null; // DEPRECATED: kept for migration to lastSession lastSession?: SessionRef; // DEPRECATED: kept for backwards compat, use sessionsByServer tokenStreaming: boolean; + showCompactions?: boolean; enableSleeptime: boolean; sessionContextEnabled: boolean; // Send device/agent context on first message of each session memoryReminderInterval: number | null; // null = disabled, number = prompt memory check every N turns @@ -91,6 +92,7 @@ export interface LocalProjectSettings { const DEFAULT_SETTINGS: Settings = { lastAgent: null, tokenStreaming: false, + showCompactions: false, enableSleeptime: false, sessionContextEnabled: true, memoryReminderInterval: 5, // number = prompt memory check every N turns