moi-computer 0.3.1-next.1 → 0.4.1-next.0
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/README.md +85 -12
- package/bin/moi.mjs +11 -0
- package/client/api/workspace-keys.ts +1 -0
- package/client/app/AppRouter.tsx +5 -1
- package/client/app/routes/WorkspaceRoute.tsx +9 -5
- package/client/app/shell/SidebarLayout.tsx +9 -7
- package/client/components/shared/BottomPanel.tsx +24 -5
- package/client/components/shared/Composer.tsx +1 -1
- package/client/components/shared/PanelHeader.tsx +1 -1
- package/client/components/ui/button.tsx +5 -5
- package/client/components/ui/dropdown-menu.tsx +6 -6
- package/client/components/ui/hover-card.tsx +1 -1
- package/client/components/ui/input.tsx +1 -1
- package/client/components/ui/popover.tsx +1 -1
- package/client/components/ui/skeleton.tsx +1 -1
- package/client/components/ui/textarea.tsx +1 -1
- package/client/components/ui/tooltip.tsx +1 -1
- package/client/features/applets/applet-cache.ts +20 -1
- package/client/features/applets/applet-log.ts +10 -30
- package/client/features/applets/applet-runtime.ts +272 -0
- package/client/features/applets/useApplet.ts +36 -10
- package/client/features/chat/ChatComposer.tsx +1 -1
- package/client/features/chat/ChatEmptyState.tsx +186 -0
- package/client/features/chat/ChatPanel.tsx +95 -54
- package/client/features/chat/ChatPopup.tsx +3 -13
- package/client/features/chat/ChatPromptBubbles.tsx +74 -0
- package/client/features/chat/MarkdownContent.tsx +15 -3
- package/client/features/chat/ModelPicker.tsx +1 -1
- package/client/features/chat/TurnView.tsx +6 -17
- package/client/features/chat/chat-send.ts +26 -1
- package/client/features/chat/tool-group/CodeBlock.tsx +1 -1
- package/client/features/chat/tool-group/ReadImagePreview.tsx +1 -1
- package/client/features/chat/tool-group/SubagentCard.tsx +1 -1
- package/client/features/chat/tool-group/TimelineRow.tsx +4 -4
- package/client/features/chat/tool-group/ToolCallGroup.tsx +12 -5
- package/client/features/chat/tool-group/ToolOutput.tsx +2 -2
- package/client/features/chat/tool-group/format.ts +25 -4
- package/client/features/chat/useAppletChatMessage.ts +69 -0
- package/client/features/chat/useChat.ts +49 -14
- package/client/features/chat/useStickToBottom.ts +11 -1
- package/client/features/connectors/McpServerCards.tsx +3 -3
- package/client/features/dev/HarnessDebugPage.tsx +213 -77
- package/client/features/dev/PixelPainter.tsx +1 -1
- package/client/features/dev/PlaygroundPage.tsx +1 -1
- package/client/features/dev/ToolCallsPage.tsx +2 -2
- package/client/features/home/HomePage.tsx +17 -14
- package/client/features/home/WorkspacePreview.tsx +12 -13
- package/client/features/home/api.ts +8 -5
- package/client/features/home/workspace-presentation.tsx +1 -1
- package/client/features/home/workspace-setup/CreateWorkspaceDialog.tsx +1 -1
- package/client/features/home/workspace-setup/WorkspaceAgentStep.tsx +21 -8
- package/client/features/scratchpad/Scratchpad.tsx +41 -2
- package/client/features/scratchpad/ScratchpadControls.tsx +13 -13
- package/client/features/scratchpad/useScratchpadSnapshot.tsx +1 -1
- package/client/features/settings/EnvironmentSettings.tsx +1 -1
- package/client/features/settings/IconPicker.tsx +11 -11
- package/client/features/settings/SettingsLayout.tsx +1 -1
- package/client/features/settings/WorkspaceSettings.tsx +2 -2
- package/client/features/settings/api.ts +33 -1
- package/client/features/widgets/HiddenPanel.tsx +4 -3
- package/client/features/widgets/Widgets.tsx +1 -0
- package/client/features/workspace/CustomizePanel.tsx +96 -82
- package/client/features/workspace/WorkspaceScreen.tsx +129 -107
- package/client/features/workspace/WorkspaceSkillUpdateBanner.tsx +91 -0
- package/client/features/workspace/WorkspaceTabs.tsx +1 -1
- package/client/features/workspace/api.ts +52 -0
- package/client/features/workspace/moi-context.ts +63 -17
- package/client/features/workspace/tab-resolution.ts +75 -0
- package/client/features/workspace/useWorkspaceNavigation.ts +128 -0
- package/client/features/workspace/useWorkspaceSkillUpdates.ts +160 -0
- package/client/index.css +10 -15
- package/client/lib/app-icon-registry.ts +77 -70
- package/client/lib/rate-limit.ts +77 -0
- package/client/main.tsx +10 -2
- package/client/runtime/useWorkspaceEvents.ts +15 -2
- package/client/runtime/workspace-theme.ts +115 -0
- package/client/store/ui.ts +42 -17
- package/client/theme.css +20 -15
- package/dist/{chunk-1dfbr7n2.js → chunk-3m1xe1j3.js} +94 -94
- package/dist/chunk-5vaevt8z.js +2 -0
- package/dist/chunk-7bzpmtxp.js +50 -0
- package/dist/chunk-h0hk61pm.js +9 -0
- package/dist/{chunk-vkvb3hjm.js → chunk-h3evrtyp.js} +1 -1
- package/dist/chunk-k5sjx9s5.js +1 -0
- package/dist/{chunk-jen6xcm1.js → chunk-m9qja0nx.js} +1 -1
- package/dist/chunk-s7za1qsv.css +1 -0
- package/dist/{chunk-sxbfh73c.js → chunk-tcfa3vt3.js} +1 -1
- package/dist/chunk-v797g6ap.js +51 -0
- package/dist/chunk-xyrw8318.js +27 -0
- package/dist/index.html +1 -1
- package/lib/app-icons.ts +73 -0
- package/lib/moi-context.ts +104 -3
- package/lib/themes.ts +83 -45
- package/lib/types.ts +44 -9
- package/lib/workspace-tabs.ts +48 -0
- package/package.json +4 -1
- package/server/api.ts +57 -5
- package/server/app-settings.ts +65 -0
- package/server/applets.ts +132 -22
- package/server/bundler/build-applet.ts +74 -16
- package/server/cli.ts +144 -17
- package/server/control.ts +53 -7
- package/server/data-dir.ts +1 -1
- package/server/events.ts +1 -1
- package/server/functions-worker.ts +15 -1
- package/server/functions.ts +51 -6
- package/server/harness/claude-code/index.ts +2 -1
- package/server/harness/codex/adapter.ts +100 -9
- package/server/harness/codex/client.ts +34 -1
- package/server/harness/codex/index.ts +2 -1
- package/server/harness/codex/session.ts +32 -8
- package/server/layout.ts +9 -14
- package/server/moi-scaffold.ts +37 -3
- package/server/registry.ts +1 -1
- package/server/skill-update.ts +47 -0
- package/server/skill-version.ts +2 -11
- package/server/tabs.ts +59 -0
- package/server/theme.ts +8 -14
- package/server/view-builders.ts +6 -2
- package/workspace/.claude/skills/moi-workspace/DESIGN.md +265 -107
- package/workspace/.claude/skills/moi-workspace/SKILL.md +85 -11
- package/client/features/workspace/useWorkspaceTheme.ts +0 -82
- package/dist/chunk-339jds4x.js +0 -15
- package/dist/chunk-3xsvsnhr.css +0 -1
- package/dist/chunk-6c8cwpzc.js +0 -1
- package/dist/chunk-anqmsbjt.js +0 -2
- package/dist/chunk-hbvfb6sk.js +0 -63
- package/dist/chunk-qwm5f6qk.js +0 -48
- package/dist/chunk-yp4srgqt.js +0 -10
- package/workspace/.claude/skills/moi-workspace/VIEW-DESIGN.md +0 -22
|
@@ -128,9 +128,9 @@ const OPENCLAW_TOOL_LABELS: Record<string, string> = {
|
|
|
128
128
|
// Claude tool names are mostly already presentable (Read, Bash, …); only a few
|
|
129
129
|
// need spacing/relabelling.
|
|
130
130
|
const CLAUDE_TOOL_LABELS: Record<string, string> = {
|
|
131
|
-
ToolSearch: 'Tool
|
|
132
|
-
WebSearch: 'Web
|
|
133
|
-
WebFetch: 'Web
|
|
131
|
+
ToolSearch: 'Tool search',
|
|
132
|
+
WebSearch: 'Web search',
|
|
133
|
+
WebFetch: 'Web fetch'
|
|
134
134
|
}
|
|
135
135
|
|
|
136
136
|
// Codex emits semantic items, which the adapter maps to a small fixed set of
|
|
@@ -173,6 +173,15 @@ function codexExecAction(input: unknown): CodexCommandAction | null {
|
|
|
173
173
|
return first
|
|
174
174
|
}
|
|
175
175
|
|
|
176
|
+
// Codex collab tool actions (`input.action` on the `subagent` card). `wait`
|
|
177
|
+
// never reaches the UI — the adapter drops it.
|
|
178
|
+
const CODEX_SUBAGENT_ACTION_LABELS: Record<string, string> = {
|
|
179
|
+
spawn_agent: 'Run sub-agent',
|
|
180
|
+
send_input: 'Message the agent',
|
|
181
|
+
resume_agent: 'Resume the agent',
|
|
182
|
+
close_agent: 'Stopping the agent'
|
|
183
|
+
}
|
|
184
|
+
|
|
176
185
|
export function getToolDisplayName(call: ToolCall): string {
|
|
177
186
|
if (call.provider === 'openclaw') return OPENCLAW_TOOL_LABELS[call.name] ?? call.name
|
|
178
187
|
if (call.provider === 'codex') {
|
|
@@ -180,6 +189,12 @@ export function getToolDisplayName(call: ToolCall): string {
|
|
|
180
189
|
const action = codexExecAction(call.input)
|
|
181
190
|
if (action?.type) return CODEX_ACTION_LABELS[action.type]
|
|
182
191
|
}
|
|
192
|
+
if (call.name === 'subagent') {
|
|
193
|
+
const action = (call.input as { action?: unknown } | null)?.action
|
|
194
|
+
if (typeof action === 'string' && action in CODEX_SUBAGENT_ACTION_LABELS) {
|
|
195
|
+
return CODEX_SUBAGENT_ACTION_LABELS[action]
|
|
196
|
+
}
|
|
197
|
+
}
|
|
183
198
|
return CODEX_TOOL_LABELS[call.name] ?? call.name
|
|
184
199
|
}
|
|
185
200
|
return CLAUDE_TOOL_LABELS[call.name] ?? call.name
|
|
@@ -244,7 +259,13 @@ function formatCodexBrief(
|
|
|
244
259
|
const plan = input.plan
|
|
245
260
|
return typeof plan === 'string' ? plan.split('\n')[0] : ''
|
|
246
261
|
}
|
|
247
|
-
if (tool === 'subagent')
|
|
262
|
+
if (tool === 'subagent') {
|
|
263
|
+
// The label already names the action; the brief carries the text being
|
|
264
|
+
// sent (spawn prompt, send_input/resume_agent message). close_agent has
|
|
265
|
+
// none — the label alone reads fine.
|
|
266
|
+
if (getInputValue(input, 'action') === 'close_agent') return ''
|
|
267
|
+
return getInputValue(input, 'prompt')
|
|
268
|
+
}
|
|
248
269
|
if (tool === 'subagent_activity') return getInputValue(input, 'kind')
|
|
249
270
|
if (tool === 'generate_image') return getInputValue(input, 'prompt').split('\n')[0]
|
|
250
271
|
if (tool === 'read_mcp_resource') return getInputValue(input, 'uri')
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
// Chat's half of the applet `sendChatMessage` API: turn a validated runtime
|
|
2
|
+
// event into a real send on the active chat.
|
|
3
|
+
//
|
|
4
|
+
// The runtime already did the untrusted work — narrowed the args, stamped the
|
|
5
|
+
// applet's `<kind>:<name>` as `source`, and rate-limited repeats
|
|
6
|
+
// (applet-runtime.ts). What's left is chat policy: reveal the chat, then send
|
|
7
|
+
// the text as an ordinary user message with the applet attribution riding the
|
|
8
|
+
// `<moi-context>` envelope.
|
|
9
|
+
//
|
|
10
|
+
// Sending while a turn is running is fine and deliberate — the composer offers
|
|
11
|
+
// the same ("Queue a follow-up"), and the harness queues the message into the
|
|
12
|
+
// live session rather than rejecting it.
|
|
13
|
+
import { reportAppletError } from '@/client/features/applets/applet-log'
|
|
14
|
+
import { type AppletChatMessage, useAppletEvent } from '@/client/features/applets/applet-runtime'
|
|
15
|
+
import type { ChatSendOptions } from '@/client/features/chat/chat-send'
|
|
16
|
+
import { useWorkspaceId } from '@/client/features/workspace/WorkspaceContext'
|
|
17
|
+
|
|
18
|
+
type UseAppletChatMessageOptions = {
|
|
19
|
+
send: (draft: string, options?: ChatSendOptions) => void
|
|
20
|
+
// Bring the chat on screen before the run starts. On a view tab in
|
|
21
|
+
// full-screen mode the chat is a popover that is closed by default, so
|
|
22
|
+
// without this the agent would start working somewhere the user can't see.
|
|
23
|
+
revealChat: () => void
|
|
24
|
+
// Same gate the composer's send button uses: `null` means the agent is
|
|
25
|
+
// ready, a string names why it isn't, and `undefined` means the availability
|
|
26
|
+
// query hasn't answered yet. Only `null` may send.
|
|
27
|
+
unavailableReason: string | null | undefined
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
// Why an applet message can't go out right now, or null when it can. The gate
|
|
31
|
+
// is exactly the composer's — `canSubmitComposerAction` requires `null`, so
|
|
32
|
+
// `undefined` (availability still loading) blocks there too. Starting a run the
|
|
33
|
+
// visible UI would have refused is worse than dropping a click the user can
|
|
34
|
+
// repeat a moment later.
|
|
35
|
+
export function appletSendBlockedReason(
|
|
36
|
+
unavailableReason: string | null | undefined
|
|
37
|
+
): string | null {
|
|
38
|
+
if (unavailableReason === null) return null
|
|
39
|
+
if (unavailableReason === undefined) {
|
|
40
|
+
return "this workspace's agent availability has not resolved yet"
|
|
41
|
+
}
|
|
42
|
+
return `this workspace's agent is unavailable (${unavailableReason})`
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export function useAppletChatMessage({
|
|
46
|
+
send,
|
|
47
|
+
revealChat,
|
|
48
|
+
unavailableReason
|
|
49
|
+
}: UseAppletChatMessageOptions): void {
|
|
50
|
+
const workspaceId = useWorkspaceId()
|
|
51
|
+
|
|
52
|
+
useAppletEvent(workspaceId, 'sendChatMessage', (event: AppletChatMessage) => {
|
|
53
|
+
const blocked = appletSendBlockedReason(unavailableReason)
|
|
54
|
+
if (blocked) {
|
|
55
|
+
// Journaled rather than dropped quietly: from the applet's side the
|
|
56
|
+
// button did nothing, and this is the only place that says why.
|
|
57
|
+
reportAppletError(workspaceId, {
|
|
58
|
+
source: 'runtime',
|
|
59
|
+
message: `sendChatMessage("${event.message}") was dropped: ${blocked}.`
|
|
60
|
+
})
|
|
61
|
+
return
|
|
62
|
+
}
|
|
63
|
+
// `message` is the visible chat text; everything else in the event IS the
|
|
64
|
+
// envelope's applet attribution.
|
|
65
|
+
const { message, ...applet } = event
|
|
66
|
+
revealChat()
|
|
67
|
+
send(message, { applet })
|
|
68
|
+
})
|
|
69
|
+
}
|
|
@@ -3,14 +3,29 @@ import { useCallback, useMemo } from 'react'
|
|
|
3
3
|
import { useQueryClient } from '@tanstack/react-query'
|
|
4
4
|
|
|
5
5
|
import { workspaceKeys } from '@/client/api/workspace-keys'
|
|
6
|
-
import {
|
|
7
|
-
|
|
6
|
+
import {
|
|
7
|
+
useSessionView,
|
|
8
|
+
useThreadConfig,
|
|
9
|
+
useWorkspaceModels,
|
|
10
|
+
useWorkspaceSessions
|
|
11
|
+
} from '@/client/features/chat/api'
|
|
12
|
+
import {
|
|
13
|
+
type WorkspaceTabAddress,
|
|
14
|
+
useMoiUserMessageContext
|
|
15
|
+
} from '@/client/features/workspace/moi-context'
|
|
8
16
|
import { useWorkspaceId } from '@/client/features/workspace/WorkspaceContext'
|
|
9
17
|
import { useWorkspaceLayoutCtx } from '@/client/features/workspace/WorkspaceLayoutContext'
|
|
10
18
|
import { sendMessage } from '@/client/features/chat/chat-connection'
|
|
11
|
-
import {
|
|
19
|
+
import {
|
|
20
|
+
type ChatSendOptions,
|
|
21
|
+
attachmentsForSend,
|
|
22
|
+
ownsComposerAttachments,
|
|
23
|
+
resolveChatRunOptions,
|
|
24
|
+
startOptimisticTurn
|
|
25
|
+
} from '@/client/features/chat/chat-send'
|
|
12
26
|
import { buildPreviewTurn } from '@/client/features/chat/preview-turn'
|
|
13
|
-
import {
|
|
27
|
+
import { liveStore, selectPreviews, useLive } from '@/client/features/chat/chat-store'
|
|
28
|
+
import { useUiStore } from '@/client/store/ui'
|
|
14
29
|
import { emptyViewState } from '@/lib/format'
|
|
15
30
|
import type { Part, ViewState } from '@/lib/types'
|
|
16
31
|
|
|
@@ -19,16 +34,24 @@ const EMPTY: ViewState = emptyViewState()
|
|
|
19
34
|
// Thin projection over app-level state: the active thread + spinner/error come
|
|
20
35
|
// from the live store; the transcript comes from the React Query cache (kept
|
|
21
36
|
// current by the connection manager's WS deltas). No socket lifecycle here.
|
|
22
|
-
|
|
37
|
+
//
|
|
38
|
+
// Takes the workspace's tab address because every message carries it: the
|
|
39
|
+
// envelope tells the agent which tab the user is on and what the active view
|
|
40
|
+
// is rendering with. Call this BELOW `useWorkspaceNavigation`, which owns it.
|
|
41
|
+
export function useChat(address: WorkspaceTabAddress) {
|
|
23
42
|
const workspaceId = useWorkspaceId()
|
|
24
43
|
const qc = useQueryClient()
|
|
25
44
|
const { layout } = useWorkspaceLayoutCtx()
|
|
26
45
|
const modelsData = useWorkspaceModels(workspaceId).data
|
|
46
|
+
const sessions = useWorkspaceSessions(workspaceId).data
|
|
27
47
|
// Snapshot of the workspace's ambient UI state + queued one-shot
|
|
28
48
|
// directives, taken when the message actually goes out.
|
|
29
|
-
const buildMoiContext = useMoiUserMessageContext()
|
|
49
|
+
const buildMoiContext = useMoiUserMessageContext(address)
|
|
30
50
|
|
|
31
51
|
const activeSessionId = useLive(s => s.activeByWorkspace[workspaceId] ?? null)
|
|
52
|
+
const sessionSelectionInitialized = useLive(s =>
|
|
53
|
+
Object.prototype.hasOwnProperty.call(s.activeByWorkspace, workspaceId)
|
|
54
|
+
)
|
|
32
55
|
const activity = useLive(s =>
|
|
33
56
|
activeSessionId ? (s.activity[`${workspaceId}:${activeSessionId}`] ?? 'idle') : 'idle'
|
|
34
57
|
)
|
|
@@ -39,7 +62,14 @@ export function useChat() {
|
|
|
39
62
|
activeSessionId ? (s.errors[`${workspaceId}:${activeSessionId}`] ?? null) : null
|
|
40
63
|
)
|
|
41
64
|
|
|
42
|
-
const
|
|
65
|
+
const viewQuery = useSessionView(workspaceId, activeSessionId)
|
|
66
|
+
const view = viewQuery.data ?? EMPTY
|
|
67
|
+
const chatLoaded =
|
|
68
|
+
sessionSelectionInitialized &&
|
|
69
|
+
sessions !== undefined &&
|
|
70
|
+
(activeSessionId === null ||
|
|
71
|
+
(sessions.some(session => session.sessionId === activeSessionId) &&
|
|
72
|
+
viewQuery.data !== undefined))
|
|
43
73
|
|
|
44
74
|
// The live streaming preview as a synthetic assistant turn, so the ChatPanel
|
|
45
75
|
// can run it through the SAME groupTurns pipeline as finalized turns — a
|
|
@@ -60,13 +90,13 @@ export function useChat() {
|
|
|
60
90
|
// keystroke re-renders only the composer — not this hook's host (WorkspaceView)
|
|
61
91
|
// and its whole subtree. See `ChatInput`.
|
|
62
92
|
const send = useCallback(
|
|
63
|
-
(draft: string) => {
|
|
93
|
+
(draft: string, options?: ChatSendOptions) => {
|
|
64
94
|
const text = draft.trim()
|
|
65
95
|
// Attachments for the active thread, keyed exactly like the draft. Only
|
|
66
96
|
// fully-uploaded ones are sent; the composer disables send while any are
|
|
67
|
-
// still uploading, so in practice they're all ready here.
|
|
68
|
-
|
|
69
|
-
const ready =
|
|
97
|
+
// still uploading, so in practice they're all ready here. An applet send
|
|
98
|
+
// gets none — the staged files are the user's, not the widget's.
|
|
99
|
+
const ready = attachmentsForSend(workspaceId, activeSessionId, options)
|
|
70
100
|
// No `processing` guard: sending while a turn is in flight QUEUES the
|
|
71
101
|
// message into the same live server session (streaming-input mode).
|
|
72
102
|
if (!text && ready.length === 0) return
|
|
@@ -118,16 +148,20 @@ export function useChat() {
|
|
|
118
148
|
model,
|
|
119
149
|
effort,
|
|
120
150
|
stream,
|
|
121
|
-
context: buildMoiContext(),
|
|
151
|
+
context: buildMoiContext(options),
|
|
122
152
|
...(ready.length > 0 ? { attachments: ready.map(a => a.upload!.id) } : {})
|
|
123
153
|
})
|
|
154
|
+
useUiStore.getState().markMessageSentFromMoi(workspaceId)
|
|
124
155
|
if (isNew) {
|
|
125
156
|
qc.invalidateQueries({ queryKey: workspaceKeys.preview(workspaceId) })
|
|
126
157
|
}
|
|
127
158
|
// Drop the thread's attachments now that they've been sent (revokes the
|
|
128
159
|
// preview object URLs). Keyed by the pre-mint id, matching where they were
|
|
129
|
-
// stored by the composer.
|
|
130
|
-
|
|
160
|
+
// stored by the composer. Skipped for an applet send, which carried none:
|
|
161
|
+
// clearing here would discard the user's staged (and in-flight) files.
|
|
162
|
+
if (ownsComposerAttachments(options)) {
|
|
163
|
+
liveStore.getState().clearAttachments(workspaceId, activeSessionId)
|
|
164
|
+
}
|
|
131
165
|
},
|
|
132
166
|
[
|
|
133
167
|
activeSessionId,
|
|
@@ -161,6 +195,7 @@ export function useChat() {
|
|
|
161
195
|
|
|
162
196
|
return {
|
|
163
197
|
view,
|
|
198
|
+
chatLoaded,
|
|
164
199
|
previewTurn,
|
|
165
200
|
sessionId: activeSessionId,
|
|
166
201
|
processing,
|
|
@@ -22,6 +22,9 @@ type StickToBottom = {
|
|
|
22
22
|
atBottom: boolean
|
|
23
23
|
// Scroll to the bottom and re-pin. `smooth` for user-initiated jumps.
|
|
24
24
|
scrollToBottom: (behavior?: ScrollBehavior) => void
|
|
25
|
+
// Show top-anchored content such as the initial Chat welcome without the
|
|
26
|
+
// resize observer pulling it back to the bottom.
|
|
27
|
+
scrollToTop: () => void
|
|
25
28
|
}
|
|
26
29
|
|
|
27
30
|
export function useStickToBottom(
|
|
@@ -48,6 +51,13 @@ export function useStickToBottom(
|
|
|
48
51
|
[scrollRef, setPinned]
|
|
49
52
|
)
|
|
50
53
|
|
|
54
|
+
const scrollToTop = useCallback(() => {
|
|
55
|
+
const el = scrollRef.current
|
|
56
|
+
if (!el) return
|
|
57
|
+
setPinned(false)
|
|
58
|
+
el.scrollTo({ top: 0, behavior: 'auto' })
|
|
59
|
+
}, [scrollRef, setPinned])
|
|
60
|
+
|
|
51
61
|
// Track whether the user is at the bottom. A programmatic scroll-to-bottom
|
|
52
62
|
// also fires this with distance ≈ 0, so pinned stays true — no fight.
|
|
53
63
|
useEffect(() => {
|
|
@@ -82,5 +92,5 @@ export function useStickToBottom(
|
|
|
82
92
|
scrollToBottom('auto')
|
|
83
93
|
}, [resetKey, scrollToBottom])
|
|
84
94
|
|
|
85
|
-
return { atBottom, scrollToBottom }
|
|
95
|
+
return { atBottom, scrollToBottom, scrollToTop }
|
|
86
96
|
}
|
|
@@ -19,14 +19,14 @@ type McpServerIconProps = {
|
|
|
19
19
|
|
|
20
20
|
function McpServerIcon({ name, status }: McpServerIconProps) {
|
|
21
21
|
const icon = getMcpIcon(name)
|
|
22
|
-
const className = 'size-full rounded-
|
|
22
|
+
const className = 'size-full rounded-lg ring-2 ring-background'
|
|
23
23
|
|
|
24
24
|
return (
|
|
25
25
|
<span className="relative size-10 shrink-0">
|
|
26
26
|
{icon ? (
|
|
27
27
|
<img src={icon} alt="" className={className} />
|
|
28
28
|
) : (
|
|
29
|
-
<span className="flex size-full items-center justify-center rounded-
|
|
29
|
+
<span className="flex size-full items-center justify-center rounded-lg bg-muted text-muted-foreground ring-2 ring-background">
|
|
30
30
|
<IconMcp className="size-5" />
|
|
31
31
|
</span>
|
|
32
32
|
)}
|
|
@@ -79,7 +79,7 @@ export function McpServerCard({ server }: McpServerCardProps) {
|
|
|
79
79
|
|
|
80
80
|
export function McpServerCardSkeleton() {
|
|
81
81
|
return (
|
|
82
|
-
<McpServerCardLayout icon={<Skeleton className="size-10 shrink-0 rounded-
|
|
82
|
+
<McpServerCardLayout icon={<Skeleton className="size-10 shrink-0 rounded-lg" />}>
|
|
83
83
|
<Skeleton className="h-4 w-36 max-w-full" />
|
|
84
84
|
<Skeleton className="h-4 w-20" />
|
|
85
85
|
</McpServerCardLayout>
|