Files
Shane 44e8d05e2c feat: background task dispatch system with live UI panel
- agent/task_registry.py: file-based JSONL event registry (cross-process)
- agent/task_worker.py: autonomous LLM loop with weather/time/memory/web tools
- agent/dispatch_mcp.py: MCP tool exposing dispatch_task to the main agent
- agent/agent.py: registers dispatch toolset, polls task events → room data
- web: slide-out task panel (FAB button + badge), live step streaming via
  data channel topic 'tasks', status dots (running/completed/failed)
- Dockerfile: copies new task_*.py and dispatch_mcp.py files

The dispatch MCP runs in its own process; events flow through
/tmp/tasks/events.jsonl which the main agent tails every second and
forwards to the browser. Tasks run up to 10 LLM iterations with tool calls.
2026-08-22 18:06:23 -04:00

699 lines
15 KiB
CSS

:root {
--bg: #09090b;
--panel: rgba(255, 255, 255, 0.05);
--panel-strong: rgba(255, 255, 255, 0.08);
--border: rgba(255, 255, 255, 0.09);
--text: #e4e4e7;
--text-dim: #a1a1aa;
--text-faint: #71717a;
--accent-1: #60a5fa;
--accent-2: #a78bfa;
--user-bubble: rgba(96, 165, 250, 0.14);
--agent-bubble: rgba(167, 139, 250, 0.14);
--danger: #ef4444;
color-scheme: dark;
}
@media (prefers-color-scheme: light) {
:root {
--bg: #fafafa;
--panel: rgba(0, 0, 0, 0.04);
--panel-strong: rgba(0, 0, 0, 0.07);
--border: rgba(0, 0, 0, 0.1);
--text: #18181b;
--text-dim: #52525b;
--text-faint: #a1a1aa;
--user-bubble: rgba(37, 99, 235, 0.1);
--agent-bubble: rgba(124, 58, 237, 0.1);
color-scheme: light;
}
}
* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; }
body {
font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
background: var(--bg);
color: var(--text);
min-height: 100vh;
display: flex;
justify-content: center;
align-items: flex-start;
padding: calc(2rem + env(safe-area-inset-top)) calc(1rem + env(safe-area-inset-right))
calc(2rem + env(safe-area-inset-bottom)) calc(1rem + env(safe-area-inset-left));
}
.container {
width: 100%;
max-width: 680px;
}
header {
text-align: center;
margin-bottom: 1.5rem;
}
h1 {
font-size: 2rem;
font-weight: 700;
background: linear-gradient(135deg, var(--accent-1), var(--accent-2));
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
background-clip: text;
}
.subtitle {
color: var(--text-faint);
margin-top: 0.5rem;
font-size: 0.9rem;
}
/* ── Orb ─────────────────────────────────────────────────────────────────── */
.orb-stage {
display: flex;
flex-direction: column;
align-items: center;
margin-bottom: 1.75rem;
}
.orb {
--pulse-scale: 1;
position: relative;
width: 200px;
height: 200px;
display: grid;
place-items: center;
}
.orb-core {
width: 130px;
height: 130px;
border-radius: 50%;
background: radial-gradient(circle at 35% 30%, var(--accent-1), var(--accent-2) 70%);
box-shadow:
0 0 60px 8px color-mix(in srgb, var(--accent-2) 45%, transparent),
inset 0 0 30px rgba(255, 255, 255, 0.15);
transform: scale(var(--pulse-scale));
transition: box-shadow 0.3s ease;
animation: breathe 4s ease-in-out infinite;
}
.orb-ring {
position: absolute;
inset: 0;
border-radius: 50%;
border: 1px solid color-mix(in srgb, var(--accent-2) 35%, transparent);
opacity: var(--pulse-opacity, 0.35);
transform: scale(var(--pulse-scale));
transition: opacity 0.2s ease;
}
/* Per-state glow */
.orb[data-state="idle"] .orb-core {
filter: saturate(0.5) brightness(0.75);
box-shadow: 0 0 30px 4px color-mix(in srgb, var(--accent-2) 25%, transparent);
}
.orb[data-state="connecting"] .orb-core {
animation-duration: 1.6s;
filter: saturate(0.8) brightness(0.9);
}
.orb[data-state="listening"] .orb-core {
box-shadow: 0 0 70px 12px color-mix(in srgb, var(--accent-1) 55%, transparent),
inset 0 0 30px rgba(255, 255, 255, 0.18);
}
.orb[data-state="thinking"] .orb-core {
animation-duration: 2s;
filter: saturate(1.1) brightness(1.05);
box-shadow: 0 0 75px 14px color-mix(in srgb, var(--accent-2) 60%, transparent),
inset 0 0 30px rgba(255, 255, 255, 0.2);
}
.orb[data-state="speaking"] .orb-core {
animation: none;
box-shadow: 0 0 90px 18px color-mix(in srgb, var(--accent-1) 65%, transparent),
inset 0 0 34px rgba(255, 255, 255, 0.22);
}
@keyframes breathe {
0%, 100% { transform: scale(calc(var(--pulse-scale) * 1)); }
50% { transform: scale(calc(var(--pulse-scale) * 1.05)); }
}
.orb-labels {
display: flex;
flex-direction: column;
align-items: center;
gap: 0.4rem;
margin-top: 1rem;
min-height: 3.6rem;
}
.state-label {
font-size: 0.85rem;
font-weight: 600;
letter-spacing: 0.08em;
text-transform: uppercase;
color: var(--text-dim);
}
.thinking-chip {
font-size: 0.75rem;
padding: 0.25rem 0.75rem;
border-radius: 999px;
background: var(--panel-strong);
border: 1px solid var(--border);
color: var(--text-dim);
animation: chipPulse 1.4s ease-in-out infinite;
}
@keyframes chipPulse {
0%, 100% { opacity: 0.55; }
50% { opacity: 1; }
}
.barge-hint {
font-size: 0.75rem;
color: var(--text-faint);
opacity: 0.6;
}
/* ── Controls ────────────────────────────────────────────────────────────── */
.controls {
display: flex;
gap: 0.75rem;
justify-content: center;
align-items: center;
margin-bottom: 1.25rem;
}
.btn {
padding: 0.75rem 2rem;
border: none;
border-radius: 8px;
font-size: 1rem;
font-weight: 600;
cursor: pointer;
transition: all 0.2s;
font-family: inherit;
}
.btn:disabled {
opacity: 0.4;
cursor: not-allowed;
}
.btn-primary {
background: #3b82f6;
color: white;
}
.btn-primary:hover:not(:disabled) {
background: #2563eb;
transform: translateY(-1px);
}
.btn-danger {
background: var(--danger);
color: white;
}
.btn-danger:hover:not(:disabled) {
background: #dc2626;
}
.btn-icon {
display: grid;
place-items: center;
width: 44px;
height: 44px;
padding: 0;
border-radius: 50%;
background: var(--panel);
color: var(--text-dim);
border: 1px solid var(--border);
}
.btn-icon:hover {
color: var(--text);
background: var(--panel-strong);
}
.btn-icon.muted {
color: #ef4444;
border-color: #ef4444;
background: rgba(239, 68, 68, 0.1);
}
.btn-ghost {
background: transparent;
color: var(--text-faint);
padding: 0.4rem 0.75rem;
font-size: 0.8rem;
border-radius: 6px;
}
.btn-ghost:hover {
color: var(--text);
background: var(--panel-strong);
}
/* ── Status + mic meter ──────────────────────────────────────────────────── */
.status {
text-align: center;
padding: 0.75rem;
background: var(--panel);
border: 1px solid var(--border);
border-radius: 8px;
margin-bottom: 0.6rem;
font-size: 0.9rem;
color: var(--text-dim);
}
.mic-meter {
height: 4px;
background: var(--panel-strong);
border-radius: 2px;
margin-bottom: 1.5rem;
overflow: hidden;
}
.mic-meter-fill {
display: block;
height: 100%;
width: 0%;
background: linear-gradient(90deg, var(--accent-1), var(--accent-2));
border-radius: 2px;
transition: width 0.1s linear;
}
/* ── Transcript ──────────────────────────────────────────────────────────── */
.transcript {
background: var(--panel);
backdrop-filter: blur(12px);
-webkit-backdrop-filter: blur(12px);
border: 1px solid var(--border);
border-radius: 12px;
padding: 1rem;
max-height: 50vh;
overflow-y: auto;
}
.transcript-header {
display: flex;
align-items: center;
justify-content: space-between;
font-weight: 700;
color: var(--text-dim);
margin-bottom: 1rem;
font-size: 0.85rem;
text-transform: uppercase;
letter-spacing: 0.05em;
}
.message-row {
display: flex;
align-items: flex-end;
gap: 0.5rem;
margin-bottom: 0.6rem;
position: relative;
animation: msgIn 120ms ease-out;
}
@keyframes msgIn {
from { opacity: 0; transform: translateY(6px); }
to { opacity: 1; transform: translateY(0); }
}
.message-row.user {
justify-content: flex-end;
}
.avatar-dot {
width: 24px;
height: 24px;
border-radius: 50%;
background: linear-gradient(135deg, var(--accent-1), var(--accent-2));
flex-shrink: 0;
margin-bottom: 2px;
}
.bubble {
max-width: 78%;
padding: 0.6rem 0.9rem;
border-radius: 14px;
font-size: 0.95rem;
line-height: 1.5;
position: relative;
}
.message-row.user .bubble {
background: var(--user-bubble);
border-bottom-right-radius: 4px;
}
.message-row.agent .bubble {
background: var(--agent-bubble);
border-bottom-left-radius: 4px;
}
.bubble.partial {
opacity: 0.55;
}
/* Timestamps on hover (CSS only, from data-ts attribute) */
.message-row::after {
content: attr(data-ts);
position: absolute;
bottom: -1.1rem;
font-size: 0.68rem;
color: var(--text-faint);
opacity: 0;
transition: opacity 0.15s ease;
pointer-events: none;
}
.message-row:hover::after {
opacity: 1;
}
.message-row.user::after {
right: 0;
}
.message-row.agent::after {
left: 2rem;
}
/* ── Agent audio visualizer (bars on latest agent bubble) ─────────────────── */
.audio-viz {
display: inline-flex;
align-items: flex-end;
gap: 2px;
height: 14px;
margin-left: 0.6rem;
vertical-align: middle;
}
.audio-viz i {
width: 3px;
height: 15%;
border-radius: 2px;
background: linear-gradient(180deg, var(--accent-2), var(--accent-1));
opacity: 0.8;
transition: height 0.08s linear;
}
/* ── Settings sheet (voice picker) ───────────────────────────────────────── */
.sheet-backdrop {
position: fixed;
inset: 0;
background: rgba(0, 0, 0, 0.5);
z-index: 90;
opacity: 0;
transition: opacity 0.2s ease;
}
.sheet-backdrop:not([hidden]) {
opacity: 1;
}
.settings-sheet {
position: fixed;
left: 50%;
bottom: 0;
transform: translate(-50%, 100%);
width: 100%;
max-width: 680px;
max-height: 75vh;
background: var(--panel-strong);
backdrop-filter: blur(12px);
-webkit-backdrop-filter: blur(12px);
border: 1px solid var(--border);
border-bottom: none;
border-radius: 16px 16px 0 0;
padding: 0.75rem 1.25rem calc(1.25rem + env(safe-area-inset-bottom));
z-index: 100;
transition: transform 0.25s cubic-bezier(0.32, 0.72, 0, 1);
display: flex;
flex-direction: column;
}
.settings-sheet.open {
transform: translate(-50%, 0);
}
.sheet-handle {
width: 36px;
height: 4px;
border-radius: 2px;
background: var(--border);
margin: 0 auto 0.75rem;
}
.sheet-header {
display: flex;
align-items: center;
justify-content: space-between;
margin-bottom: 1rem;
}
.sheet-header h2 {
font-size: 1.1rem;
font-weight: 700;
}
.voice-list {
overflow-y: auto;
display: flex;
flex-direction: column;
gap: 0.5rem;
padding-right: 0.25rem;
}
.voice-card {
display: flex;
align-items: center;
justify-content: space-between;
gap: 0.75rem;
padding: 0.8rem 1rem;
border-radius: 10px;
background: var(--panel);
border: 1px solid var(--border);
cursor: pointer;
transition: all 0.15s ease;
}
.voice-card:hover {
background: var(--panel-strong);
}
.voice-card.active {
border-color: color-mix(in srgb, var(--accent-2) 60%, transparent);
background: var(--agent-bubble);
}
.voice-name {
font-size: 0.95rem;
font-weight: 500;
}
/* ── Scrollbar ───────────────────────────────────────────────────────────── */
.transcript::-webkit-scrollbar,
.voice-list::-webkit-scrollbar { width: 6px; }
.transcript::-webkit-scrollbar-track,
.voice-list::-webkit-scrollbar-track { background: transparent; }
.transcript::-webkit-scrollbar-thumb,
.voice-list::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
/* ── Task panel ──────────────────────────────────────────────────────────── */
.tasks-fab {
position: fixed;
bottom: calc(1.5rem + env(safe-area-inset-bottom));
right: 1.5rem;
z-index: 100;
}
.tasks-badge {
position: absolute;
top: -4px;
right: -4px;
background: #3b82f6;
color: #fff;
font-size: 0.65rem;
font-weight: 700;
min-width: 18px;
height: 18px;
border-radius: 9px;
display: grid;
place-items: center;
padding: 0 4px;
}
.tasks-panel {
position: fixed;
top: 0;
right: -320px;
width: 320px;
max-width: 85vw;
height: 100dvh;
background: var(--panel);
border-left: 1px solid var(--border);
z-index: 200;
display: flex;
flex-direction: column;
transition: right 0.25s ease;
}
.tasks-panel.open {
right: 0;
}
.tasks-header {
display: flex;
align-items: center;
justify-content: space-between;
padding: 1rem;
border-bottom: 1px solid var(--border);
}
.tasks-header h2 {
font-size: 1rem;
margin: 0;
}
.tasks-list {
flex: 1;
overflow-y: auto;
padding: 0.75rem;
display: flex;
flex-direction: column;
gap: 0.75rem;
}
.tasks-empty {
color: var(--text-faint);
font-size: 0.85rem;
text-align: center;
margin-top: 2rem;
}
.task-card {
background: var(--panel-strong);
border: 1px solid var(--border);
border-radius: 10px;
padding: 0.75rem;
font-size: 0.82rem;
}
.task-card-header {
display: flex;
align-items: center;
gap: 0.5rem;
margin-bottom: 0.4rem;
}
.task-status-dot {
width: 8px;
height: 8px;
border-radius: 50%;
background: #6b7280;
flex-shrink: 0;
}
.task-status-dot.running {
background: #3b82f6;
animation: pulse-dot 1.5s infinite;
}
.task-status-dot.completed {
background: #22c55e;
}
.task-status-dot.failed {
background: #ef4444;
}
@keyframes pulse-dot {
0%, 100% { opacity: 1; }
50% { opacity: 0.4; }
}
.task-desc {
font-weight: 600;
color: var(--text);
flex: 1;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.task-steps {
margin-top: 0.5rem;
padding-left: 0;
list-style: none;
display: flex;
flex-direction: column;
gap: 0.3rem;
max-height: 200px;
overflow-y: auto;
}
.task-step {
font-size: 0.75rem;
color: var(--text-dim);
padding: 0.25rem 0.4rem;
border-radius: 4px;
background: rgba(0,0,0,0.15);
}
.task-step.tool_call {
color: #60a5fa;
}
.task-step.tool_result {
color: var(--text-faint);
}
.task-step.text {
color: var(--text);
font-weight: 500;
}
.task-result {
margin-top: 0.5rem;
padding: 0.5rem;
background: rgba(34, 197, 94, 0.1);
border-radius: 6px;
font-size: 0.8rem;
color: var(--text);
}
.task-error {
margin-top: 0.5rem;
padding: 0.5rem;
background: rgba(239, 68, 68, 0.1);
border-radius: 6px;
font-size: 0.8rem;
color: #fca5a5;
}
/* ── Reduced motion ──────────────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
.orb-core,
.thinking-chip,
.message-row,
.settings-sheet,
.sheet-backdrop,
.tasks-panel,
.audio-viz i,
.mic-meter-fill {
animation: none !important;
transition: none !important;
}
}