fix: correct SDK import and clear stale agent UI on stop

Changes:
- Revert incorrect import from claude_code_sdk to claude_agent_sdk in agent.py
  (PR #50 introduced an undocumented change to a deprecated package)
- Clear activeAgents and recentActivity in useWebSocket when agent stops
  to prevent stale UI state

The claude_code_sdk package is deprecated (last updated Sep 2025) while
claude_agent_sdk is the active, maintained package. The import change in
PR #50 was undocumented and would have caused ImportError since only
claude-agent-sdk is specified in requirements.txt.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Auto
2026-01-22 09:39:24 +02:00
parent a71406c2b5
commit 29c6b252a9
2 changed files with 3 additions and 1 deletions

View File

@@ -14,7 +14,7 @@ from pathlib import Path
from typing import Optional from typing import Optional
from zoneinfo import ZoneInfo from zoneinfo import ZoneInfo
from claude_code_sdk import ClaudeSDKClient from claude_agent_sdk import ClaudeSDKClient
# Fix Windows console encoding for Unicode characters (emoji, etc.) # Fix Windows console encoding for Unicode characters (emoji, etc.)
# Without this, print() crashes when Claude outputs emoji like ✅ # Without this, print() crashes when Claude outputs emoji like ✅

View File

@@ -112,6 +112,8 @@ export function useProjectWebSocket(projectName: string | null) {
setState(prev => ({ setState(prev => ({
...prev, ...prev,
agentStatus: message.status, agentStatus: message.status,
// Clear active agents when process stops to prevent stale UI
...(message.status === 'stopped' && { activeAgents: [], recentActivity: [] }),
})) }))
break break