moi-computer 0.11.1-next.1 → 0.11.1-next.3
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 +2 -2
- package/client/app/AppRouter.tsx +2 -2
- package/client/app/routes/WorkspaceRoute.tsx +7 -9
- package/client/app/shell/SidebarLayout.tsx +18 -15
- package/client/components/shared/BottomPanel.tsx +26 -14
- package/client/components/shared/PanelHeader.tsx +1 -1
- package/client/components/shared/ReorderableList.tsx +7 -2
- package/client/components/shared/WorkspaceIcon.tsx +92 -0
- package/client/components/ui/alert-dialog.tsx +1 -0
- package/client/components/ui/checkbox.tsx +1 -0
- package/client/components/ui/inline-input.tsx +84 -0
- package/client/components/ui/toast.tsx +2 -2
- package/client/features/applets/AppletMount.tsx +1 -1
- package/client/features/applets/applet-cache.ts +3 -3
- package/client/features/applets/applet-runtime.ts +147 -108
- package/client/features/applets/applet-styles.ts +2 -2
- package/client/features/applets/applet-thumbnail.ts +6 -8
- package/client/features/applets/useApplet.ts +10 -9
- package/client/features/chat/ChatPanel.tsx +19 -10
- package/client/features/chat/ChatPopup.tsx +7 -2
- package/client/features/chat/applet-chat-intents.ts +170 -0
- package/client/features/chat/chat-send.ts +116 -64
- package/client/features/chat/chat-store.ts +51 -62
- package/client/features/chat/composer/ChatComposer.tsx +43 -132
- package/client/features/chat/composer/ModelPicker.tsx +41 -42
- package/client/features/chat/composer/attachments/AttachmentChip.tsx +99 -0
- package/client/features/chat/composer/attachments/DrawingAttachmentChip.tsx +37 -0
- package/client/features/chat/composer/attachments/FileAttachmentChip.tsx +22 -0
- package/client/features/chat/composer/attachments/TextAttachmentChip.tsx +11 -0
- package/client/features/chat/composer/attachments/draft-attachments.ts +168 -0
- package/client/features/chat/composer/attachments/types.ts +25 -0
- package/client/features/chat/composer/attachments/uploads.ts +26 -0
- package/client/features/chat/composer/model-order.ts +15 -0
- package/client/features/chat/{chat-connection.ts → connection/chat-connection.ts} +1 -1
- package/client/features/chat/{chat-frames.ts → connection/chat-frames.ts} +6 -7
- package/client/features/chat/{ChatEmptyState.tsx → messages/ChatEmptyState.tsx} +16 -11
- package/client/features/chat/{MarkdownContent.tsx → messages/MarkdownContent.tsx} +16 -1
- package/client/features/chat/{TurnView.tsx → messages/TurnView.tsx} +22 -15
- package/client/features/chat/{group-turns.ts → messages/group-turns.ts} +1 -0
- package/client/features/chat/{interleave-notices.ts → messages/interleave-notices.ts} +7 -11
- package/client/features/chat/{tool-group → messages/tool-group}/SubagentCard.tsx +1 -1
- package/client/features/chat/{tool-group → messages/tool-group}/TimelineRow.tsx +2 -2
- package/client/features/chat/{tool-group → messages/tool-group}/ToolCallGroup.tsx +2 -5
- package/client/features/chat/{tool-group → messages/tool-group}/format/codex.ts +4 -1
- package/client/features/chat/{ChatSelector.tsx → sessions/ChatSelector.tsx} +3 -3
- package/client/features/chat/{api.ts → sessions/api.ts} +1 -1
- package/client/features/chat/useChat.ts +37 -23
- package/client/features/dev/ChatStatesPage.tsx +5 -6
- package/client/features/dev/HarnessDebugPage.tsx +10 -7
- package/client/features/dev/ToolCallsPage.tsx +1 -1
- package/client/features/dev/UiComponentPreviews.tsx +21 -0
- package/client/features/dev/chat-states-fixtures.ts +13 -2
- package/client/features/drawings/useChatAnnotation.ts +17 -17
- package/client/features/drawings/useDrawingLayer.ts +7 -9
- package/client/features/drawings/useViewBuilderSketch.ts +18 -15
- package/client/features/home/HomePage.tsx +8 -7
- package/client/features/home/WorkspacePreview.tsx +1 -1
- package/client/features/home/workspace-presentation.tsx +1 -11
- package/client/features/home/workspace-setup/WorkspaceAgentStep.tsx +2 -4
- package/client/features/overview/HiddenPanel.tsx +109 -0
- package/client/features/overview/Overview.tsx +302 -0
- package/client/features/overview/WidgetCanvas.tsx +164 -0
- package/client/features/{widgets → overview}/WidgetFrame.tsx +24 -16
- package/client/features/overview/WorkspaceName.tsx +60 -0
- package/client/features/overview/api.ts +30 -0
- package/client/features/overview/default/ViewsWidget.tsx +252 -0
- package/client/features/overview/default/registry.tsx +36 -0
- package/client/features/{widgets → overview}/grid.ts +36 -0
- package/client/features/overview/useGridReconcile.ts +94 -0
- package/client/features/scratchpad/Scratchpad.tsx +7 -8
- package/client/features/scratchpad/ScratchpadControls.tsx +0 -1
- package/client/features/scratchpad/useScratchpadSnapshot.tsx +23 -13
- package/client/features/settings/GeneralSettings.tsx +55 -58
- package/client/features/settings/SettingsLayout.tsx +2 -2
- package/client/features/settings/WorkspaceIconPicker.tsx +318 -0
- package/client/features/settings/WorkspaceSettingsDialog.tsx +65 -0
- package/client/features/settings/api.ts +48 -24
- package/client/features/views/ViewBuilder.tsx +5 -4
- package/client/features/views/ViewManager.tsx +11 -13
- package/client/features/views/api.ts +36 -2
- package/client/features/views/useViewBuilderActions.ts +8 -5
- package/client/features/views/useViewBuilderDrafts.ts +23 -21
- package/client/features/views/view-presentation.ts +13 -0
- package/client/features/workspace/{CustomizePanel.tsx → ThemePanel.tsx} +26 -31
- package/client/features/workspace/UnavailablePage.tsx +21 -0
- package/client/features/workspace/WorkspaceLayoutContext.tsx +4 -7
- package/client/features/workspace/WorkspaceScreen.tsx +205 -161
- package/client/features/workspace/WorkspaceSplitLayout.tsx +1 -1
- package/client/features/workspace/WorkspaceTabs.tsx +2 -0
- package/client/features/workspace/api.ts +0 -26
- package/client/features/workspace/moi-context.ts +8 -9
- package/client/features/workspace/tab-resolution.ts +10 -33
- package/client/features/workspace/useWorkspaceNavigation.ts +164 -101
- package/client/index.css +1 -1
- package/client/lib/app-icon-registry.ts +2 -0
- package/client/lib/use-latest-ref.ts +11 -0
- package/client/main.tsx +1 -1
- package/client/runtime/useWorkspaceEvents.ts +59 -14
- package/client/theme.css +5 -5
- package/dist/chunk-1pp135b4.js +1 -0
- package/dist/chunk-2gs8jjx4.css +1 -0
- package/dist/chunk-94m3q9ce.js +1 -0
- package/dist/chunk-azkjzc7a.js +68 -0
- package/dist/{chunk-w482ew2c.js → chunk-brr0zbeh.js} +73 -73
- package/dist/chunk-m1fvqssh.js +2 -0
- package/dist/chunk-p34hvqt3.js +1 -0
- package/dist/{chunk-4s15axjs.js → chunk-p83f0jnj.js} +2 -2
- package/dist/{chunk-j3wvxjr7.js → chunk-tzz101ea.js} +1 -1
- package/dist/chunk-xg01f6pn.js +10 -0
- package/dist/{chunk-53a7pxcz.js → chunk-zs4mte79.js} +1 -1
- package/dist/index.html +1 -1
- package/lib/app-icons.ts +1 -0
- package/lib/applet-selector.ts +24 -0
- package/lib/chat-title.ts +6 -1
- package/lib/default-widgets.ts +32 -0
- package/lib/format.ts +18 -6
- package/lib/message-attachments.ts +40 -0
- package/lib/moi-attachments.ts +204 -0
- package/lib/moi-context.ts +20 -35
- package/lib/navigation.ts +84 -0
- package/lib/types.ts +84 -26
- package/lib/workspace-icon.ts +20 -0
- package/lib/workspace-layout.ts +22 -2
- package/lib/workspace-tabs.ts +9 -33
- package/package.json +27 -27
- package/registry.json +13 -0
- package/server/AGENTS.md +1 -0
- package/server/api.ts +115 -38
- package/server/applet-typecheck.ts +95 -0
- package/server/applets/applet-css.ts +55 -0
- package/server/{bundler → applets}/build-applet.ts +13 -246
- package/server/applets/config.ts +226 -0
- package/server/applets/dependencies.ts +206 -0
- package/server/{applets.ts → applets/index.ts} +15 -161
- package/server/applets/runtime/base.ts +4 -0
- package/server/applets/runtime/moi.ts +42 -0
- package/server/applets/runtime/rpc.ts +17 -0
- package/server/applets/view-source.ts +67 -0
- package/server/attachment-message.ts +95 -0
- package/server/cli.ts +163 -97
- package/server/control.ts +63 -42
- package/server/harness/README.md +32 -41
- package/server/harness/acp/adapter.ts +7 -21
- package/server/harness/acp/session.ts +31 -50
- package/server/harness/claude-code/NOTES.md +8 -2
- package/server/harness/claude-code/adapter.ts +8 -25
- package/server/harness/claude-code/index.ts +2 -0
- package/server/harness/claude-code/session.ts +42 -47
- package/server/harness/claude-code/sessions.ts +9 -4
- package/server/harness/codex/NOTES.md +222 -350
- package/server/harness/codex/adapter.ts +102 -52
- package/server/harness/codex/auth.ts +1 -3
- package/server/harness/codex/client.ts +169 -249
- package/server/harness/codex/discovery.ts +9 -17
- package/server/harness/codex/index.ts +3 -1
- package/server/harness/codex/pagination.ts +24 -0
- package/server/harness/codex/permissions.ts +32 -8
- package/server/harness/codex/probe.ts +10 -13
- package/server/harness/codex/session.ts +567 -181
- package/server/harness/codex/transport.ts +184 -0
- package/server/harness/debug.ts +1 -1
- package/server/harness/hermes/NOTES.md +1 -1
- package/server/harness/hermes/index.ts +4 -0
- package/server/harness/openclaw/NOTES.md +1 -1
- package/server/harness/openclaw/adapter.ts +22 -4
- package/server/harness/openclaw/gateway.ts +5 -3
- package/server/harness/openclaw/session.ts +27 -27
- package/server/harness/types.ts +5 -3
- package/server/layout.ts +9 -14
- package/server/moi-scaffold.ts +21 -13
- package/server/navigation-relay.ts +110 -0
- package/server/registry.ts +8 -0
- package/server/selected-session.ts +24 -4
- package/server/skill-update.ts +5 -3
- package/server/skill-version.ts +4 -7
- package/server/skills-template.ts +48 -9
- package/server/tabs.ts +19 -33
- package/server/uploads.ts +0 -0
- package/server/view-builders.ts +18 -1
- package/server/views.ts +126 -6
- package/server/web.ts +38 -9
- package/server/widgets.ts +12 -5
- package/server/workspace-config.ts +13 -9
- package/ui-components/alert-dialog.tsx +1 -1
- package/ui-components/alert.tsx +1 -1
- package/ui-components/avatar.tsx +1 -1
- package/ui-components/button.tsx +2 -2
- package/ui-components/checkbox.tsx +2 -1
- package/ui-components/combobox.tsx +3 -1
- package/ui-components/docs/kbd.md +191 -0
- package/ui-components/dropdown-menu.tsx +1 -1
- package/ui-components/field.tsx +1 -1
- package/ui-components/input-group.tsx +2 -2
- package/ui-components/kbd.tsx +32 -0
- package/ui-components/radio-group.tsx +2 -1
- package/ui-components/slider.tsx +1 -1
- package/ui-components/switch.tsx +3 -2
- package/ui-components/tabs.tsx +1 -1
- package/workspace/.claude/skills/moi-workspace/SKILL.md +284 -228
- package/workspace/.claude/skills/moi-workspace/references/DESIGN.md +100 -153
- package/workspace/.claude/skills/moi-workspace/references/INTENTS.md +156 -0
- package/client/features/chat/attachment-staging.ts +0 -153
- package/client/features/chat/uploads.ts +0 -18
- package/client/features/chat/useAppletChatMessage.ts +0 -68
- package/client/features/settings/IconPicker.tsx +0 -442
- package/client/features/settings/WorkspaceSettings.tsx +0 -95
- package/client/features/settings/render-icon.ts +0 -173
- package/client/features/widgets/HiddenPanel.tsx +0 -80
- package/client/features/widgets/WidgetGrid.tsx +0 -123
- package/client/features/widgets/Widgets.tsx +0 -262
- package/client/features/widgets/useGridReconcile.ts +0 -73
- package/dist/chunk-6664vxpk.css +0 -1
- package/dist/chunk-87thzbtw.js +0 -2
- package/dist/chunk-a6jad1a6.js +0 -1
- package/dist/chunk-dghwstd2.js +0 -9
- package/dist/chunk-eg120aca.js +0 -1
- package/dist/chunk-vwjeezeb.js +0 -1
- package/dist/chunk-yc471zah.js +0 -70
- package/server/bundler/applet-css.ts +0 -160
- /package/client/features/chat/{ChatPromptBubbles.tsx → messages/ChatPromptBubbles.tsx} +0 -0
- /package/client/features/chat/{ShimmerText.tsx → messages/ShimmerText.tsx} +0 -0
- /package/client/features/chat/{preview-turn.ts → messages/preview-turn.ts} +0 -0
- /package/client/features/chat/{tool-group → messages/tool-group}/CodeBlock.tsx +0 -0
- /package/client/features/chat/{tool-group → messages/tool-group}/Collapse.tsx +0 -0
- /package/client/features/chat/{tool-group → messages/tool-group}/ReadImagePreview.tsx +0 -0
- /package/client/features/chat/{tool-group → messages/tool-group}/ToolOutput.tsx +0 -0
- /package/client/features/chat/{tool-group → messages/tool-group}/detect.ts +0 -0
- /package/client/features/chat/{tool-group → messages/tool-group}/fixtures.ts +0 -0
- /package/client/features/chat/{tool-group → messages/tool-group}/format/claude.ts +0 -0
- /package/client/features/chat/{tool-group → messages/tool-group}/format/hermes.ts +0 -0
- /package/client/features/chat/{tool-group → messages/tool-group}/format/index.ts +0 -0
- /package/client/features/chat/{tool-group → messages/tool-group}/format/mcp.ts +0 -0
- /package/client/features/chat/{tool-group → messages/tool-group}/format/openclaw.ts +0 -0
- /package/client/features/chat/{tool-group → messages/tool-group}/format/shared.ts +0 -0
- /package/client/features/chat/{tool-group → messages/tool-group}/format/shell.ts +0 -0
- /package/client/features/chat/{tool-group → messages/tool-group}/index.ts +0 -0
- /package/client/features/chat/{useStickToBottom.ts → messages/useStickToBottom.ts} +0 -0
- /package/client/features/chat/{session-view.ts → sessions/session-view.ts} +0 -0
- /package/client/features/chat/{useSelectedSession.ts → sessions/useSelectedSession.ts} +0 -0
- /package/server/{bundler → applets}/build-worker.ts +0 -0
package/README.md
CHANGED
|
@@ -33,7 +33,7 @@ Works with the harness you already use:
|
|
|
33
33
|
fonts, color scheme and more.
|
|
34
34
|
- **Scratchpad**. A shared canvas where you ideate together with the agent: ask
|
|
35
35
|
it to draw diagrams, add feedback or comments, visualize knowledge and plans.
|
|
36
|
-
- **
|
|
36
|
+
- **Overview**. A dynamic home made of small widgets wired to the data from
|
|
37
37
|
your workspace. They can be rearranged, modified, and completely customized.
|
|
38
38
|
- **Views**. An app embedded in the workspace that lives in its own tab. Build
|
|
39
39
|
complex interfaces: CRMs, task trackers, second brain storage, customer
|
|
@@ -41,7 +41,7 @@ Works with the harness you already use:
|
|
|
41
41
|
|
|
42
42
|
<table>
|
|
43
43
|
<tr>
|
|
44
|
-
<td align="center"><img src="assets/screenshots/moi-moi-dash-2.webp" alt="
|
|
44
|
+
<td align="center"><img src="assets/screenshots/moi-moi-dash-2.webp" alt="Overview" /><br /><sub>Widgets wired to live project stats</sub></td>
|
|
45
45
|
<td align="center"><img src="assets/screenshots/moi-magazin-scratch-2.webp" alt="Scratchpad" /><br /><sub>Order funnel on the scratchpad, live from Postgres</sub></td>
|
|
46
46
|
<td align="center"><img src="assets/screenshots/moi-magazin-products-2.webp" alt="Products view" /><br /><sub>Use the agent as a copilot when working with products</sub></td>
|
|
47
47
|
</tr>
|
package/client/app/AppRouter.tsx
CHANGED
|
@@ -2,7 +2,7 @@ import { Suspense, lazy, useEffect } from 'react'
|
|
|
2
2
|
|
|
3
3
|
import { Redirect, Route, Switch, useLocation } from 'wouter'
|
|
4
4
|
|
|
5
|
-
import { setWorkspaceSwitchHandler } from '@/client/features/chat/chat-connection'
|
|
5
|
+
import { setWorkspaceSwitchHandler } from '@/client/features/chat/connection/chat-connection'
|
|
6
6
|
|
|
7
7
|
import { HomeRoute } from './routes/HomeRoute'
|
|
8
8
|
import { WorkspaceRoute } from './routes/WorkspaceRoute'
|
|
@@ -41,7 +41,7 @@ export function AppRouter() {
|
|
|
41
41
|
<Switch>
|
|
42
42
|
<Route path="/" component={HomeRoute} />
|
|
43
43
|
<Route path="/dev/*?" component={DevLazy} />
|
|
44
|
-
{/* The wildcard is the
|
|
44
|
+
{/* The wildcard is the destination path (`views/orders`, `overview`, …) —
|
|
45
45
|
the URL is the tab address, read downstream with `useParams`. This
|
|
46
46
|
pattern is its only definition. Keyed by workspace id only, so tab
|
|
47
47
|
switches never remount the workspace tree. */}
|
|
@@ -3,7 +3,7 @@ import { useQueryClient } from '@tanstack/react-query'
|
|
|
3
3
|
import { workspaceKeys } from '@/client/api/workspace-keys'
|
|
4
4
|
import { LedLogo } from '@/client/components/shared/LedLogo'
|
|
5
5
|
import { SidebarLayout } from '@/client/app/shell/SidebarLayout'
|
|
6
|
-
import { useSelectedSession } from '@/client/features/chat/useSelectedSession'
|
|
6
|
+
import { useSelectedSession } from '@/client/features/chat/sessions/useSelectedSession'
|
|
7
7
|
import { useAppletCacheInvalidation } from '@/client/features/applets/useApplet'
|
|
8
8
|
import { Workspace } from '@/client/features/workspace/WorkspaceContext'
|
|
9
9
|
import {
|
|
@@ -11,9 +11,8 @@ import {
|
|
|
11
11
|
useWorkspaceLayoutCtx
|
|
12
12
|
} from '@/client/features/workspace/WorkspaceLayoutContext'
|
|
13
13
|
import { WorkspaceScreen } from '@/client/features/workspace/WorkspaceScreen'
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import { useGridReconcile } from '@/client/features/widgets/useGridReconcile'
|
|
14
|
+
import { useViewBuilders, useViews } from '@/client/features/views/api'
|
|
15
|
+
import { useWidgets } from '@/client/features/overview/api'
|
|
17
16
|
import { useWorkspaceEvent } from '@/client/runtime/useWorkspaceEvents'
|
|
18
17
|
|
|
19
18
|
type WorkspaceRouteProps = {
|
|
@@ -35,11 +34,10 @@ export function WorkspaceRoute({ id }: WorkspaceRouteProps) {
|
|
|
35
34
|
function WorkspaceLoader({ id }: WorkspaceRouteProps) {
|
|
36
35
|
const queryClient = useQueryClient()
|
|
37
36
|
const [selectedSessionId] = useSelectedSession()
|
|
38
|
-
const {
|
|
39
|
-
const widgets =
|
|
40
|
-
const views =
|
|
37
|
+
const { isLoading: layoutLoading } = useWorkspaceLayoutCtx()
|
|
38
|
+
const widgets = useWidgets(id)
|
|
39
|
+
const views = useViews(id)
|
|
41
40
|
const builders = useViewBuilders(id)
|
|
42
|
-
useGridReconcile(id, widgets.data, layout, setLayout)
|
|
43
41
|
useAppletCacheInvalidation()
|
|
44
42
|
|
|
45
43
|
useWorkspaceEvent(event => {
|
|
@@ -72,7 +70,7 @@ function WorkspaceLoader({ id }: WorkspaceRouteProps) {
|
|
|
72
70
|
</div>
|
|
73
71
|
) : (
|
|
74
72
|
<WorkspaceScreen
|
|
75
|
-
widgets={widgets.data
|
|
73
|
+
widgets={widgets.data}
|
|
76
74
|
views={views.data ?? []}
|
|
77
75
|
builders={builders.data ?? []}
|
|
78
76
|
/>
|
|
@@ -18,6 +18,7 @@ import { CreateWorkspaceDialog } from '@/client/features/home/workspace-setup/Cr
|
|
|
18
18
|
import { DemoDialog } from '@/client/features/home/workspace-setup/DemoDialog'
|
|
19
19
|
import { ReorderableList } from '@/client/components/shared/ReorderableList'
|
|
20
20
|
import type { ReorderableRenderState } from '@/client/components/shared/ReorderableList'
|
|
21
|
+
import { WorkspaceIcon } from '@/client/components/shared/WorkspaceIcon'
|
|
21
22
|
import { Button, buttonVariants } from '@/client/components/ui/button'
|
|
22
23
|
import {
|
|
23
24
|
Tooltip,
|
|
@@ -25,10 +26,7 @@ import {
|
|
|
25
26
|
TooltipProvider,
|
|
26
27
|
TooltipTrigger
|
|
27
28
|
} from '@/client/components/ui/tooltip'
|
|
28
|
-
import {
|
|
29
|
-
workspaceDisplayName,
|
|
30
|
-
workspaceProviderIcon
|
|
31
|
-
} from '@/client/features/home/workspace-presentation'
|
|
29
|
+
import { workspaceDisplayName } from '@/client/features/home/workspace-presentation'
|
|
32
30
|
import { cn } from '@/client/lib/cn'
|
|
33
31
|
import type { WorkspaceEntry } from '@/lib/types'
|
|
34
32
|
|
|
@@ -53,14 +51,18 @@ type SidebarLayoutProps = {
|
|
|
53
51
|
export function SidebarLayout({ children, showWorkspaces = true }: SidebarLayoutProps) {
|
|
54
52
|
const { data: workspaces } = useWorkspaces()
|
|
55
53
|
|
|
56
|
-
//
|
|
57
|
-
//
|
|
58
|
-
//
|
|
54
|
+
// Identity, theme, and registry changes can all alter a workspace's sidebar
|
|
55
|
+
// presentation. Refetch the list so the sidebar reflects them live. Exact:
|
|
56
|
+
// `workspaceKeys.all` is the
|
|
59
57
|
// prefix of every workspace query — a prefix invalidation would refetch
|
|
60
58
|
// transcripts, widgets, and MCP probes in every connected client.
|
|
61
59
|
const qc = useQueryClient()
|
|
62
60
|
useWorkspaceEvent(e => {
|
|
63
|
-
if (
|
|
61
|
+
if (
|
|
62
|
+
e.type === 'workspace:updated' ||
|
|
63
|
+
e.type === 'theme:updated' ||
|
|
64
|
+
e.type === 'workspaces-list:updated'
|
|
65
|
+
) {
|
|
64
66
|
qc.invalidateQueries({ queryKey: workspaceKeys.all, exact: true })
|
|
65
67
|
}
|
|
66
68
|
})
|
|
@@ -104,7 +106,7 @@ function Sidebar({ workspaces }: SidebarProps) {
|
|
|
104
106
|
className="flex flex-col gap-4"
|
|
105
107
|
onReorder={ids => reorder.mutate(ids)}
|
|
106
108
|
renderPlaceholder={() => (
|
|
107
|
-
<div className="pointer-events-none absolute top-0 left-1 size-
|
|
109
|
+
<div className="pointer-events-none absolute top-0 left-1 size-12 rounded-xl bg-accent" />
|
|
108
110
|
)}
|
|
109
111
|
renderOverlay={ws => <WorkspaceButton workspace={ws} dragOverlay />}
|
|
110
112
|
renderItem={(ws, state) => <WorkspaceButton workspace={ws} dragState={state} />}
|
|
@@ -197,7 +199,7 @@ function WorkspaceButton({ workspace, dragOverlay = false, dragState }: Workspac
|
|
|
197
199
|
const [location] = useLocation()
|
|
198
200
|
const href = `/workspace/${workspace.id}`
|
|
199
201
|
const label = workspaceDisplayName(workspace)
|
|
200
|
-
// A workspace URL carries a
|
|
202
|
+
// A workspace URL carries a destination (`/workspace/:id/views/orders`), so the
|
|
201
203
|
// rail matches the workspace segment, not the whole path. The trailing slash
|
|
202
204
|
// keeps `/workspace/ws1` from lighting up a sibling `/workspace/ws1-other`.
|
|
203
205
|
const active = location === href || location.startsWith(`${href}/`)
|
|
@@ -212,10 +214,11 @@ function WorkspaceButton({ workspace, dragOverlay = false, dragState }: Workspac
|
|
|
212
214
|
active && !dragOverlay && 'bg-accent text-accent-foreground'
|
|
213
215
|
)}
|
|
214
216
|
>
|
|
215
|
-
<
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
217
|
+
<WorkspaceIcon
|
|
218
|
+
icon={workspace.icon}
|
|
219
|
+
workspaceType={workspace.type}
|
|
220
|
+
workspaceTheme={workspace.theme}
|
|
221
|
+
className="size-7 shrink-0 rounded-md transition-[border-radius] duration-100 ease-out motion-reduce:transition-none"
|
|
219
222
|
/>
|
|
220
223
|
</div>
|
|
221
224
|
)
|
|
@@ -242,7 +245,7 @@ function WorkspaceButton({ workspace, dragOverlay = false, dragState }: Workspac
|
|
|
242
245
|
if (dragState?.isDragging) event.preventDefault()
|
|
243
246
|
}}
|
|
244
247
|
className={cn(
|
|
245
|
-
'group flex w-14 flex-col items-center rounded-
|
|
248
|
+
'group flex w-14 flex-col items-center rounded-xl outline-none',
|
|
246
249
|
dragState?.isDragging && 'invisible'
|
|
247
250
|
)}
|
|
248
251
|
{...dragState?.dragHandleProps}
|
|
@@ -8,22 +8,31 @@ import { Button } from '@/client/components/ui/button'
|
|
|
8
8
|
import { cn } from '@/client/lib/cn'
|
|
9
9
|
|
|
10
10
|
type BottomPanelProps = {
|
|
11
|
+
actions?: ReactNode
|
|
11
12
|
className?: string
|
|
12
13
|
title: string
|
|
13
|
-
children
|
|
14
|
+
children?: ReactNode
|
|
14
15
|
onClose: () => void
|
|
15
16
|
// Forwarded to the panel element so the working area can measure its height
|
|
16
17
|
// and reserve matching space below the grid.
|
|
17
18
|
ref?: Ref<HTMLDivElement>
|
|
18
19
|
}
|
|
19
20
|
|
|
20
|
-
export function BottomPanel({
|
|
21
|
+
export function BottomPanel({
|
|
22
|
+
actions,
|
|
23
|
+
className,
|
|
24
|
+
title,
|
|
25
|
+
children,
|
|
26
|
+
onClose,
|
|
27
|
+
ref
|
|
28
|
+
}: BottomPanelProps) {
|
|
21
29
|
return (
|
|
22
30
|
<motion.div
|
|
23
31
|
ref={ref}
|
|
24
32
|
className={cn(
|
|
25
|
-
'absolute inset-x-4 bottom-4 no-scrollbar flex max-h-full flex-col gap-4 overflow-y-auto rounded-2xl bg-
|
|
26
|
-
'mx-auto max-w-[calc(var(--chat-max-container)+var(--page-pad)*2)] p-(--page-pad)
|
|
33
|
+
'absolute inset-x-4 bottom-4 no-scrollbar flex max-h-full flex-col gap-4 overflow-y-auto rounded-2xl bg-popover text-popover-foreground shadow-md',
|
|
34
|
+
'mx-auto max-w-[calc(var(--chat-max-container)+var(--page-pad)*2)] p-(--page-pad)',
|
|
35
|
+
children && 'pb-0',
|
|
27
36
|
className
|
|
28
37
|
)}
|
|
29
38
|
variants={{
|
|
@@ -37,17 +46,20 @@ export function BottomPanel({ className, title, children, onClose, ref }: Bottom
|
|
|
37
46
|
>
|
|
38
47
|
<div className="flex shrink-0 items-center justify-between gap-4">
|
|
39
48
|
<p className="text-sm font-medium">{title}</p>
|
|
40
|
-
<
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
+
<div className="flex items-center gap-2">
|
|
50
|
+
{actions}
|
|
51
|
+
<Button
|
|
52
|
+
type="button"
|
|
53
|
+
variant="ghost"
|
|
54
|
+
size="icon-sm"
|
|
55
|
+
onClick={onClose}
|
|
56
|
+
aria-label="Close panel"
|
|
57
|
+
>
|
|
58
|
+
<IconX stroke={1.75} />
|
|
59
|
+
</Button>
|
|
60
|
+
</div>
|
|
49
61
|
</div>
|
|
50
|
-
<div className="flex-1 pb-(--page-pad)">{children}</div>
|
|
62
|
+
{children && <div className="flex-1 pb-(--page-pad)">{children}</div>}
|
|
51
63
|
</motion.div>
|
|
52
64
|
)
|
|
53
65
|
}
|
|
@@ -5,7 +5,7 @@ export function PanelHeader({ children }: { children?: ReactNode }) {
|
|
|
5
5
|
return (
|
|
6
6
|
<header
|
|
7
7
|
className={cn(
|
|
8
|
-
'@container relative flex shrink-0 items-center gap-
|
|
8
|
+
'@container relative flex shrink-0 items-center gap-1 py-2 pr-3 pl-4',
|
|
9
9
|
// Header bottom border that overflows the tab content and contrasts with it
|
|
10
10
|
'after:absolute after:top-full after:left-0 after:h-px after:w-full after:bg-border'
|
|
11
11
|
)}
|
|
@@ -40,6 +40,7 @@ type ReorderableListProps<T> = {
|
|
|
40
40
|
className?: string
|
|
41
41
|
itemClassName?: (item: T, state: ReorderableRenderState) => string | undefined
|
|
42
42
|
dragDisabled?: boolean
|
|
43
|
+
isItemDragDisabled?: (item: T) => boolean
|
|
43
44
|
onReorder: (orderedIds: ReorderableId[]) => void
|
|
44
45
|
renderItem: (item: T, state: ReorderableRenderState) => ReactNode
|
|
45
46
|
renderPlaceholder?: (item: T) => ReactNode
|
|
@@ -63,6 +64,7 @@ export function ReorderableList<T>({
|
|
|
63
64
|
className,
|
|
64
65
|
itemClassName,
|
|
65
66
|
dragDisabled = false,
|
|
67
|
+
isItemDragDisabled,
|
|
66
68
|
onReorder,
|
|
67
69
|
renderItem,
|
|
68
70
|
renderPlaceholder,
|
|
@@ -83,7 +85,10 @@ export function ReorderableList<T>({
|
|
|
83
85
|
.map(id => itemById.get(id))
|
|
84
86
|
.filter((item): item is T => Boolean(item))
|
|
85
87
|
const draggingItem = draggingId ? itemById.get(draggingId) : undefined
|
|
86
|
-
const
|
|
88
|
+
const reorderableCount = isItemDragDisabled
|
|
89
|
+
? items.filter(item => !isItemDragDisabled(item)).length
|
|
90
|
+
: items.length
|
|
91
|
+
const disabled = dragDisabled || reorderableCount < 2
|
|
87
92
|
|
|
88
93
|
const handleDragOver = (event: DragOverEvent) => {
|
|
89
94
|
const activeId = String(event.active.id)
|
|
@@ -132,7 +137,7 @@ export function ReorderableList<T>({
|
|
|
132
137
|
key={getId(item)}
|
|
133
138
|
id={getId(item)}
|
|
134
139
|
item={item}
|
|
135
|
-
disabled={disabled}
|
|
140
|
+
disabled={disabled || isItemDragDisabled?.(item) === true}
|
|
136
141
|
itemClassName={itemClassName}
|
|
137
142
|
renderItem={renderItem}
|
|
138
143
|
renderPlaceholder={renderPlaceholder}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { createElement } from 'react'
|
|
2
|
+
|
|
3
|
+
import claudeIcon from '@/client/assets/claude.svg'
|
|
4
|
+
import hermesIcon from '@/client/assets/hermes.png'
|
|
5
|
+
import openaiIcon from '@/client/assets/openai.svg'
|
|
6
|
+
import openclawIcon from '@/client/assets/openclaw.svg'
|
|
7
|
+
import { resolveAppIcon } from '@/client/lib/app-icon-registry'
|
|
8
|
+
import { cn } from '@/client/lib/cn'
|
|
9
|
+
import { DEFAULT_PRIMARY_COLOR, deriveThemeColors, resolveThemeColorOverrides } from '@/lib/themes'
|
|
10
|
+
import type {
|
|
11
|
+
WorkspaceIcon as WorkspaceIconValue,
|
|
12
|
+
WorkspaceLayout,
|
|
13
|
+
WorkspaceType
|
|
14
|
+
} from '@/lib/types'
|
|
15
|
+
|
|
16
|
+
export const workspaceProviderIcon: Record<WorkspaceType, string> = {
|
|
17
|
+
'claude-code': claudeIcon,
|
|
18
|
+
openclaw: openclawIcon,
|
|
19
|
+
codex: openaiIcon,
|
|
20
|
+
hermes: hermesIcon
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
type WorkspaceIconProps = {
|
|
24
|
+
className?: string
|
|
25
|
+
icon?: WorkspaceIconValue
|
|
26
|
+
workspaceType?: WorkspaceType | null
|
|
27
|
+
workspaceTheme?: WorkspaceLayout['theme']
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
function renderIconContent(
|
|
31
|
+
icon: WorkspaceIconValue | undefined,
|
|
32
|
+
themed: boolean,
|
|
33
|
+
providerIcon: string
|
|
34
|
+
) {
|
|
35
|
+
switch (icon?.type) {
|
|
36
|
+
case 'emoji':
|
|
37
|
+
return (
|
|
38
|
+
<span
|
|
39
|
+
aria-hidden="true"
|
|
40
|
+
className={cn(
|
|
41
|
+
'flex size-full translate-y-[2cqi] items-center justify-center font-[Apple_Color_Emoji,Segoe_UI_Emoji,Noto_Color_Emoji,sans-serif] leading-none',
|
|
42
|
+
themed ? 'text-[60cqi]' : 'text-[85cqi]'
|
|
43
|
+
)}
|
|
44
|
+
>
|
|
45
|
+
{icon.value}
|
|
46
|
+
</span>
|
|
47
|
+
)
|
|
48
|
+
case 'upload':
|
|
49
|
+
return <img src={icon.value} alt="" className="size-full" />
|
|
50
|
+
case 'glyph': {
|
|
51
|
+
const Glyph = resolveAppIcon(icon.value)
|
|
52
|
+
if (Glyph) {
|
|
53
|
+
return createElement(Glyph, {
|
|
54
|
+
'aria-hidden': true,
|
|
55
|
+
stroke: 1.75,
|
|
56
|
+
className: themed ? 'size-[70%]' : 'size-[95%] text-foreground'
|
|
57
|
+
})
|
|
58
|
+
}
|
|
59
|
+
// Fall through to the default provider icon.
|
|
60
|
+
}
|
|
61
|
+
default:
|
|
62
|
+
return <img src={providerIcon} alt="" className="size-[95%]" />
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export function WorkspaceIcon({
|
|
67
|
+
className,
|
|
68
|
+
icon,
|
|
69
|
+
workspaceType,
|
|
70
|
+
workspaceTheme
|
|
71
|
+
}: WorkspaceIconProps) {
|
|
72
|
+
const themed = icon?.type !== 'upload' && icon?.background === 'theme'
|
|
73
|
+
const colors = themed
|
|
74
|
+
? (resolveThemeColorOverrides(workspaceTheme) ?? deriveThemeColors(DEFAULT_PRIMARY_COLOR))
|
|
75
|
+
: undefined
|
|
76
|
+
const providerIcon = workspaceProviderIcon[workspaceType ?? 'claude-code']
|
|
77
|
+
|
|
78
|
+
return (
|
|
79
|
+
<span
|
|
80
|
+
className={cn(
|
|
81
|
+
'@container inline-flex shrink-0 items-center justify-center overflow-hidden',
|
|
82
|
+
themed && 'shadow-[inset_0_0_1rem_rgba(255,255,255,0.3)]',
|
|
83
|
+
className
|
|
84
|
+
)}
|
|
85
|
+
style={
|
|
86
|
+
colors ? { backgroundColor: colors.primary, color: colors.primaryForeground } : undefined
|
|
87
|
+
}
|
|
88
|
+
>
|
|
89
|
+
{renderIconContent(icon, themed, providerIcon)}
|
|
90
|
+
</span>
|
|
91
|
+
)
|
|
92
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '@/ui-components/alert-dialog'
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '@/ui-components/checkbox'
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { useRef } from 'react'
|
|
2
|
+
import type { ComponentProps } from 'react'
|
|
3
|
+
|
|
4
|
+
import { Input as InputPrimitive } from '@base-ui/react/input'
|
|
5
|
+
|
|
6
|
+
import { cn } from '@/client/lib/cn'
|
|
7
|
+
|
|
8
|
+
type InputPrimitiveProps = ComponentProps<typeof InputPrimitive>
|
|
9
|
+
type InputFocusEvent = Parameters<NonNullable<InputPrimitiveProps['onFocus']>>[0]
|
|
10
|
+
type InputKeyboardEvent = Parameters<NonNullable<InputPrimitiveProps['onKeyDown']>>[0]
|
|
11
|
+
|
|
12
|
+
type InlineInputProps = Omit<InputPrimitiveProps, 'onChange'> & {
|
|
13
|
+
onValueChange?: (value: string) => void
|
|
14
|
+
onValueCommit?: (value: string) => void
|
|
15
|
+
selectOnFocus?: boolean
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
function InlineInput({
|
|
19
|
+
className,
|
|
20
|
+
onBlur,
|
|
21
|
+
onFocus,
|
|
22
|
+
onKeyDown,
|
|
23
|
+
onValueChange,
|
|
24
|
+
onValueCommit,
|
|
25
|
+
selectOnFocus,
|
|
26
|
+
...props
|
|
27
|
+
}: InlineInputProps) {
|
|
28
|
+
const valueBeforeEditRef = useRef<string | null>(null)
|
|
29
|
+
|
|
30
|
+
function handleBlur(event: InputFocusEvent) {
|
|
31
|
+
const shouldCommit = valueBeforeEditRef.current !== null
|
|
32
|
+
valueBeforeEditRef.current = null
|
|
33
|
+
onBlur?.(event)
|
|
34
|
+
if (!event.defaultPrevented && shouldCommit) {
|
|
35
|
+
onValueCommit?.(event.currentTarget.value)
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
function handleFocus(event: InputFocusEvent) {
|
|
40
|
+
valueBeforeEditRef.current = event.currentTarget.value
|
|
41
|
+
if (selectOnFocus) {
|
|
42
|
+
const input = event.currentTarget
|
|
43
|
+
input.select()
|
|
44
|
+
requestAnimationFrame(() => {
|
|
45
|
+
input.scrollLeft = 0
|
|
46
|
+
})
|
|
47
|
+
}
|
|
48
|
+
onFocus?.(event)
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
function handleKeyDown(event: InputKeyboardEvent) {
|
|
52
|
+
onKeyDown?.(event)
|
|
53
|
+
if (event.defaultPrevented) return
|
|
54
|
+
|
|
55
|
+
if (event.key === 'Enter') {
|
|
56
|
+
event.preventDefault()
|
|
57
|
+
event.currentTarget.blur()
|
|
58
|
+
} else if (event.key === 'Escape') {
|
|
59
|
+
event.preventDefault()
|
|
60
|
+
const valueBeforeEdit = valueBeforeEditRef.current ?? event.currentTarget.value
|
|
61
|
+
valueBeforeEditRef.current = null
|
|
62
|
+
event.currentTarget.value = valueBeforeEdit
|
|
63
|
+
onValueChange?.(valueBeforeEdit)
|
|
64
|
+
event.currentTarget.blur()
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
return (
|
|
69
|
+
<InputPrimitive
|
|
70
|
+
data-slot="inline-input"
|
|
71
|
+
className={cn(
|
|
72
|
+
'-ml-2 [field-sizing:content] w-auto max-w-full min-w-0 rounded-md bg-transparent px-2 py-0.5 text-sm shadow-none outline-none focus:[field-sizing:fixed] focus:w-full focus-visible:border-ring focus-visible:bg-accent disabled:pointer-events-none',
|
|
73
|
+
className
|
|
74
|
+
)}
|
|
75
|
+
onBlur={handleBlur}
|
|
76
|
+
onChange={event => onValueChange?.(event.target.value)}
|
|
77
|
+
onFocus={handleFocus}
|
|
78
|
+
onKeyDown={handleKeyDown}
|
|
79
|
+
{...props}
|
|
80
|
+
/>
|
|
81
|
+
)
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
export { InlineInput }
|
|
@@ -40,7 +40,7 @@ function Toast({ className, ...props }: ToastPrimitive.Root.Props) {
|
|
|
40
40
|
<ToastPrimitive.Root
|
|
41
41
|
data-slot="toast"
|
|
42
42
|
className={cn(
|
|
43
|
-
'group/toast pointer-events-auto absolute right-0 bottom-0 z-[calc(1000-var(--toast-index))] w-full origin-bottom rounded-
|
|
43
|
+
'group/toast pointer-events-auto absolute right-0 bottom-0 z-[calc(1000-var(--toast-index))] w-full origin-bottom rounded-xl bg-popover text-popover-foreground shadow-lg will-change-transform outline-none select-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50',
|
|
44
44
|
'[--gap:0.75rem] [--height:var(--toast-frontmost-height,var(--toast-height))] [--offset-y:calc(var(--toast-offset-y)*-1+calc(var(--toast-index)*var(--gap)*-1)+var(--toast-swipe-movement-y))] [--peek:0.75rem] [--scale:calc(max(0,1-(var(--toast-index)*0.1)))] [--shrink:calc(1-var(--scale))]',
|
|
45
45
|
'h-(--height) [transform:translateX(var(--toast-swipe-movement-x))_translateY(calc(var(--toast-swipe-movement-y)-(var(--toast-index)*var(--peek))-(var(--shrink)*var(--height))))_scale(var(--scale))] [transition:transform_500ms_cubic-bezier(0.22,1,0.36,1),opacity_500ms,height_150ms]',
|
|
46
46
|
"after:absolute after:top-full after:left-0 after:h-[calc(var(--gap)+1px)] after:w-full after:content-['']",
|
|
@@ -67,7 +67,7 @@ function ToastContent({ className, ...props }: ToastPrimitive.Content.Props) {
|
|
|
67
67
|
<ToastPrimitive.Content
|
|
68
68
|
data-slot="toast-content"
|
|
69
69
|
className={cn(
|
|
70
|
-
'flex
|
|
70
|
+
'flex items-center gap-3 overflow-hidden p-4 transition-opacity duration-250 ease-[cubic-bezier(0.22,1,0.36,1)] data-behind:opacity-0 data-expanded:opacity-100',
|
|
71
71
|
className
|
|
72
72
|
)}
|
|
73
73
|
{...props}
|
|
@@ -13,7 +13,7 @@ type AppletMountProps = {
|
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
// The style scope for one mounted applet: puts the `data-applet` attribute the
|
|
16
|
-
// bundle's scoped CSS selectors key off (see server/
|
|
16
|
+
// bundle's scoped CSS selectors key off (see server/applets/applet-css.ts) on a
|
|
17
17
|
// wrapper filling the parent box, and keeps the applet's <style> tag mounted
|
|
18
18
|
// exactly as long as the applet is — unmounting removes the styles from the
|
|
19
19
|
// page. This is the widget path. Views don't use it: ViewManager parks a view's
|
|
@@ -36,7 +36,7 @@ export function appletVersion(segment: AppletSegment, workspaceId: string, name:
|
|
|
36
36
|
// zone's Browser Cache TTL — 4 hours by default — gets stamped over the server's
|
|
37
37
|
// `no-cache`, pinning a stale bundle in the browser with no way to revalidate it
|
|
38
38
|
// away. Extensionless keeps the server's headers intact. `parseAppletTail` in
|
|
39
|
-
// `server/applets.ts` maps this back to `index.js`; the two must agree.
|
|
39
|
+
// `server/applets/index.ts` maps this back to `index.js`; the two must agree.
|
|
40
40
|
const ENTRY_ROUTE = 'module'
|
|
41
41
|
|
|
42
42
|
// The cache-busting import URL for an applet's entry at its current version.
|
|
@@ -48,14 +48,14 @@ export function appletUrl(segment: AppletSegment, workspaceId: string, name: str
|
|
|
48
48
|
|
|
49
49
|
// The key an applet bundle registers its CSS under (`window.__moiAppletCss`):
|
|
50
50
|
// the bundle-dir path, which the bundle derives from its own import.meta.url
|
|
51
|
-
// (see injectCss in server/
|
|
51
|
+
// (see injectCss in server/applets/build-applet.ts). Workspace-qualified so two
|
|
52
52
|
// workspaces sharing an applet name never read each other's styles.
|
|
53
53
|
export function appletStyleKey(segment: AppletSegment, workspaceId: string, name: string): string {
|
|
54
54
|
return `/api/workspaces/${workspaceId}/${segment}/${name}`
|
|
55
55
|
}
|
|
56
56
|
|
|
57
57
|
// The `data-applet` value the bundle's scoped CSS selectors key off (see
|
|
58
|
-
// server/
|
|
58
|
+
// server/applets/applet-css.ts). It goes on the container wrapping a mounted
|
|
59
59
|
// applet — AppletMount for widgets, the view slot for views.
|
|
60
60
|
export function appletScope(segment: AppletSegment, name: string): string {
|
|
61
61
|
return `${segment === 'widgets' ? 'widget' : 'view'}:${name}`
|