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.
This commit is contained in:
+173
@@ -510,6 +510,178 @@ h1 {
|
||||
.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,
|
||||
@@ -517,6 +689,7 @@ h1 {
|
||||
.message-row,
|
||||
.settings-sheet,
|
||||
.sheet-backdrop,
|
||||
.tasks-panel,
|
||||
.audio-viz i,
|
||||
.mic-meter-fill {
|
||||
animation: none !important;
|
||||
|
||||
Reference in New Issue
Block a user