Handle conversation compacting with status messages and token reset

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
andrepimenta
2025-12-02 00:22:47 +00:00
parent abf81a1176
commit 82899ebb40
3 changed files with 48 additions and 1 deletions

View File

@@ -693,6 +693,36 @@ class ClaudeChatProvider {
mcpServers: jsonData.mcp_servers || []
}
});
} else if (jsonData.subtype === 'status') {
// Handle status changes (e.g., compacting)
if (jsonData.status === 'compacting') {
console.log('Conversation compacting started');
this._sendAndSaveMessage({
type: 'compacting',
data: { isCompacting: true }
});
} else if (jsonData.status === null) {
console.log('Status cleared');
this._sendAndSaveMessage({
type: 'compacting',
data: { isCompacting: false }
});
}
} else if (jsonData.subtype === 'compact_boundary') {
// Compact boundary - conversation was compacted, reset token counts
console.log('Compact boundary received', jsonData.compact_metadata);
// Reset tokens since the conversation is now summarized
this._totalTokensInput = 0;
this._totalTokensOutput = 0;
this._sendAndSaveMessage({
type: 'compactBoundary',
data: {
trigger: jsonData.compact_metadata?.trigger,
preTokens: jsonData.compact_metadata?.pre_tokens
}
});
}
break;