Fix usage logging dedupe and reduce stats churn

- batch console log buffer events and support batched SSE log messages
- debounce usage stats update/pending events to reduce UI/runtime churn
- avoid awaiting request-success bookkeeping before returning provider responses
- deduplicate identical usage writes in usageHistory/daily aggregates
- reduce default logger verbosity from DEBUG to INFO (overridable via LOG_LEVEL)

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Mink Nguyen
2026-06-26 10:22:20 +07:00
committed by decolua
co-authored by Cursor
parent ec096d2add
commit 0d21668917
7 changed files with 107 additions and 10 deletions
@@ -47,6 +47,11 @@ export default function ConsoleLogClient() {
const next = [...prev, msg.line];
return next.length > CONSOLE_LOG_CONFIG.maxLines ? next.slice(-CONSOLE_LOG_CONFIG.maxLines) : next;
});
} else if (msg.type === "lines") {
setLogs((prev) => {
const next = [...prev, ...msg.lines];
return next.length > CONSOLE_LOG_CONFIG.maxLines ? next.slice(-CONSOLE_LOG_CONFIG.maxLines) : next;
});
} else if (msg.type === "clear") {
setLogs([]);
}