Fix auto-compaction TUI integration and cut point logic

- Trigger auto-compaction after agent_end instead of during message_end
- Show CompactionComponent after auto-compaction (same as manual /compact)
- Fix cut point to include bash executions before kept user message
- Stop backward scan at compaction, assistant, user, or toolResult boundaries
This commit is contained in:
Mario Zechner 2025-12-09 02:45:24 +01:00
parent 75c2eea151
commit 4227fd5996
3 changed files with 46 additions and 20 deletions

View file

@ -597,7 +597,11 @@ export class InteractiveMode {
// Rebuild chat to show compacted state
this.chatContainer.clear();
this.rebuildChatFromMessages();
this.showStatus(`Auto-compacted: ${event.result.tokensBefore.toLocaleString()} tokens`);
// Add compaction component (same as manual /compact)
const compactionComponent = new CompactionComponent(event.result.tokensBefore, event.result.summary);
compactionComponent.setExpanded(this.toolOutputExpanded);
this.chatContainer.addChild(compactionComponent);
this.footer.updateState(this.session.state);
}
this.ui.requestRender();
break;