claude-code-kanban 3.9.0 → 3.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/parsers.js CHANGED
@@ -115,6 +115,20 @@ function parseJsonlLine(line) {
115
115
  }
116
116
 
117
117
  const TOOL_RESULT_MAX = 1500;
118
+ const USER_TEXT_MAX = 500;
119
+ const INTERRUPT_MARKER = '[Request interrupted by user]';
120
+
121
+ function pushUserMessage(messages, text, timestamp, sysLabel) {
122
+ if (sysLabel === '__skip__') return;
123
+ const truncated = text.length > USER_TEXT_MAX;
124
+ messages.push({
125
+ type: 'user',
126
+ text: truncated ? text.slice(0, USER_TEXT_MAX) + '...' : text,
127
+ fullText: truncated ? text : null,
128
+ timestamp,
129
+ ...(sysLabel && { systemLabel: sysLabel })
130
+ });
131
+ }
118
132
 
119
133
  // Cache: jsonlPath -> { scannedUpTo, customTitle }
120
134
  // Only re-scan the new bytes appended since last scan
@@ -516,17 +530,16 @@ function readRecentMessages(jsonlPath, limit = 10) {
516
530
  });
517
531
  continue;
518
532
  }
519
- const sysLabel = getSystemMessageLabel(t);
520
- if (sysLabel === '__skip__') continue;
521
- const uTruncated = t.length > 500;
522
- messages.push({
523
- type: 'user',
524
- text: uTruncated ? t.slice(0, 500) + '...' : t,
525
- fullText: uTruncated ? t : null,
526
- timestamp: obj.timestamp,
527
- ...(sysLabel && { systemLabel: sysLabel })
528
- });
533
+ pushUserMessage(messages, t, obj.timestamp, getSystemMessageLabel(t));
529
534
  } else if (Array.isArray(obj.message.content)) {
535
+ const joined = obj.message.content
536
+ .filter(b => b.type === 'text' && typeof b.text === 'string' && b.text)
537
+ .map(b => b.text)
538
+ .join('\n')
539
+ .trim();
540
+ if (joined && joined !== INTERRUPT_MARKER) {
541
+ pushUserMessage(messages, joined, obj.timestamp, getSystemMessageLabel(joined));
542
+ }
530
543
  for (const block of obj.message.content) {
531
544
  if (block.type === 'tool_result' && block.tool_use_id) {
532
545
  let resultText = '';
@@ -633,6 +646,9 @@ function readMessagesPage(jsonlPath, limit = 10, beforeTimestamp = null) {
633
646
  function buildSessionDigest(jsonlPath) {
634
647
  const map = {};
635
648
  const terminated = new Map();
649
+ const rejectedToolUseIds = new Set();
650
+ const promptByToolUseId = {};
651
+ const killedAgentIds = new Set();
636
652
  try {
637
653
  const content = readFileSync(jsonlPath, 'utf8');
638
654
  const re = /"type":"agent_progress"[^}]*"agentId":"([^"]+)"/;
@@ -642,6 +658,7 @@ function buildSessionDigest(jsonlPath) {
642
658
  const bgAgentIdRe = /agentId: ([a-zA-Z0-9_@-]+)/;
643
659
  const tmToolIdRe = /"tool_use_id":"([^"]+)"/;
644
660
  const tmAgentIdRe = /agent_id: ([a-zA-Z0-9_@-]+)/;
661
+ const taskIdRe = /<task-id>([a-zA-Z0-9_-]+)<\/task-id>/;
645
662
  const nameByToolUseId = {};
646
663
  const descByToolUseId = {};
647
664
  for (const line of content.split('\n')) {
@@ -708,10 +725,18 @@ function buildSessionDigest(jsonlPath) {
708
725
  if (b.type === 'tool_use' && b.name === 'Agent' && b.id) {
709
726
  if (b.input?.name) nameByToolUseId[b.id] = b.input.name;
710
727
  if (b.input?.description) descByToolUseId[b.id] = b.input.description;
728
+ if (b.input?.prompt) promptByToolUseId[b.id] = b.input.prompt;
711
729
  }
712
730
  }
713
731
  }
714
732
  } catch (_) {}
733
+ } else if (line.includes('User rejected tool use') && line.includes('"tool_use_id"')) {
734
+ const m = tmToolIdRe.exec(line);
735
+ if (m) rejectedToolUseIds.add(m[1]);
736
+ } else if (line.includes('<task-notification>') &&
737
+ (line.includes('<status>killed</status>') || line.includes('<status>error</status>'))) {
738
+ const idMatch = taskIdRe.exec(line);
739
+ if (idMatch) killedAgentIds.add(idMatch[1]);
715
740
  } else if (line.includes('"toolUseResult"') && line.includes('"agentId"') && line.includes('"tool_result"')) {
716
741
  try {
717
742
  const obj = JSON.parse(line);
@@ -734,7 +759,15 @@ function buildSessionDigest(jsonlPath) {
734
759
  if (descByToolUseId[key]) entry.description = descByToolUseId[key];
735
760
  }
736
761
  } catch (_) {}
737
- return { progressMap: map, terminated };
762
+ const rejectedAgentIds = new Set();
763
+ const rejectedPrompts = new Set();
764
+ for (const toolUseId of rejectedToolUseIds) {
765
+ const entry = map[toolUseId];
766
+ if (entry?.agentId) rejectedAgentIds.add(entry.agentId);
767
+ const prompt = entry?.prompt || promptByToolUseId[toolUseId];
768
+ if (prompt) rejectedPrompts.add(prompt);
769
+ }
770
+ return { progressMap: map, terminated, rejectedAgentIds, rejectedPrompts, killedAgentIds };
738
771
  }
