feat(ralph): enhance Ralph Wiggum loop visualization

Add polished, animated Ralph Wiggum Loop panel with:
- Circular progress ring showing task completion percentage
- Task cards with status indicators (pending/in-progress/completed)
- Animated status badge with pulsing indicator when active
- Completion celebration animation with animated checkmark
- Smart time formatting ("1h 23m" instead of "1.38 hours")

Enhanced detection patterns based on official Ralph plugin:
- /ralph-loop command detection
- Iteration patterns: "Iteration 5/50", "[5/50]"
- Max iterations from YAML: "max-iterations: 50"
- TodoWrite tool output detection

Adds maxIterations field to InnerLoopState for tracking loop limits.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
arkon
2026-01-19 17:09:56 +01:00
co-authored by Claude Opus 4.5
parent 1ffefa41aa
commit 684ccc2b07
6 changed files with 859 additions and 192 deletions
+388 -100
View File
@@ -447,166 +447,454 @@ body {
to { transform: rotate(360deg); }
}
/* Inner State Panel (Ralph Loop + Todo List) */
.inner-state-panel {
/* ===== Enhanced Ralph Wiggum Loop Panel ===== */
.ralph-panel {
background: var(--bg-card);
border-bottom: 1px solid var(--border);
font-size: 0.75rem;
flex-shrink: 0;
}
.inner-state-panel.collapsed .inner-state-content {
max-height: 28px;
overflow: hidden;
position: relative;
}
.inner-state-header {
/* Collapsed Summary Bar */
.ralph-summary {
display: flex;
align-items: center;
gap: 0.5rem;
padding: 0.35rem 0.75rem;
gap: 0.75rem;
padding: 0.5rem 0.75rem;
cursor: pointer;
user-select: none;
transition: background 0.15s;
}
.inner-state-header:hover {
.ralph-summary:hover {
background: var(--bg-hover);
}
.inner-state-toggle {
/* Mini Progress Ring (in summary) */
.ralph-ring-mini {
position: relative;
width: 32px;
height: 32px;
flex-shrink: 0;
}
.ralph-ring-svg {
width: 100%;
height: 100%;
transform: rotate(-90deg);
}
.ralph-ring-bg {
fill: none;
stroke: var(--bg-input);
stroke-width: 3;
}
.ralph-ring-progress {
fill: none;
stroke: url(#ralphGradient);
stroke-width: 3;
stroke-linecap: round;
stroke-dasharray: 100;
stroke-dashoffset: 100;
transition: stroke-dashoffset 0.5s ease-out;
}
.ralph-ring-text {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
font-size: 0.55rem;
font-weight: 600;
color: var(--text);
}
/* Summary Info */
.ralph-summary-info {
flex: 1;
display: flex;
align-items: center;
gap: 0.75rem;
min-width: 0;
}
.ralph-status-badge {
display: flex;
align-items: center;
gap: 0.35rem;
padding: 0.2rem 0.5rem;
border-radius: 4px;
background: var(--bg-input);
font-size: 0.7rem;
font-weight: 500;
}
.ralph-status-dot {
width: 6px;
height: 6px;
border-radius: 50%;
background: var(--text-muted);
transition: background 0.2s;
}
.ralph-status-badge.active .ralph-status-dot {
background: var(--accent);
animation: ralph-pulse 1.5s ease-in-out infinite;
}
.ralph-status-badge.completed .ralph-status-dot {
background: var(--green);
}
@keyframes ralph-pulse {
0%, 100% { opacity: 1; transform: scale(1); }
50% { opacity: 0.6; transform: scale(1.2); }
}
.ralph-phrase-preview {
color: var(--text-dim);
font-size: 0.7rem;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
max-width: 200px;
}
.ralph-phrase-preview code {
background: var(--bg-input);
padding: 0.1rem 0.3rem;
border-radius: 2px;
font-family: 'SF Mono', Monaco, monospace;
font-size: 0.65rem;
}
/* Summary Stats */
.ralph-summary-stats {
display: flex;
align-items: center;
gap: 0.75rem;
}
.ralph-stat {
display: flex;
align-items: center;
gap: 0.25rem;
color: var(--text-dim);
font-size: 0.7rem;
}
.ralph-stat-icon {
font-size: 0.75rem;
opacity: 0.7;
}
.ralph-toggle {
color: var(--text-dim);
font-size: 0.6rem;
transition: transform 0.2s;
flex-shrink: 0;
}
.inner-state-title {
color: var(--text-dim);
font-weight: 500;
.ralph-panel:not(.collapsed) .ralph-toggle {
transform: rotate(90deg);
}
.inner-state-content {
padding: 0 0.75rem 0.5rem;
transition: max-height 0.2s;
/* Hide detail when collapsed */
.ralph-panel.collapsed .ralph-detail {
display: none;
}
.inner-state-panel.collapsed .inner-state-content {
padding: 0 0.75rem;
/* Expanded Detail View */
.ralph-detail {
padding: 0.75rem;
border-top: 1px solid var(--border);
background: var(--bg-dark);
}
.ralph-progress-section {
display: flex;
align-items: center;
gap: 1rem;
align-items: flex-start;
gap: 1.5rem;
margin-bottom: 1rem;
}
/* Loop status in summary view */
.inner-loop-status {
padding: 0.15rem 0.5rem;
border-radius: 3px;
font-size: 0.7rem;
/* Large Progress Ring */
.ralph-ring {
position: relative;
width: 100px;
height: 100px;
flex-shrink: 0;
}
.inner-loop-status.active {
background: rgba(59, 130, 246, 0.2);
color: var(--accent-hover);
.ralph-ring-svg-large {
width: 100%;
height: 100%;
transform: rotate(-90deg);
}
.inner-loop-status.completed {
background: rgba(34, 197, 94, 0.2);
color: var(--green);
.ralph-ring-track {
fill: none;
stroke: var(--bg-input);
stroke-width: 6;
}
.inner-todo-summary {
color: var(--text-dim);
.ralph-ring-fill {
fill: none;
stroke: url(#ralphGradient);
stroke-width: 6;
stroke-linecap: round;
stroke-dasharray: 264;
stroke-dashoffset: 264;
transition: stroke-dashoffset 0.5s ease-out;
}
/* Loop details in expanded view */
.inner-loop-details {
margin-bottom: 0.5rem;
padding: 0.5rem;
background: rgba(59, 130, 246, 0.1);
border-radius: 4px;
border-left: 2px solid var(--accent);
.ralph-ring-center {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
text-align: center;
}
.inner-loop-active {
color: var(--accent-hover);
}
.inner-loop-active code {
background: var(--bg-input);
padding: 0.1rem 0.3rem;
border-radius: 2px;
font-family: 'SF Mono', Monaco, monospace;
font-size: 0.7rem;
}
.inner-loop-elapsed,
.inner-loop-cycles {
color: var(--text-dim);
font-size: 0.7rem;
margin-top: 0.25rem;
}
.inner-loop-completed {
color: var(--green);
}
.inner-loop-completed code {
background: var(--bg-input);
padding: 0.1rem 0.3rem;
border-radius: 2px;
font-family: 'SF Mono', Monaco, monospace;
font-size: 0.7rem;
}
/* Todo list in expanded view */
.inner-todo-list {
padding: 0.5rem;
background: var(--bg-input);
border-radius: 4px;
}
.inner-todo-header {
.ralph-ring-percent {
font-size: 1.25rem;
font-weight: 700;
color: var(--text);
font-weight: 500;
margin-bottom: 0.35rem;
padding-bottom: 0.35rem;
border-bottom: 1px solid var(--border);
line-height: 1;
}
.inner-todo-items {
list-style: none;
padding: 0;
margin: 0;
.ralph-ring-label {
font-size: 0.6rem;
color: var(--text-dim);
margin-top: 0.15rem;
}
/* Meta Info */
.ralph-meta {
flex: 1;
display: flex;
flex-direction: column;
gap: 0.75rem;
}
.ralph-meta-item {
display: flex;
flex-direction: column;
gap: 0.2rem;
}
.ralph-meta-label {
font-size: 0.65rem;
color: var(--text-muted);
text-transform: uppercase;
letter-spacing: 0.5px;
}
.ralph-meta code {
background: var(--bg-input);
padding: 0.25rem 0.5rem;
border-radius: 4px;
font-family: 'SF Mono', Monaco, monospace;
font-size: 0.75rem;
color: var(--accent);
word-break: break-all;
}
.ralph-meta-row {
display: flex;
gap: 1.5rem;
}
.ralph-meta-item span:not(.ralph-meta-label) {
font-size: 0.9rem;
font-weight: 500;
color: var(--text);
}
/* Task Cards Section */
.ralph-tasks-section {
background: var(--bg-card);
border-radius: 6px;
overflow: hidden;
}
.ralph-tasks-header {
display: flex;
justify-content: space-between;
align-items: center;
padding: 0.5rem 0.75rem;
background: var(--bg-input);
font-weight: 500;
color: var(--text);
font-size: 0.75rem;
}
.ralph-tasks-count {
color: var(--text-dim);
font-weight: 400;
}
.ralph-tasks-grid {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
gap: 0.5rem;
padding: 0.5rem;
max-height: 200px;
overflow-y: auto;
}
.inner-todo-items li {
padding: 0.25rem 0;
color: var(--text-dim);
font-family: 'SF Mono', Monaco, monospace;
/* Task Cards */
.ralph-task-card {
display: flex;
align-items: flex-start;
gap: 0.5rem;
padding: 0.5rem;
background: var(--bg-dark);
border-radius: 4px;
border-left: 2px solid var(--text-muted);
transition: border-color 0.2s, background 0.2s;
}
.ralph-task-card.task-pending {
border-left-color: var(--text-muted);
}
.ralph-task-card.task-in-progress {
border-left-color: var(--accent);
background: rgba(59, 130, 246, 0.05);
}
.ralph-task-card.task-completed {
border-left-color: var(--green);
opacity: 0.75;
}
.ralph-task-icon {
flex-shrink: 0;
width: 16px;
height: 16px;
display: flex;
align-items: center;
justify-content: center;
font-size: 0.7rem;
white-space: nowrap;
border-radius: 50%;
}
.ralph-task-card.task-pending .ralph-task-icon {
color: var(--text-muted);
}
.ralph-task-card.task-in-progress .ralph-task-icon {
color: var(--accent);
animation: ralph-spin 2s linear infinite;
}
.ralph-task-card.task-completed .ralph-task-icon {
color: var(--green);
}
@keyframes ralph-spin {
from { transform: rotate(0deg); }
to { transform: rotate(360deg); }
}
.ralph-task-content {
flex: 1;
font-size: 0.7rem;
color: var(--text-dim);
line-height: 1.3;
overflow: hidden;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
}
.inner-todo-items li.todo-completed {
color: var(--green);
.ralph-task-card.task-completed .ralph-task-content {
text-decoration: line-through;
opacity: 0.7;
}
.inner-todo-items li.todo-in-progress {
color: var(--accent-hover);
/* Completion Celebration */
.ralph-celebration {
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
display: none;
align-items: center;
justify-content: center;
background: rgba(10, 10, 10, 0.95);
z-index: 10;
}
.inner-todo-items li.todo-pending {
color: var(--text-dim);
.ralph-celebration.show {
display: flex;
animation: ralph-celebration-in 0.3s ease-out;
}
@keyframes ralph-celebration-in {
from { opacity: 0; }
to { opacity: 1; }
}
.ralph-celebration-content {
text-align: center;
}
.ralph-checkmark {
width: 60px;
height: 60px;
margin: 0 auto 0.75rem;
}
.ralph-checkmark svg {
width: 100%;
height: 100%;
}
.ralph-checkmark-circle {
fill: none;
stroke: var(--green);
stroke-width: 2;
stroke-dasharray: 166;
stroke-dashoffset: 166;
animation: ralph-circle 0.6s ease-out forwards;
}
.ralph-checkmark-check {
fill: none;
stroke: var(--green);
stroke-width: 3;
stroke-linecap: round;
stroke-linejoin: round;
stroke-dasharray: 48;
stroke-dashoffset: 48;
animation: ralph-check 0.3s ease-out 0.4s forwards;
}
@keyframes ralph-circle {
to { stroke-dashoffset: 0; }
}
@keyframes ralph-check {
to { stroke-dashoffset: 0; }
}
.ralph-celebration-text {
font-size: 1rem;
font-weight: 600;
color: var(--green);
}
/* Empty state (legacy support) */
.inner-state-empty {
color: var(--text-muted);
font-style: italic;
padding: 0.5rem;
}
/* Main - Terminal Area */