mirror of
https://github.com/Ark0N/Codeman.git
synced 2026-10-04 22:49:41 +02:00
fix: improve reliability and performance across session management
- Add state store flush on shutdown to prevent data loss from debounced saves - Add error handling in session exit handler to ensure cleanup always runs - Add 5s timeout to all TUI execSync calls to prevent hangs - Cache screen -ls output with 100ms TTL (90% reduction in execSync calls) - Add token pre-check to skip expensive regex when "token" not in data Based on findings from security, performance, and reliability analysis. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1148,6 +1148,9 @@ export class Session extends EventEmitter {
|
||||
// Parse token count from Claude's status line in interactive mode
|
||||
// Matches patterns like "123.4k tokens", "5234 tokens", "1.2M tokens"
|
||||
private parseTokensFromStatusLine(data: string): void {
|
||||
// Quick pre-check: skip expensive regex if "token" not present (performance optimization)
|
||||
if (!data.includes('token')) return;
|
||||
|
||||
// Remove ANSI escape codes for cleaner parsing (use pre-compiled pattern)
|
||||
const cleanData = data.replace(ANSI_ESCAPE_PATTERN, '');
|
||||
|
||||
|
||||
Reference in New Issue
Block a user