moi-computer 0.3.0-next.1 → 0.3.0-next.2
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/bunfig.toml +5 -1
- package/client/AGENTS.md +15 -0
- package/client/accept-hmr-dependencies.ts +22 -0
- package/client/api/http.ts +31 -0
- package/client/api/query-options.ts +6 -0
- package/client/api/workspace-keys.ts +17 -0
- package/client/app/AppRouter.tsx +35 -0
- package/client/app/routes/HomeRoute.tsx +13 -0
- package/client/app/routes/WorkspaceRoute.tsx +89 -0
- package/client/app/shell/SidebarLayout.tsx +191 -0
- package/client/assets.d.ts +9 -0
- package/client/components/playground/PixelPainter.tsx +10 -21
- package/client/components/playground/PlaygroundPage.tsx +9 -11
- package/client/components/playground/ToolCallsPage.tsx +9 -11
- package/client/components/{BottomPanel.tsx → shared/BottomPanel.tsx} +1 -1
- package/client/components/shared/PanelHeader.tsx +9 -0
- package/client/components/shared/ReorderableList.tsx +199 -0
- package/client/components/ui/button.tsx +10 -7
- package/client/components/ui/collapsible.tsx +15 -0
- package/client/components/ui/dialog.tsx +2 -2
- package/client/components/ui/dropdown-menu.tsx +5 -5
- package/client/components/ui/hover-card.tsx +1 -1
- package/client/components/ui/popover.tsx +1 -1
- package/client/components/ui/skeleton.tsx +13 -0
- package/client/components/ui/tooltip.tsx +1 -1
- package/client/externalize-react.ts +7 -1
- package/client/{components → features/applets}/WidgetErrorBoundary.tsx +1 -1
- package/client/{components → features/applets}/WidgetShell.tsx +1 -1
- package/client/{hooks → features/applets}/useApplet.ts +6 -7
- package/client/{components/ChatInput.tsx → features/chat/ChatComposer.tsx} +29 -23
- package/client/features/chat/ChatPanel.tsx +188 -0
- package/client/{components → features/chat}/ChatPopup.tsx +23 -12
- package/client/{components → features/chat}/MarkdownContent.tsx +1 -1
- package/client/{components → features/chat}/ModelPicker.tsx +68 -17
- package/client/{components → features/chat}/ThreadSelector.tsx +11 -9
- package/client/{components → features/chat}/TurnView.tsx +16 -9
- package/client/features/chat/api.ts +78 -0
- package/client/features/chat/chat-connection.ts +107 -0
- package/client/features/chat/chat-frames.ts +131 -0
- package/client/{lib → features/chat}/preview-turn.ts +1 -1
- package/client/{components → features/chat}/tool-group/ReadImagePreview.tsx +1 -1
- package/client/{components → features/chat}/tool-group/SubagentCard.tsx +12 -10
- package/client/{components → features/chat}/tool-group/TimelineRow.tsx +5 -5
- package/client/{components → features/chat}/tool-group/ToolCallGroup.tsx +12 -4
- package/client/{components → features/chat}/tool-group/ToolOutput.tsx +12 -18
- package/client/{hooks → features/chat}/useChat.ts +7 -11
- package/client/features/connectors/ConnectorsPage.tsx +92 -0
- package/client/features/connectors/McpMenu.tsx +162 -0
- package/client/features/connectors/api.ts +28 -0
- package/client/features/home/CreateWorkspaceDialog.tsx +224 -0
- package/client/features/home/HomePage.tsx +220 -0
- package/client/{components → features/home}/WorkspacePreview.tsx +2 -2
- package/client/features/home/api.ts +148 -0
- package/client/features/home/workspace-presentation.tsx +44 -0
- package/client/features/scratchpad/Scratchpad.tsx +312 -0
- package/client/features/scratchpad/ScratchpadControls.tsx +503 -0
- package/client/features/scratchpad/useScratchpadSnapshot.tsx +115 -0
- package/client/features/settings/EnvironmentSettings.tsx +149 -0
- package/client/features/settings/GeneralSettings.tsx +90 -0
- package/client/{components → features}/settings/IconPicker.tsx +73 -222
- package/client/features/settings/SettingsLayout.tsx +53 -0
- package/client/{components → features}/settings/WorkspaceSettings.tsx +12 -16
- package/client/features/settings/api.ts +88 -0
- package/client/features/settings/icon-picker-options.ts +161 -0
- package/client/{hooks → features/settings}/useEnvVars.ts +4 -4
- package/client/{components → features/widgets}/HiddenPanel.tsx +3 -3
- package/client/{components → features/widgets}/WidgetFrame.tsx +3 -8
- package/client/{components → features/widgets}/WidgetGrid.tsx +2 -9
- package/client/features/widgets/Widgets.tsx +215 -0
- package/client/{lib/grid-pack.ts → features/widgets/grid.ts} +7 -1
- package/client/{hooks → features/widgets}/useGridReconcile.ts +1 -1
- package/client/{components → features/workspace}/CustomizePanel.tsx +5 -6
- package/client/{lib → features/workspace}/WorkspaceLayoutContext.tsx +15 -8
- package/client/features/workspace/WorkspaceScreen.tsx +536 -0
- package/client/features/workspace/WorkspaceTabs.tsx +205 -0
- package/client/features/workspace/api.ts +56 -0
- package/client/features/workspace/useFitsSplitLayout.ts +37 -0
- package/client/global.d.ts +5 -0
- package/client/index.css +6 -10
- package/client/index.html +1 -1
- package/client/index.tsx +14 -31
- package/client/main.tsx +2 -2
- package/client/runtime/hmr-watchdog.ts +39 -0
- package/client/{hooks/useMeiEvents.ts → runtime/useWorkspaceEvents.ts} +9 -6
- package/client/store/ui.ts +5 -1
- package/client/theme.css +0 -2
- package/dist/chunk-11cab5dq.css +1 -0
- package/dist/chunk-23cgr1tz.css +1 -0
- package/dist/chunk-3hy3qy6d.js +10 -0
- package/dist/chunk-c4j722at.js +546 -0
- package/dist/chunk-dyfaffyz.js +119 -0
- package/dist/chunk-kpe40hm8.js +1 -0
- package/dist/chunk-p68fnz3q.js +2 -0
- package/dist/chunk-pcnahct1.js +5 -0
- package/dist/chunk-tqd3pkg8.css +1 -0
- package/dist/chunk-ty6dvda0.js +1 -0
- package/dist/index.html +2 -2
- package/lib/types.ts +18 -7
- package/lib/workspace-name.ts +14 -0
- package/package.json +3 -2
- package/server/api.ts +119 -14
- package/server/cli.ts +11 -5
- package/server/layout.ts +38 -7
- package/server/mcp.ts +72 -15
- package/server/moi-scaffold.ts +55 -10
- package/server/registry.ts +16 -0
- package/server/web.ts +1 -0
- package/server/workspace-init.ts +5 -19
- package/tsconfig.json +1 -1
- package/workspace/.claude/skills/moi-workspace/DESIGN.md +1 -1
- package/workspace/.claude/skills/moi-workspace/VIEW-DESIGN.md +1 -1
- package/client/api/workspaces.ts +0 -427
- package/client/components/App.tsx +0 -41
- package/client/components/ChatPanel.tsx +0 -275
- package/client/components/HomePage.tsx +0 -17
- package/client/components/McpMenu.tsx +0 -125
- package/client/components/Scratchpad.tsx +0 -935
- package/client/components/Widgets.tsx +0 -132
- package/client/components/WorkspacesPage.tsx +0 -245
- package/client/components/layout/SidebarLayout.tsx +0 -258
- package/client/components/routes/workspace/[id].tsx +0 -675
- package/client/components/routes/workspace/create.tsx +0 -155
- package/client/components/settings/SettingsPages.tsx +0 -255
- package/client/hooks/useFitsSidebar.ts +0 -34
- package/client/lib/connection.ts +0 -238
- package/dist/chunk-07qf2tv1.css +0 -1
- package/dist/chunk-w18801vn.js +0 -672
- /package/client/components/{playground → shared}/LedLogo.tsx +0 -0
- /package/client/{lib → features/applets}/applet-cache.ts +0 -0
- /package/client/{components → features/chat}/ShimmerText.tsx +0 -0
- /package/client/{store/live.ts → features/chat/chat-store.ts} +0 -0
- /package/client/{lib → features/chat}/group-turns.ts +0 -0
- /package/client/{components → features/chat}/tool-group/CodeBlock.tsx +0 -0
- /package/client/{components → features/chat}/tool-group/Collapse.tsx +0 -0
- /package/client/{components → features/chat}/tool-group/detect.ts +0 -0
- /package/client/{components → features/chat}/tool-group/fixtures.ts +0 -0
- /package/client/{components → features/chat}/tool-group/format.ts +0 -0
- /package/client/{components → features/chat}/tool-group/index.ts +0 -0
- /package/client/{lib → features/chat}/uploads.ts +0 -0
- /package/client/{hooks → features/chat}/useStickToBottom.ts +0 -0
- /package/client/{components → features/connectors}/IconMcp.tsx +0 -0
- /package/client/{lib → features/connectors}/mcp-icons.ts +0 -0
- /package/client/{lib → features/scratchpad}/scratch-executor.ts +0 -0
- /package/client/{lib → features/settings}/render-icon.ts +0 -0
- /package/client/{lib → features/workspace}/WorkspaceContext.tsx +0 -0
- /package/client/{hooks → features/workspace}/useWorkspaceTheme.ts +0 -0
|
@@ -1,275 +0,0 @@
|
|
|
1
|
-
import { useCallback, useMemo } from 'react'
|
|
2
|
-
|
|
3
|
-
import { IconChevronDown, IconChevronsRight, IconSelector, IconX } from '@tabler/icons-react'
|
|
4
|
-
|
|
5
|
-
import { useScrollFade } from '@/client/hooks/useScrollFade'
|
|
6
|
-
import { useStickToBottom } from '@/client/hooks/useStickToBottom'
|
|
7
|
-
import { cn } from '@/client/lib/cn'
|
|
8
|
-
import { groupTurns } from '@/client/lib/group-turns'
|
|
9
|
-
import type { ChatDisplay, Turn, ViewState } from '@/lib/types'
|
|
10
|
-
|
|
11
|
-
import { ChatInput } from './ChatInput'
|
|
12
|
-
import { ThreadSelector } from './ThreadSelector'
|
|
13
|
-
import { EmptyState, ThinkingIndicator, TurnView } from './TurnView'
|
|
14
|
-
import { Button } from './ui/button'
|
|
15
|
-
import {
|
|
16
|
-
DropdownMenu,
|
|
17
|
-
DropdownMenuContent,
|
|
18
|
-
DropdownMenuRadioGroup,
|
|
19
|
-
DropdownMenuRadioItem,
|
|
20
|
-
DropdownMenuTrigger
|
|
21
|
-
} from './ui/dropdown-menu'
|
|
22
|
-
|
|
23
|
-
type ChatModeIconProps = {
|
|
24
|
-
className?: string
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
function ChatModeIconSidebar({ className }: ChatModeIconProps) {
|
|
28
|
-
return (
|
|
29
|
-
<svg
|
|
30
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
31
|
-
width="24"
|
|
32
|
-
height="24"
|
|
33
|
-
viewBox="0 0 24 24"
|
|
34
|
-
fill="none"
|
|
35
|
-
strokeWidth="1.5"
|
|
36
|
-
className={className}
|
|
37
|
-
>
|
|
38
|
-
<rect x="1.75" y="3.75" width="20.5" height="16.5" rx="2.25" stroke="currentColor" />
|
|
39
|
-
<rect x="11.5" y="5.5" width="9" height="13" rx="1" fill="currentColor" />
|
|
40
|
-
</svg>
|
|
41
|
-
)
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
function ChatModeIconFloating({ className }: ChatModeIconProps) {
|
|
45
|
-
return (
|
|
46
|
-
<svg
|
|
47
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
48
|
-
width="24"
|
|
49
|
-
height="24"
|
|
50
|
-
viewBox="0 0 24 24"
|
|
51
|
-
fill="none"
|
|
52
|
-
strokeWidth="1.5"
|
|
53
|
-
className={className}
|
|
54
|
-
>
|
|
55
|
-
<rect x="1.75" y="3.75" width="20.5" height="16.5" rx="2.25" stroke="currentColor" />
|
|
56
|
-
<rect x="12.5" y="11.5" width="8" height="7" rx="1" fill="currentColor" />
|
|
57
|
-
</svg>
|
|
58
|
-
)
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
function ChatModeIconFullscreen({ className }: ChatModeIconProps) {
|
|
62
|
-
return (
|
|
63
|
-
<svg
|
|
64
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
65
|
-
width="24"
|
|
66
|
-
height="24"
|
|
67
|
-
viewBox="0 0 24 24"
|
|
68
|
-
fill="none"
|
|
69
|
-
strokeWidth="1.5"
|
|
70
|
-
className={className}
|
|
71
|
-
>
|
|
72
|
-
<rect x="1.75" y="3.75" width="20.5" height="16.5" rx="2.25" stroke="currentColor" />
|
|
73
|
-
<rect x="4.5" y="6.5" width="15" height="11" rx="1" fill="currentColor" />
|
|
74
|
-
</svg>
|
|
75
|
-
)
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
type ChatPanelProps = {
|
|
79
|
-
view: ViewState
|
|
80
|
-
// The live streaming preview as a synthetic assistant turn (or null). Merged
|
|
81
|
-
// into the transcript through the same groupTurns pipeline so a thinking-only
|
|
82
|
-
// preview folds into the current tool group. See client/lib/preview-turn.ts.
|
|
83
|
-
previewTurn?: Turn | null
|
|
84
|
-
// Active thread id — used only as the scroll reset key (jump to bottom on
|
|
85
|
-
// thread switch).
|
|
86
|
-
sessionId?: string | null
|
|
87
|
-
processing: boolean
|
|
88
|
-
error?: string | null
|
|
89
|
-
onDismissError?: () => void
|
|
90
|
-
send: (text: string) => void
|
|
91
|
-
stop: () => void
|
|
92
|
-
// How the chat is shown right now (position, or fullscreen). The mode switch
|
|
93
|
-
// and collapse/close affordances key off this; fullscreen shows neither.
|
|
94
|
-
chatMode: ChatDisplay
|
|
95
|
-
// Constrain the scrollable history and the composer to a centered max-width
|
|
96
|
-
// column (var --chat-max-container) while the header still spans full width.
|
|
97
|
-
// Always on for now; will be toggled per layout mode later.
|
|
98
|
-
contained?: boolean
|
|
99
|
-
onSwitchThread: (sessionId: string | null) => void
|
|
100
|
-
// The chat display picker — sidebar / floating (position) and fullscreen (the
|
|
101
|
-
// transient view). The parent routes each to the right state.
|
|
102
|
-
onModeChange?: (mode: ChatDisplay) => void
|
|
103
|
-
onCollapse?: () => void
|
|
104
|
-
onClose?: () => void
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
export function ChatPanel({
|
|
108
|
-
view,
|
|
109
|
-
previewTurn,
|
|
110
|
-
sessionId,
|
|
111
|
-
processing,
|
|
112
|
-
error,
|
|
113
|
-
onDismissError,
|
|
114
|
-
send,
|
|
115
|
-
stop,
|
|
116
|
-
chatMode,
|
|
117
|
-
contained = true,
|
|
118
|
-
onSwitchThread,
|
|
119
|
-
onModeChange,
|
|
120
|
-
onCollapse,
|
|
121
|
-
onClose
|
|
122
|
-
}: ChatPanelProps) {
|
|
123
|
-
const { ref: scrollRef, showTopFade, showBottomFade } = useScrollFade()
|
|
124
|
-
const turns = view.turns
|
|
125
|
-
// Visual grouping: fold consecutive tool-only assistant turns into one
|
|
126
|
-
// synthetic turn so OpenAI Codex–style traces (which serialize one
|
|
127
|
-
// assistant message per agent step) don't render with the wider
|
|
128
|
-
// inter-turn gap between every tool call. See `dev/turn-spacing.md`.
|
|
129
|
-
// The live preview turn is appended before grouping, so a thinking-only
|
|
130
|
-
// preview merges into the trailing tool group exactly like its finalized form.
|
|
131
|
-
const groupedTurns = useMemo(
|
|
132
|
-
() => groupTurns(previewTurn ? [...turns, previewTurn] : turns),
|
|
133
|
-
[turns, previewTurn]
|
|
134
|
-
)
|
|
135
|
-
|
|
136
|
-
// Stick to the bottom while pinned; respect scroll-up; jump on thread switch.
|
|
137
|
-
const { atBottom, scrollToBottom } = useStickToBottom(scrollRef, sessionId)
|
|
138
|
-
|
|
139
|
-
// Sending always returns the user to the bottom, even if they'd scrolled up —
|
|
140
|
-
// they expect to see their message and the reply.
|
|
141
|
-
const handleSend = useCallback(
|
|
142
|
-
(text: string) => {
|
|
143
|
-
send(text)
|
|
144
|
-
scrollToBottom()
|
|
145
|
-
},
|
|
146
|
-
[send, scrollToBottom]
|
|
147
|
-
)
|
|
148
|
-
|
|
149
|
-
const TriggerIcon =
|
|
150
|
-
chatMode === 'sidebar'
|
|
151
|
-
? ChatModeIconSidebar
|
|
152
|
-
: chatMode === 'floating'
|
|
153
|
-
? ChatModeIconFloating
|
|
154
|
-
: ChatModeIconFullscreen
|
|
155
|
-
|
|
156
|
-
return (
|
|
157
|
-
<div className="flex h-full flex-col pt-2 pb-4">
|
|
158
|
-
<header className="flex items-center justify-between pr-2 pb-2 pl-5">
|
|
159
|
-
<div className="flex min-w-0 items-center gap-2.5">
|
|
160
|
-
<ThreadSelector onSwitch={onSwitchThread} />
|
|
161
|
-
</div>
|
|
162
|
-
<div className="flex items-center gap-0.5">
|
|
163
|
-
{onModeChange && (
|
|
164
|
-
<DropdownMenu>
|
|
165
|
-
<DropdownMenuTrigger
|
|
166
|
-
render={
|
|
167
|
-
<Button
|
|
168
|
-
className="gap-0 pr-1! pl-2!"
|
|
169
|
-
variant="ghost"
|
|
170
|
-
aria-label="Switch chat mode"
|
|
171
|
-
>
|
|
172
|
-
<>
|
|
173
|
-
<TriggerIcon className="text-muted-foreground" />
|
|
174
|
-
<IconSelector className="size-4! text-muted-foreground/50" stroke={2} />
|
|
175
|
-
</>
|
|
176
|
-
</Button>
|
|
177
|
-
}
|
|
178
|
-
/>
|
|
179
|
-
<DropdownMenuContent align="end" className="min-w-40">
|
|
180
|
-
<DropdownMenuRadioGroup value={chatMode} onValueChange={onModeChange}>
|
|
181
|
-
<DropdownMenuRadioItem value="sidebar" closeOnClick>
|
|
182
|
-
<ChatModeIconSidebar />
|
|
183
|
-
Sidebar
|
|
184
|
-
</DropdownMenuRadioItem>
|
|
185
|
-
<DropdownMenuRadioItem value="floating" closeOnClick>
|
|
186
|
-
<ChatModeIconFloating />
|
|
187
|
-
Floating
|
|
188
|
-
</DropdownMenuRadioItem>
|
|
189
|
-
<DropdownMenuRadioItem value="fullscreen" closeOnClick>
|
|
190
|
-
<ChatModeIconFullscreen />
|
|
191
|
-
Fullscreen
|
|
192
|
-
</DropdownMenuRadioItem>
|
|
193
|
-
</DropdownMenuRadioGroup>
|
|
194
|
-
</DropdownMenuContent>
|
|
195
|
-
</DropdownMenu>
|
|
196
|
-
)}
|
|
197
|
-
{chatMode === 'sidebar' && onCollapse && (
|
|
198
|
-
<Button variant="ghost" size="icon" onClick={onCollapse} aria-label="Collapse chat">
|
|
199
|
-
{/* Tabler icon with double chevrons has a really weird optical size, hence the adjustments */}
|
|
200
|
-
<IconChevronsRight className="size-6! text-muted-foreground" stroke={1.5} />
|
|
201
|
-
</Button>
|
|
202
|
-
)}
|
|
203
|
-
{chatMode === 'floating' && onClose && (
|
|
204
|
-
<Button variant="ghost" size="icon" onClick={onClose} aria-label="Close chat">
|
|
205
|
-
<IconX className="text-muted-foreground" stroke={1.5} />
|
|
206
|
-
</Button>
|
|
207
|
-
)}
|
|
208
|
-
</div>
|
|
209
|
-
</header>
|
|
210
|
-
|
|
211
|
-
<div className="relative flex min-h-0 flex-1 flex-col">
|
|
212
|
-
<div
|
|
213
|
-
ref={scrollRef}
|
|
214
|
-
className={cn(
|
|
215
|
-
'flex scrollbar-thin flex-1 flex-col overflow-y-auto overscroll-contain px-5 pt-4 pb-12',
|
|
216
|
-
showTopFade && showBottomFade && 'mask-fade-y',
|
|
217
|
-
showTopFade && !showBottomFade && 'mask-fade-top',
|
|
218
|
-
!showTopFade && showBottomFade && 'mask-fade-bottom'
|
|
219
|
-
)}
|
|
220
|
-
>
|
|
221
|
-
<div
|
|
222
|
-
className={cn(
|
|
223
|
-
'flex flex-1 flex-col gap-6',
|
|
224
|
-
contained && 'mx-auto w-full max-w-[var(--chat-max-container)]'
|
|
225
|
-
)}
|
|
226
|
-
>
|
|
227
|
-
{turns.length === 0 && !processing && <EmptyState />}
|
|
228
|
-
{groupedTurns.map((turn, i) => (
|
|
229
|
-
<TurnView
|
|
230
|
-
key={turn.id}
|
|
231
|
-
turn={turn}
|
|
232
|
-
processing={processing && i === groupedTurns.length - 1}
|
|
233
|
-
/>
|
|
234
|
-
))}
|
|
235
|
-
{/* Pulsing dots only before the first token — once the preview has
|
|
236
|
-
visible content it renders as a (possibly merged) grouped turn. */}
|
|
237
|
-
{processing && !previewTurn && <ThinkingIndicator />}
|
|
238
|
-
</div>
|
|
239
|
-
</div>
|
|
240
|
-
|
|
241
|
-
{/* Jump to latest — shown only when scrolled up, so following the tail
|
|
242
|
-
never yanks the user while they read history. */}
|
|
243
|
-
{!atBottom && turns.length > 0 && (
|
|
244
|
-
<button
|
|
245
|
-
type="button"
|
|
246
|
-
onClick={() => scrollToBottom('smooth')}
|
|
247
|
-
aria-label="Jump to latest"
|
|
248
|
-
className="absolute bottom-3 left-1/2 flex size-8 -translate-x-1/2 animate-in items-center justify-center rounded-full border border-border bg-background text-muted-foreground shadow-md transition-colors duration-150 fade-in slide-in-from-bottom-1 hover:text-foreground"
|
|
249
|
-
>
|
|
250
|
-
<IconChevronDown size={18} stroke={1.5} />
|
|
251
|
-
</button>
|
|
252
|
-
)}
|
|
253
|
-
</div>
|
|
254
|
-
|
|
255
|
-
<div className={cn(contained && 'mx-auto w-full max-w-[var(--chat-max-container)] px-3')}>
|
|
256
|
-
{error && (
|
|
257
|
-
<div className="mb-2 flex items-start gap-2 rounded-md border border-red-200 bg-red-50 px-3 py-2 text-xs text-red-800">
|
|
258
|
-
<span className="flex-1 break-words">{error}</span>
|
|
259
|
-
{onDismissError && (
|
|
260
|
-
<button
|
|
261
|
-
type="button"
|
|
262
|
-
onClick={onDismissError}
|
|
263
|
-
className="text-red-600 hover:text-red-900"
|
|
264
|
-
aria-label="Dismiss error"
|
|
265
|
-
>
|
|
266
|
-
<IconX size={14} stroke={1.5} />
|
|
267
|
-
</button>
|
|
268
|
-
)}
|
|
269
|
-
</div>
|
|
270
|
-
)}
|
|
271
|
-
<ChatInput onSend={handleSend} onStop={stop} processing={processing} />
|
|
272
|
-
</div>
|
|
273
|
-
</div>
|
|
274
|
-
)
|
|
275
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { WorkspacesPage } from './WorkspacesPage'
|
|
2
|
-
import { PanelHeader, SidebarLayout, SidebarToggle } from './layout/SidebarLayout'
|
|
3
|
-
|
|
4
|
-
// The `/` route: the app shell wrapping the workspaces view.
|
|
5
|
-
export function HomePage() {
|
|
6
|
-
return (
|
|
7
|
-
<SidebarLayout>
|
|
8
|
-
<PanelHeader>
|
|
9
|
-
<SidebarToggle />
|
|
10
|
-
<span className="text-sm font-medium text-foreground">Home</span>
|
|
11
|
-
</PanelHeader>
|
|
12
|
-
<div className="min-h-0 flex-1 overflow-y-auto">
|
|
13
|
-
<WorkspacesPage />
|
|
14
|
-
</div>
|
|
15
|
-
</SidebarLayout>
|
|
16
|
-
)
|
|
17
|
-
}
|
|
@@ -1,125 +0,0 @@
|
|
|
1
|
-
import { useWorkspaceMcp } from '@/client/api/workspaces'
|
|
2
|
-
import { IconMcp } from '@/client/components/IconMcp'
|
|
3
|
-
import { Button } from '@/client/components/ui/button'
|
|
4
|
-
import { HoverCard, HoverCardContent, HoverCardTrigger } from '@/client/components/ui/hover-card'
|
|
5
|
-
import { useScrollFade } from '@/client/hooks/useScrollFade'
|
|
6
|
-
import { formatMcpServerName, getMcpIcon } from '@/client/lib/mcp-icons'
|
|
7
|
-
import { useWorkspaceId } from '@/client/lib/WorkspaceContext'
|
|
8
|
-
import { useWorkspaceLayoutCtx } from '@/client/lib/WorkspaceLayoutContext'
|
|
9
|
-
import { cn } from '@/client/lib/cn'
|
|
10
|
-
import type { McpServer } from '@/lib/types'
|
|
11
|
-
|
|
12
|
-
function McpServerRow({ server }: { server: McpServer }) {
|
|
13
|
-
const icon = getMcpIcon(server.name)
|
|
14
|
-
const connected = server.status === 'connected'
|
|
15
|
-
return (
|
|
16
|
-
<div className="flex items-center gap-2.5 rounded-xs px-2 py-1 hover:bg-muted">
|
|
17
|
-
{icon ? (
|
|
18
|
-
<img src={icon} alt="" className="size-5 shrink-0 rounded ring-2 ring-background" />
|
|
19
|
-
) : (
|
|
20
|
-
<span className="flex size-5 shrink-0 items-center justify-center rounded bg-muted text-muted-foreground ring-2 ring-background">
|
|
21
|
-
<IconMcp className="size-4" />
|
|
22
|
-
</span>
|
|
23
|
-
)}
|
|
24
|
-
<span className="flex-1 truncate text-sm text-foreground">
|
|
25
|
-
{formatMcpServerName(server.name)}
|
|
26
|
-
</span>
|
|
27
|
-
<span
|
|
28
|
-
className={cn(
|
|
29
|
-
'size-[5px] shrink-0 rounded-full',
|
|
30
|
-
connected ? 'bg-emerald-500' : 'bg-yellow-500/75'
|
|
31
|
-
)}
|
|
32
|
-
/>
|
|
33
|
-
</div>
|
|
34
|
-
)
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
// The scrollable server list. Its own component so `useScrollFade`'s effect runs
|
|
38
|
-
// when the (portaled, mount-on-open) hover card opens — attaching the scroll ref.
|
|
39
|
-
// Overflow is signalled with top/bottom mask fades; the scrollbar is hidden.
|
|
40
|
-
function McpList({ servers }: { servers: McpServer[] }) {
|
|
41
|
-
const { ref, showTopFade, showBottomFade } = useScrollFade()
|
|
42
|
-
const fade =
|
|
43
|
-
showTopFade && showBottomFade
|
|
44
|
-
? 'mask-fade-y'
|
|
45
|
-
: showTopFade
|
|
46
|
-
? 'mask-fade-top'
|
|
47
|
-
: showBottomFade
|
|
48
|
-
? 'mask-fade-bottom'
|
|
49
|
-
: undefined
|
|
50
|
-
return (
|
|
51
|
-
<div
|
|
52
|
-
ref={ref}
|
|
53
|
-
className={cn(
|
|
54
|
-
'scrollbar-none flex max-h-72 flex-col overflow-y-auto overscroll-contain',
|
|
55
|
-
fade
|
|
56
|
-
)}
|
|
57
|
-
>
|
|
58
|
-
{servers.map(server => (
|
|
59
|
-
<McpServerRow key={server.name} server={server} />
|
|
60
|
-
))}
|
|
61
|
-
</div>
|
|
62
|
-
)
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
// MCP status hover card — Claude workspaces only (OpenClaw/Hermes use other
|
|
66
|
-
// backends). Lists each MCP server with a green/red dot. The (expensive, cached)
|
|
67
|
-
// status query: while it hasn't resolved the trigger is just a gray icon with no
|
|
68
|
-
// dot and no hover card; once loaded the card opens on hover and the icon goes
|
|
69
|
-
// dark + shows a dot badge when any server is connected.
|
|
70
|
-
export function McpMenu() {
|
|
71
|
-
const workspaceId = useWorkspaceId()
|
|
72
|
-
// Read provider from the shared layout context, not a second `useWorkspaceLayout`
|
|
73
|
-
// observer — a duplicate observer that remounts (e.g. when this menu moves
|
|
74
|
-
// between the fullscreen and two-pane headers) fires `refetchOnMount`, which
|
|
75
|
-
// overwrites an in-flight optimistic chat-mode change before it's persisted.
|
|
76
|
-
const { provider, isLoading } = useWorkspaceLayoutCtx()
|
|
77
|
-
const isClaude = !isLoading && provider !== 'openclaw' && provider !== 'hermes'
|
|
78
|
-
const { data: servers } = useWorkspaceMcp(workspaceId, isClaude)
|
|
79
|
-
|
|
80
|
-
if (!isClaude) return null
|
|
81
|
-
|
|
82
|
-
const anyConnected = servers?.some(s => s.status === 'connected') ?? false
|
|
83
|
-
|
|
84
|
-
const trigger = (
|
|
85
|
-
<Button
|
|
86
|
-
variant="ghost"
|
|
87
|
-
size="icon"
|
|
88
|
-
aria-label="MCP"
|
|
89
|
-
className={cn(
|
|
90
|
-
'relative size-7 [&_svg]:size-[20px]',
|
|
91
|
-
anyConnected ? 'text-foreground' : 'text-muted-foreground'
|
|
92
|
-
)}
|
|
93
|
-
>
|
|
94
|
-
<IconMcp />
|
|
95
|
-
{anyConnected && (
|
|
96
|
-
<span className="absolute right-[5px] bottom-1.5 size-[5px] rounded-full bg-foreground ring-1 ring-background" />
|
|
97
|
-
)}
|
|
98
|
-
</Button>
|
|
99
|
-
)
|
|
100
|
-
|
|
101
|
-
// Not loaded yet → plain gray icon, no hover card.
|
|
102
|
-
if (!servers) return trigger
|
|
103
|
-
|
|
104
|
-
// Active (connected) servers first, then disabled/errored/auth-pending. The
|
|
105
|
-
// sort is stable, so each group keeps the server list's original order.
|
|
106
|
-
const sorted = [...servers].sort(
|
|
107
|
-
(a, b) => Number(b.status === 'connected') - Number(a.status === 'connected')
|
|
108
|
-
)
|
|
109
|
-
|
|
110
|
-
return (
|
|
111
|
-
<HoverCard delay={0} closeDelay={100}>
|
|
112
|
-
<HoverCardTrigger render={trigger} />
|
|
113
|
-
<HoverCardContent align="end" sideOffset={6} className="w-56 p-1">
|
|
114
|
-
<div className="px-2 pt-1 pb-1.5 text-xs font-medium text-muted-foreground">
|
|
115
|
-
Connected MCPs
|
|
116
|
-
</div>
|
|
117
|
-
{servers.length === 0 ? (
|
|
118
|
-
<div className="px-2 py-1 text-sm text-muted-foreground">No MCP servers</div>
|
|
119
|
-
) : (
|
|
120
|
-
<McpList servers={sorted} />
|
|
121
|
-
)}
|
|
122
|
-
</HoverCardContent>
|
|
123
|
-
</HoverCard>
|
|
124
|
-
)
|
|
125
|
-
}
|