feat(tui): use configured compaction threshold for /context output

This commit is contained in:
William Valentin
2026-02-16 18:10:54 -08:00
parent 409ab04ca1
commit fc6a79ed90
7 changed files with 53 additions and 4 deletions
+3 -1
View File
@@ -50,6 +50,7 @@ export interface AppProps {
agent?: NativeAgent;
hookEngine?: HookEngine;
modelProviderConfigs?: Partial<Record<ModelProvider, ModelConfig>>;
contextThresholdPct?: number;
onExit?: () => void;
}
@@ -62,6 +63,7 @@ export function App({
agent,
hookEngine,
modelProviderConfigs,
contextThresholdPct,
onExit,
}: AppProps): React.ReactElement {
const { exit } = useApp();
@@ -247,7 +249,7 @@ export function App({
const modelName = modelRouter?.getLabel(tier) ?? model;
const window = getContextWindow(modelName);
const usagePct = window > 0 ? (estimated / window) * 100 : 0;
const thresholdPct = 80;
const thresholdPct = contextThresholdPct ?? 80;
const thresholdTokens = Math.floor((thresholdPct / 100) * window);
const remaining = Math.max(0, window - estimated);
const text = [