@agent-relay/dashboard 2.0.82 → 2.0.84

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 (228) hide show
  1. package/out/404.html +1 -1
  2. package/out/_next/static/chunks/1028-da5d75e35d1420f1.js +1 -0
  3. package/out/_next/static/chunks/1528-78b17000a7e10bc6.js +2 -0
  4. package/out/_next/static/chunks/1695-4a5d33ba715e09b4.js +1 -0
  5. package/out/_next/static/chunks/1705-36c2180d00a4a569.js +1 -0
  6. package/out/_next/static/chunks/1dd3208c-e1f87c7b3dc1a820.js +1 -0
  7. package/out/_next/static/chunks/3663-47290254b8f6f5dd.js +1 -0
  8. package/out/_next/static/chunks/3677-4b225baf4801d9b9.js +73 -0
  9. package/out/_next/static/chunks/5118-7e8ada2df38eef07.js +1 -0
  10. package/out/_next/static/chunks/5888-15cbe97c90ed5fae.js +1 -0
  11. package/out/_next/static/chunks/6773-a45343a98df3abb5.js +1 -0
  12. package/out/_next/static/chunks/6940-b824612b605e79b3.js +9 -0
  13. package/out/_next/static/chunks/7894-f4a15249082a680d.js +1 -0
  14. package/out/_next/static/chunks/9175-b3617c1e5cbfed0e.js +1 -0
  15. package/out/_next/static/chunks/9372-1a804b8d08c7a236.js +1 -0
  16. package/out/_next/static/chunks/{ab6c8a12-0a58072fbb505134.js → ab6c8a12-91438a812d94ecf0.js} +1 -1
  17. package/out/_next/static/chunks/app/_not-found/page-8e8842f82d204726.js +1 -0
  18. package/out/_next/static/chunks/app/about/page-b78577a7da8fa459.js +1 -0
  19. package/out/_next/static/chunks/app/app/[[...slug]]/page-3dffd65b6344f53e.js +1 -0
  20. package/out/_next/static/chunks/app/app/onboarding/page-b89be9aa6264a5e1.js +1 -0
  21. package/out/_next/static/chunks/app/blog/go-to-bed-wake-up-to-a-finished-product/page-fbd00893ef69e499.js +1 -0
  22. package/out/_next/static/chunks/app/blog/let-them-cook-multi-agent-orchestration/page-de2ea13649d0b6d3.js +1 -0
  23. package/out/_next/static/chunks/app/blog/page-a08e263c57a156fa.js +1 -0
  24. package/out/_next/static/chunks/app/careers/page-02228e1d6969b232.js +1 -0
  25. package/out/_next/static/chunks/app/changelog/page-1b5c1d79efc6e53a.js +1 -0
  26. package/out/_next/static/chunks/app/cloud/link/page-99654edffffb3af2.js +1 -0
  27. package/out/_next/static/chunks/app/complete-profile/page-59d146e5ddeafc5c.js +1 -0
  28. package/out/_next/static/chunks/app/connect-repos/page-995e16a976a6632c.js +1 -0
  29. package/out/_next/static/chunks/app/contact/page-273396a5ad57bcee.js +1 -0
  30. package/out/_next/static/chunks/app/dev/cli-tools/page-a71b80dcb2d5fc8d.js +1 -0
  31. package/out/_next/static/chunks/app/dev/log-viewer/page-46a6151ae1be0796.js +1 -0
  32. package/out/_next/static/chunks/app/docs/page-7c7cb603b24b7c40.js +1 -0
  33. package/out/_next/static/chunks/app/history/page-0c5cab1dab4e8886.js +1 -0
  34. package/out/_next/static/chunks/app/layout-96d72ba8ef8a43a0.js +1 -0
  35. package/out/_next/static/chunks/app/login/page-0ccbab34213df842.js +1 -0
  36. package/out/_next/static/chunks/app/metrics/page-8616272aeab9c8b0.js +1 -0
  37. package/out/_next/static/chunks/app/page-09ce10603ad9a251.js +1 -0
  38. package/out/_next/static/chunks/app/pricing/page-91c975079120c941.js +1 -0
  39. package/out/_next/static/chunks/app/privacy/{page-c21d51ac2dee3a88.js → page-a49ab271cc686644.js} +1 -1
  40. package/out/_next/static/chunks/app/providers/{page-59114505f4353512.js → page-d775d6eb5bc29e96.js} +1 -1
  41. package/out/_next/static/chunks/app/providers/setup/[provider]/page-ec4ef3cd80de807e.js +1 -0
  42. package/out/_next/static/chunks/app/security/page-d9da9bd9191e8f95.js +1 -0
  43. package/out/_next/static/chunks/app/signup/page-930eca0bf5fd299d.js +1 -0
  44. package/out/_next/static/chunks/app/terms/page-3e4827620b98613c.js +1 -0
  45. package/out/_next/static/chunks/framework-648e1ae7da590300.js +1 -0
  46. package/out/_next/static/chunks/{main-acb1b24265295d6a.js → main-2b1990080c292d92.js} +1 -1
  47. package/out/_next/static/chunks/main-app-9f6b7ff9e754a8f5.js +1 -0
  48. package/out/_next/static/chunks/pages/_app-a077b72e02273ab1.js +1 -0
  49. package/out/_next/static/chunks/pages/_error-84001666436a04e4.js +1 -0
  50. package/out/_next/static/chunks/{webpack-dd93b81e2659669c.js → webpack-7586035f1585f2db.js} +1 -1
  51. package/out/_next/static/css/eb9fc69d1e3d2bed.css +1 -0
  52. package/out/_next/static/{IxfA6RZu4trcsEMYlkQra → g3G0LMdB7lxcrU5mdM54m}/_buildManifest.js +1 -1
  53. package/out/about.html +2 -2
  54. package/out/about.txt +2 -2
  55. package/out/app/onboarding.html +1 -1
  56. package/out/app/onboarding.txt +2 -2
  57. package/out/app.html +1 -1
  58. package/out/app.txt +2 -2
  59. package/out/blog/go-to-bed-wake-up-to-a-finished-product.html +3 -3
  60. package/out/blog/go-to-bed-wake-up-to-a-finished-product.txt +1 -1
  61. package/out/blog/let-them-cook-multi-agent-orchestration.html +2 -2
  62. package/out/blog/let-them-cook-multi-agent-orchestration.txt +2 -2
  63. package/out/blog.html +2 -2
  64. package/out/blog.txt +1 -1
  65. package/out/careers.html +2 -2
  66. package/out/careers.txt +2 -2
  67. package/out/changelog.html +2 -2
  68. package/out/changelog.txt +2 -2
  69. package/out/cloud/link.html +1 -1
  70. package/out/cloud/link.txt +2 -2
  71. package/out/complete-profile.html +2 -2
  72. package/out/complete-profile.txt +2 -2
  73. package/out/connect-repos.html +1 -1
  74. package/out/connect-repos.txt +2 -2
  75. package/out/contact.html +2 -2
  76. package/out/contact.txt +2 -2
  77. package/out/dev/cli-tools.html +1 -0
  78. package/out/dev/cli-tools.txt +7 -0
  79. package/out/dev/log-viewer.html +23 -0
  80. package/out/dev/log-viewer.txt +7 -0
  81. package/out/docs.html +2 -2
  82. package/out/docs.txt +2 -2
  83. package/out/history.html +1 -1
  84. package/out/history.txt +2 -2
  85. package/out/index.html +1 -1
  86. package/out/index.txt +2 -2
  87. package/out/login.html +2 -2
  88. package/out/login.txt +2 -2
  89. package/out/metrics.html +1 -1
  90. package/out/metrics.txt +2 -2
  91. package/out/pricing.html +2 -2
  92. package/out/pricing.txt +2 -2
  93. package/out/privacy.html +2 -2
  94. package/out/privacy.txt +2 -2
  95. package/out/providers/setup/claude.html +1 -1
  96. package/out/providers/setup/claude.txt +2 -2
  97. package/out/providers/setup/codex.html +1 -1
  98. package/out/providers/setup/codex.txt +2 -2
  99. package/out/providers/setup/cursor.html +1 -1
  100. package/out/providers/setup/cursor.txt +2 -2
  101. package/out/providers.html +1 -1
  102. package/out/providers.txt +2 -2
  103. package/out/security.html +2 -2
  104. package/out/security.txt +2 -2
  105. package/out/signup.html +2 -2
  106. package/out/signup.txt +2 -2
  107. package/out/terms.html +2 -2
  108. package/out/terms.txt +2 -2
  109. package/package.json +5 -1
  110. package/src/adapters/DashboardConfigProvider.tsx +56 -0
  111. package/src/adapters/cloudFetchAdapter.ts +278 -0
  112. package/src/adapters/index.ts +3 -0
  113. package/src/adapters/types.ts +508 -0
  114. package/src/app/app/[[...slug]]/DashboardPageClient.tsx +67 -18
  115. package/src/app/app/onboarding/page.tsx +870 -170
  116. package/src/app/cloud/link/page.tsx +14 -6
  117. package/src/app/connect-repos/page.tsx +9 -3
  118. package/src/app/dev/cli-tools/page.tsx +130 -0
  119. package/src/app/dev/log-viewer/MockLogViewer.tsx +132 -0
  120. package/src/app/dev/log-viewer/fixtures.ts +110 -0
  121. package/src/app/dev/log-viewer/page.tsx +288 -0
  122. package/src/app/history/page.tsx +28 -12
  123. package/src/app/page.tsx +1 -1
  124. package/src/app/providers/setup/[provider]/ProviderSetupClient.tsx +209 -59
  125. package/src/components/AgentCard.tsx +4 -4
  126. package/src/components/AgentLogPreview.tsx +2 -38
  127. package/src/components/App.tsx +441 -2624
  128. package/src/components/CliToolHarness.test.tsx +83 -0
  129. package/src/components/CliToolHarness.tsx +292 -0
  130. package/src/components/CoordinatorPanel.tsx +13 -6
  131. package/src/components/LogViewer.tsx +2 -42
  132. package/src/components/ProviderAuthFlow.tsx +201 -81
  133. package/src/components/ProvisioningProgress.tsx +1 -1
  134. package/src/components/ReactionChips.tsx +2 -1
  135. package/src/components/SpawnModal.test.tsx +51 -18
  136. package/src/components/SpawnModal.tsx +175 -207
  137. package/src/components/TerminalProviderSetup.tsx +1 -1
  138. package/src/components/ThreadPanel.tsx +2 -0
  139. package/src/components/WorkspaceContext.tsx +7 -19
  140. package/src/components/XTermLogViewer.tsx +190 -27
  141. package/src/components/channels/ChannelMessageList.tsx +94 -4
  142. package/src/components/channels/ChannelViewV1.tsx +35 -11
  143. package/src/components/channels/api.ts +21 -20
  144. package/src/components/channels/types.ts +16 -0
  145. package/src/components/hooks/index.ts +0 -19
  146. package/src/components/hooks/useMessages.test.ts +80 -0
  147. package/src/components/hooks/useMessages.ts +13 -4
  148. package/src/components/hooks/useOrchestrator.ts +1 -1
  149. package/src/components/hooks/usePresence.ts +45 -6
  150. package/src/components/hooks/useThread.ts +83 -46
  151. package/src/components/hooks/useTrajectory.ts +62 -5
  152. package/src/components/hooks/useWebSocket.test.ts +358 -0
  153. package/src/components/hooks/useWebSocket.ts +243 -5
  154. package/src/components/index.ts +2 -14
  155. package/src/components/layout/Header.tsx +9 -15
  156. package/src/components/layout/Sidebar.tsx +1 -8
  157. package/src/components/settings/SettingsPage.tsx +108 -47
  158. package/src/components/settings/index.ts +0 -3
  159. package/src/landing/blogData.ts +1 -1
  160. package/src/lib/agent-merge.test.ts +2 -2
  161. package/src/lib/api.ts +8 -38
  162. package/src/lib/identity.test.ts +139 -0
  163. package/src/lib/identity.ts +48 -0
  164. package/src/lib/relaycastMessageAdapters.test.ts +182 -0
  165. package/src/lib/relaycastMessageAdapters.ts +105 -0
  166. package/src/lib/sanitize-logs.test.ts +227 -0
  167. package/src/lib/sanitize-logs.ts +202 -0
  168. package/src/providers/AgentProvider.tsx +799 -0
  169. package/src/providers/ChannelProvider.tsx +528 -0
  170. package/src/providers/CloudWorkspaceProvider.tsx +402 -0
  171. package/src/providers/MessageProvider.tsx +875 -0
  172. package/src/providers/RelayConfigProvider.tsx +94 -0
  173. package/src/providers/SendProvider.tsx +497 -0
  174. package/src/providers/SettingsProvider.tsx +247 -0
  175. package/src/providers/index.ts +26 -0
  176. package/src/types/index.ts +10 -10
  177. package/out/_next/static/chunks/11-9a2993a37266dcb3.js +0 -9
  178. package/out/_next/static/chunks/118-ae2b650136a5a5fc.js +0 -1
  179. package/out/_next/static/chunks/1dd3208c-40ab0fc0f60392b8.js +0 -1
  180. package/out/_next/static/chunks/202-fc0763dd7488e58f.js +0 -1
  181. package/out/_next/static/chunks/259-83b77fa1b91ba5aa.js +0 -1
  182. package/out/_next/static/chunks/407-0c82986cf79c8ecb.js +0 -1
  183. package/out/_next/static/chunks/528-f5f676996d613c25.js +0 -2
  184. package/out/_next/static/chunks/663-ddb04081febc3678.js +0 -1
  185. package/out/_next/static/chunks/687-88b6b139a6bb0e2e.js +0 -1
  186. package/out/_next/static/chunks/695-51d25b1988644374.js +0 -1
  187. package/out/_next/static/chunks/773-54a2641043c81e55.js +0 -1
  188. package/out/_next/static/chunks/app/_not-found/page-6da9b72091e5b511.js +0 -1
  189. package/out/_next/static/chunks/app/about/page-fff7c6457683f243.js +0 -1
  190. package/out/_next/static/chunks/app/app/[[...slug]]/page-f7eca1b66fb4249b.js +0 -1
  191. package/out/_next/static/chunks/app/app/onboarding/page-129abc5da2e67971.js +0 -1
  192. package/out/_next/static/chunks/app/blog/go-to-bed-wake-up-to-a-finished-product/page-5d5f28fd126b692f.js +0 -1
  193. package/out/_next/static/chunks/app/blog/let-them-cook-multi-agent-orchestration/page-b194f207fbd91862.js +0 -1
  194. package/out/_next/static/chunks/app/blog/page-b9bd9d8703fca76a.js +0 -1
  195. package/out/_next/static/chunks/app/careers/page-a4bd8d5f4de8f4eb.js +0 -1
  196. package/out/_next/static/chunks/app/changelog/page-9a1f6ad1743d63c5.js +0 -1
  197. package/out/_next/static/chunks/app/cloud/link/page-0844c5699b027c3b.js +0 -1
  198. package/out/_next/static/chunks/app/complete-profile/page-39ed5a67916beb87.js +0 -1
  199. package/out/_next/static/chunks/app/connect-repos/page-297eddee0c39f2a3.js +0 -1
  200. package/out/_next/static/chunks/app/contact/page-3c1dd8690217fade.js +0 -1
  201. package/out/_next/static/chunks/app/docs/page-1875e981f2c3fd13.js +0 -1
  202. package/out/_next/static/chunks/app/history/page-2d5c5695c9e8b40c.js +0 -1
  203. package/out/_next/static/chunks/app/layout-0a4b99656da25511.js +0 -1
  204. package/out/_next/static/chunks/app/login/page-f69c076f5a6fc520.js +0 -1
  205. package/out/_next/static/chunks/app/metrics/page-bebbee055669a17e.js +0 -1
  206. package/out/_next/static/chunks/app/page-0ee604f7070d14c0.js +0 -1
  207. package/out/_next/static/chunks/app/pricing/page-eeae7d594af333b6.js +0 -1
  208. package/out/_next/static/chunks/app/providers/setup/[provider]/page-daf9b3e05e77ae19.js +0 -1
  209. package/out/_next/static/chunks/app/security/page-cd562730fe84a0a2.js +0 -1
  210. package/out/_next/static/chunks/app/signup/page-c242ca08101a84ff.js +0 -1
  211. package/out/_next/static/chunks/app/terms/page-c7001720e7941dc6.js +0 -1
  212. package/out/_next/static/chunks/framework-3664cab31236a9fa.js +0 -1
  213. package/out/_next/static/chunks/main-app-7f73a939a312a228.js +0 -1
  214. package/out/_next/static/chunks/pages/_app-10a93ab5b7c32eb3.js +0 -1
  215. package/out/_next/static/chunks/pages/_error-2d792b2a41857be4.js +0 -1
  216. package/out/_next/static/css/8968d98ed4c4d33f.css +0 -1
  217. package/src/components/BillingResult.tsx +0 -447
  218. package/src/components/CloudSessionProvider.tsx +0 -130
  219. package/src/components/SessionExpiredModal.tsx +0 -128
  220. package/src/components/WorkspaceStatusIndicator.tsx +0 -396
  221. package/src/components/hooks/useSession.ts +0 -209
  222. package/src/components/hooks/useWorkspaceMembers.ts +0 -132
  223. package/src/components/hooks/useWorkspaceStatus.ts +0 -237
  224. package/src/components/settings/BillingSettingsPanel.tsx +0 -564
  225. package/src/components/settings/TeamSettingsPanel.tsx +0 -560
  226. package/src/components/settings/WorkspaceSettingsPanel.tsx +0 -1368
  227. package/src/lib/cloudApi.ts +0 -893
  228. /package/out/_next/static/{IxfA6RZu4trcsEMYlkQra → g3G0LMdB7lxcrU5mdM54m}/_ssgManifest.js +0 -0