739
772
 
740
773
  function buildAgentProgressMap(jsonlPath) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claude-code-kanban",
3
- "version": "3.9.0",
3
+ "version": "3.10.0",
4
4
  "description": "A web-based Kanban board for viewing Claude Code tasks with agent teams support",
5
5
  "main": "server.js",
6
6
  "bin": {
package/public/app.js CHANGED
@@ -4,6 +4,8 @@ let currentSessionId = null;
4
4
  let currentTasks = [];
5
5
  let viewMode = 'session';
6
6
  let sessionFilter = 'active';
7
+ // Only meaningful while sessionFilter === 'active' (filterBySessions clears it otherwise)
8
+ const activityFilter = new Set(); // kinds: 'waiting' | 'active'
7
9
  let sessionLimit = '20';
8
10
  let filterProject = '__recent__'; // null = all, '__recent__' = last 24h, or project path
9
11
  let recentProjects = new Set();
@@ -144,7 +146,6 @@ const inProgressCount = document.getElementById('in-progress-count');
144
146
  const completedCount = document.getElementById('completed-count');
145
147
  const detailPanel = document.getElementById('detail-panel');
146
148
  const detailContent = document.getElementById('detail-content');
147
- const connectionStatus = document.getElementById('connection-status');
148
149
  const CONTENT_TRUNCATE_MAX = 1500;
149
150
  const COLUMNS = [{ el: pendingTasks }, { el: inProgressTasks }, { el: completedTasks }];
150
151
 
@@ -186,7 +187,7 @@ async function fetchSessions(includeTasks = true) {
186
187
 
187
188
  sessions = newSessions;
188
189
  renderSessions();
189
- renderLiveUpdatesFromCache();
190
+ renderActivityChip();
190
191
  } catch (error) {
191
192
  console.error('Failed to fetch sessions:', error);
192
193
  }
@@ -412,15 +413,7 @@ function fuzzyMatch(text, query) {
412
413
 
413
414
  //#endregion
414
415
 
415
- //#region LIVE_UPDATES
416
- function renderLiveUpdatesFromCache() {
417
- let activeTasks = allTasksCache.filter((t) => t.status === 'in_progress' && !isInternalTask(t));
418
- if (filterProject) {
419
- activeTasks = activeTasks.filter((t) => matchesProjectFilter(t.project));
420
- }
421
- renderLiveUpdates(activeTasks);
422
- }
423
-
416
+ // biome-ignore lint/correctness/noUnusedVariables: used in HTML
424
417
  function toggleSection(containerId, chevronId) {
425
418
  const container = document.getElementById(containerId);
426
419
  const chevron = document.getElementById(chevronId);
@@ -429,38 +422,90 @@ function toggleSection(containerId, chevronId) {
429
422
  localStorage.setItem(`${containerId}Collapsed`, collapsed);
430
423
  }
431
424
 
432
- // biome-ignore lint/correctness/noUnusedVariables: used in HTML
433
- function toggleLiveUpdates() {
434
- toggleSection('live-updates', 'live-updates-chevron');
425
+ function isWaitingSession(s) {
426
+ return !!s.hasWaitingForUser;
427
+ }
428
+ function isActiveSession(s) {
429
+ return !s.hasWaitingForUser && (s.inProgress > 0 || s.hasRecentLog || s.hasRunningAgents);
435
430
  }
436
431
 
437
- function renderLiveUpdates(activeTasks) {
438
- const container = document.getElementById('live-updates');
432
+ const ACTIVITY_PREDICATES = {
433
+ waiting: isWaitingSession,
434
+ active: isActiveSession,
435
+ };
439
436
 
440
- if (activeTasks.length === 0) {
441
- container.innerHTML = '<div class="live-empty">No active tasks</div>';
442
- return;
443
- }
437
+ let lastChipKey = '';
444
438
 
445
- container.innerHTML = activeTasks
446
- .map(
447
- (task) => `
448
- <div class="live-item" onclick="openLiveTask('${task.sessionId}', '${task.id}')">
449
- <span class="pulse"></span>
450
- <div class="live-item-content">
451
- <div class="live-item-action" title="${escapeHtml(task.activeForm || task.subject)}">${escapeHtml(task.activeForm || task.subject)}</div>
452
- <div class="live-item-session" title="${escapeHtml(task.sessionName || task.sessionId)}">${escapeHtml(task.sessionName || task.sessionId)}</div>
453
- </div>
454
- </div>
455
- `,
456
- )
439
+ function renderActivityChip() {
440
+ const container = document.getElementById('activity-chips');
441
+ if (!container) return;
442
+
443
+ let waiting = 0;
444
+ let active = 0;
445
+ for (const s of sessions) {
446
+ if (s.hasWaitingForUser) waiting++;
447
+ else if (s.inProgress > 0 || s.hasRecentLog || s.hasRunningAgents) active++;
448
+ }
449
+
450
+ const key = `${waiting}|${active}|${[...activityFilter].sort().join(',')}`;
451
+ if (key === lastChipKey) return;
452
+ lastChipKey = key;
453
+
454
+ const chips = [
455
+ {
456
+ kind: 'waiting',
457
+ count: waiting,
458
+ label: `${waiting} waiting`,
459
+ title: `${waiting} session${waiting === 1 ? '' : 's'} waiting for input`,
460
+ },
461
+ {
462
+ kind: 'active',
463
+ count: active,
464
+ label: `${active} active`,
465
+ title: `${active} session${active === 1 ? '' : 's'} with running work or recent activity`,
466
+ },
467
+ ];
468
+
469
+ container.innerHTML = chips
470
+ .map((c) => {
471
+ const isOn = activityFilter.has(c.kind);
472
+ const classes = [
473
+ 'activity-chip',
474
+ `activity-${c.kind}`,
475
+ c.count === 0 ? 'activity-zero' : '',
476
+ isOn ? 'activity-filter-on' : '',
477
+ ]
478
+ .filter(Boolean)
479
+ .join(' ');
480
+ const hint = isOn ? ' — click to clear filter' : ` — click to filter to ${c.kind}`;
481
+ return `
482
+ <button type="button"
483
+ class="${classes}"
484
+ onclick="setActivityFilter('${c.kind}')"
485
+ aria-pressed="${isOn ? 'true' : 'false'}"
486
+ title="${escapeHtml(c.title + hint)}">
487
+ <span class="activity-dot"></span>
488
+ <span class="activity-label">${escapeHtml(c.label)}</span>
489
+ </button>
490
+ `;
491
+ })
457
492
  .join('');
458
493
  }
459
494
 
460
495
  // biome-ignore lint/correctness/noUnusedVariables: used in HTML
461
- async function openLiveTask(sessionId, taskId) {
462
- await fetchTasks(sessionId);
463
- showTaskDetail(taskId, sessionId);
496
+ function setActivityFilter(kind) {
497
+ if (activityFilter.has(kind)) activityFilter.delete(kind);
498
+ else activityFilter.add(kind);
499
+ // active/waiting only make sense with the active session filter on
500
+ const targetFilter = activityFilter.size > 0 ? 'active' : sessionFilter;
501
+ if (targetFilter !== sessionFilter) {
502
+ sessionFilter = targetFilter;
503
+ const dropdown = document.getElementById('session-filter');
504
+ if (dropdown) dropdown.value = targetFilter;
505
+ updateUrl();
506
+ }
507
+ renderSessions();
508
+ renderActivityChip();
464
509
  }
465
510
 
466
511
  let lastCurrentTasksHash = '';
@@ -2239,7 +2284,7 @@ async function showAllTasks() {
2239
2284
  updateUrl();
2240
2285
  renderAllTasks();
2241
2286
  renderSessions();
2242
- renderLiveUpdatesFromCache();
2287
+ renderActivityChip();
2243
2288
  } catch (error) {
2244
2289
  console.error('Failed to fetch all tasks:', error);
2245
2290
  }
@@ -2313,7 +2358,11 @@ function renderSessions() {
2313
2358
  filteredSessions = filteredSessions.filter((s) => matchesProjectFilter(s.project));
2314
2359
  }
2315
2360
 
2316
- // Apply search filter
2361
+ if (activityFilter.size > 0) {
2362
+ const preds = [...activityFilter].map((k) => ACTIVITY_PREDICATES[k]).filter(Boolean);
2363
+ if (preds.length) filteredSessions = filteredSessions.filter((s) => preds.some((p) => p(s)));
2364
+ }
2365
+
2317
2366
  if (searchQuery) {
2318
2367
  const taskMatchIds = new Set();
2319
2368
  for (const t of allTasksCache) {
@@ -2334,7 +2383,7 @@ function renderSessions() {
2334
2383
  filteredSessions = filteredSessions.filter(matchesSearch);
2335
2384
 
2336
2385
  // Re-add pinned/sticky sessions that match the query but were excluded by active filter
2337
- if (pinnedSessionIds.size > 0 || stickySessionIds.size > 0) {
2386
+ if (activityFilter.size === 0 && (pinnedSessionIds.size > 0 || stickySessionIds.size > 0)) {
2338
2387
  const filteredIds = new Set(filteredSessions.map((s) => s.id));
2339
2388
  const missingPinned = sessions.filter((s) => isAnyPinned(s.id) && !filteredIds.has(s.id) && matchesSearch(s));
2340
2389
  if (missingPinned.length) filteredSessions = [...missingPinned, ...filteredSessions];
@@ -2342,7 +2391,8 @@ function renderSessions() {
2342
2391
  }
2343
2392
 
2344
2393
  // Include pinned/sticky sessions even if they don't match active/recent filter
2345
- if (!searchQuery && (pinnedSessionIds.size > 0 || stickySessionIds.size > 0)) {
2394
+ // (skipped when an activity chip filter is on — user explicitly asked for a slice)
2395
+ if (activityFilter.size === 0 && !searchQuery && (pinnedSessionIds.size > 0 || stickySessionIds.size > 0)) {
2346
2396
  const filteredIds = new Set(filteredSessions.map((s) => s.id));
2347
2397
  const missingPinned = sessions.filter((s) => isAnyPinned(s.id) && !filteredIds.has(s.id));
2348
2398
  if (missingPinned.length) filteredSessions = [...missingPinned, ...filteredSessions];
@@ -3546,7 +3596,6 @@ async function refreshCurrentView() {
3546
3596
  await showAllTasks();
3547
3597
  } else if (currentSessionId) {
3548
3598
  await fetchTasks(currentSessionId);
3549
- renderLiveUpdatesFromCache();
3550
3599
  } else {
3551
3600
  await fetchSessions();
3552
3601
  }
@@ -3997,7 +4046,6 @@ function _renderStorageLinkedDocs() {
3997
4046
  }
3998
4047
 
3999
4048
  function _storagePreviewLinkedDoc(path) {
4000
- closeStorageManager();
4001
4049
  openPreviewByPath(path);
4002
4050
  }
4003
4051
 
@@ -4305,6 +4353,33 @@ document.addEventListener('keydown', (e) => {
4305
4353
  hubNavigate('memory', mSession?.project ? `?project=${encodeURIComponent(mSession.project)}` : undefined);
4306
4354
  return;
4307
4355
  }
4356
+ if (e.ctrlKey && !e.altKey && !e.shiftKey && !e.metaKey && e.key === 'd') {
4357
+ e.preventDefault();
4358
+ if (!contextSid || dismissedSessionIds.has(contextSid)) return;
4359
+ const prevIdx = selectedSessionIdx;
4360
+ dismissedSessionIds.add(contextSid);
4361
+ updateDismissBtnState();
4362
+ renderSessions();
4363
+ const newItems = getNavigableItems();
4364
+ const targetIdx = newItems.length > 0 ? Math.max(0, prevIdx - 1) : -1;
4365
+ // If the dismissed session is currently open, navigate to the previous one
4366
+ if (currentSessionId === contextSid || selectedSessionId === contextSid) {
4367
+ selectedSessionId = null;
4368
+ if (targetIdx >= 0) {
4369
+ const targetSid = newItems[targetIdx]?.dataset?.sessionId;
4370
+ if (targetSid) {
4371
+ fetchTasks(targetSid).then(() => selectSessionByIndex(targetIdx, getNavigableItems()));
4372
+ } else {
4373
+ showAllTasks().then(() => selectSessionByIndex(targetIdx, getNavigableItems()));
4374
+ }
4375
+ } else {
4376
+ showAllTasks();
4377
+ }
4378
+ } else if (targetIdx >= 0) {
4379
+ selectSessionByIndex(targetIdx, newItems);
4380
+ }
4381
+ return;
4382
+ }
4308
4383
  if (e.code === 'KeyC' && e.shiftKey) {
4309
4384
  e.preventDefault();
4310
4385
  if (!contextSid) {
@@ -4624,20 +4699,12 @@ function setupEventSource() {
4624
4699
  wasConnected = true;
4625
4700
  retryDelay = 1000;
4626
4701
  hideOffline();
4627
- connectionStatus.innerHTML = `
4628
- <span class="connection-dot live"></span>
4629
- <span>Connected</span>
4630
- `;
4631
4702
  };
4632
4703
 
4633
4704
  eventSource.onerror = () => {
4634
4705
  eventSource.close();
4635
4706
  failCount++;
4636
4707
  console.warn('[SSE] Connection lost, retrying in', retryDelay, 'ms');
4637
- connectionStatus.innerHTML = `
4638
- <span class="connection-dot error"></span>
4639
- <span>Reconnecting...</span>
4640
- `;
4641
4708
  if (failCount >= 2) showOffline();
4642
4709
  setTimeout(connect, retryDelay);
4643
4710
  retryDelay = Math.min(retryDelay * 2, 30000);
@@ -4667,7 +4734,7 @@ function setupEventSource() {
4667
4734
  if (viewMode === 'all') {
4668
4735
  currentTasks = filterProject ? allTasksCache.filter((t) => matchesProjectFilter(t.project)) : allTasksCache;
4669
4736
  renderAllTasks();
4670
- renderLiveUpdatesFromCache();
4737
+ renderActivityChip();
4671
4738
  } else if (viewMode === 'project' && currentProjectPath) {
4672
4739
  const hasUpdate = currentProjectSessionIds.some((id) => pendingTaskSessionIds.has(id));
4673
4740
  if (hasUpdate) fetchProjectView(currentProjectPath);
@@ -5096,8 +5163,10 @@ function getOwnerColor(name) {
5096
5163
  // biome-ignore lint/correctness/noUnusedVariables: used in HTML
5097
5164
  function filterBySessions(value) {
5098
5165
  sessionFilter = value;
5166
+ if (value !== 'active') activityFilter.clear();
5099
5167
  updateUrl();
5100
5168
  renderSessions();
5169
+ renderActivityChip();
5101
5170
  }
5102
5171
 
5103
5172
  // biome-ignore lint/correctness/noUnusedVariables: used in HTML
@@ -5360,7 +5429,7 @@ function initPanelResize(panelId, handleId, cssVar, storageKey) {
5360
5429
  });
5361
5430
 
5362
5431
  function onMove(e) {
5363
- const w = Math.min(900, Math.max(320, startWidth - (e.clientX - startX)));
5432
+ const w = Math.max(200, startWidth - (e.clientX - startX));
5364
5433
  panel.style.setProperty(cssVar, `${w}px`);
5365
5434
  }
5366
5435
 
@@ -5784,15 +5853,6 @@ function filterByOwner(value) {
5784
5853
 
5785
5854
  //#endregion
5786
5855
 
5787
- //#region LAYOUT_SYNC
5788
- const sidebarHeader = document.querySelector('.sidebar-header');
5789
- const viewHeader = document.querySelector('.view-header');
5790
- new ResizeObserver(() => {
5791
- sidebarHeader.style.height = `${viewHeader.offsetHeight}px`;
5792
- }).observe(viewHeader);
5793
-
5794
- //#endregion
5795
-
5796
5856
  //#region PWA
5797
5857
  if ('serviceWorker' in navigator) {
5798
5858
  navigator.serviceWorker.register('/sw.js');
@@ -5802,14 +5862,10 @@ if ('serviceWorker' in navigator) {
5802
5862
 
5803
5863
  //#region INIT
5804
5864
  loadTheme();
5805
- ['live-updates', 'sessions-filters'].forEach((id) => {
5806
- if (localStorage.getItem(`${id}Collapsed`) === 'true') {
5807
- document.getElementById(id).classList.add('collapsed');
5808
- document
5809
- .getElementById(id === 'live-updates' ? 'live-updates-chevron' : 'sessions-chevron')
5810
- .classList.add('rotated');
5811
- }
5812
- });
5865
+ if (localStorage.getItem('sessions-filtersCollapsed') === 'true') {
5866
+ document.getElementById('sessions-filters').classList.add('collapsed');
5867
+ document.getElementById('sessions-chevron').classList.add('rotated');
5868
+ }
5813
5869
 
5814
5870
  document.addEventListener('DOMContentLoaded', () => {
5815
5871
  if (typeof marked !== 'undefined' && typeof hljs !== 'undefined') {
package/public/index.html CHANGED
@@ -44,18 +44,7 @@
44
44
  <!-- Sidebar -->
45
45
  <aside class="sidebar">
46
46
  <header class="sidebar-header">
47
- <div class="logo">
48
- <div class="logo-mark">
49
- <svg viewBox="4 6 16 12" fill="none" stroke="currentColor" stroke-width="2.5">
50
- <path d="M5 13l4 4L19 7"/>
51
- </svg>
52
- </div>
53
- <span class="logo-text">Dashboard</span>
54
- </div>
55
- <div id="connection-status" class="connection">
56
- <span class="connection-dot"></span>
57
- <span>Connecting</span>
58
- </div>
47
+ <div id="activity-chips" class="activity-chips"></div>
59
48
  <button id="sidebar-toggle" class="sidebar-toggle-btn" onclick="toggleSidebar()" title="Toggle sidebar" aria-label="Toggle sidebar">
60
49
  <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
61
50
  <path d="M15 18l-6-6 6-6"/>
@@ -63,19 +52,6 @@
63
52
  </button>
64
53
  </header>
65
54
 
66
- <!-- Live Updates -->
67
- <div class="sidebar-section">
68
- <div class="section-header" onclick="toggleLiveUpdates()" style="cursor: pointer;">
69
- <span>Live Updates</span>
70
- <svg id="live-updates-chevron" class="collapse-chevron" viewBox="0 0 24 24">
71
- <path d="M6 9l6 6 6-6"/>
72
- </svg>
73
- </div>
74
- <div id="live-updates" class="live-updates">
75
- <div class="live-empty">No active tasks</div>
76
- </div>
77
- </div>
78
-
79
55
  <!-- Tasks -->
80
56
  <div class="sidebar-section flex-1">
81
57
  <div class="section-header" onclick="toggleSection('sessions-filters', 'sessions-chevron')" style="cursor: pointer;">
@@ -413,6 +389,10 @@
413
389
  <td style="padding: 4px 0; color: var(--text-secondary);"><kbd style="background: var(--bg-hover); padding: 2px 6px; border-radius: 4px; font-family: monospace;">I</kbd></td>
414
390
  <td style="padding: 4px 0; color: var(--text-primary);">Open session info</td>
415
391
  </tr>
392
+ <tr>
393
+ <td style="padding: 4px 0; color: var(--text-secondary);"><kbd style="background: var(--bg-hover); padding: 2px 6px; border-radius: 4px; font-family: monospace;">Ctrl+D</kbd></td>
394
+ <td style="padding: 4px 0; color: var(--text-primary);">Dismiss selected session</td>
395
+ </tr>
416
396
  <tr>
417
397
  <td style="padding: 4px 0; color: var(--text-secondary);"><kbd style="background: var(--bg-hover); padding: 2px 6px; border-radius: 4px; font-family: monospace;">D</kbd></td>
418
398
  <td style="padding: 4px 0; color: var(--text-primary);">Delete selected task</td>
package/public/style.css CHANGED
@@ -100,19 +100,118 @@ body::before {
100
100
  }
101
101
 
102
102
  .sidebar-header {
103
- padding: 20px 20px 16px;
103
+ padding: 6px 10px;
104
104
  border-bottom: none;
105
105
  background-image: linear-gradient(to right, transparent, var(--border), transparent);
106
106
  background-size: 100% 1px;
107
107
  background-repeat: no-repeat;
108
108
  background-position: bottom;
109
109
  position: relative;
110
+ display: flex;
111
+ align-items: center;
112
+ justify-content: space-between;
113
+ gap: 8px;
114
+ }
115
+
116
+ .activity-chips {
117
+ display: inline-flex;
118
+ align-items: center;
119
+ gap: 6px;
120
+ flex-wrap: wrap;
121
+ min-width: 0;
122
+ }
123
+
124
+ .activity-chip {
125
+ display: inline-flex;
126
+ align-items: center;
127
+ gap: 7px;
128
+ padding: 4px 10px 4px 9px;
129
+ font: inherit;
130
+ font-size: 11px;
131
+ font-weight: 500;
132
+ letter-spacing: 0.04em;
133
+ color: var(--text-secondary);
134
+ background: var(--bg-deep);
135
+ border: 1px solid var(--border);
136
+ border-radius: 999px;
137
+ white-space: nowrap;
138
+ cursor: pointer;
139
+ transition:
140
+ color 0.2s ease,
141
+ border-color 0.2s ease,
142
+ background 0.2s ease,
143
+ transform 0.1s ease;
144
+ }
145
+
146
+ .activity-chip:hover {
147
+ background: var(--bg-hover);
148
+ border-color: color-mix(in srgb, var(--text-secondary) 30%, var(--border));
149
+ }
150
+
151
+ .activity-chip:active {
152
+ transform: scale(0.97);
153
+ }
154
+
155
+ .activity-chip.activity-filter-on {
156
+ background: color-mix(in srgb, var(--accent) 14%, var(--bg-deep));
157
+ border-color: var(--accent);
158
+ box-shadow: inset 0 0 0 1px var(--accent);
159
+ }
160
+ .activity-chip.activity-waiting.activity-filter-on {
161
+ border-color: var(--warning);
162
+ box-shadow: inset 0 0 0 1px var(--warning);
163
+ background: color-mix(in srgb, var(--warning) 14%, var(--bg-deep));
164
+ }
165
+
166
+ .activity-dot {
167
+ width: 6px;
168
+ height: 6px;
169
+ border-radius: 50%;
170
+ background: var(--text-muted);
171
+ flex-shrink: 0;
172
+ transition:
173
+ background 0.2s ease,
174
+ box-shadow 0.2s ease;
175
+ }
176
+
177
+ .activity-chip.activity-zero {
178
+ color: var(--text-tertiary);
179
+ border-color: var(--border);
180
+ opacity: 0.6;
181
+ }
182
+ .activity-chip.activity-zero .activity-dot {
183
+ background: var(--text-muted);
184
+ box-shadow: none;
185
+ animation: none;
186
+ }
187
+ .activity-chip.activity-zero:hover {
188
+ opacity: 1;
189
+ }
190
+
191
+ .activity-chip.activity-waiting {
192
+ color: var(--warning);
193
+ border-color: color-mix(in srgb, var(--warning) 40%, var(--border));
194
+ }
195
+ .activity-chip.activity-waiting .activity-dot {
196
+ background: var(--warning);
197
+ box-shadow: 0 0 8px color-mix(in srgb, var(--warning) 60%, transparent);
198
+ }
199
+
200
+ .activity-chip.activity-active {
201
+ color: color-mix(in srgb, var(--accent) 70%, var(--text-secondary));
202
+ border-color: color-mix(in srgb, var(--accent) 18%, var(--border));
203
+ }
204
+ .activity-chip.activity-active .activity-dot {
205
+ background: color-mix(in srgb, var(--accent) 75%, var(--text-secondary));
206
+ box-shadow: 0 0 4px color-mix(in srgb, var(--accent) 30%, transparent);
207
+ animation: pulse 2.5s ease-in-out infinite;
208
+ }
209
+
210
+ .sidebar.collapsed .activity-chips {
211
+ display: none;
110
212
  }
111
213
 
112
214
  .sidebar-toggle-btn {
113
- position: absolute;
114
- top: 20px;
115
- right: 8px;
116
215
  width: 28px;
117
216
  height: 28px;
118
217
  display: flex;
@@ -178,62 +277,6 @@ body::before {
178
277
  background: var(--accent-dim);
179
278
  }
180
279
 
181
- .logo {
182
- display: flex;
183
- align-items: center;
184
- gap: 10px;
185
- }
186
-
187
- .logo-mark {
188
- width: 24px;
189
- height: 24px;
190
- background: var(--accent);
191
- border-radius: 6px;
192
- display: flex;
193
- align-items: center;
194
- justify-content: center;
195
- }
196
-
197
- .logo-mark svg {
198
- width: 14px;
199
- height: 14px;
200
- color: white;
201
- }
202
-
203
- .logo-text {
204
- font-family: var(--serif);
205
- font-size: 17px;
206
- font-weight: 500;
207
- letter-spacing: -0.02em;
208
- }
209
-
210
- .connection {
211
- display: flex;
212
- align-items: center;
213
- gap: 5px;
214
- margin-top: 10px;
215
- font-size: 10px;
216
- color: var(--text-tertiary);
217
- text-transform: uppercase;
218
- letter-spacing: 0.05em;
219
- }
220
-
221
- .connection-dot {
222
- width: 6px;
223
- height: 6px;
224
- border-radius: 50%;
225
- background: var(--warning);
226
- }
227
-
228
- .connection-dot.live {
229
- background: var(--success);
230
- box-shadow: 0 0 8px var(--success);
231
- }
232
-
233
- .connection-dot.error {
234
- background: #ef4444;
235
- }
236
-
237
280
  .offline-overlay {
238
281
  display: none;
239
282
  position: fixed;
@@ -370,7 +413,7 @@ body::before {
370
413
 
371
414
  /* #endregion */
372
415
 
373
- /* #region LIVE_UPDATES */
416
+ /* #region COLLAPSIBLE */
374
417
  .collapse-chevron {
375
418
  width: 14px;
376
419
  height: 14px;
@@ -401,80 +444,6 @@ body::before {
401
444
  overflow: hidden;
402
445
  }
403
446
 
404
- .live-updates {
405
- padding: 0 16px 8px;
406
- max-height: 140px;
407
- overflow-y: auto;
408
- transition:
409
- max-height 0.2s ease,
410
- padding 0.2s ease,
411
- opacity 0.2s ease;
412
- }
413
-
414
- .live-updates.collapsed {
415
- max-height: 0;
416
- padding: 0 16px;
417
- overflow: hidden;
418
- opacity: 0;
419
- }
420
-
421
- .live-empty {
422
- padding: 8px;
423
- text-align: center;
424
- font-size: 11px;
425
- color: var(--text-muted);
426
- }
427
-
428
- .live-item {
429
- display: flex;
430
- align-items: flex-start;
431
- gap: 8px;
432
- padding: 6px 10px;
433
- background: var(--bg-deep);
434
- border: 1px solid transparent;
435
- border-radius: 6px;
436
- margin-bottom: 3px;
437
- cursor: pointer;
438
- transition: all 0.15s ease;
439
- }
440
-
441
- .live-item:hover {
442
- background: var(--bg-hover);
443
- }
444
-
445
- .live-item .pulse {
446
- width: 6px;
447
- height: 6px;
448
- margin-top: 4px;
449
- background: var(--accent);
450
- border-radius: 50%;
451
- flex-shrink: 0;
452
- animation: pulse 2s ease-in-out infinite;
453
- box-shadow: 0 0 8px var(--accent-glow);
454
- }
455
-
456
- .live-item-content {
457
- flex: 1;
458
- min-width: 0;
459
- }
460
-
461
- .live-item-action {
462
- font-size: 11px;
463
- color: var(--text-primary);
464
- white-space: nowrap;
465
- overflow: hidden;
466
- text-overflow: ellipsis;
467
- }
468
-
469
- .live-item-session {
470
- font-size: 10px;
471
- color: var(--text-tertiary);
472
- margin-top: 1px;
473
- white-space: nowrap;
474
- overflow: hidden;
475
- text-overflow: ellipsis;
476
- }
477
-
478
447
  /* #endregion */
479
448
 
480
449
  /* #region SESSIONS */
@@ -762,8 +731,6 @@ body::before {
762
731
  .sidebar.collapsed {
763
732
  width: 48px;
764
733
  }
765
- .sidebar.collapsed .logo-text,
766
- .sidebar.collapsed .connection,
767
734
  .sidebar.collapsed .sidebar-section,
768
735
  .sidebar.collapsed .sidebar-footer {
769
736
  display: none;
@@ -3455,10 +3422,6 @@ pre.mermaid svg {
3455
3422
  }
3456
3423
  }
3457
3424
 
3458
- .connection-dot.live {
3459
- animation: breathe 3s ease-in-out infinite;
3460
- }
3461
-
3462
3425
  /* Progress bar shimmer */
3463
3426
  @keyframes shimmer {
3464
3427
  0% {
package/server.js CHANGED
@@ -1088,6 +1088,29 @@ app.get('/api/sessions/:sessionId/agents', (req, res) => {
1088
1088
  }
1089
1089
  }
1090
1090
  } catch (_) {}
1091
+ // Mark agents whose spawning Agent tool_use was rejected by the user as stopped:
1092
+ // the parent will never read their output, so they're orphans. Match by agentId
1093
+ // when the digest already correlated tool_use→agent, else fall back to prompt text
1094
+ // (the agent-spy hook doesn't record the spawning tool_use_id).
1095
+ try {
1096
+ const { rejectedAgentIds = new Set(), rejectedPrompts = new Set(), killedAgentIds = new Set() } =
1097
+ getSessionDigest(meta.jsonlPath);
1098
+ if (rejectedAgentIds.size || rejectedPrompts.size || killedAgentIds.size) {
1099
+ for (const agent of liveAgents) {
1100
+ if (agent.status !== 'active' && agent.status !== 'idle') continue;
1101
+ let reason = null;
1102
+ if (killedAgentIds.has(agent.agentId)) reason = 'killed-by-harness';
1103
+ else if (rejectedAgentIds.has(agent.agentId) || (agent.prompt && rejectedPrompts.has(agent.prompt))) {
1104
+ reason = 'orphaned-by-rejection';
1105
+ }
1106
+ if (!reason) continue;
1107
+ agent.status = 'stopped';
1108
+ agent.stoppedAt = agent.stoppedAt || new Date().toISOString();
1109
+ agent.stopReason = agent.stopReason || reason;
1110
+ persistAgent(agentDir, agent);
1111
+ }
1112
+ }
1113
+ } catch (_) {}
1091
1114
  }
1092
1115
 
1093
1116
  const dirty = new Set();
@@ -1190,6 +1213,31 @@ function subagentJsonlPath(meta, agentId) {
1190
1213
  );
1191
1214
  }
1192
1215
 
1216
+ // Claude Code can scatter a session's records across multiple project dirs
1217
+ // (e.g. main repo + worktree), so the subagent JSONL may live under a
1218
+ // different project dir than meta.jsonlPath. Fall back to scanning when the
1219
+ // derived path is missing.
1220
+ const subagentPathCache = new Map();
1221
+ function resolveSubagentJsonl(meta, sessionId, agentId) {
1222
+ const primary = subagentJsonlPath(meta, agentId);
1223
+ if (existsSync(primary)) return primary;
1224
+ const key = sessionId + '/' + agentId;
1225
+ if (subagentPathCache.has(key)) return subagentPathCache.get(key) || primary;
1226
+ let found = null;
1227
+ try {
1228
+ for (const entry of readdirSync(PROJECTS_DIR, { withFileTypes: true })) {
1229
+ if (!entry.isDirectory()) continue;
1230
+ const candidate = path.join(
1231
+ PROJECTS_DIR, entry.name, sessionId,
1232
+ 'subagents', 'agent-' + agentId + '.jsonl'
1233
+ );
1234
+ if (existsSync(candidate)) { found = candidate; break; }
1235
+ }
1236
+ } catch (_) { /* projects dir missing */ }
1237
+ subagentPathCache.set(key, found);
1238
+ return found || primary;
1239
+ }
1240
+
1193
1241
  app.get('/api/sessions/:sessionId/agents/:agentId/messages', (req, res) => {
1194
1242
  const sessionId = resolveSessionId(req.params.sessionId);
1195
1243
  const agentId = sanitizeAgentId(req.params.agentId);
@@ -1197,7 +1245,7 @@ app.get('/api/sessions/:sessionId/agents/:agentId/messages', (req, res) => {
1197
1245
  const metadata = loadSessionMetadata();
1198
1246
  const meta = metadata[sessionId];
1199
1247
  if (!meta?.jsonlPath) return res.json({ messages: [], agentId });
1200
- const subagentJsonl = subagentJsonlPath(meta, agentId);
1248
+ const subagentJsonl = resolveSubagentJsonl(meta, sessionId, agentId);
1201
1249
  if (!existsSync(subagentJsonl)) return res.json({ messages: [], agentId });
1202
1250
  const messages = readRecentMessages(subagentJsonl, limit);
1203
1251
  res.json({ messages, agentId });
@@ -1212,7 +1260,7 @@ app.get('/api/sessions/:sessionId/agents/:agentId/messages/stream', (req, res) =
1212
1260
  res.status(404).json({ error: 'Session not found' });
1213
1261
  return;
1214
1262
  }
1215
- const subagentJsonl = subagentJsonlPath(meta, agentId);
1263
+ const subagentJsonl = resolveSubagentJsonl(meta, sessionId, agentId);
1216
1264
 
1217
1265
  res.writeHead(200, {
1218
1266
  'Content-Type': 'text/event-stream',