@agent-relay/dashboard 2.0.81 → 2.0.82

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.
Files changed (244) hide show
  1. package/out/404.html +1 -1
  2. package/out/_next/static/chunks/{118-4c8241b0218335de.js → 118-ae2b650136a5a5fc.js} +1 -1
  3. package/out/_next/static/chunks/407-0c82986cf79c8ecb.js +1 -0
  4. package/out/_next/static/chunks/app/app/[[...slug]]/{page-1e81c047cff17212.js → page-f7eca1b66fb4249b.js} +1 -1
  5. package/out/_next/static/chunks/app/{page-6892fe2dd07fb48b.js → page-0ee604f7070d14c0.js} +1 -1
  6. package/out/_next/static/css/8968d98ed4c4d33f.css +1 -0
  7. package/out/about.html +2 -2
  8. package/out/about.txt +1 -1
  9. package/out/app/onboarding.html +1 -1
  10. package/out/app/onboarding.txt +1 -1
  11. package/out/app.html +1 -1
  12. package/out/app.txt +2 -2
  13. package/out/blog/go-to-bed-wake-up-to-a-finished-product.html +2 -2
  14. package/out/blog/go-to-bed-wake-up-to-a-finished-product.txt +1 -1
  15. package/out/blog/let-them-cook-multi-agent-orchestration.html +2 -2
  16. package/out/blog/let-them-cook-multi-agent-orchestration.txt +2 -2
  17. package/out/blog.html +2 -2
  18. package/out/blog.txt +1 -1
  19. package/out/careers.html +2 -2
  20. package/out/careers.txt +1 -1
  21. package/out/changelog.html +2 -2
  22. package/out/changelog.txt +1 -1
  23. package/out/cloud/link.html +1 -1
  24. package/out/cloud/link.txt +2 -2
  25. package/out/complete-profile.html +2 -2
  26. package/out/complete-profile.txt +1 -1
  27. package/out/connect-repos.html +1 -1
  28. package/out/connect-repos.txt +1 -1
  29. package/out/contact.html +2 -2
  30. package/out/contact.txt +1 -1
  31. package/out/docs.html +2 -2
  32. package/out/docs.txt +1 -1
  33. package/out/history.html +1 -1
  34. package/out/history.txt +2 -2
  35. package/out/index.html +1 -1
  36. package/out/index.txt +2 -2
  37. package/out/login.html +2 -2
  38. package/out/login.txt +1 -1
  39. package/out/metrics.html +1 -1
  40. package/out/metrics.txt +2 -2
  41. package/out/pricing.html +2 -2
  42. package/out/pricing.txt +1 -1
  43. package/out/privacy.html +2 -2
  44. package/out/privacy.txt +1 -1
  45. package/out/providers/setup/claude.html +1 -1
  46. package/out/providers/setup/claude.txt +1 -1
  47. package/out/providers/setup/codex.html +1 -1
  48. package/out/providers/setup/codex.txt +1 -1
  49. package/out/providers/setup/cursor.html +1 -1
  50. package/out/providers/setup/cursor.txt +1 -1
  51. package/out/providers.html +1 -1
  52. package/out/providers.txt +1 -1
  53. package/out/security.html +2 -2
  54. package/out/security.txt +1 -1
  55. package/out/signup.html +2 -2
  56. package/out/signup.txt +1 -1
  57. package/out/terms.html +2 -2
  58. package/out/terms.txt +1 -1
  59. package/package.json +7 -1
  60. package/src/app/about/page.tsx +7 -0
  61. package/src/app/app/[[...slug]]/DashboardPageClient.tsx +853 -0
  62. package/src/app/app/[[...slug]]/page.tsx +23 -0
  63. package/src/app/app/onboarding/page.tsx +394 -0
  64. package/src/app/apple-icon.png +0 -0
  65. package/src/app/blog/go-to-bed-wake-up-to-a-finished-product/page.tsx +88 -0
  66. package/src/app/blog/let-them-cook-multi-agent-orchestration/page.tsx +93 -0
  67. package/src/app/blog/page.tsx +15 -0
  68. package/src/app/careers/page.tsx +7 -0
  69. package/src/app/changelog/page.tsx +7 -0
  70. package/src/app/cloud/link/page.tsx +464 -0
  71. package/src/app/complete-profile/page.tsx +204 -0
  72. package/src/app/connect-repos/page.tsx +410 -0
  73. package/src/app/contact/page.tsx +7 -0
  74. package/src/app/docs/page.tsx +7 -0
  75. package/src/app/favicon.png +0 -0
  76. package/src/app/globals.css +200 -0
  77. package/src/app/history/page.tsx +658 -0
  78. package/src/app/layout.tsx +25 -0
  79. package/src/app/login/page.tsx +424 -0
  80. package/src/app/metrics/page.tsx +781 -0
  81. package/src/app/page.tsx +59 -0
  82. package/src/app/pricing/page.tsx +7 -0
  83. package/src/app/privacy/page.tsx +7 -0
  84. package/src/app/providers/page.tsx +193 -0
  85. package/src/app/providers/setup/[provider]/ProviderSetupClient.tsx +197 -0
  86. package/src/app/providers/setup/[provider]/constants.ts +35 -0
  87. package/src/app/providers/setup/[provider]/page.tsx +42 -0
  88. package/src/app/security/page.tsx +7 -0
  89. package/src/app/signup/page.tsx +533 -0
  90. package/src/app/terms/page.tsx +7 -0
  91. package/src/components/ActivityFeed.tsx +216 -0
  92. package/src/components/AddWorkspaceModal.tsx +170 -0
  93. package/src/components/AgentCard.test.tsx +134 -0
  94. package/src/components/AgentCard.tsx +585 -0
  95. package/src/components/AgentList.test.tsx +147 -0
  96. package/src/components/AgentList.tsx +419 -0
  97. package/src/components/AgentLogPreview.tsx +173 -0
  98. package/src/components/AgentProfilePanel.tsx +569 -0
  99. package/src/components/App.tsx +3424 -0
  100. package/src/components/BillingPanel.tsx +922 -0
  101. package/src/components/BillingResult.tsx +447 -0
  102. package/src/components/BroadcastComposer.tsx +690 -0
  103. package/src/components/ChannelAdminPanel.tsx +773 -0
  104. package/src/components/ChannelBrowser.tsx +385 -0
  105. package/src/components/ChannelChat.tsx +261 -0
  106. package/src/components/ChannelSidebar.tsx +399 -0
  107. package/src/components/CloudSessionProvider.tsx +130 -0
  108. package/src/components/CommandPalette.tsx +815 -0
  109. package/src/components/ConfirmationDialog.tsx +133 -0
  110. package/src/components/ConversationHistory.tsx +518 -0
  111. package/src/components/CoordinatorPanel.tsx +956 -0
  112. package/src/components/DecisionQueue.tsx +717 -0
  113. package/src/components/DirectMessageView.tsx +164 -0
  114. package/src/components/FileAutocomplete.tsx +368 -0
  115. package/src/components/FleetOverview.tsx +278 -0
  116. package/src/components/LogViewer.tsx +310 -0
  117. package/src/components/LogViewerPanel.tsx +482 -0
  118. package/src/components/Logo.tsx +284 -0
  119. package/src/components/MentionAutocomplete.tsx +384 -0
  120. package/src/components/MessageComposer.tsx +473 -0
  121. package/src/components/MessageList.tsx +725 -0
  122. package/src/components/MessageSenderName.tsx +91 -0
  123. package/src/components/MessageStatusIndicator.tsx +142 -0
  124. package/src/components/NewConversationModal.tsx +400 -0
  125. package/src/components/NotificationToast.tsx +488 -0
  126. package/src/components/OnlineUsersIndicator.tsx +164 -0
  127. package/src/components/Pagination.tsx +124 -0
  128. package/src/components/PricingPlans.tsx +386 -0
  129. package/src/components/ProjectList.tsx +711 -0
  130. package/src/components/ProviderAuthFlow.tsx +343 -0
  131. package/src/components/ProviderConnectionList.tsx +375 -0
  132. package/src/components/ProvisioningProgress.tsx +730 -0
  133. package/src/components/ReactionChips.tsx +70 -0
  134. package/src/components/ReactionPicker.tsx +121 -0
  135. package/src/components/RepoAccessPanel.tsx +787 -0
  136. package/src/components/RepositoriesPanel.tsx +901 -0
  137. package/src/components/ServerCard.tsx +202 -0
  138. package/src/components/SessionExpiredModal.tsx +128 -0
  139. package/src/components/SpawnModal.test.tsx +190 -0
  140. package/src/components/SpawnModal.tsx +1001 -0
  141. package/src/components/TaskAssignmentUI.tsx +375 -0
  142. package/src/components/TerminalProviderSetup.tsx +517 -0
  143. package/src/components/ThemeProvider.tsx +159 -0
  144. package/src/components/ThinkingIndicator.tsx +231 -0
  145. package/src/components/ThreadList.tsx +198 -0
  146. package/src/components/ThreadPanel.tsx +405 -0
  147. package/src/components/TrajectoryViewer.tsx +698 -0
  148. package/src/components/TypingIndicator.tsx +69 -0
  149. package/src/components/UsageBanner.tsx +231 -0
  150. package/src/components/UserProfilePanel.tsx +233 -0
  151. package/src/components/WorkspaceContext.tsx +95 -0
  152. package/src/components/WorkspaceSelector.tsx +234 -0
  153. package/src/components/WorkspaceStatusIndicator.tsx +396 -0
  154. package/src/components/XTermInteractive.tsx +516 -0
  155. package/src/components/XTermLogViewer.tsx +719 -0
  156. package/src/components/channels/ChannelDialogs.tsx +1411 -0
  157. package/src/components/channels/ChannelHeader.tsx +317 -0
  158. package/src/components/channels/ChannelMessageList.tsx +463 -0
  159. package/src/components/channels/ChannelViewV1.tsx +146 -0
  160. package/src/components/channels/MessageInput.tsx +302 -0
  161. package/src/components/channels/SearchInput.tsx +172 -0
  162. package/src/components/channels/SearchResults.tsx +336 -0
  163. package/src/components/channels/api.test.ts +1527 -0
  164. package/src/components/channels/api.ts +703 -0
  165. package/src/components/channels/index.ts +76 -0
  166. package/src/components/channels/mockApi.ts +344 -0
  167. package/src/components/channels/types.ts +566 -0
  168. package/src/components/hooks/index.ts +58 -0
  169. package/src/components/hooks/useAgentLogs.ts +504 -0
  170. package/src/components/hooks/useAgents.ts +127 -0
  171. package/src/components/hooks/useBroadcastDedup.test.ts +371 -0
  172. package/src/components/hooks/useBroadcastDedup.ts +86 -0
  173. package/src/components/hooks/useChannelAdmin.ts +329 -0
  174. package/src/components/hooks/useChannelBrowser.ts +239 -0
  175. package/src/components/hooks/useChannelCommands.ts +138 -0
  176. package/src/components/hooks/useChannels.ts +367 -0
  177. package/src/components/hooks/useDebounce.ts +29 -0
  178. package/src/components/hooks/useDirectMessage.test.ts +952 -0
  179. package/src/components/hooks/useDirectMessage.ts +141 -0
  180. package/src/components/hooks/useMessages.ts +310 -0
  181. package/src/components/hooks/useOrchestrator.test.ts +165 -0
  182. package/src/components/hooks/useOrchestrator.ts +424 -0
  183. package/src/components/hooks/usePinnedAgents.test.ts +356 -0
  184. package/src/components/hooks/usePinnedAgents.ts +140 -0
  185. package/src/components/hooks/usePresence.test.ts +245 -0
  186. package/src/components/hooks/usePresence.ts +377 -0
  187. package/src/components/hooks/useRecentRepos.ts +130 -0
  188. package/src/components/hooks/useSession.ts +209 -0
  189. package/src/components/hooks/useThread.ts +138 -0
  190. package/src/components/hooks/useTrajectory.ts +265 -0
  191. package/src/components/hooks/useWebSocket.ts +290 -0
  192. package/src/components/hooks/useWorkspaceMembers.ts +132 -0
  193. package/src/components/hooks/useWorkspaceRepos.ts +73 -0
  194. package/src/components/hooks/useWorkspaceStatus.ts +237 -0
  195. package/src/components/index.ts +81 -0
  196. package/src/components/layout/Header.tsx +311 -0
  197. package/src/components/layout/RepoContextHeader.tsx +361 -0
  198. package/src/components/layout/Sidebar.archive.test.tsx +126 -0
  199. package/src/components/layout/Sidebar.test.tsx +691 -0
  200. package/src/components/layout/Sidebar.tsx +900 -0
  201. package/src/components/layout/index.ts +7 -0
  202. package/src/components/settings/BillingSettingsPanel.tsx +564 -0
  203. package/src/components/settings/SettingsPage.tsx +683 -0
  204. package/src/components/settings/TeamSettingsPanel.tsx +560 -0
  205. package/src/components/settings/WorkspaceSettingsPanel.tsx +1368 -0
  206. package/src/components/settings/index.ts +11 -0
  207. package/src/components/settings/types.ts +79 -0
  208. package/src/components/utils/messageFormatting.test.tsx +331 -0
  209. package/src/components/utils/messageFormatting.tsx +597 -0
  210. package/src/index.ts +63 -0
  211. package/src/landing/AboutPage.tsx +77 -0
  212. package/src/landing/BlogContent.tsx +187 -0
  213. package/src/landing/BlogPage.tsx +47 -0
  214. package/src/landing/CareersPage.tsx +53 -0
  215. package/src/landing/ChangelogPage.tsx +33 -0
  216. package/src/landing/ContactPage.tsx +41 -0
  217. package/src/landing/DocsPage.tsx +43 -0
  218. package/src/landing/LandingPage.tsx +702 -0
  219. package/src/landing/PricingPage.tsx +549 -0
  220. package/src/landing/PrivacyPage.tsx +117 -0
  221. package/src/landing/SecurityPage.tsx +42 -0
  222. package/src/landing/StaticPage.tsx +165 -0
  223. package/src/landing/TermsPage.tsx +125 -0
  224. package/src/landing/blogData.ts +312 -0
  225. package/src/landing/index.ts +18 -0
  226. package/src/landing/styles.css +3673 -0
  227. package/src/lib/agent-merge.test.ts +43 -0
  228. package/src/lib/agent-merge.ts +35 -0
  229. package/src/lib/api.ts +1294 -0
  230. package/src/lib/cloudApi.ts +893 -0
  231. package/src/lib/colors.test.ts +175 -0
  232. package/src/lib/colors.ts +218 -0
  233. package/src/lib/config.ts +109 -0
  234. package/src/lib/hierarchy.ts +242 -0
  235. package/src/lib/stuckDetection.ts +142 -0
  236. package/src/lib/useUrlRouting.ts +190 -0
  237. package/src/types/index.ts +317 -0
  238. package/src/types/threading.ts +7 -0
  239. package/out/_next/static/chunks/285-dc644487a8d6500d.js +0 -1
  240. package/out/_next/static/css/4c58d9cf493aa626.css +0 -1
  241. /package/out/_next/static/{dYlczDQI12PIQ3tqq3N4Y → IxfA6RZu4trcsEMYlkQra}/_buildManifest.js +0 -0
  242. /package/out/_next/static/{dYlczDQI12PIQ3tqq3N4Y → IxfA6RZu4trcsEMYlkQra}/_ssgManifest.js +0 -0
  243. /package/out/_next/static/chunks/{528-d375bc8b46912d2c.js → 528-f5f676996d613c25.js} +0 -0
  244. /package/out/_next/static/chunks/app/blog/let-them-cook-multi-agent-orchestration/{page-a58308f43557b908.js → page-b194f207fbd91862.js} +0 -0