@@ -1,128 +0,0 @@
1
- /**
2
- * Session Expired Modal
3
- *
4
- * Displayed when the user's session has expired and they need to log in again.
5
- * Provides a clear message and easy path to re-authenticate.
6
- */
7
-
8
- import React from 'react';
9
- import type { SessionError } from './hooks/useSession';
10
-
11
- export interface SessionExpiredModalProps {
12
- /** Whether the modal is visible */
13
- isOpen: boolean;
14
- /** Session error details */
15
- error: SessionError | null;
16
- /** Called when user clicks to log in */
17
- onLogin: () => void;
18
- /** Called when modal is dismissed (optional) */
19
- onDismiss?: () => void;
20
- }
21
-
22
- export function SessionExpiredModal({
23
- isOpen,
24
- error,
25
- onLogin,
26
- onDismiss,
27
- }: SessionExpiredModalProps) {
28
- if (!isOpen) return null;
29
-
30
- const getMessage = () => {
31
- if (!error) return 'Your session has expired. Please log in again to continue.';
32
-
33
- switch (error.code) {
34
- case 'SESSION_EXPIRED':
35
- return 'Your session has expired. Please log in again to continue.';
36
- case 'USER_NOT_FOUND':
37
- return 'Your account was not found. Please log in again.';
38
- case 'SESSION_ERROR':
39
- return 'There was a problem with your session. Please log in again.';
40
- default:
41
- return error.message || 'Your session has expired. Please log in again.';
42
- }
43
- };
44
-
45
- return (
46
- <>
47
- {/* Backdrop */}
48
- <div
49
- className="fixed inset-0 bg-black/60 backdrop-blur-sm z-[9998]"
50
- onClick={onDismiss}
51
- aria-hidden="true"
52
- />
53
-
54
- {/* Modal */}
55
- <div
56
- className="fixed inset-0 flex items-center justify-center z-[9999] p-4"
57
- role="dialog"
58
- aria-modal="true"
59
- aria-labelledby="session-expired-title"
60
- >
61
- <div className="bg-bg-primary rounded-lg shadow-xl max-w-md w-full p-6 animate-in fade-in zoom-in-95 duration-200">
62
- {/* Icon */}
63
- <div className="flex justify-center mb-4">
64
- <div className="w-16 h-16 rounded-full bg-warning/10 flex items-center justify-center">
65
- <svg
66
- className="w-8 h-8 text-warning"
67
- fill="none"
68
- viewBox="0 0 24 24"
69
- stroke="currentColor"
70
- strokeWidth={2}
71
- >
72
- <path
73
- strokeLinecap="round"
74
- strokeLinejoin="round"
75
- d="M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"
76
- />
77
- </svg>
78
- </div>
79
- </div>
80
-
81
- {/* Title */}
82
- <h2
83
- id="session-expired-title"
84
- className="text-xl font-semibold text-text-primary text-center mb-2"
85
- >
86
- Session Expired
87
- </h2>
88
-
89
- {/* Message */}
90
- <p className="text-text-muted text-center mb-6">
91
- {getMessage()}
92
- </p>
93
-
94
- {/* Actions */}
95
- <div className="flex flex-col gap-3">
96
- <button
97
- onClick={onLogin}
98
- className="w-full py-3 px-4 bg-accent text-white font-medium rounded-lg
99
- hover:bg-accent-hover transition-colors duration-200
100
- focus:outline-none focus:ring-2 focus:ring-accent focus:ring-offset-2
101
- focus:ring-offset-bg-primary"
102
- >
103
- Log In Again
104
- </button>
105
-
106
- {onDismiss && (
107
- <button
108
- onClick={onDismiss}
109
- className="w-full py-3 px-4 text-text-muted hover:text-text-primary
110
- font-medium rounded-lg transition-colors duration-200
111
- hover:bg-bg-secondary"
112
- >
113
- Dismiss
114
- </button>
115
- )}
116
- </div>
117
-
118
- {/* Help text */}
119
- <p className="text-xs text-text-muted text-center mt-4">
120
- You'll be redirected to the login page where you can sign in with GitHub.
121
- </p>
122
- </div>
123
- </div>
124
- </>
125
- );
126
- }
127
-
128
- export default SessionExpiredModal;
@@ -1,396 +0,0 @@
1
- /**
2
- * Workspace Status Indicator
3
- *
4
- * Shows workspace status in the dashboard with visual indicators:
5
- * - Running (green): Workspace is active and ready
6
- * - Stopped (amber): Workspace is idle, can be woken up
7
- * - Provisioning (cyan): Workspace is being created
8
- * - Error (red): Workspace has an issue
9
- * - None (gray): No workspace exists
10
- */
11
-
12
- import React, { useCallback, useState } from 'react';
13
- import { cloudApi } from '../lib/cloudApi';
14
- import { useWorkspaceStatus } from './hooks/useWorkspaceStatus';
15
-
16
- export interface WorkspaceStatusIndicatorProps {
17
- /** Show expanded view with details (default: false) */
18
- expanded?: boolean;
19
- /** Auto-wakeup when workspace is stopped (default: false) */
20
- autoWakeup?: boolean;
21
- /** Callback when wakeup is triggered */
22
- onWakeup?: () => void;
23
- /** Callback when status changes */
24
- onStatusChange?: (status: string) => void;
25
- /** Custom class name */
26
- className?: string;
27
- }
28
-
29
- export function WorkspaceStatusIndicator({
30
- expanded = false,
31
- autoWakeup = false,
32
- onWakeup,
33
- onStatusChange,
34
- className = '',
35
- }: WorkspaceStatusIndicatorProps) {
36
- const [showToast, setShowToast] = useState(false);
37
- const [toastMessage, setToastMessage] = useState('');
38
-
39
- const {
40
- workspace,
41
- exists,
42
- isLoading,
43
- isWakingUp,
44
- statusMessage,
45
- actionNeeded,
46
- wakeup,
47
- } = useWorkspaceStatus({
48
- autoWakeup,
49
- onStatusChange: (status, wasRestarted) => {
50
- onStatusChange?.(status);
51
- if (wasRestarted) {
52
- setToastMessage('Workspace is starting up...');
53
- setShowToast(true);
54
- setTimeout(() => setShowToast(false), 5000);
55
- } else if (status === 'running') {
56
- setToastMessage('Workspace is ready!');
57
- setShowToast(true);
58
- setTimeout(() => setShowToast(false), 3000);
59
- }
60
- },
61
- });
62
-
63
- const [isRestarting, setIsRestarting] = useState(false);
64
-
65
- const handleWakeup = useCallback(async () => {
66
- const result = await wakeup();
67
- if (result.success) {
68
- onWakeup?.();
69
- setToastMessage(result.message);
70
- setShowToast(true);
71
- setTimeout(() => setShowToast(false), 5000);
72
- }
73
- }, [wakeup, onWakeup]);
74
-
75
- const handleRestart = useCallback(async () => {
76
- if (!workspace) return;
77
- setIsRestarting(true);
78
- const result = await cloudApi.restartWorkspace(workspace.id);
79
- if (result.success) {
80
- setToastMessage(result.data.message);
81
- } else {
82
- setToastMessage(result.error);
83
- }
84
- setShowToast(true);
85
- setTimeout(() => setShowToast(false), 5000);
86
- setIsRestarting(false);
87
- }, [workspace]);
88
-
89
- // Get status color and icon
90
- const getStatusConfig = () => {
91
- if (!exists) {
92
- return {
93
- color: 'text-text-muted',
94
- bgColor: 'bg-bg-tertiary',
95
- borderColor: 'border-border-subtle',
96
- icon: <NoWorkspaceIcon />,
97
- label: 'No workspace',
98
- pulseColor: null,
99
- };
100
- }
101
-
102
- if (isLoading && !workspace) {
103
- return {
104
- color: 'text-text-muted',
105
- bgColor: 'bg-bg-tertiary',
106
- borderColor: 'border-border-subtle',
107
- icon: <LoadingIcon />,
108
- label: 'Loading...',
109
- pulseColor: null,
110
- };
111
- }
112
-
113
- if (workspace?.isRunning) {
114
- return {
115
- color: 'text-success',
116
- bgColor: 'bg-success/10',
117
- borderColor: 'border-success/30',
118
- icon: <RunningIcon />,
119
- label: 'Running',
120
- pulseColor: 'bg-success',
121
- };
122
- }
123
-
124
- if (workspace?.isStopped) {
125
- return {
126
- color: 'text-amber-400',
127
- bgColor: 'bg-amber-400/10',
128
- borderColor: 'border-amber-400/30',
129
- icon: <StoppedIcon />,
130
- label: 'Stopped',
131
- pulseColor: null,
132
- };
133
- }
134
-
135
- if (workspace?.isProvisioning || isWakingUp) {
136
- return {
137
- color: 'text-accent-cyan',
138
- bgColor: 'bg-accent-cyan/10',
139
- borderColor: 'border-accent-cyan/30',
140
- icon: <ProvisioningIcon />,
141
- label: isWakingUp ? 'Starting...' : 'Provisioning',
142
- pulseColor: 'bg-accent-cyan',
143
- };
144
- }
145
-
146
- if (workspace?.hasError) {
147
- return {
148
- color: 'text-error',
149
- bgColor: 'bg-error/10',
150
- borderColor: 'border-error/30',
151
- icon: <ErrorIcon />,
152
- label: 'Error',
153
- pulseColor: null,
154
- };
155
- }
156
-
157
- return {
158
- color: 'text-text-muted',
159
- bgColor: 'bg-bg-tertiary',
160
- borderColor: 'border-border-subtle',
161
- icon: <NoWorkspaceIcon />,
162
- label: 'Unknown',
163
- pulseColor: null,
164
- };
165
- };
166
-
167
- const config = getStatusConfig();
168
-
169
- // Compact indicator (for header)
170
- if (!expanded) {
171
- return (
172
- <div className={`relative ${className}`}>
173
- <div
174
- className={`flex items-center gap-2 px-2.5 py-1.5 rounded-lg border ${config.bgColor} ${config.borderColor} cursor-default`}
175
- title={statusMessage || config.label}
176
- >
177
- <span className={config.color}>{config.icon}</span>
178
- <span
179
- className={`text-xs font-medium ${config.color} truncate max-w-[100px]`}
180
- title={statusMessage || config.label}
181
- >
182
- {config.label}
183
- </span>
184
- {config.pulseColor && (
185
- <span
186
- className={`w-2 h-2 rounded-full ${config.pulseColor} animate-pulse`}
187
- />
188
- )}
189
- </div>
190
-
191
- {/* Wakeup button for stopped state */}
192
- {actionNeeded === 'wakeup' && !isWakingUp && (
193
- <button
194
- onClick={handleWakeup}
195
- className="ml-2 px-2 py-1 text-xs font-medium text-amber-400 bg-amber-400/10 border border-amber-400/30 rounded hover:bg-amber-400/20 transition-colors"
196
- >
197
- Wake up
198
- </button>
199
- )}
200
-
201
- {/* Toast notification */}
202
- {showToast && (
203
- <div className="absolute top-full mt-2 left-0 z-50 px-3 py-2 bg-bg-card border border-border-medium rounded-lg shadow-lg text-sm text-text-primary whitespace-nowrap animate-in fade-in slide-in-from-top-2">
204
- {toastMessage}
205
- </div>
206
- )}
207
- </div>
208
- );
209
- }
210
-
211
- // Expanded view (for sidebar or dedicated panel)
212
- return (
213
- <div
214
- className={`rounded-lg border ${config.borderColor} ${config.bgColor} p-4 ${className}`}
215
- >
216
- <div className="flex items-center justify-between mb-3">
217
- <div className="flex items-center gap-2">
218
- <span className={config.color}>{config.icon}</span>
219
- <span className={`text-sm font-semibold ${config.color}`}>
220
- Workspace Status
221
- </span>
222
- </div>
223
- {config.pulseColor && (
224
- <span
225
- className={`w-2.5 h-2.5 rounded-full ${config.pulseColor} animate-pulse`}
226
- />
227
- )}
228
- </div>
229
-
230
- <div className="space-y-2">
231
- <div className="flex items-center justify-between">
232
- <span className="text-xs text-text-muted">Name</span>
233
- <span className="text-sm text-text-primary font-medium truncate max-w-[150px]">
234
- {workspace?.name || 'None'}
235
- </span>
236
- </div>
237
-
238
- <div className="flex items-center justify-between">
239
- <span className="text-xs text-text-muted">Status</span>
240
- <span className={`text-sm font-medium ${config.color}`}>
241
- {config.label}
242
- </span>
243
- </div>
244
-
245
- {statusMessage && (
246
- <p className="text-xs text-text-muted mt-2">{statusMessage}</p>
247
- )}
248
-
249
- {/* Action buttons */}
250
- {actionNeeded === 'wakeup' && !isWakingUp && (
251
- <button
252
- onClick={handleWakeup}
253
- className="w-full mt-3 px-3 py-2 text-sm font-medium text-amber-400 bg-amber-400/10 border border-amber-400/30 rounded-lg hover:bg-amber-400/20 transition-colors"
254
- >
255
- Wake up workspace
256
- </button>
257
- )}
258
-
259
- {actionNeeded === 'check_error' && (
260
- <div className="flex gap-2 mt-3">
261
- <button
262
- onClick={handleRestart}
263
- disabled={isRestarting}
264
- className="flex-1 px-3 py-2 text-sm font-medium text-accent-cyan bg-accent-cyan/10 border border-accent-cyan/30 rounded-lg hover:bg-accent-cyan/20 transition-colors disabled:opacity-50"
265
- >
266
- {isRestarting ? 'Restarting...' : 'Restart'}
267
- </button>
268
- <a
269
- href="/app/settings/workspace"
270
- className="px-3 py-2 text-sm font-medium text-center text-text-muted bg-bg-tertiary border border-border-subtle rounded-lg hover:bg-bg-hover transition-colors no-underline"
271
- >
272
- Settings
273
- </a>
274
- </div>
275
- )}
276
- </div>
277
-
278
- {/* Toast notification */}
279
- {showToast && (
280
- <div className="mt-3 px-3 py-2 bg-bg-card border border-border-medium rounded-lg text-sm text-text-primary animate-in fade-in">
281
- {toastMessage}
282
- </div>
283
- )}
284
- </div>
285
- );
286
- }
287
-
288
- // Icons
289
- function RunningIcon() {
290
- return (
291
- <svg
292
- width="14"
293
- height="14"
294
- viewBox="0 0 24 24"
295
- fill="none"
296
- stroke="currentColor"
297
- strokeWidth="2"
298
- strokeLinecap="round"
299
- strokeLinejoin="round"
300
- >
301
- <polygon points="5 3 19 12 5 21 5 3" />
302
- </svg>
303
- );
304
- }
305
-
306
- function StoppedIcon() {
307
- return (
308
- <svg
309
- width="14"
310
- height="14"
311
- viewBox="0 0 24 24"
312
- fill="none"
313
- stroke="currentColor"
314
- strokeWidth="2"
315
- strokeLinecap="round"
316
- strokeLinejoin="round"
317
- >
318
- <rect x="6" y="6" width="12" height="12" />
319
- </svg>
320
- );
321
- }
322
-
323
- function ProvisioningIcon() {
324
- return (
325
- <svg
326
- width="14"
327
- height="14"
328
- viewBox="0 0 24 24"
329
- fill="none"
330
- stroke="currentColor"
331
- strokeWidth="2"
332
- strokeLinecap="round"
333
- strokeLinejoin="round"
334
- className="animate-spin"
335
- >
336
- <path d="M21 12a9 9 0 1 1-6.219-8.56" />
337
- </svg>
338
- );
339
- }
340
-
341
- function ErrorIcon() {
342
- return (
343
- <svg
344
- width="14"
345
- height="14"
346
- viewBox="0 0 24 24"
347
- fill="none"
348
- stroke="currentColor"
349
- strokeWidth="2"
350
- strokeLinecap="round"
351
- strokeLinejoin="round"
352
- >
353
- <circle cx="12" cy="12" r="10" />
354
- <line x1="15" y1="9" x2="9" y2="15" />
355
- <line x1="9" y1="9" x2="15" y2="15" />
356
- </svg>
357
- );
358
- }
359
-
360
- function NoWorkspaceIcon() {
361
- return (
362
- <svg
363
- width="14"
364
- height="14"
365
- viewBox="0 0 24 24"
366
- fill="none"
367
- stroke="currentColor"
368
- strokeWidth="2"
369
- strokeLinecap="round"
370
- strokeLinejoin="round"
371
- >
372
- <rect x="3" y="3" width="18" height="18" rx="2" ry="2" />
373
- <line x1="12" y1="8" x2="12" y2="16" />
374
- <line x1="8" y1="12" x2="16" y2="12" />
375
- </svg>
376
- );
377
- }
378
-
379
- function LoadingIcon() {
380
- return (
381
- <svg
382
- width="14"
383
- height="14"
384
- viewBox="0 0 24 24"
385
- fill="none"
386
- stroke="currentColor"
387
- strokeWidth="2"
388
- strokeLinecap="round"
389
- strokeLinejoin="round"
390
- className="animate-spin"
391
- >
392
- <circle cx="12" cy="12" r="10" strokeOpacity="0.25" />
393
- <path d="M12 2a10 10 0 0 1 10 10" />
394
- </svg>
395
- );
396
- }