From c3996573aacabf64106e51220c2c66d0ca8c5db4 Mon Sep 17 00:00:00 2001 From: iven Date: Thu, 26 Mar 2026 20:27:19 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=20=E7=A7=BB=E9=99=A4=20Team=20?= =?UTF-8?q?=E5=92=8C=20Swarm=20=E5=8D=8F=E4=BD=9C=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 功能论证结论:Team(团队)和 Swarm(协作)为零后端支持的 纯前端 localStorage 空壳,Pipeline 系统已完全覆盖其全部能力。 删除 16 个文件,约 7,950 行代码: - 5 个组件:TeamCollaborationView, TeamOrchestrator, TeamList, DevQALoop, SwarmDashboard - 1 个 Store:teamStore.ts - 3 个 Client/库:team-client.ts, useTeamEvents.ts, agent-swarm.ts - 1 个类型文件:team.ts - 4 个测试文件 - 1 个文档(归档 swarm-coordination.md) 修改 4 个文件: - Sidebar.tsx:移除"团队"和"协作"导航项 - App.tsx:移除 team/swarm 视图路由 - types/index.ts:移除 team 类型导出 - chatStore.ts:移除 dispatchSwarmTask 方法 更新 CHANGELOG.md 和功能文档 README.md --- CHANGELOG.md | 2 + desktop/src/App.tsx | 73 +- desktop/src/components/DevQALoop.tsx | 464 ----- desktop/src/components/Sidebar.tsx | 29 +- desktop/src/components/SwarmDashboard.tsx | 590 ------- .../src/components/TeamCollaborationView.tsx | 401 ----- desktop/src/components/TeamList.tsx | 294 ---- desktop/src/components/TeamOrchestrator.tsx | 580 ------- desktop/src/lib/agent-swarm.ts | 549 ------ desktop/src/lib/team-client.ts | 440 ----- desktop/src/lib/useTeamEvents.ts | 202 --- desktop/src/store/chatStore.ts | 35 - desktop/src/store/teamStore.ts | 608 ------- desktop/src/types/index.ts | 21 - desktop/src/types/team.ts | 296 ---- .../e2e/specs/team-collaboration.spec.ts | 1487 ----------------- desktop/tests/lib/team-client.test.ts | 594 ------- desktop/tests/store/teamStore.test.ts | 373 ----- .../05-swarm-coordination.md | 0 docs/features/README.md | 7 +- docs/knowledge-base/team-feature-notes.md | 138 -- tests/desktop/teamStore.test.ts | 517 ------ 22 files changed, 11 insertions(+), 7689 deletions(-) delete mode 100644 desktop/src/components/DevQALoop.tsx delete mode 100644 desktop/src/components/SwarmDashboard.tsx delete mode 100644 desktop/src/components/TeamCollaborationView.tsx delete mode 100644 desktop/src/components/TeamList.tsx delete mode 100644 desktop/src/components/TeamOrchestrator.tsx delete mode 100644 desktop/src/lib/agent-swarm.ts delete mode 100644 desktop/src/lib/team-client.ts delete mode 100644 desktop/src/lib/useTeamEvents.ts delete mode 100644 desktop/src/store/teamStore.ts delete mode 100644 desktop/src/types/team.ts delete mode 100644 desktop/tests/e2e/specs/team-collaboration.spec.ts delete mode 100644 desktop/tests/lib/team-client.test.ts delete mode 100644 desktop/tests/store/teamStore.test.ts rename docs/{features/01-core-features => archive/removed-features}/05-swarm-coordination.md (100%) delete mode 100644 docs/knowledge-base/team-feature-notes.md delete mode 100644 tests/desktop/teamStore.test.ts diff --git a/CHANGELOG.md b/CHANGELOG.md index fbf15dc..3c82420 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -43,6 +43,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Stub Channel 适配器(Telegram、Discord、Slack) - 未使用的 Store(meshStore、personaStore) - 不完整的 ActiveLearningPanel 和 skillMarketStore +- 未使用的 Feedback 组件目录 +- Team(团队)和 Swarm(协作)功能(~8,100 行前端代码,零后端支持,Pipeline 系统已覆盖其全部能力) - 调试日志清理(~310 处 console/println 语句) --- diff --git a/desktop/src/App.tsx b/desktop/src/App.tsx index 4a49276..2dd00f3 100644 --- a/desktop/src/App.tsx +++ b/desktop/src/App.tsx @@ -6,9 +6,6 @@ import { ChatArea } from './components/ChatArea'; import { RightPanel } from './components/RightPanel'; import { SettingsLayout } from './components/Settings/SettingsLayout'; import { AutomationPanel } from './components/Automation'; -import { TeamCollaborationView } from './components/TeamCollaborationView'; -import { TeamOrchestrator } from './components/TeamOrchestrator'; -import { SwarmDashboard } from './components/SwarmDashboard'; import { SkillMarket } from './components/SkillMarket'; import { AgentOnboardingWizard } from './components/AgentOnboardingWizard'; import { HandApprovalModal } from './components/HandApprovalModal'; @@ -16,13 +13,11 @@ import { TopBar } from './components/TopBar'; import { DetailDrawer } from './components/DetailDrawer'; import { useConnectionStore } from './store/connectionStore'; import { useHandStore, type HandRun } from './store/handStore'; -import { useTeamStore } from './store/teamStore'; import { useChatStore } from './store/chatStore'; import { initializeStores } from './store'; import { getStoredGatewayToken } from './lib/gateway-client'; import { pageVariants, defaultTransition, fadeInVariants } from './lib/animations'; -import { Users, Loader2, Settings } from 'lucide-react'; -import { EmptyState } from './components/ui'; +import { Loader2 } from 'lucide-react'; import { isTauriRuntime, getLocalGatewayStatus, startLocalGateway } from './lib/tauri-gateway'; import { useOnboarding } from './lib/use-onboarding'; import { intelligenceClient } from './lib/intelligence-client'; @@ -47,7 +42,6 @@ function BootstrapScreen({ status }: { status: string }) { function App() { const [view, setView] = useState('main'); const [mainContentView, setMainContentView] = useState('chat'); - const [selectedTeamId, setSelectedTeamId] = useState(undefined); const [bootstrapping, setBootstrapping] = useState(true); const [bootstrapStatus, setBootstrapStatus] = useState('Initializing...'); const [showOnboarding, setShowOnboarding] = useState(false); @@ -56,13 +50,11 @@ function App() { // Hand Approval state const [pendingApprovalRun, setPendingApprovalRun] = useState(null); const [showApprovalModal, setShowApprovalModal] = useState(false); - const [teamViewMode, setTeamViewMode] = useState<'collaboration' | 'orchestrator'>('collaboration'); const connect = useConnectionStore((s) => s.connect); const hands = useHandStore((s) => s.hands); const approveHand = useHandStore((s) => s.approveHand); const loadHands = useHandStore((s) => s.loadHands); - const { activeTeam, setActiveTeam, teams } = useTeamStore(); const { setCurrentAgent, newConversation } = useChatStore(); const { isNeeded: onboardingNeeded, isLoading: onboardingLoading, markCompleted } = useOnboarding(); @@ -288,14 +280,6 @@ function App() { setMainContentView('chat'); }; - const handleSelectTeam = (teamId: string) => { - const team = teams.find(t => t.id === teamId); - if (team) { - setActiveTeam(team); - setSelectedTeamId(teamId); - } - }; - if (view === 'settings') { return setView('main')} />; } @@ -362,8 +346,6 @@ function App() { setView('settings')} onMainViewChange={handleMainViewChange} - selectedTeamId={selectedTeamId} - onSelectTeam={handleSelectTeam} onNewChat={handleNewChat} /> @@ -395,59 +377,6 @@ function App() { > - ) : mainContentView === 'team' ? ( - activeTeam ? ( -
- {/* Team View Tabs */} -
- - -
- {/* Tab Content */} -
- {teamViewMode === 'orchestrator' ? ( - setTeamViewMode('collaboration')} /> - ) : ( - - )} -
-
- ) : ( - } - title="选择或创建团队" - description="从左侧列表中选择一个团队,或点击 + 创建新的多 Agent 协作团队。" - /> - ) - ) : mainContentView === 'swarm' ? ( - - - ) : mainContentView === 'skills' ? ( void; -} - -function FeedbackItem({ feedback, iteration, isExpanded, onToggle }: FeedbackItemProps) { - const verdictColors = { - approved: 'bg-green-100 text-green-700 dark:bg-green-900/30 dark:text-green-300', - needs_work: 'bg-yellow-100 text-yellow-700 dark:bg-yellow-900/30 dark:text-yellow-300', - rejected: 'bg-red-100 text-red-700 dark:bg-red-900/30 dark:text-red-300', - }; - - const verdictIcons = { - approved: , - needs_work: , - rejected: , - }; - - const severityColors = { - critical: 'bg-red-100 text-red-700 dark:bg-red-900/30 dark:text-red-300', - major: 'bg-orange-100 text-orange-700 dark:bg-orange-900/30 dark:text-orange-300', - minor: 'bg-yellow-100 text-yellow-700 dark:bg-yellow-900/30 dark:text-yellow-300', - suggestion: 'bg-blue-100 text-blue-700 dark:bg-blue-900/30 dark:text-blue-300', - }; - - return ( -
- - - {isExpanded && ( -
- {/* Comments */} - {feedback.comments.length > 0 && ( -
-
Comments
-
    - {feedback.comments.map((comment, idx) => ( -
  • - - {comment} -
  • - ))} -
-
- )} - - {/* Issues */} - {feedback.issues.length > 0 && ( -
-
Issues ({feedback.issues.length})
-
- {feedback.issues.map((issue, idx) => ( -
-
- - {issue.severity} - - {issue.file && ( - - - {issue.file}{issue.line ? `:${issue.line}` : ''} - - )} -
-

{issue.description}

- {issue.suggestion && ( -

- - {issue.suggestion} -

- )} -
- ))} -
-
- )} -
- )} -
- ); -} - -interface ReviewFormProps { - loopId: string; - teamId: string; - onSubmit: (feedback: Omit) => void; - onCancel: () => void; -} - -function ReviewForm({ loopId: _loopId, teamId: _teamId, onSubmit, onCancel }: ReviewFormProps) { - const [verdict, setVerdict] = useState('needs_work'); - const [comment, setComment] = useState(''); - const [issues, setIssues] = useState([]); - const [newIssue, setNewIssue] = useState>({}); - - const handleAddIssue = () => { - if (!newIssue.description) return; - setIssues([...issues, { - severity: newIssue.severity || 'minor', - description: newIssue.description, - file: newIssue.file, - line: newIssue.line, - suggestion: newIssue.suggestion, - } as ReviewIssue]); - setNewIssue({}); - }; - - const handleSubmit = () => { - onSubmit({ - verdict, - comments: comment ? [comment] : [], - issues, - }); - }; - - return ( -
-

Submit Review

- - {/* Verdict */} -
- -
- {(['approved', 'needs_work', 'rejected'] as const).map(v => ( - - ))} -
-
- - {/* Comment */} -
- -