feat: hide compaction messages setting (#857)

This commit is contained in:
jnjpng
2026-02-06 22:18:31 -08:00
committed by GitHub
parent 6a7d069fe5
commit cbee6bd4df
3 changed files with 23 additions and 2 deletions

View File

@@ -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" ? (
<StatusMessage line={item} />
) : item.kind === "event" ? (
<EventMessage line={item} />
!showCompactionsEnabled &&
item.eventType === "compaction" ? null : (
<EventMessage line={item} />
)
) : item.kind === "separator" ? (
<Box marginTop={1}>
<Text dimColor>{"─".repeat(columns)}</Text>

View File

@@ -1996,6 +1996,7 @@ async function main(): Promise<void> {
messageHistory: resumeData?.messageHistory ?? EMPTY_MESSAGE_ARRAY,
resumedExistingConversation,
tokenStreaming: settings.tokenStreaming,
showCompactions: settings.showCompactions,
agentProvenance,
releaseNotes,
});
@@ -2012,6 +2013,7 @@ async function main(): Promise<void> {
messageHistory: resumeData?.messageHistory ?? EMPTY_MESSAGE_ARRAY,
resumedExistingConversation,
tokenStreaming: settings.tokenStreaming,
showCompactions: settings.showCompactions,
agentProvenance,
releaseNotes,
});

View File

@@ -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