From 8dee32894d1c9b4b119ed24ef2e2dc7a0e1a94a3 Mon Sep 17 00:00:00 2001 From: Kunal Keshari Pattanaik Date: Sat, 6 Jun 2026 14:33:38 +0530 Subject: [PATCH 1/2] Add terminal output metrics badge --- ui/app.js | 23 +++++++++++++++++++++++ ui/index.html | 2 ++ ui/style.css | 15 +++++++++++++++ 3 files changed, 40 insertions(+) diff --git a/ui/app.js b/ui/app.js index bf7725b..31b50e5 100644 --- a/ui/app.js +++ b/ui/app.js @@ -890,6 +890,7 @@ document.addEventListener('DOMContentLoaded', async () => { initResizers(); await restoreSession(); applyTerminalDensity(); + updateTerminalMetrics(); // Initialize auto-scroll as enabled for terminal 1 state.autoScroll[1] = true; @@ -998,6 +999,23 @@ function getTerminalBody(termId = state.activeTerminalId) { || (termId === 1 ? document.getElementById('terminal-body') : null); } +function updateTerminalMetrics(termId = state.activeTerminalId) { + const badge = document.getElementById('terminal-metrics-badge'); + if (!badge) return; + + const termBody = getTerminalBody(termId); + const outputText = termBody + ? Array.from(termBody.querySelectorAll('.cli-output-block')) + .map(el => el.textContent || '') + .join('\n') + : ''; + const lineCount = outputText ? outputText.split(/\r?\n/).length : 0; + const charCount = outputText.length; + + badge.textContent = `${lineCount} ${lineCount === 1 ? 'line' : 'lines'} / ${charCount} chars`; + badge.title = `Terminal ${termId} output size: ${lineCount} ${lineCount === 1 ? 'line' : 'lines'}, ${charCount} characters`; +} + function updateRunButton() { const btnRun = document.getElementById('btn-run'); if (!btnRun) return; @@ -2164,6 +2182,9 @@ function appendToCli(text, className = '', termId = state.activeTerminalId) { line.className = `cli-output-block ${className}`; line.textContent = text; termBody.appendChild(line); + if (termId === state.activeTerminalId) { + updateTerminalMetrics(termId); + } // Only auto-scroll if enabled for this terminal (default: true) if (state.autoScroll[termId] !== false) { @@ -2179,6 +2200,7 @@ function clearCli() { if (termBody) { termBody.innerHTML = '
$ Terminal cleared.
'; } + updateTerminalMetrics(state.activeTerminalId); document.getElementById('run-status').textContent = ''; document.getElementById('run-status').className = 'run-status'; document.getElementById('resource-panel').style.display = 'none'; @@ -2811,6 +2833,7 @@ function switchTerminal(id) { } updateRunButton(); highlightTerminalSearch(); + updateTerminalMetrics(id); updateProgressTrackerUI(); persistWorkspace(); diff --git a/ui/index.html b/ui/index.html index 58399eb..80b5d07 100644 --- a/ui/index.html +++ b/ui/index.html @@ -348,6 +348,8 @@

Scripts

+ 0 lines / 0 chars
Date: Sat, 6 Jun 2026 14:48:19 +0530 Subject: [PATCH 2/2] Log cleanup removal failures --- app.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app.py b/app.py index ba877de..25e91c0 100644 --- a/app.py +++ b/app.py @@ -2566,8 +2566,8 @@ def clear_history(): os.unlink(file_path) elif os.path.isdir(file_path): shutil.rmtree(file_path) - except Exception: - pass + except Exception as exc: + logger.warning("Failed to remove execution log entry %s: %s", file_path, exc) # Clear session logs if os.path.exists(SESSION_LOG_DIR): @@ -2578,8 +2578,8 @@ def clear_history(): os.unlink(file_path) elif os.path.isdir(file_path): shutil.rmtree(file_path) - except Exception: - pass + except Exception as exc: + logger.warning("Failed to remove session log entry %s: %s", file_path, exc) return jsonify({ 'success': True,