moi-computer 0.9.1-next.4 → 0.10.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 +124 -58
- package/client/app/shell/SidebarLayout.tsx +114 -69
- package/client/assets/floppy-disk.webp +0 -0
- package/client/assets.d.ts +5 -0
- package/client/components/ui/button.tsx +2 -1
- package/client/features/chat/ChatEmptyState.tsx +70 -34
- package/client/features/chat/ChatPanel.tsx +8 -1
- package/client/features/chat/chat-store.ts +4 -0
- package/client/features/chat/tool-group/format/claude.ts +2 -1
- package/client/features/chat/tool-group/format/codex.ts +2 -1
- package/client/features/chat/tool-group/format/hermes.ts +2 -1
- package/client/features/chat/tool-group/format/mcp.ts +7 -3
- package/client/features/chat/tool-group/format/openclaw.ts +6 -2
- package/client/features/chat/tool-group/format/shell.ts +162 -0
- package/client/features/dev/DevIndexPage.tsx +5 -0
- package/client/features/dev/DevRoutes.tsx +2 -0
- package/client/features/dev/TextureLabPage.tsx +149 -0
- package/client/features/home/HomePage.tsx +5 -5
- package/client/features/home/workspace-setup/CreateWorkspaceDialog.tsx +3 -3
- package/client/features/home/workspace-setup/DemoDialog.tsx +239 -0
- package/client/features/home/workspace-setup/WorkspaceAgentStep.tsx +22 -5
- package/client/features/settings/GeneralSettings.tsx +27 -23
- package/client/features/update/Update.tsx +78 -0
- package/client/features/update/api.ts +35 -0
- package/client/features/widgets/WidgetFrame.tsx +1 -0
- package/client/features/workspace/WorkspaceScreen.tsx +15 -0
- package/client/index.css +2 -2
- package/client/runtime/workspace-theme.ts +12 -4
- package/client/theme.css +26 -22
- package/dist/{chunk-zbt8emsw.js → chunk-0set7tmf.js} +2 -2
- package/dist/chunk-4057kxht.css +1 -0
- package/dist/{chunk-zcyvyebg.js → chunk-5t06zksf.js} +2 -2
- package/dist/{chunk-zbeq02yc.js → chunk-97eg9mjn.js} +1 -1
- package/dist/chunk-b5c62p8h.js +1 -0
- package/dist/chunk-dfe7qnrp.js +1 -0
- package/dist/{chunk-b959mdkj.js → chunk-efdyz6xp.js} +1 -1
- package/dist/chunk-f6xmz3tn.js +83 -0
- package/dist/chunk-h2kj1ysj.js +1 -0
- package/dist/{chunk-zfz3b4xg.js → chunk-ht1f95h9.js} +2 -2
- package/dist/chunk-qtc5a8qa.js +10 -0
- package/dist/floppy-disk-wmjs0n85.webp +0 -0
- package/dist/index.html +1 -1
- package/lib/ids.ts +27 -0
- package/lib/themes.ts +12 -12
- package/lib/types.ts +11 -2
- package/lib/update.ts +2 -0
- package/package.json +2 -1
- package/server/api.ts +47 -1
- package/server/app-config.ts +2 -2
- package/server/bundler/build-applet.ts +2 -3
- package/server/cli.ts +30 -7
- package/server/constants.ts +4 -2
- package/server/registry.ts +37 -2
- package/server/update.ts +293 -5
- package/server/web.ts +1 -1
- package/client/features/home/workspace-setup/InstallMoiDialog.tsx +0 -245
- package/dist/chunk-87q78504.js +0 -1
- package/dist/chunk-8s41nd3g.js +0 -1
- package/dist/chunk-cagtq45k.js +0 -1
- package/dist/chunk-ek6zde7t.js +0 -10
- package/dist/chunk-n8tq2494.js +0 -82
- package/dist/chunk-v82nefjq.css +0 -1
package/README.md
CHANGED
|
@@ -9,18 +9,22 @@
|
|
|
9
9
|
An extendable visual workspace where your AI agents build their own UI.
|
|
10
10
|
See [moi.computer](https://moi.computer) for what it is and how it works.
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
moi gives your agent of choice a UI it can reshape on the fly and grow into your
|
|
13
13
|
personal software. Under the hood, the agent writes and embeds live components
|
|
14
14
|
wired to real data: APIs, local files and commands, MCP servers.
|
|
15
15
|
|
|
16
16
|
Works with the harness you already use:
|
|
17
17
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
18
|
+
<p align="center">
|
|
19
|
+
<a href="#claude-code-and-codex"><img src="assets/harnesses/claude.svg" width="16" alt="" /> <strong>Claude Code</strong></a>
|
|
20
|
+
<a href="#claude-code-and-codex"><img src="assets/harnesses/codex.png" width="16" alt="" /> <strong>Codex</strong></a>
|
|
21
|
+
<a href="#openclaw"><img src="assets/harnesses/openclaw.svg" width="16" alt="" /> <strong>OpenClaw</strong></a>
|
|
22
|
+
<a href="#hermes"><img src="assets/harnesses/hermes.png" width="16" alt="" /> <strong>Hermes</strong></a>
|
|
23
|
+
</p>
|
|
21
24
|
|
|
22
25
|
# Features
|
|
23
26
|
|
|
27
|
+
- **Bring your own agent**. Connect the agent you already use.
|
|
24
28
|
- **Workspace**. The folder where your agent (e.g. Claude Code) runs and keeps
|
|
25
29
|
its data. It gets a special skill that teaches it how to communicate with moi.
|
|
26
30
|
- **Theme**. The agent can modify the appearance of the workspace for you:
|
|
@@ -53,39 +57,130 @@ Works with the harness you already use:
|
|
|
53
57
|
|
|
54
58
|
# Quick start
|
|
55
59
|
|
|
56
|
-
|
|
57
|
-
|
|
60
|
+
Make sure [Bun](https://bun.sh) 1.3 or newer is installed. moi uses it to run the web server and bundle the dynamic UI.
|
|
61
|
+
|
|
62
|
+
Install the `moi-computer` package from npm and start the web UI:
|
|
63
|
+
|
|
64
|
+
```sh
|
|
65
|
+
bun i -g moi-computer
|
|
66
|
+
moi start # http://localhost:13337
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
Then connect your agent: [Claude Code and Codex](#claude-code-and-codex),
|
|
70
|
+
[OpenClaw](#openclaw), or [Hermes](#hermes).
|
|
71
|
+
|
|
72
|
+
Learn how to:
|
|
73
|
+
|
|
74
|
+
- [Run moi as a service](#run-moi-as-a-service)
|
|
75
|
+
- [Update moi](#update-moi)
|
|
76
|
+
|
|
77
|
+
# How it works
|
|
78
|
+
|
|
79
|
+
moi runs locally as a CLI and web UI connected to your agent. The workspace
|
|
80
|
+
skill teaches the agent how to call the CLI, which updates the UI using your
|
|
81
|
+
files, commands, APIs, and MCP servers.
|
|
82
|
+
|
|
83
|
+
The core is `moi` command that both agent and you can use to modify the workspace.
|
|
84
|
+
Everything gets propagated to the UI instantly.
|
|
85
|
+
|
|
86
|
+
```mermaid
|
|
87
|
+
%%{init: {"theme": "base", "themeVariables": {"primaryColor": "#ffffff", "primaryTextColor": "#111111", "primaryBorderColor": "#111111", "lineColor": "#737373", "edgeLabelBackground": "#ffffff"}}}%%
|
|
88
|
+
flowchart LR
|
|
89
|
+
Agent["Your agent, e.g. Claude Code"] -->|"uses moi skill"| CLI["moi CLI"]
|
|
90
|
+
CLI -->|"updates"| UI["UI"]
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
Moi also stores the all widgets and views as code to keep the workspace filesystem
|
|
94
|
+
as a source of truth.
|
|
95
|
+
|
|
96
|
+
Updates installed from the UI restart moi and reload the browser automatically.
|
|
97
|
+
The app checks npm at most once an hour while it is open, retrying in five
|
|
98
|
+
minutes if the registry could not be reached; a closed app makes no network
|
|
99
|
+
calls of its own.
|
|
100
|
+
|
|
101
|
+
# Connect an agent
|
|
102
|
+
|
|
103
|
+
A workspace is the folder where your agent runs and stores its data. moi adds
|
|
104
|
+
a `.moi/` folder and the skills the agent needs to work with the UI.
|
|
105
|
+
|
|
106
|
+
You can connect a workspace in either of these ways:
|
|
107
|
+
|
|
108
|
+
- Open [http://localhost:13337](http://localhost:13337) and create a workspace
|
|
109
|
+
or import one that moi found on your computer.
|
|
110
|
+
- Run `moi init` in a folder. moi detects the harness from the folder's Hermes
|
|
111
|
+
profile, OpenClaw agent, or Claude Code or Codex history. If detection is
|
|
112
|
+
ambiguous, it asks you to choose a harness.
|
|
113
|
+
|
|
114
|
+
## Claude Code and Codex
|
|
115
|
+
|
|
116
|
+
Open Claude Code or Codex in your project folder and paste this prompt:
|
|
58
117
|
|
|
59
118
|
```
|
|
60
119
|
Set up the moi workspace for this project. Fetch https://moi.computer/INSTALL.md, and follow the steps.
|
|
61
120
|
```
|
|
62
121
|
|
|
63
|
-
|
|
122
|
+
To set it up manually, run:
|
|
64
123
|
|
|
65
|
-
|
|
124
|
+
```sh
|
|
125
|
+
moi init --harness=claude-code # or --harness=codex
|
|
126
|
+
moi start # or run moi as a service
|
|
127
|
+
```
|
|
66
128
|
|
|
67
|
-
|
|
129
|
+
The project folder becomes the workspace. You can create as many workspaces as
|
|
130
|
+
you need.
|
|
68
131
|
|
|
69
|
-
|
|
132
|
+
## OpenClaw
|
|
133
|
+
|
|
134
|
+
[OpenClaw](https://openclaw.ai/) is a self-hosted harness for running one or
|
|
135
|
+
more always-on agents. Its channels connect agents to Slack and other
|
|
136
|
+
messaging services.
|
|
137
|
+
|
|
138
|
+
moi connects each OpenClaw agent to one workspace. See the
|
|
139
|
+
[OpenClaw documentation](https://docs.openclaw.ai/cli/agents) to add or manage
|
|
140
|
+
agents.
|
|
141
|
+
|
|
142
|
+
Run `moi openclaw init` to connect your agent. If moi finds more than one, it
|
|
143
|
+
lists them so you can rerun the command with the agent you want:
|
|
70
144
|
|
|
71
145
|
```sh
|
|
72
|
-
|
|
73
|
-
moi
|
|
146
|
+
moi openclaw init
|
|
147
|
+
moi openclaw init <agent> # only needed when you have multiple agents
|
|
148
|
+
moi start # or run moi as a service
|
|
74
149
|
```
|
|
75
150
|
|
|
76
|
-
|
|
151
|
+
Your agent's workspace will show up at `http://localhost:13337`.
|
|
152
|
+
|
|
153
|
+
## Hermes
|
|
154
|
+
|
|
155
|
+
[Hermes](https://hermes-agent.nousresearch.com/) is a self-hosted personal
|
|
156
|
+
agent from Nous Research.
|
|
157
|
+
|
|
158
|
+
moi connects each Hermes profile to one workspace. A profile is a separate
|
|
159
|
+
agent identity with its own model, keys, persona, skills, and memories.
|
|
160
|
+
|
|
161
|
+
Run `moi hermes init` to connect your profile. If moi finds more than one, it
|
|
162
|
+
lists them so you can rerun the command with the profile you want:
|
|
163
|
+
|
|
164
|
+
```sh
|
|
165
|
+
moi hermes init
|
|
166
|
+
moi hermes init <profile> # only needed when you have multiple profiles
|
|
167
|
+
moi start # or run moi as a service
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
The profile's workspace appears at `http://localhost:13337`. To add another,
|
|
171
|
+
create it with `hermes profile create <name>`, then run `moi hermes init` again.
|
|
172
|
+
|
|
173
|
+
moi connects to Hermes through its built-in
|
|
174
|
+
[Agent Client Protocol](https://agentclientprotocol.com/) server. It starts a
|
|
175
|
+
`hermes -p <profile> acp` process and communicates over stdio, so there is no
|
|
176
|
+
gateway, port, or additional API key to configure.
|
|
77
177
|
|
|
78
|
-
|
|
79
|
-
(or import one moi found on this computer) right from the web UI;
|
|
80
|
-
- or run `moi init` inside a folder to turn it into a workspace. It picks the
|
|
81
|
-
agent backend up from the folder itself — a Hermes profile, an OpenClaw
|
|
82
|
-
agent, or Codex/Claude Code history — and asks for
|
|
83
|
-
`--harness=claude-code|codex|hermes|openclaw` when it can't tell.
|
|
178
|
+
# Manage moi
|
|
84
179
|
|
|
85
|
-
## Run as a service
|
|
180
|
+
## Run moi as a service
|
|
86
181
|
|
|
87
182
|
Instead of keeping `moi start` in a terminal, install moi as a user-level
|
|
88
|
-
service
|
|
183
|
+
service. It starts on login, restarts on crash, and survives reboots
|
|
89
184
|
(launchd on macOS, a systemd user unit on Linux; no root needed):
|
|
90
185
|
|
|
91
186
|
```sh
|
|
@@ -96,17 +191,15 @@ moi service restart
|
|
|
96
191
|
moi service uninstall
|
|
97
192
|
```
|
|
98
193
|
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
Anything else your agents need belongs in the workspace env (`moi env set`,
|
|
103
|
-
`.env`) — or capture it by name: `moi service install --env MY_TOKEN,OTHER`.
|
|
194
|
+
Anything your agents need belongs in the workspace env (`moi env set` or
|
|
195
|
+
`.env`). To capture shell variables instead, run
|
|
196
|
+
`moi service install --env MY_TOKEN,OTHER`.
|
|
104
197
|
Rerun `moi service install` after changing captured vars (or moving bun). On
|
|
105
198
|
macOS the first install may show a "background item added" notification for
|
|
106
199
|
"moi"; that is the moi service. On headless Linux, lingering is enabled
|
|
107
200
|
automatically when possible so the service outlives your SSH session.
|
|
108
201
|
|
|
109
|
-
##
|
|
202
|
+
## Update moi
|
|
110
203
|
|
|
111
204
|
```sh
|
|
112
205
|
moi update # update to the latest release
|
|
@@ -116,42 +209,15 @@ moi update --check # only check; exit 0 up to date, 1 update available, 2 che
|
|
|
116
209
|
`moi update` checks npm for the latest release and updates through whichever
|
|
117
210
|
package manager owns the install (bun, npm, pnpm, or yarn). A service-managed
|
|
118
211
|
server is restarted onto the new version; a foreground `moi start` only gets
|
|
119
|
-
a warning
|
|
212
|
+
a warning, so restart it yourself. Prerelease installs (`…-next.N`) are left
|
|
120
213
|
alone. `--check` changes nothing and is made for scripts and agents.
|
|
121
214
|
`moi status` shows when the running server and CLI versions differ, however
|
|
122
215
|
the update happened.
|
|
123
216
|
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
In OpenClaw, moi is installed per _agent workspace_. First, list the agents
|
|
127
|
-
you have:
|
|
128
|
-
|
|
129
|
-
```
|
|
130
|
-
> openclaw agents
|
|
131
|
-
|
|
132
|
-
🦞 OpenClaw 2026.7.1
|
|
133
|
-
|
|
134
|
-
Agents:
|
|
135
|
-
- main (default) <-- the agent name you'll pass to moi
|
|
136
|
-
Identity: Assistant (IDENTITY.md)
|
|
137
|
-
Workspace: ~/.openclaw/workspace
|
|
138
|
-
Agent dir: ~/.openclaw/agents/main/agent
|
|
139
|
-
Model: openai/gpt-5.6-sol
|
|
140
|
-
```
|
|
141
|
-
|
|
142
|
-
Then install the moi skill into an agent's workspace and start the web UI:
|
|
143
|
-
|
|
144
|
-
```sh
|
|
145
|
-
moi openclaw init <agent-name>
|
|
146
|
-
moi start
|
|
147
|
-
```
|
|
148
|
-
|
|
149
|
-
Your agent's workspace will show up at `http://localhost:13337`.
|
|
150
|
-
|
|
151
|
-
## No crypto token
|
|
217
|
+
# No crypto token
|
|
152
218
|
|
|
153
|
-
moi has **no** cryptocurrency, token, coin, or NFT
|
|
154
|
-
|
|
219
|
+
moi has **no** cryptocurrency, token, coin, or NFT, official or otherwise, on
|
|
220
|
+
any chain, and never will. Any token using the moi name, logo, or the
|
|
155
221
|
maintainer's name (on pump.fun, Solana, or anywhere else) is an unauthorized
|
|
156
222
|
scam with no affiliation to, endorsement from, or benefit to this project.
|
|
157
223
|
The maintainer will never announce, endorse, or accept proceeds from a token.
|
|
@@ -1,16 +1,25 @@
|
|
|
1
1
|
import { type ReactNode } from 'react'
|
|
2
2
|
|
|
3
|
-
import { IconPlus, IconSmartHome } from '@tabler/icons-react'
|
|
3
|
+
import { IconAlertSquareRoundedFilled, IconPlus, IconSmartHome } from '@tabler/icons-react'
|
|
4
4
|
import { useQueryClient } from '@tanstack/react-query'
|
|
5
5
|
import { Link, useLocation } from 'wouter'
|
|
6
6
|
|
|
7
|
+
import { useAppConfig } from '@/client/api/app-config'
|
|
7
8
|
import { useReorderWorkspaces, useWorkspaces } from '@/client/features/home/api'
|
|
9
|
+
import { Update } from '@/client/features/update/Update'
|
|
8
10
|
import { workspaceKeys } from '@/client/api/workspace-keys'
|
|
9
11
|
import { useWorkspaceEvent } from '@/client/runtime/useWorkspaceEvents'
|
|
10
12
|
import { CreateWorkspaceDialog } from '@/client/features/home/workspace-setup/CreateWorkspaceDialog'
|
|
13
|
+
import { DemoDialog } from '@/client/features/home/workspace-setup/DemoDialog'
|
|
11
14
|
import { ReorderableList } from '@/client/components/shared/ReorderableList'
|
|
12
15
|
import type { ReorderableRenderState } from '@/client/components/shared/ReorderableList'
|
|
13
16
|
import { Button, buttonVariants } from '@/client/components/ui/button'
|
|
17
|
+
import {
|
|
18
|
+
Tooltip,
|
|
19
|
+
TooltipContent,
|
|
20
|
+
TooltipProvider,
|
|
21
|
+
TooltipTrigger
|
|
22
|
+
} from '@/client/components/ui/tooltip'
|
|
14
23
|
import {
|
|
15
24
|
workspaceDisplayName,
|
|
16
25
|
workspaceProviderIcon
|
|
@@ -63,51 +72,79 @@ type SidebarProps = {
|
|
|
63
72
|
|
|
64
73
|
function Sidebar({ workspaces }: SidebarProps) {
|
|
65
74
|
const reorder = useReorderWorkspaces()
|
|
75
|
+
const { cloudDemo } = useAppConfig()
|
|
66
76
|
|
|
67
77
|
return (
|
|
68
|
-
<
|
|
69
|
-
<
|
|
70
|
-
<
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
78
|
+
<TooltipProvider delay={500}>
|
|
79
|
+
<aside className="flex h-full shrink-0 flex-col items-center gap-4 px-2 py-5 [font-family:var(--default-sans)]">
|
|
80
|
+
<Tooltip>
|
|
81
|
+
<TooltipTrigger
|
|
82
|
+
render={
|
|
83
|
+
<Link href="/" aria-label="Home" className={sidebarNavButtonClass}>
|
|
84
|
+
<IconSmartHome stroke={1.5} />
|
|
85
|
+
</Link>
|
|
86
|
+
}
|
|
87
|
+
/>
|
|
88
|
+
<TooltipContent side="right">Home</TooltipContent>
|
|
89
|
+
</Tooltip>
|
|
90
|
+
|
|
91
|
+
<nav className="flex max-h-full min-h-0 w-14 flex-1 flex-col items-center justify-center gap-4">
|
|
92
|
+
{workspaces.length > 0 && (
|
|
93
|
+
<>
|
|
94
|
+
<div className="no-scrollbar min-h-0 scroll-fade overflow-y-auto [--scroll-fade-reveal:16px]">
|
|
95
|
+
<ReorderableList
|
|
96
|
+
items={workspaces}
|
|
97
|
+
getId={ws => ws.id}
|
|
98
|
+
className="flex flex-col gap-4"
|
|
99
|
+
onReorder={ids => reorder.mutate(ids)}
|
|
100
|
+
renderPlaceholder={() => (
|
|
101
|
+
<div className="pointer-events-none absolute top-0 left-1 size-10 rounded-xl bg-accent" />
|
|
102
|
+
)}
|
|
103
|
+
renderOverlay={ws => <WorkspaceButton workspace={ws} dragOverlay />}
|
|
104
|
+
renderItem={(ws, state) => <WorkspaceButton workspace={ws} dragState={state} />}
|
|
105
|
+
/>
|
|
106
|
+
</div>
|
|
107
|
+
<div className="shrink-0">
|
|
108
|
+
<Tooltip>
|
|
109
|
+
<CreateWorkspaceDialog
|
|
110
|
+
trigger={
|
|
111
|
+
<TooltipTrigger
|
|
112
|
+
render={
|
|
113
|
+
<Button
|
|
114
|
+
type="button"
|
|
115
|
+
variant="ghost"
|
|
116
|
+
size="icon-lg"
|
|
117
|
+
aria-label="Create new workspace"
|
|
118
|
+
className="text-muted-foreground hover:text-foreground"
|
|
119
|
+
>
|
|
120
|
+
<IconPlus data-icon="inline-start" stroke={1.5} />
|
|
121
|
+
</Button>
|
|
122
|
+
}
|
|
123
|
+
/>
|
|
124
|
+
}
|
|
125
|
+
/>
|
|
126
|
+
<TooltipContent side="right">Create new workspace</TooltipContent>
|
|
127
|
+
</Tooltip>
|
|
128
|
+
</div>
|
|
129
|
+
</>
|
|
130
|
+
)}
|
|
131
|
+
</nav>
|
|
132
|
+
|
|
133
|
+
<div className="size-8 shrink-0">
|
|
134
|
+
{cloudDemo ? (
|
|
135
|
+
<DemoDialog
|
|
136
|
+
trigger={
|
|
137
|
+
<Button size="icon" aria-label="Unlock all features" title="Unlock all features">
|
|
138
|
+
<IconAlertSquareRoundedFilled stroke={1.5} />
|
|
139
|
+
</Button>
|
|
140
|
+
}
|
|
141
|
+
/>
|
|
142
|
+
) : (
|
|
143
|
+
<Update />
|
|
144
|
+
)}
|
|
145
|
+
</div>
|
|
146
|
+
</aside>
|
|
147
|
+
</TooltipProvider>
|
|
111
148
|
)
|
|
112
149
|
}
|
|
113
150
|
|
|
@@ -125,39 +162,43 @@ function WorkspaceButton({ workspace, dragOverlay = false, dragState }: Workspac
|
|
|
125
162
|
// rail matches the workspace segment, not the whole path. The trailing slash
|
|
126
163
|
// keeps `/workspace/ws1` from lighting up a sibling `/workspace/ws1-other`.
|
|
127
164
|
const active = location === href || location.startsWith(`${href}/`)
|
|
128
|
-
const
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
165
|
+
const icon = (
|
|
166
|
+
<div
|
|
167
|
+
className={cn(
|
|
168
|
+
buttonVariants({ variant: 'ghost', size: 'icon-lg' }),
|
|
169
|
+
'pointer-events-none size-12',
|
|
170
|
+
dragOverlay
|
|
171
|
+
? 'bg-background shadow-lg'
|
|
172
|
+
: 'group-hover:bg-accent group-hover:text-accent-foreground group-focus-visible:ring-3 group-focus-visible:ring-ring/50',
|
|
173
|
+
active && !dragOverlay && 'bg-accent text-accent-foreground'
|
|
174
|
+
)}
|
|
175
|
+
>
|
|
176
|
+
<img
|
|
177
|
+
src={workspace.icon ?? workspaceProviderIcon[workspace.type ?? 'claude-code']}
|
|
178
|
+
alt=""
|
|
179
|
+
className="size-7 shrink-0 rounded-xs"
|
|
180
|
+
/>
|
|
181
|
+
</div>
|
|
182
|
+
)
|
|
183
|
+
const labelElement = (
|
|
184
|
+
<span className="mt-0.5 line-clamp-2 w-full text-center text-[11px] leading-snug font-medium text-ellipsis text-foreground">
|
|
185
|
+
{label}
|
|
186
|
+
</span>
|
|
150
187
|
)
|
|
151
188
|
|
|
152
189
|
if (dragOverlay) {
|
|
153
|
-
return
|
|
190
|
+
return (
|
|
191
|
+
<span className="flex w-14 flex-col items-center">
|
|
192
|
+
{icon}
|
|
193
|
+
{labelElement}
|
|
194
|
+
</span>
|
|
195
|
+
)
|
|
154
196
|
}
|
|
155
197
|
|
|
156
198
|
return (
|
|
157
199
|
<Link
|
|
158
200
|
href={href}
|
|
159
201
|
aria-label={label}
|
|
160
|
-
title={label}
|
|
161
202
|
onClick={event => {
|
|
162
203
|
if (dragState?.isDragging) event.preventDefault()
|
|
163
204
|
}}
|
|
@@ -167,7 +208,11 @@ function WorkspaceButton({ workspace, dragOverlay = false, dragState }: Workspac
|
|
|
167
208
|
)}
|
|
168
209
|
{...dragState?.dragHandleProps}
|
|
169
210
|
>
|
|
170
|
-
{
|
|
211
|
+
{icon}
|
|
212
|
+
<Tooltip>
|
|
213
|
+
<TooltipTrigger render={labelElement} />
|
|
214
|
+
<TooltipContent side="right">{label}</TooltipContent>
|
|
215
|
+
</Tooltip>
|
|
171
216
|
</Link>
|
|
172
217
|
)
|
|
173
218
|
}
|
|
Binary file
|
package/client/assets.d.ts
CHANGED
|
@@ -12,7 +12,8 @@ const buttonVariants = cva(
|
|
|
12
12
|
'bg-primary text-primary-foreground inset-shadow-[0_0_8px_color-mix(in_oklab,var(--color-white)_20%,transparent)] hover:bg-primary/90 disabled:bg-accent disabled:text-muted-foreground disabled:opacity-100 disabled:shadow-none',
|
|
13
13
|
secondary:
|
|
14
14
|
'bg-accent text-foreground hover:bg-[color-mix(in_oklch,var(--accent),var(--foreground)_3%)] hover:text-accent-foreground',
|
|
15
|
-
outline:
|
|
15
|
+
outline:
|
|
16
|
+
'bg-background text-foreground shadow-xs hover:text-accent-foreground hover:shadow-sm',
|
|
16
17
|
ghost: 'hover:bg-accent hover:text-accent-foreground',
|
|
17
18
|
destructive:
|
|
18
19
|
'bg-destructive/10 text-destructive hover:bg-destructive/20 focus-visible:border-destructive/40 focus-visible:ring-destructive/20'
|