@@ -0,0 +1,956 @@
1
+ /**
2
+ * CoordinatorPanel Component
3
+ *
4
+ * Manage bridge-level coordinator agents that oversee multiple projects.
5
+ * Available in cloud mode for Pro+ users.
6
+ */
7
+
8
+ import React, { useState, useEffect } from 'react';
9
+ import { getCsrfToken } from '../lib/cloudApi';
10
+ import type { Project } from '../types';
11
+
12
+ export interface RepositoryInfo {
13
+ id: string;
14
+ githubFullName: string;
15
+ defaultBranch: string;
16
+ isPrivate: boolean;
17
+ workspaceId?: string;
18
+ }
19
+
20
+ export interface ProjectGroup {
21
+ id: string;
22
+ name: string;
23
+ description?: string | null;
24
+ color?: string | null;
25
+ icon?: string | null;
26
+ repositoryCount: number;
27
+ repositories: RepositoryInfo[];
28
+ coordinatorAgent?: {
29
+ enabled: boolean;
30
+ name?: string;
31
+ model?: string;
32
+ systemPrompt?: string;
33
+ capabilities?: string[];
34
+ };
35
+ createdAt: string;
36
+ updatedAt: string;
37
+ }
38
+
39
+ export interface CoordinatorPanelProps {
40
+ isOpen: boolean;
41
+ onClose: () => void;
42
+ projects: Project[];
43
+ isCloudMode?: boolean;
44
+ /** Whether an Architect agent is already running */
45
+ hasArchitect?: boolean;
46
+ /** Callback when Architect is spawned */
47
+ onArchitectSpawned?: () => void;
48
+ }
49
+
50
+ export function CoordinatorPanel({
51
+ isOpen,
52
+ onClose,
53
+ projects,
54
+ isCloudMode = false,
55
+ hasArchitect = false,
56
+ onArchitectSpawned,
57
+ }: CoordinatorPanelProps) {
58
+ const [projectGroups, setProjectGroups] = useState<ProjectGroup[]>([]);
59
+ const [ungroupedRepos, setUngroupedRepos] = useState<RepositoryInfo[]>([]);
60
+ const [isLoading, setIsLoading] = useState(false);
61
+ const [error, setError] = useState<string | null>(null);
62
+ const [showCreateForm, setShowCreateForm] = useState(false);
63
+ const [newGroupName, setNewGroupName] = useState('');
64
+ const [newGroupDescription, setNewGroupDescription] = useState('');
65
+ const [selectedRepos, setSelectedRepos] = useState<Set<string>>(new Set());
66
+ const [isSpawningArchitect, setIsSpawningArchitect] = useState(false);
67
+ const [selectedCli, setSelectedCli] = useState('claude');
68
+ const [editingGroup, setEditingGroup] = useState<ProjectGroup | null>(null);
69
+ const [addingReposToGroupId, setAddingReposToGroupId] = useState<string | null>(null);
70
+ const [reposToAdd, setReposToAdd] = useState<Set<string>>(new Set());
71
+
72
+ const csrfHeaders = (): Record<string, string> => {
73
+ const token = getCsrfToken();
74
+ return token ? { 'X-CSRF-Token': token } : {};
75
+ };
76
+
77
+ // Fetch project groups on open
78
+ useEffect(() => {
79
+ if (isOpen && isCloudMode) {
80
+ fetchProjectGroups();
81
+ }
82
+ }, [isOpen, isCloudMode]);
83
+
84
+ const fetchProjectGroups = async () => {
85
+ setIsLoading(true);
86
+ setError(null);
87
+ try {
88
+ const response = await fetch('/api/project-groups');
89
+ if (response.ok) {
90
+ const data = await response.json();
91
+ setProjectGroups(data.groups || []);
92
+ setUngroupedRepos(data.ungroupedRepositories || []);
93
+ } else {
94
+ const errorData = await response.json().catch(() => ({}));
95
+ setError(errorData.error || 'Failed to load project groups');
96
+ }
97
+ } catch (_err) {
98
+ setError('Failed to load project groups');
99
+ } finally {
100
+ setIsLoading(false);
101
+ }
102
+ };
103
+
104
+ const handleCreateGroup = async () => {
105
+ if (!newGroupName.trim() || selectedRepos.size === 0) return;
106
+
107
+ setIsLoading(true);
108
+ setError(null);
109
+ try {
110
+ const response = await fetch('/api/project-groups', {
111
+ method: 'POST',
112
+ headers: { 'Content-Type': 'application/json', ...csrfHeaders() },
113
+ body: JSON.stringify({
114
+ name: newGroupName.trim(),
115
+ description: newGroupDescription.trim() || undefined,
116
+ repositoryIds: Array.from(selectedRepos),
117
+ }),
118
+ });
119
+
120
+ if (response.ok) {
121
+ const data = await response.json();
122
+ if (data.group) {
123
+ // Add the new group and remove selected repos from ungrouped
124
+ setProjectGroups((prev) => [...prev, data.group]);
125
+ setUngroupedRepos((prev) => prev.filter(r => !selectedRepos.has(r.id)));
126
+ setShowCreateForm(false);
127
+ setNewGroupName('');
128
+ setNewGroupDescription('');
129
+ setSelectedRepos(new Set());
130
+ }
131
+ } else {
132
+ const errorData = await response.json().catch(() => ({}));
133
+ setError(errorData.error || 'Failed to create project group');
134
+ }
135
+ } catch (_err) {
136
+ setError('Failed to create project group');
137
+ } finally {
138
+ setIsLoading(false);
139
+ }
140
+ };
141
+
142
+ const handleUpdateGroup = async (groupId: string, updates: { name?: string; description?: string }) => {
143
+ setError(null);
144
+ try {
145
+ const response = await fetch(`/api/project-groups/${groupId}`, {
146
+ method: 'PATCH',
147
+ headers: { 'Content-Type': 'application/json', ...csrfHeaders() },
148
+ body: JSON.stringify(updates),
149
+ });
150
+
151
+ if (response.ok) {
152
+ const data = await response.json();
153
+ if (data.group) {
154
+ setProjectGroups((prev) =>
155
+ prev.map((g) => (g.id === groupId ? { ...g, ...data.group } : g))
156
+ );
157
+ setEditingGroup(null);
158
+ }
159
+ } else {
160
+ const errorData = await response.json().catch(() => ({}));
161
+ setError(errorData.error || 'Failed to update project group');
162
+ }
163
+ } catch (_err) {
164
+ setError('Failed to update project group');
165
+ }
166
+ };
167
+
168
+ const handleEnableCoordinator = async (groupId: string, enable: boolean) => {
169
+ setError(null);
170
+ try {
171
+ const endpoint = `/api/project-groups/${groupId}/coordinator/${enable ? 'enable' : 'disable'}`;
172
+ const response = await fetch(endpoint, { method: 'POST', headers: csrfHeaders() });
173
+
174
+ if (response.ok) {
175
+ const data = await response.json();
176
+ setProjectGroups((prev) =>
177
+ prev.map((g) =>
178
+ g.id === groupId
179
+ ? {
180
+ ...g,
181
+ coordinatorAgent: {
182
+ ...g.coordinatorAgent,
183
+ enabled: enable,
184
+ name: data.coordinator?.name || g.coordinatorAgent?.name,
185
+ },
186
+ }
187
+ : g
188
+ )
189
+ );
190
+ } else {
191
+ const errorData = await response.json().catch(() => ({}));
192
+ if (response.status === 402 && errorData.upgrade) {
193
+ setError(`${errorData.error}. Go to Settings > Billing to upgrade.`);
194
+ } else {
195
+ setError(errorData.error || `Failed to ${enable ? 'enable' : 'disable'} coordinator`);
196
+ }
197
+ }
198
+ } catch (_err) {
199
+ setError(`Failed to ${enable ? 'enable' : 'disable'} coordinator`);
200
+ }
201
+ };
202
+
203
+ const handleDeleteGroup = async (groupId: string) => {
204
+ if (!window.confirm('Delete this project group? The coordinator will be stopped and repositories will be ungrouped.')) {
205
+ return;
206
+ }
207
+
208
+ try {
209
+ // Find the group to get its repos before deletion
210
+ const groupToDelete = projectGroups.find(g => g.id === groupId);
211
+
212
+ const response = await fetch(`/api/project-groups/${groupId}`, {
213
+ method: 'DELETE',
214
+ headers: csrfHeaders(),
215
+ });
216
+
217
+ if (response.ok) {
218
+ setProjectGroups((prev) => prev.filter((g) => g.id !== groupId));
219
+ // Add the repos back to ungrouped
220
+ if (groupToDelete?.repositories) {
221
+ setUngroupedRepos((prev) => [...prev, ...groupToDelete.repositories]);
222
+ }
223
+ } else {
224
+ const errorData = await response.json().catch(() => ({}));
225
+ setError(errorData.error || 'Failed to delete project group');
226
+ }
227
+ } catch (_err) {
228
+ setError('Failed to delete project group');
229
+ }
230
+ };
231
+
232
+ const handleRemoveRepoFromGroup = async (groupId: string, repoId: string) => {
233
+ try {
234
+ const response = await fetch(`/api/project-groups/${groupId}/repositories/${repoId}`, {
235
+ method: 'DELETE',
236
+ headers: csrfHeaders(),
237
+ });
238
+
239
+ if (response.ok) {
240
+ // Move repo from group to ungrouped
241
+ const group = projectGroups.find(g => g.id === groupId);
242
+ const removedRepo = group?.repositories.find(r => r.id === repoId);
243
+
244
+ setProjectGroups((prev) =>
245
+ prev.map((g) =>
246
+ g.id === groupId
247
+ ? {
248
+ ...g,
249
+ repositories: g.repositories.filter(r => r.id !== repoId),
250
+ repositoryCount: g.repositoryCount - 1,
251
+ }
252
+ : g
253
+ )
254
+ );
255
+
256
+ if (removedRepo) {
257
+ setUngroupedRepos((prev) => [...prev, removedRepo]);
258
+ }
259
+ } else {
260
+ const errorData = await response.json().catch(() => ({}));
261
+ setError(errorData.error || 'Failed to remove repository from group');
262
+ }
263
+ } catch (_err) {
264
+ setError('Failed to remove repository from group');
265
+ }
266
+ };
267
+
268
+ const handleAddReposToGroup = async (groupId: string, repoIds: string[]) => {
269
+ if (repoIds.length === 0) return;
270
+
271
+ try {
272
+ const response = await fetch(`/api/project-groups/${groupId}/repositories`, {
273
+ method: 'POST',
274
+ headers: { 'Content-Type': 'application/json', ...csrfHeaders() },
275
+ body: JSON.stringify({ repositoryIds: repoIds }),
276
+ });
277
+
278
+ if (response.ok) {
279
+ // Refetch to get updated data
280
+ await fetchProjectGroups();
281
+ setAddingReposToGroupId(null);
282
+ setReposToAdd(new Set());
283
+ } else {
284
+ const errorData = await response.json().catch(() => ({}));
285
+ setError(errorData.error || 'Failed to add repositories to group');
286
+ }
287
+ } catch (_err) {
288
+ setError('Failed to add repositories to group');
289
+ }
290
+ };
291
+
292
+ const toggleRepoToAdd = (repoId: string) => {
293
+ setReposToAdd((prev) => {
294
+ const next = new Set(prev);
295
+ if (next.has(repoId)) {
296
+ next.delete(repoId);
297
+ } else {
298
+ next.add(repoId);
299
+ }
300
+ return next;
301
+ });
302
+ };
303
+
304
+ const toggleRepo = (repoId: string) => {
305
+ setSelectedRepos((prev) => {
306
+ const next = new Set(prev);
307
+ if (next.has(repoId)) {
308
+ next.delete(repoId);
309
+ } else {
310
+ next.add(repoId);
311
+ }
312
+ return next;
313
+ });
314
+ };
315
+
316
+ if (!isOpen) return null;
317
+
318
+ // Spawn architect handler for local mode
319
+ const handleSpawnArchitect = async () => {
320
+ setIsSpawningArchitect(true);
321
+ setError(null);
322
+ try {
323
+ const response = await fetch('/api/spawn/architect', {
324
+ method: 'POST',
325
+ headers: { 'Content-Type': 'application/json', ...csrfHeaders() },
326
+ body: JSON.stringify({ cli: selectedCli }),
327
+ });
328
+
329
+ const data = await response.json();
330
+ if (response.ok && data.success) {
331
+ onArchitectSpawned?.();
332
+ onClose();
333
+ } else {
334
+ setError(data.error || 'Failed to spawn Architect');
335
+ }
336
+ } catch (_err) {
337
+ setError('Failed to spawn Architect');
338
+ } finally {
339
+ setIsSpawningArchitect(false);
340
+ }
341
+ };
342
+
343
+ // Local mode: show spawn architect UI
344
+ if (!isCloudMode) {
345
+ const isInBridgeMode = projects.length > 1;
346
+
347
+ return (
348
+ <div
349
+ className="fixed inset-0 bg-black/70 flex items-center justify-center z-[1000] animate-fade-in"
350
+ onClick={onClose}
351
+ >
352
+ <div
353
+ className="bg-bg-secondary rounded-xl w-[500px] max-w-[90vw] max-h-[80vh] flex flex-col shadow-modal animate-slide-up"
354
+ onClick={(e) => e.stopPropagation()}
355
+ >
356
+ <div className="flex items-center justify-between py-5 px-6 border-b border-border-subtle">
357
+ <div className="flex items-center gap-3">
358
+ <CoordinatorIcon />
359
+ <h2 className="m-0 text-lg font-semibold text-text-primary">Coordinator Agent</h2>
360
+ </div>
361
+ <button
362
+ className="flex items-center justify-center w-8 h-8 bg-transparent border-none rounded-md text-text-secondary cursor-pointer transition-all duration-150 hover:bg-bg-hover hover:text-text-primary"
363
+ onClick={onClose}
364
+ >
365
+ <CloseIcon />
366
+ </button>
367
+ </div>
368
+
369
+ <div className="flex-1 overflow-y-auto p-6">
370
+ {error && (
371
+ <div className="bg-error/10 border border-error/30 rounded-lg p-3 mb-4 text-error text-sm">
372
+ {error}
373
+ </div>
374
+ )}
375
+
376
+ {/* Spawn from dashboard - only in bridge mode */}
377
+ {isInBridgeMode && (
378
+ <div className="bg-gradient-to-r from-accent-purple/10 to-accent-cyan/10 border border-accent-purple/30 rounded-lg p-4 mb-4">
379
+ <h3 className="text-sm font-semibold text-text-primary mb-3 flex items-center gap-2">
380
+ <CoordinatorIcon />
381
+ Spawn Architect
382
+ </h3>
383
+
384
+ {hasArchitect ? (
385
+ <div className="flex items-center gap-2 text-sm text-success">
386
+ <CheckIcon />
387
+ Architect is running
388
+ </div>
389
+ ) : (
390
+ <>
391
+ <p className="text-sm text-text-secondary mb-4">
392
+ Spawn an Architect agent to coordinate across your {projects.length} connected projects.
393
+ </p>
394
+
395
+ <div className="flex items-center gap-3">
396
+ <select
397
+ className="flex-1 py-2 px-3 bg-bg-card border border-border-subtle rounded-md text-sm text-text-primary outline-none focus:border-accent-purple/50"
398
+ value={selectedCli}
399
+ onChange={(e) => setSelectedCli(e.target.value)}
400
+ >
401
+ <option value="claude">Claude (default)</option>
402
+ <option value="claude:opus">Claude Opus</option>
403
+ <option value="claude:sonnet">Claude Sonnet</option>
404
+ <option value="codex">Codex</option>
405
+ </select>
406
+ <button
407
+ className="py-2 px-4 bg-gradient-to-r from-accent-purple to-accent-cyan text-bg-deep rounded-md text-sm font-semibold hover:shadow-lg transition-all disabled:opacity-50"
408
+ onClick={handleSpawnArchitect}
409
+ disabled={isSpawningArchitect}
410
+ >
411
+ {isSpawningArchitect ? 'Spawning...' : 'Spawn'}
412
+ </button>
413
+ </div>
414
+ </>
415
+ )}
416
+ </div>
417
+ )}
418
+
419
+ {/* Not in bridge mode message */}
420
+ {!isInBridgeMode && (
421
+ <div className="bg-bg-tertiary rounded-lg p-4 mb-4 border border-border-subtle">
422
+ <h3 className="text-sm font-semibold text-text-primary mb-2">Not in Bridge Mode</h3>
423
+ <p className="text-sm text-text-secondary">
424
+ The Architect coordinates multiple projects. Start bridge mode to enable:
425
+ </p>
426
+ <div className="bg-bg-card rounded-lg p-3 font-mono text-sm mt-3">
427
+ <span className="text-text-muted">$</span>{' '}
428
+ <span className="text-accent-cyan">relay bridge</span>{' '}
429
+ <span className="text-accent-orange">~/project1 ~/project2</span>
430
+ </div>
431
+ </div>
432
+ )}
433
+
434
+ <div className="bg-bg-tertiary rounded-lg p-4 mb-4">
435
+ <h3 className="text-sm font-semibold text-text-primary mb-2">CLI Alternative</h3>
436
+ <p className="text-sm text-text-secondary mb-3">
437
+ You can also spawn the Architect via CLI with the <code className="bg-bg-card px-1.5 py-0.5 rounded text-accent-cyan">--architect</code> flag:
438
+ </p>
439
+ <div className="bg-bg-card rounded-lg p-3 font-mono text-sm">
440
+ <span className="text-text-muted">$</span>{' '}
441
+ <span className="text-accent-cyan">relay bridge</span>{' '}
442
+ <span className="text-accent-orange">~/project1 ~/project2</span>{' '}
443
+ <span className="text-accent-purple">--architect</span>
444
+ </div>
445
+ </div>
446
+ </div>
447
+
448
+ <div className="flex justify-end py-4 px-6 border-t border-border-subtle">
449
+ <button
450
+ className="py-2 px-5 bg-bg-tertiary border border-border-subtle rounded-md text-sm text-text-secondary cursor-pointer transition-colors duration-150 hover:bg-bg-hover"
451
+ onClick={onClose}
452
+ >
453
+ Close
454
+ </button>
455
+ </div>
456
+ </div>
457
+ </div>
458
+ );
459
+ }
460
+
461
+ // Cloud mode: full coordinator management
462
+ return (
463
+ <div
464
+ className="fixed inset-0 bg-black/70 flex items-center justify-center z-[1000] animate-fade-in"
465
+ onClick={onClose}
466
+ >
467
+ <div
468
+ className="bg-bg-secondary rounded-xl w-[600px] max-w-[90vw] max-h-[80vh] flex flex-col shadow-modal animate-slide-up"
469
+ onClick={(e) => e.stopPropagation()}
470
+ >
471
+ <div className="flex items-center justify-between py-5 px-6 border-b border-border-subtle">
472
+ <div className="flex items-center gap-3">
473
+ <CoordinatorIcon />
474
+ <h2 className="m-0 text-lg font-semibold text-text-primary">Coordinator Agents</h2>
475
+ </div>
476
+ <button
477
+ className="flex items-center justify-center w-8 h-8 bg-transparent border-none rounded-md text-text-secondary cursor-pointer transition-all duration-150 hover:bg-bg-hover hover:text-text-primary"
478
+ onClick={onClose}
479
+ >
480
+ <CloseIcon />
481
+ </button>
482
+ </div>
483
+
484
+ <div className="flex-1 overflow-y-auto p-6">
485
+ {error && (
486
+ <div className="bg-error/10 border border-error/30 rounded-lg p-3 mb-4 text-error text-sm">
487
+ {error}
488
+ </div>
489
+ )}
490
+
491
+ {isLoading && projectGroups.length === 0 ? (
492
+ <div className="flex items-center justify-center py-12 text-text-muted">
493
+ <LoadingSpinner />
494
+ </div>
495
+ ) : (
496
+ <>
497
+ {/* Existing project groups */}
498
+ {projectGroups.length > 0 && (
499
+ <div className="space-y-3 mb-6">
500
+ <h4 className="text-xs font-semibold text-text-muted uppercase tracking-wider">
501
+ Project Groups
502
+ </h4>
503
+ {projectGroups.map((group) => (
504
+ <div
505
+ key={group.id}
506
+ className="bg-bg-tertiary rounded-lg p-4 border border-border-subtle"
507
+ >
508
+ <div className="flex items-center justify-between mb-3">
509
+ <div className="flex items-center gap-2">
510
+ <span className="font-semibold text-text-primary">{group.name}</span>
511
+ <span className="text-xs text-text-muted">
512
+ {group.repositoryCount} {group.repositoryCount === 1 ? 'repo' : 'repos'}
513
+ </span>
514
+ </div>
515
+ <div className="flex items-center gap-1">
516
+ <button
517
+ className="text-text-muted hover:text-accent-cyan transition-colors p-1"
518
+ onClick={() => setEditingGroup(group)}
519
+ title="Edit group"
520
+ >
521
+ <EditIcon />
522
+ </button>
523
+ <button
524
+ className="text-text-muted hover:text-error transition-colors p-1"
525
+ onClick={() => handleDeleteGroup(group.id)}
526
+ title="Delete group"
527
+ >
528
+ <TrashIcon />
529
+ </button>
530
+ </div>
531
+ </div>
532
+
533
+ {/* Show repositories in the group */}
534
+ {group.repositories.length > 0 && (
535
+ <div className="mb-3 space-y-1">
536
+ {group.repositories.map((repo) => (
537
+ <div
538
+ key={repo.id}
539
+ className="flex items-center justify-between py-1 px-2 bg-bg-card/50 rounded text-xs"
540
+ >
541
+ <span className="text-text-secondary font-mono">
542
+ {repo.githubFullName}
543
+ </span>
544
+ <button
545
+ className="text-text-muted hover:text-error transition-colors p-0.5"
546
+ onClick={() => handleRemoveRepoFromGroup(group.id, repo.id)}
547
+ title="Remove from group"
548
+ >
549
+ <CloseIcon size={12} />
550
+ </button>
551
+ </div>
552
+ ))}
553
+ </div>
554
+ )}
555
+
556
+ {group.description && (
557
+ <p className="text-xs text-text-muted mb-3">{group.description}</p>
558
+ )}
559
+
560
+ {/* Add repos to group section */}
561
+ {addingReposToGroupId === group.id ? (
562
+ <div className="mb-3 p-3 bg-bg-card rounded-lg border border-border-subtle">
563
+ <div className="text-xs font-medium text-text-muted mb-2">
564
+ Select repositories to add:
565
+ </div>
566
+ <div className="space-y-1 max-h-[150px] overflow-y-auto mb-3">
567
+ {ungroupedRepos.length > 0 ? (
568
+ ungroupedRepos.map((repo) => (
569
+ <label
570
+ key={repo.id}
571
+ className="flex items-center gap-2 p-1.5 rounded cursor-pointer hover:bg-bg-hover"
572
+ >
573
+ <input
574
+ type="checkbox"
575
+ className="accent-accent-cyan"
576
+ checked={reposToAdd.has(repo.id)}
577
+ onChange={() => toggleRepoToAdd(repo.id)}
578
+ />
579
+ <span className="text-xs text-text-primary font-mono">
580
+ {repo.githubFullName}
581
+ </span>
582
+ </label>
583
+ ))
584
+ ) : (
585
+ <p className="text-xs text-text-muted py-2 text-center">
586
+ No ungrouped repositories available
587
+ </p>
588
+ )}
589
+ </div>
590
+ <div className="flex justify-end gap-2">
591
+ <button
592
+ className="py-1 px-3 text-xs bg-transparent border border-border-subtle rounded text-text-secondary hover:bg-bg-hover"
593
+ onClick={() => {
594
+ setAddingReposToGroupId(null);
595
+ setReposToAdd(new Set());
596
+ }}
597
+ >
598
+ Cancel
599
+ </button>
600
+ <button
601
+ className="py-1 px-3 text-xs bg-accent-cyan text-bg-deep rounded font-medium hover:bg-accent-cyan/90 disabled:opacity-50"
602
+ onClick={() => handleAddReposToGroup(group.id, Array.from(reposToAdd))}
603
+ disabled={reposToAdd.size === 0}
604
+ >
605
+ Add Selected
606
+ </button>
607
+ </div>
608
+ </div>
609
+ ) : ungroupedRepos.length > 0 ? (
610
+ <button
611
+ className="mb-3 w-full py-1.5 text-xs border border-dashed border-border-subtle rounded text-text-muted hover:border-accent-cyan/50 hover:text-accent-cyan transition-colors flex items-center justify-center gap-1"
612
+ onClick={() => {
613
+ setAddingReposToGroupId(group.id);
614
+ setReposToAdd(new Set());
615
+ }}
616
+ >
617
+ <PlusIcon />
618
+ Add repositories
619
+ </button>
620
+ ) : null}
621
+
622
+ <div className="flex items-center justify-between">
623
+ <div className="flex items-center gap-2">
624
+ <StatusBadge status={group.coordinatorAgent?.enabled ? 'running' : 'stopped'} />
625
+ {group.coordinatorAgent?.name && (
626
+ <span className="text-sm text-text-secondary">
627
+ {group.coordinatorAgent.name}
628
+ </span>
629
+ )}
630
+ </div>
631
+ <button
632
+ className={`py-1.5 px-3 rounded-md text-xs font-medium transition-colors ${
633
+ group.coordinatorAgent?.enabled
634
+ ? 'bg-error/20 text-error hover:bg-error/30'
635
+ : 'bg-accent-cyan/20 text-accent-cyan hover:bg-accent-cyan/30'
636
+ } ${group.repositoryCount === 0 ? 'opacity-50 cursor-not-allowed' : ''}`}
637
+ onClick={() =>
638
+ group.repositoryCount > 0 &&
639
+ handleEnableCoordinator(group.id, !group.coordinatorAgent?.enabled)
640
+ }
641
+ disabled={group.repositoryCount === 0}
642
+ title={group.repositoryCount === 0 ? 'Add repositories first' : undefined}
643
+ >
644
+ {group.coordinatorAgent?.enabled ? 'Stop' : 'Start'} Coordinator
645
+ </button>
646
+ </div>
647
+ </div>
648
+ ))}
649
+ </div>
650
+ )}
651
+
652
+ {/* Edit group modal */}
653
+ {editingGroup && (
654
+ <div className="bg-bg-tertiary rounded-lg p-4 border border-accent-cyan/30 mb-4">
655
+ <h4 className="text-sm font-semibold text-text-primary mb-4">
656
+ Edit Project Group
657
+ </h4>
658
+ <EditGroupForm
659
+ group={editingGroup}
660
+ onSave={(updates) => handleUpdateGroup(editingGroup.id, updates)}
661
+ onCancel={() => setEditingGroup(null)}
662
+ />
663
+ </div>
664
+ )}
665
+
666
+ {/* Create new group form */}
667
+ {showCreateForm ? (
668
+ <div className="bg-bg-tertiary rounded-lg p-4 border border-accent-cyan/30">
669
+ <h4 className="text-sm font-semibold text-text-primary mb-4">
670
+ Create Project Group
671
+ </h4>
672
+
673
+ <div className="space-y-4">
674
+ <div>
675
+ <label className="block text-xs font-medium text-text-muted mb-1.5">
676
+ Group Name
677
+ </label>
678
+ <input
679
+ type="text"
680
+ className="w-full py-2 px-3 bg-bg-card border border-border-subtle rounded-md text-sm text-text-primary outline-none focus:border-accent-cyan/50"
681
+ placeholder="e.g., Frontend Team"
682
+ value={newGroupName}
683
+ onChange={(e) => setNewGroupName(e.target.value)}
684
+ />
685
+ </div>
686
+
687
+ <div>
688
+ <label className="block text-xs font-medium text-text-muted mb-1.5">
689
+ Description (optional)
690
+ </label>
691
+ <input
692
+ type="text"
693
+ className="w-full py-2 px-3 bg-bg-card border border-border-subtle rounded-md text-sm text-text-primary outline-none focus:border-accent-cyan/50"
694
+ placeholder="e.g., All frontend repositories"
695
+ value={newGroupDescription}
696
+ onChange={(e) => setNewGroupDescription(e.target.value)}
697
+ />
698
+ </div>
699
+
700
+ <div>
701
+ <label className="block text-xs font-medium text-text-muted mb-1.5">
702
+ Select Repositories
703
+ </label>
704
+ <div className="space-y-2 max-h-[200px] overflow-y-auto">
705
+ {ungroupedRepos.map((repo) => (
706
+ <label
707
+ key={repo.id}
708
+ className="flex items-center gap-2 p-2 bg-bg-card rounded-md cursor-pointer hover:bg-bg-hover"
709
+ >
710
+ <input
711
+ type="checkbox"
712
+ className="accent-accent-cyan"
713
+ checked={selectedRepos.has(repo.id)}
714
+ onChange={() => toggleRepo(repo.id)}
715
+ />
716
+ <span className="text-sm text-text-primary font-mono">
717
+ {repo.githubFullName}
718
+ </span>
719
+ {repo.isPrivate && (
720
+ <span className="text-xs text-text-muted">🔒</span>
721
+ )}
722
+ </label>
723
+ ))}
724
+ {ungroupedRepos.length === 0 && (
725
+ <p className="text-sm text-text-muted py-4 text-center">
726
+ No ungrouped repositories. Add repositories in Settings or ungroup existing ones.
727
+ </p>
728
+ )}
729
+ </div>
730
+ </div>
731
+
732
+ <div className="flex justify-end gap-2">
733
+ <button
734
+ className="py-2 px-4 bg-transparent border border-border-subtle rounded-md text-sm text-text-secondary hover:bg-bg-hover"
735
+ onClick={() => {
736
+ setShowCreateForm(false);
737
+ setNewGroupName('');
738
+ setNewGroupDescription('');
739
+ setSelectedRepos(new Set());
740
+ }}
741
+ >
742
+ Cancel
743
+ </button>
744
+ <button
745
+ className="py-2 px-4 bg-accent-cyan text-bg-deep rounded-md text-sm font-medium hover:bg-accent-cyan/90 disabled:opacity-50"
746
+ onClick={handleCreateGroup}
747
+ disabled={!newGroupName.trim() || selectedRepos.size === 0 || isLoading}
748
+ >
749
+ {isLoading ? 'Creating...' : 'Create Group'}
750
+ </button>
751
+ </div>
752
+ </div>
753
+ </div>
754
+ ) : (
755
+ <button
756
+ className="w-full py-3 px-4 border-2 border-dashed border-border-subtle rounded-lg text-text-muted hover:border-accent-cyan/50 hover:text-accent-cyan transition-colors flex items-center justify-center gap-2"
757
+ onClick={() => setShowCreateForm(true)}
758
+ disabled={!!editingGroup}
759
+ >
760
+ <PlusIcon />
761
+ Create Project Group
762
+ </button>
763
+ )}
764
+
765
+ {/* Info box */}
766
+ <div className="mt-6 p-4 bg-bg-tertiary/50 rounded-lg border border-border-subtle">
767
+ <h4 className="text-sm font-semibold text-text-primary mb-2 flex items-center gap-2">
768
+ <InfoIcon />
769
+ What is a Coordinator?
770
+ </h4>
771
+ <p className="text-sm text-text-secondary">
772
+ A coordinator is a high-level AI agent that oversees multiple projects. It can
773
+ delegate tasks to project leads, ensure consistency across codebases, and manage
774
+ cross-project dependencies.
775
+ </p>
776
+ </div>
777
+ </>
778
+ )}
779
+ </div>
780
+ </div>
781
+ </div>
782
+ );
783
+ }
784
+
785
+ function StatusBadge({ status }: { status: string }) {
786
+ const colors: Record<string, string> = {
787
+ stopped: 'bg-text-muted/20 text-text-muted',
788
+ starting: 'bg-accent-orange/20 text-accent-orange',
789
+ running: 'bg-success/20 text-success',
790
+ error: 'bg-error/20 text-error',
791
+ };
792
+
793
+ return (
794
+ <span className={`px-2 py-0.5 rounded-full text-xs font-medium ${colors[status] || colors.stopped}`}>
795
+ {status}
796
+ </span>
797
+ );
798
+ }
799
+
800
+ function LoadingSpinner() {
801
+ return (
802
+ <svg className="animate-spin h-6 w-6 text-accent-cyan" viewBox="0 0 24 24">
803
+ <circle
804
+ cx="12"
805
+ cy="12"
806
+ r="10"
807
+ stroke="currentColor"
808
+ strokeWidth="2"
809
+ fill="none"
810
+ strokeDasharray="32"
811
+ strokeLinecap="round"
812
+ />
813
+ </svg>
814
+ );
815
+ }
816
+
817
+ function CoordinatorIcon() {
818
+ return (
819
+ <svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" className="text-accent-cyan">
820
+ <circle cx="12" cy="12" r="3" />
821
+ <circle cx="5" cy="5" r="2" />
822
+ <circle cx="19" cy="5" r="2" />
823
+ <circle cx="5" cy="19" r="2" />
824
+ <circle cx="19" cy="19" r="2" />
825
+ <line x1="9.5" y1="9.5" x2="6.5" y2="6.5" />
826
+ <line x1="14.5" y1="9.5" x2="17.5" y2="6.5" />
827
+ <line x1="9.5" y1="14.5" x2="6.5" y2="17.5" />
828
+ <line x1="14.5" y1="14.5" x2="17.5" y2="17.5" />
829
+ </svg>
830
+ );
831
+ }
832
+
833
+ function CloseIcon({ size = 20 }: { size?: number }) {
834
+ return (
835
+ <svg width={size} height={size} viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2">
836
+ <line x1="18" y1="6" x2="6" y2="18" />
837
+ <line x1="6" y1="6" x2="18" y2="18" />
838
+ </svg>
839
+ );
840
+ }
841
+
842
+ function EditIcon() {
843
+ return (
844
+ <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2">
845
+ <path d="M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7" />
846
+ <path d="M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z" />
847
+ </svg>
848
+ );
849
+ }
850
+
851
+ function PlusIcon() {
852
+ return (
853
+ <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2">
854
+ <line x1="12" y1="5" x2="12" y2="19" />
855
+ <line x1="5" y1="12" x2="19" y2="12" />
856
+ </svg>
857
+ );
858
+ }
859
+
860
+ function TrashIcon() {
861
+ return (
862
+ <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2">
863
+ <polyline points="3 6 5 6 21 6" />
864
+ <path d="M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2" />
865
+ </svg>
866
+ );
867
+ }
868
+
869
+ function InfoIcon() {
870
+ return (
871
+ <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" className="text-accent-cyan">
872
+ <circle cx="12" cy="12" r="10" />
873
+ <line x1="12" y1="16" x2="12" y2="12" />
874
+ <line x1="12" y1="8" x2="12.01" y2="8" />
875
+ </svg>
876
+ );
877
+ }
878
+
879
+ function CheckIcon() {
880
+ return (
881
+ <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2.5" className="text-success">
882
+ <polyline points="20 6 9 17 4 12" />
883
+ </svg>
884
+ );
885
+ }
886
+
887
+ interface EditGroupFormProps {
888
+ group: ProjectGroup;
889
+ onSave: (updates: { name?: string; description?: string }) => void;
890
+ onCancel: () => void;
891
+ }
892
+
893
+ function EditGroupForm({ group, onSave, onCancel }: EditGroupFormProps) {
894
+ const [name, setName] = useState(group.name);
895
+ const [description, setDescription] = useState(group.description || '');
896
+
897
+ const handleSave = () => {
898
+ const updates: { name?: string; description?: string } = {};
899
+ if (name.trim() !== group.name) {
900
+ updates.name = name.trim();
901
+ }
902
+ if (description.trim() !== (group.description || '')) {
903
+ updates.description = description.trim();
904
+ }
905
+ if (Object.keys(updates).length > 0) {
906
+ onSave(updates);
907
+ } else {
908
+ onCancel();
909
+ }
910
+ };
911
+
912
+ return (
913
+ <div className="space-y-4">
914
+ <div>
915
+ <label className="block text-xs font-medium text-text-muted mb-1.5">
916
+ Group Name
917
+ </label>
918
+ <input
919
+ type="text"
920
+ className="w-full py-2 px-3 bg-bg-card border border-border-subtle rounded-md text-sm text-text-primary outline-none focus:border-accent-cyan/50"
921
+ value={name}
922
+ onChange={(e) => setName(e.target.value)}
923
+ />
924
+ </div>
925
+
926
+ <div>
927
+ <label className="block text-xs font-medium text-text-muted mb-1.5">
928
+ Description
929
+ </label>
930
+ <input
931
+ type="text"
932
+ className="w-full py-2 px-3 bg-bg-card border border-border-subtle rounded-md text-sm text-text-primary outline-none focus:border-accent-cyan/50"
933
+ placeholder="Optional description"
934
+ value={description}
935
+ onChange={(e) => setDescription(e.target.value)}
936
+ />
937
+ </div>
938
+
939
+ <div className="flex justify-end gap-2">
940
+ <button
941
+ className="py-2 px-4 bg-transparent border border-border-subtle rounded-md text-sm text-text-secondary hover:bg-bg-hover"
942
+ onClick={onCancel}
943
+ >
944
+ Cancel
945
+ </button>
946
+ <button
947
+ className="py-2 px-4 bg-accent-cyan text-bg-deep rounded-md text-sm font-medium hover:bg-accent-cyan/90 disabled:opacity-50"
948
+ onClick={handleSave}
949
+ disabled={!name.trim()}
950
+ >
951
+ Save Changes
952
+ </button>
953
+ </div>
954
+ </div>
955
+ );
956
+ }