Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions app.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand All @@ -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,
Expand Down
23 changes: 23 additions & 0 deletions ui/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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) {
Expand All @@ -2179,6 +2200,7 @@ function clearCli() {
if (termBody) {
termBody.innerHTML = '<div class="cli-welcome"><span class="cli-prompt">$</span> <span class="cli-welcome-text">Terminal cleared.</span></div>';
}
updateTerminalMetrics(state.activeTerminalId);
document.getElementById('run-status').textContent = '';
document.getElementById('run-status').className = 'run-status';
document.getElementById('resource-panel').style.display = 'none';
Expand Down Expand Up @@ -2811,6 +2833,7 @@ function switchTerminal(id) {
}
updateRunButton();
highlightTerminalSearch();
updateTerminalMetrics(id);

updateProgressTrackerUI();
persistWorkspace();
Expand Down
2 changes: 2 additions & 0 deletions ui/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -348,6 +348,8 @@ <h2>Scripts</h2>
<button class="density-option" type="button" data-density="relaxed"
title="Relaxed line height">Relaxed</button>
</div>
<span class="terminal-metrics-badge" id="terminal-metrics-badge"
title="Terminal output size">0 lines / 0 chars</span>
<div class="terminal-search-wrapper">
<svg class="search-icon" xmlns="http://www.w3.org/2000/svg" width="14" height="14"
viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"
Expand Down
15 changes: 15 additions & 0 deletions ui/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -871,6 +871,21 @@ body {
background: rgba(99, 102, 241, 0.14);
}

.terminal-metrics-badge {
display: inline-flex;
align-items: center;
height: 26px;
padding: 0 9px;
border: 1px solid var(--border);
border-radius: 6px;
background: var(--bg-tertiary);
color: var(--text-muted);
font-family: var(--font-mono);
font-size: 10px;
line-height: 1;
white-space: nowrap;
}

.cli-dots {
display: flex;
gap: 4px;
Expand Down
Loading