moi-computer 0.3.1-next.0 → 0.4.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 +49 -12
- package/client/api/workspace-keys.ts +2 -2
- package/client/app/AppRouter.tsx +0 -2
- package/client/app/shell/SidebarLayout.tsx +3 -16
- package/client/assets/openai.svg +1 -3
- package/client/components/shared/Composer.tsx +53 -2
- package/client/components/ui/button.tsx +1 -1
- package/client/components/ui/tooltip.tsx +12 -15
- package/client/features/chat/ChatComposer.tsx +25 -15
- package/client/features/chat/ChatPanel.tsx +5 -2
- package/client/features/chat/MarkdownContent.tsx +20 -2
- package/client/features/chat/ModelPicker.tsx +5 -3
- package/client/features/chat/TurnView.tsx +2 -2
- package/client/features/chat/chat-frames.ts +13 -6
- package/client/features/chat/chat-send.ts +1 -1
- package/client/features/chat/chat-store.ts +22 -17
- package/client/features/chat/tool-group/ToolOutput.tsx +4 -12
- package/client/features/chat/tool-group/format.ts +22 -7
- package/client/features/chat/useChat.ts +11 -2
- package/client/features/connectors/McpServerCards.tsx +95 -0
- package/client/features/connectors/api.ts +0 -11
- package/client/features/dev/HarnessDebugPage.tsx +210 -74
- package/client/features/home/HomePage.tsx +33 -28
- package/client/features/home/api.ts +24 -12
- package/client/features/home/workspace-presentation.tsx +17 -15
- package/client/features/home/workspace-setup/CreateWorkspaceDialog.tsx +243 -0
- package/client/features/home/workspace-setup/ImportWorkspaceDialog.tsx +95 -0
- package/client/features/home/workspace-setup/WorkspaceAgentStep.tsx +230 -0
- package/client/features/home/workspace-setup/WorkspaceDialogContent.tsx +35 -0
- package/client/features/home/workspace-setup/useWorkspaceImport.ts +61 -0
- package/client/features/settings/ConnectorsSettings.tsx +89 -0
- package/client/features/settings/SettingsLayout.tsx +2 -2
- package/client/features/settings/WorkspaceSettings.tsx +8 -4
- package/client/features/views/ViewBuilderTab.tsx +19 -15
- package/client/features/views/useViewBuilderActions.ts +1 -1
- package/client/features/workspace/WorkspaceLayoutContext.tsx +3 -4
- package/client/features/workspace/WorkspaceScreen.tsx +11 -3
- package/client/features/workspace/api.ts +19 -1
- package/client/features/workspace/moi-context.ts +85 -0
- package/client/main.tsx +16 -5
- package/dist/chunk-19g80zc9.css +1 -0
- package/dist/{chunk-jen6xcm1.js → chunk-2vaafjp4.js} +1 -1
- package/dist/{chunk-vkvb3hjm.js → chunk-35fq49qa.js} +1 -1
- package/dist/chunk-69nhbjhy.js +50 -0
- package/dist/{chunk-axszxe4c.js → chunk-72atbmh3.js} +1 -1
- package/dist/{chunk-zpxrb1ce.js → chunk-7mkv2gr0.js} +2 -2
- package/dist/{chunk-cs8vbert.js → chunk-fh2mf6v9.js} +3 -3
- package/dist/chunk-gt7n06ef.js +1 -0
- package/dist/chunk-jwmc32rp.js +63 -0
- package/dist/chunk-kh24bstm.js +10 -0
- package/dist/chunk-sfa4mbmx.js +15 -0
- package/dist/index.html +1 -1
- package/dist/openai-ep9ht2pq.svg +1 -0
- package/lib/ids.ts +15 -0
- package/lib/moi-context.ts +170 -0
- package/lib/types.ts +29 -11
- package/lib/view-builder-directives.ts +16 -0
- package/lib/workspace-types.ts +12 -0
- package/package.json +2 -1
- package/server/api.ts +92 -30
- package/server/harness/README.md +25 -9
- package/server/harness/claude-code/NOTES.md +20 -6
- package/server/harness/claude-code/adapter.ts +2 -2
- package/server/harness/claude-code/git-worktree.ts +32 -0
- package/server/harness/claude-code/index.ts +33 -12
- package/server/harness/claude-code/mcp.ts +16 -65
- package/server/harness/claude-code/models.ts +3 -0
- package/server/harness/claude-code/session.ts +196 -61
- package/server/harness/codex/NOTES.md +41 -11
- package/server/harness/codex/adapter.ts +121 -16
- package/server/harness/codex/client.ts +67 -18
- package/server/harness/codex/discovery.ts +114 -0
- package/server/harness/codex/index.ts +10 -5
- package/server/harness/codex/probe.ts +4 -2
- package/server/harness/codex/session.ts +89 -13
- package/server/harness/executable.ts +82 -0
- package/server/harness/openclaw/adapter.ts +8 -1
- package/server/harness/openclaw/index.ts +8 -14
- package/server/harness/openclaw/session.ts +50 -10
- package/server/harness/openclaw/strip.ts +2 -2
- package/server/harness/shell-path.ts +79 -0
- package/server/harness/types.ts +22 -5
- package/server/registry.ts +57 -12
- package/server/view-builders.ts +3 -2
- package/server/web.ts +24 -8
- package/server/workspace-import.ts +45 -0
- package/workspace/.claude/skills/moi-workspace/SKILL.md +3 -3
- package/client/features/connectors/ConnectorsPage.tsx +0 -92
- package/client/features/connectors/McpMenu.tsx +0 -145
- package/client/features/home/CreateWorkspaceDialog.tsx +0 -130
- package/client/features/home/CreateWorkspaceDialogSteps.tsx +0 -234
- package/dist/chunk-4vf1t6v1.js +0 -10
- package/dist/chunk-6c8cwpzc.js +0 -1
- package/dist/chunk-b3ynfk4g.js +0 -62
- package/dist/chunk-b4b276wx.js +0 -15
- package/dist/chunk-kxmvv1ax.js +0 -48
- package/dist/chunk-npwq6jmr.css +0 -1
- package/dist/openai-h13pza4b.svg +0 -3
- package/lib/view-builder-meta.ts +0 -35
package/README.md
CHANGED
|
@@ -2,36 +2,73 @@
|
|
|
2
2
|
██████████ ██████ ██
|
|
3
3
|
██░░██░░██ ██░░██ ██
|
|
4
4
|
██░░██░░██ ██████ ██
|
|
5
|
+
|
|
6
|
+
THE UI FOR YOUR AI
|
|
5
7
|
```
|
|
6
8
|
|
|
7
|
-
A
|
|
9
|
+
A visual workspace where your AI agents build their own UI.
|
|
8
10
|
See [moi.computer](https://moi.computer) for what it is and how it works.
|
|
9
11
|
|
|
10
|
-
|
|
12
|
+
Works with the harness you already use:
|
|
13
|
+
|
|
14
|
+
| [Claude Code](https://github.com/anthropics/claude-code) | [Codex](https://github.com/openai/codex) |
|
|
15
|
+
| :------------------------------------------------------- | :--------------------------------------- |
|
|
16
|
+
| [OpenClaw](https://github.com/openclaw/openclaw) | Hermes _(coming soon)_ |
|
|
17
|
+
|
|
18
|
+
# Quick start
|
|
19
|
+
|
|
20
|
+
Using Claude Code or Codex? Paste this prompt into an existing session and the
|
|
21
|
+
agent will set everything up for you:
|
|
22
|
+
|
|
23
|
+
```
|
|
24
|
+
Set up the moi workspace for this project. Fetch https://moi.computer/CC-INSTALL.md, and follow the steps.
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
For OpenClaw or a manual setup, read on.
|
|
28
|
+
|
|
29
|
+
## Manual install
|
|
30
|
+
|
|
31
|
+
Make sure [Bun](https://bun.sh) is installed. moi uses it to run the web server and bundle the dynamic UI.
|
|
32
|
+
|
|
33
|
+
Install the `moi-computer` package from npm and start the web UI:
|
|
11
34
|
|
|
12
35
|
```sh
|
|
13
36
|
bun i -g moi-computer
|
|
14
37
|
moi start # http://localhost:13337
|
|
15
38
|
```
|
|
16
39
|
|
|
17
|
-
|
|
40
|
+
Then bring in your project, either way works:
|
|
41
|
+
|
|
42
|
+
- open [http://localhost:13337](http://localhost:13337) and create a workspace
|
|
43
|
+
(or import an existing folder) right from the web UI;
|
|
44
|
+
- or run `moi init` inside a folder to turn it into a workspace.
|
|
45
|
+
|
|
46
|
+
## OpenClaw
|
|
47
|
+
|
|
48
|
+
In OpenClaw, moi is installed per _agent workspace_. First, list the agents
|
|
49
|
+
you have:
|
|
18
50
|
|
|
19
51
|
```
|
|
20
|
-
|
|
52
|
+
> openclaw agents
|
|
53
|
+
|
|
54
|
+
🦞 OpenClaw 2026.7.1
|
|
55
|
+
|
|
56
|
+
Agents:
|
|
57
|
+
- main (default) <-- the agent name you'll pass to moi
|
|
58
|
+
Identity: Assistant (IDENTITY.md)
|
|
59
|
+
Workspace: ~/.openclaw/workspace
|
|
60
|
+
Agent dir: ~/.openclaw/agents/main/agent
|
|
61
|
+
Model: openai/gpt-5.6-sol
|
|
21
62
|
```
|
|
22
63
|
|
|
23
|
-
|
|
64
|
+
Then install the moi skill into an agent's workspace and start the web UI:
|
|
24
65
|
|
|
25
66
|
```sh
|
|
26
|
-
|
|
27
|
-
|
|
67
|
+
moi openclaw init <agent-name>
|
|
68
|
+
moi start
|
|
28
69
|
```
|
|
29
70
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
moi also works with OpenClaw agents — `moi openclaw init` installs the moi
|
|
33
|
-
skills into an OpenClaw agent workspace. Integration notes live in
|
|
34
|
-
[server/harness/openclaw/NOTES.md](server/harness/openclaw/NOTES.md).
|
|
71
|
+
Your agent's workspace will show up at `http://localhost:13337`.
|
|
35
72
|
|
|
36
73
|
## No crypto token
|
|
37
74
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export const workspaceKeys = {
|
|
2
2
|
all: ['workspaces'] as const,
|
|
3
3
|
discover: ['workspaces', 'discover'] as const,
|
|
4
|
-
|
|
4
|
+
setupInfo: ['workspaces', 'setup-info'] as const,
|
|
5
5
|
preview: (id: string) => ['workspaces', 'preview', id] as const,
|
|
6
6
|
layout: (id: string) => ['workspaces', 'layout', id] as const,
|
|
7
7
|
widgets: (id: string) => ['workspaces', 'widgets', id] as const,
|
|
@@ -11,8 +11,8 @@ export const workspaceKeys = {
|
|
|
11
11
|
events: (id: string, sessionId: string) => ['workspaces', 'events', id, sessionId] as const,
|
|
12
12
|
threadConfig: (id: string, sessionId: string) =>
|
|
13
13
|
['workspaces', 'threadConfig', id, sessionId] as const,
|
|
14
|
-
userMcp: ['mcp', 'user'] as const,
|
|
15
14
|
mcp: (id: string) => ['workspaces', 'mcp', id] as const,
|
|
16
15
|
models: (id: string) => ['workspaces', 'models', id] as const,
|
|
16
|
+
availability: (id: string) => ['workspaces', 'availability', id] as const,
|
|
17
17
|
env: (id: string) => ['workspaces', 'env', id] as const
|
|
18
18
|
}
|
package/client/app/AppRouter.tsx
CHANGED
|
@@ -3,7 +3,6 @@ import { Suspense, lazy, useEffect } from 'react'
|
|
|
3
3
|
import { Route, Switch, useLocation } from 'wouter'
|
|
4
4
|
|
|
5
5
|
import { setWorkspaceSwitchHandler } from '@/client/features/chat/chat-connection'
|
|
6
|
-
import { ConnectorsPage } from '@/client/features/connectors/ConnectorsPage'
|
|
7
6
|
|
|
8
7
|
import { HomeRoute } from './routes/HomeRoute'
|
|
9
8
|
import { WorkspaceRoute } from './routes/WorkspaceRoute'
|
|
@@ -34,7 +33,6 @@ export function AppRouter() {
|
|
|
34
33
|
return (
|
|
35
34
|
<Switch>
|
|
36
35
|
<Route path="/" component={HomeRoute} />
|
|
37
|
-
<Route path="/connectors" component={ConnectorsPage} />
|
|
38
36
|
<Route path="/dev/*?" component={DevLazy} />
|
|
39
37
|
<Route path="/workspace/:id">
|
|
40
38
|
{(params: { id: string }) => <WorkspaceRoute key={params.id} id={params.id} />}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { type ReactNode } from 'react'
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import { IconPlus, IconSmartHome } from '@tabler/icons-react'
|
|
4
4
|
import { useQueryClient } from '@tanstack/react-query'
|
|
5
5
|
import { Link, useLocation } from 'wouter'
|
|
6
6
|
|
|
7
7
|
import { useReorderWorkspaces, useWorkspaces } from '@/client/features/home/api'
|
|
8
8
|
import { workspaceKeys } from '@/client/api/workspace-keys'
|
|
9
9
|
import { useWorkspaceEvent } from '@/client/runtime/useWorkspaceEvents'
|
|
10
|
-
import { CreateWorkspaceDialog } from '@/client/features/home/CreateWorkspaceDialog'
|
|
10
|
+
import { CreateWorkspaceDialog } from '@/client/features/home/workspace-setup/CreateWorkspaceDialog'
|
|
11
11
|
import { ReorderableList } from '@/client/components/shared/ReorderableList'
|
|
12
12
|
import type { ReorderableRenderState } from '@/client/components/shared/ReorderableList'
|
|
13
13
|
import { Button, buttonVariants } from '@/client/components/ui/button'
|
|
@@ -119,24 +119,11 @@ function Sidebar({ workspaces }: SidebarProps) {
|
|
|
119
119
|
)}
|
|
120
120
|
</nav>
|
|
121
121
|
|
|
122
|
-
<
|
|
122
|
+
<div aria-hidden="true" className="size-8 shrink-0" />
|
|
123
123
|
</aside>
|
|
124
124
|
)
|
|
125
125
|
}
|
|
126
126
|
|
|
127
|
-
function ConnectorsNavLink() {
|
|
128
|
-
return (
|
|
129
|
-
<Link
|
|
130
|
-
href="/connectors"
|
|
131
|
-
aria-label="Connectors"
|
|
132
|
-
title="Connectors"
|
|
133
|
-
className={sidebarNavButtonClass}
|
|
134
|
-
>
|
|
135
|
-
<IconPlugConnected stroke={1.5} />
|
|
136
|
-
</Link>
|
|
137
|
-
)
|
|
138
|
-
}
|
|
139
|
-
|
|
140
127
|
type WorkspaceButtonProps = {
|
|
141
128
|
workspace: WorkspaceEntry
|
|
142
129
|
dragOverlay?: boolean
|
package/client/assets/openai.svg
CHANGED
|
@@ -1,3 +1 @@
|
|
|
1
|
-
<svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
-
<path fill="#10A37F" d="M22.2819 9.8211a5.9847 5.9847 0 0 0-.5157-4.9108 6.0462 6.0462 0 0 0-6.5098-2.9A6.0651 6.0651 0 0 0 4.9807 4.1818a5.9847 5.9847 0 0 0-3.9977 2.9 6.0462 6.0462 0 0 0 .7427 7.0966 5.98 5.98 0 0 0 .511 4.9107 6.051 6.051 0 0 0 6.5146 2.9001A5.9847 5.9847 0 0 0 13.2599 24a6.0557 6.0557 0 0 0 5.7718-4.2058 5.9894 5.9894 0 0 0 3.9977-2.9001 6.0557 6.0557 0 0 0-.7475-7.073zm-9.022 12.6081a4.4755 4.4755 0 0 1-2.8764-1.0408l.1419-.0804 4.7783-2.7582a.7948.7948 0 0 0 .3927-.6813v-6.7369l2.02 1.1686a.071.071 0 0 1 .038.052v5.5826a4.504 4.504 0 0 1-4.4945 4.4944zm-9.6607-4.1254a4.4708 4.4708 0 0 1-.5346-3.0137l.142.0852 4.783 2.7582a.7712.7712 0 0 0 .7806 0l5.8428-3.3685v2.3324a.0804.0804 0 0 1-.0332.0615L9.74 19.9502a4.4992 4.4992 0 0 1-6.1408-1.6464zM2.3408 7.8956a4.485 4.485 0 0 1 2.3655-1.9728V11.6a.7664.7664 0 0 0 .3879.6765l5.8144 3.3543-2.0201 1.1685a.0757.0757 0 0 1-.071 0l-4.8303-2.7865A4.504 4.504 0 0 1 2.3408 7.8956zm16.5963 3.8558L13.1038 8.364 15.1192 7.2a.0757.0757 0 0 1 .071 0l4.8303 2.7913a4.4944 4.4944 0 0 1-.6765 8.1042v-5.6772a.79.79 0 0 0-.407-.667zm2.0107-3.0231l-.142-.0852-4.7735-2.7818a.7759.7759 0 0 0-.7854 0L9.409 9.2297V6.8974a.0662.0662 0 0 1 .0284-.0615l4.8303-2.7866a4.4992 4.4992 0 0 1 6.6802 4.66zM8.3065 12.863l-2.02-1.1638a.0804.0804 0 0 1-.038-.0567V6.0742a4.4992 4.4992 0 0 1 7.3757-3.4537l-.142.0805L8.704 5.459a.7948.7948 0 0 0-.3927.6813zm1.0976-2.3654l2.602-1.4998 2.6069 1.4998v2.9994l-2.5974 1.4997-2.6067-1.4997z"/>
|
|
3
|
-
</svg>
|
|
1
|
+
<svg fill="none" fill-rule="evenodd" height="1em" style="flex:none;line-height:1" viewBox="0 0 24 24" width="1em" xmlns="http://www.w3.org/2000/svg"><title>OpenAI</title><path d="M9.205 8.658v-2.26c0-.19.072-.333.238-.428l4.543-2.616c.619-.357 1.356-.523 2.117-.523 2.854 0 4.662 2.212 4.662 4.566 0 .167 0 .357-.024.547l-4.71-2.759a.797.797 0 00-.856 0l-5.97 3.473zm10.609 8.8V12.06c0-.333-.143-.57-.429-.737l-5.97-3.473 1.95-1.118a.433.433 0 01.476 0l4.543 2.617c1.309.76 2.189 2.378 2.189 3.948 0 1.808-1.07 3.473-2.76 4.163zM7.802 12.703l-1.95-1.142c-.167-.095-.239-.238-.239-.428V5.899c0-2.545 1.95-4.472 4.591-4.472 1 0 1.927.333 2.712.928L8.23 5.067c-.285.166-.428.404-.428.737v6.898zM12 15.128l-2.795-1.57v-3.33L12 8.658l2.795 1.57v3.33L12 15.128zm1.796 7.23c-1 0-1.927-.332-2.712-.927l4.686-2.712c.285-.166.428-.404.428-.737v-6.898l1.974 1.142c.167.095.238.238.238.428v5.233c0 2.545-1.974 4.472-4.614 4.472zm-5.637-5.303l-4.544-2.617c-1.308-.761-2.188-2.378-2.188-3.948A4.482 4.482 0 014.21 6.327v5.423c0 .333.143.571.428.738l5.947 3.449-1.95 1.118a.432.432 0 01-.476 0zm-.262 3.9c-2.688 0-4.662-2.021-4.662-4.519 0-.19.024-.38.047-.57l4.686 2.71c.286.167.571.167.856 0l5.97-3.448v2.26c0 .19-.07.333-.237.428l-4.543 2.616c-.619.357-1.356.523-2.117.523zm5.899 2.83a5.947 5.947 0 005.827-4.756C22.287 18.339 24 15.84 24 13.296c0-1.665-.713-3.282-1.998-4.448.119-.5.19-.999.19-1.498 0-3.401-2.759-5.947-5.946-5.947-.642 0-1.26.095-1.88.31A5.962 5.962 0 0010.205 0a5.947 5.947 0 00-5.827 4.757C1.713 5.447 0 7.945 0 10.49c0 1.666.713 3.283 1.998 4.448-.119.5-.19 1-.19 1.499 0 3.401 2.759 5.946 5.946 5.946.642 0 1.26-.095 1.88-.309a5.96 5.96 0 004.162 1.713z" fill="#111111"></path></svg>
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import type { ComponentProps, RefObject } from 'react'
|
|
2
2
|
|
|
3
|
+
import { IconArrowUp, IconLoader2 } from '@tabler/icons-react'
|
|
4
|
+
|
|
5
|
+
import { Button } from '@/client/components/ui/button'
|
|
6
|
+
import { Tooltip, TooltipContent, TooltipTrigger } from '@/client/components/ui/tooltip'
|
|
3
7
|
import { cn } from '@/client/lib/cn'
|
|
4
8
|
|
|
5
9
|
type ComposerProps = Omit<ComponentProps<'form'>, 'ref'> & {
|
|
@@ -19,8 +23,11 @@ export function Composer({
|
|
|
19
23
|
onMouseDown={event => {
|
|
20
24
|
onMouseDown?.(event)
|
|
21
25
|
if (event.defaultPrevented) return
|
|
22
|
-
if (
|
|
23
|
-
|
|
26
|
+
if (
|
|
27
|
+
event.target instanceof Element &&
|
|
28
|
+
event.target.closest('button, input, textarea, select, a, [contenteditable="true"]')
|
|
29
|
+
)
|
|
30
|
+
return
|
|
24
31
|
composerRef.current?.focus()
|
|
25
32
|
}}
|
|
26
33
|
className={cn(
|
|
@@ -59,3 +66,47 @@ export function ComposerFooter({ className, children, ...props }: ComposerFooter
|
|
|
59
66
|
</div>
|
|
60
67
|
)
|
|
61
68
|
}
|
|
69
|
+
|
|
70
|
+
export function canSubmitComposerAction(
|
|
71
|
+
hasContent: boolean,
|
|
72
|
+
busy: boolean,
|
|
73
|
+
unavailableReason: string | null | undefined
|
|
74
|
+
): boolean {
|
|
75
|
+
return hasContent && !busy && unavailableReason === null
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
type ComposerSubmitButtonProps = {
|
|
79
|
+
label: string
|
|
80
|
+
hasContent: boolean
|
|
81
|
+
busy?: boolean
|
|
82
|
+
loading?: boolean
|
|
83
|
+
unavailableReason: string | null | undefined
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
export function ComposerSubmitButton({
|
|
87
|
+
label,
|
|
88
|
+
hasContent,
|
|
89
|
+
busy = false,
|
|
90
|
+
loading = false,
|
|
91
|
+
unavailableReason
|
|
92
|
+
}: ComposerSubmitButtonProps) {
|
|
93
|
+
const canSubmit = canSubmitComposerAction(hasContent, busy || loading, unavailableReason)
|
|
94
|
+
const button = (
|
|
95
|
+
<Button type="submit" size="icon" disabled={!canSubmit} aria-label={label}>
|
|
96
|
+
{loading ? (
|
|
97
|
+
<IconLoader2 stroke={1.5} className="animate-spin" />
|
|
98
|
+
) : (
|
|
99
|
+
<IconArrowUp stroke={1.5} />
|
|
100
|
+
)}
|
|
101
|
+
</Button>
|
|
102
|
+
)
|
|
103
|
+
|
|
104
|
+
if (loading || !unavailableReason) return button
|
|
105
|
+
|
|
106
|
+
return (
|
|
107
|
+
<Tooltip>
|
|
108
|
+
<TooltipTrigger render={<span className="inline-flex">{button}</span>} />
|
|
109
|
+
<TooltipContent className="max-w-64 text-center">{unavailableReason}</TooltipContent>
|
|
110
|
+
</Tooltip>
|
|
111
|
+
)
|
|
112
|
+
}
|
|
@@ -4,7 +4,7 @@ import { type VariantProps, cva } from 'class-variance-authority'
|
|
|
4
4
|
import { cn } from '@/client/lib/cn'
|
|
5
5
|
|
|
6
6
|
const buttonVariants = cva(
|
|
7
|
-
'inline-flex shrink-0 cursor-pointer items-center justify-center gap-
|
|
7
|
+
'inline-flex shrink-0 cursor-pointer items-center justify-center gap-1.5 rounded-sm text-sm font-medium whitespace-nowrap transition-all outline-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0',
|
|
8
8
|
{
|
|
9
9
|
variants: {
|
|
10
10
|
variant: {
|
|
@@ -2,18 +2,12 @@ import { Tooltip as TooltipPrimitive } from '@base-ui/react/tooltip'
|
|
|
2
2
|
|
|
3
3
|
import { cn } from '@/client/lib/cn'
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
...props
|
|
11
|
-
}: TooltipPrimitive.Root.Props & { delay?: number; closeDelay?: number }) {
|
|
12
|
-
return (
|
|
13
|
-
<TooltipPrimitive.Provider delay={delay} closeDelay={closeDelay}>
|
|
14
|
-
<TooltipPrimitive.Root data-slot="tooltip" {...props} />
|
|
15
|
-
</TooltipPrimitive.Provider>
|
|
16
|
-
)
|
|
5
|
+
function TooltipProvider({ delay = 100, ...props }: TooltipPrimitive.Provider.Props) {
|
|
6
|
+
return <TooltipPrimitive.Provider data-slot="tooltip-provider" delay={delay} {...props} />
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
function Tooltip({ ...props }: TooltipPrimitive.Root.Props) {
|
|
10
|
+
return <TooltipPrimitive.Root data-slot="tooltip" {...props} />
|
|
17
11
|
}
|
|
18
12
|
|
|
19
13
|
function TooltipTrigger({ ...props }: TooltipPrimitive.Trigger.Props) {
|
|
@@ -26,6 +20,7 @@ function TooltipContent({
|
|
|
26
20
|
sideOffset = 6,
|
|
27
21
|
align = 'center',
|
|
28
22
|
alignOffset = 0,
|
|
23
|
+
children,
|
|
29
24
|
...props
|
|
30
25
|
}: TooltipPrimitive.Popup.Props &
|
|
31
26
|
Pick<TooltipPrimitive.Positioner.Props, 'align' | 'alignOffset' | 'side' | 'sideOffset'>) {
|
|
@@ -41,14 +36,16 @@ function TooltipContent({
|
|
|
41
36
|
<TooltipPrimitive.Popup
|
|
42
37
|
data-slot="tooltip-content"
|
|
43
38
|
className={cn(
|
|
44
|
-
'z-50 origin-(--transform-origin) rounded-sm bg-popover px-2 py-1 text-xs font-medium text-popover-foreground shadow-md
|
|
39
|
+
'z-50 w-fit max-w-xs origin-(--transform-origin) items-center gap-1.5 rounded-sm bg-popover px-2.5 py-1.5 text-xs font-medium text-popover-foreground shadow-md has-data-[slot=kbd]:pr-1.5 data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 **:data-[slot=kbd]:relative **:data-[slot=kbd]:isolate **:data-[slot=kbd]:z-50 **:data-[slot=kbd]:rounded-sm data-[state=delayed-open]:animate-in data-[state=delayed-open]:fade-in-0 data-[state=delayed-open]:zoom-in-95 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95',
|
|
45
40
|
className
|
|
46
41
|
)}
|
|
47
42
|
{...props}
|
|
48
|
-
|
|
43
|
+
>
|
|
44
|
+
{children}
|
|
45
|
+
</TooltipPrimitive.Popup>
|
|
49
46
|
</TooltipPrimitive.Positioner>
|
|
50
47
|
</TooltipPrimitive.Portal>
|
|
51
48
|
)
|
|
52
49
|
}
|
|
53
50
|
|
|
54
|
-
export { Tooltip, TooltipContent, TooltipTrigger }
|
|
51
|
+
export { Tooltip, TooltipContent, TooltipTrigger, TooltipProvider }
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { type RefObject, useRef, useState } from 'react'
|
|
2
2
|
|
|
3
|
+
import { IconFile, IconLoader2, IconPaperclip, IconPlayerStop, IconX } from '@tabler/icons-react'
|
|
4
|
+
|
|
3
5
|
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
} from '
|
|
11
|
-
|
|
12
|
-
import { Composer, ComposerFooter, ComposerTextarea } from '@/client/components/shared/Composer'
|
|
6
|
+
canSubmitComposerAction,
|
|
7
|
+
Composer,
|
|
8
|
+
ComposerFooter,
|
|
9
|
+
ComposerSubmitButton,
|
|
10
|
+
ComposerTextarea
|
|
11
|
+
} from '@/client/components/shared/Composer'
|
|
12
|
+
import { Button } from '@/client/components/ui/button'
|
|
13
13
|
import { cn } from '@/client/lib/cn'
|
|
14
14
|
import { useWorkspaceId } from '@/client/features/workspace/WorkspaceContext'
|
|
15
15
|
import { uploadFiles } from '@/client/features/chat/uploads'
|
|
@@ -21,13 +21,13 @@ import {
|
|
|
21
21
|
} from '@/client/features/chat/chat-store'
|
|
22
22
|
|
|
23
23
|
import { ModelPicker } from './ModelPicker'
|
|
24
|
-
import { Button } from '@/client/components/ui/button'
|
|
25
24
|
|
|
26
25
|
type ChatComposerProps = {
|
|
27
26
|
composerRef: RefObject<HTMLTextAreaElement | null>
|
|
28
27
|
onSend: (text: string) => void
|
|
29
28
|
onStop: () => void
|
|
30
29
|
processing: boolean
|
|
30
|
+
unavailableReason: string | null | undefined
|
|
31
31
|
}
|
|
32
32
|
|
|
33
33
|
// The composer owns the draft: it reads/writes the per-thread draft in the live
|
|
@@ -35,7 +35,13 @@ type ChatComposerProps = {
|
|
|
35
35
|
// panel, message list, or surrounding workspace. The draft is keyed by the
|
|
36
36
|
// active thread, so switching threads swaps the unsent text with you. Attachments
|
|
37
37
|
// (drag/drop, paste, attach button) are tracked the same way and cleared on send.
|
|
38
|
-
export function ChatComposer({
|
|
38
|
+
export function ChatComposer({
|
|
39
|
+
composerRef,
|
|
40
|
+
onSend,
|
|
41
|
+
onStop,
|
|
42
|
+
processing,
|
|
43
|
+
unavailableReason
|
|
44
|
+
}: ChatComposerProps) {
|
|
39
45
|
const fileRef = useRef<HTMLInputElement>(null)
|
|
40
46
|
const workspaceId = useWorkspaceId()
|
|
41
47
|
const sessionId = useLive(s => s.activeByWorkspace[workspaceId] ?? null)
|
|
@@ -45,7 +51,8 @@ export function ChatComposer({ composerRef, onSend, onStop, processing }: ChatCo
|
|
|
45
51
|
|
|
46
52
|
const uploading = attachments.some(a => a.status === 'uploading')
|
|
47
53
|
const hasReady = attachments.some(a => a.status === 'ready')
|
|
48
|
-
const
|
|
54
|
+
const hasContent = value.trim().length > 0 || hasReady
|
|
55
|
+
const canSend = canSubmitComposerAction(hasContent, uploading, unavailableReason)
|
|
49
56
|
|
|
50
57
|
const onChange = (next: string) => liveStore.getState().setDraft(workspaceId, sessionId, next)
|
|
51
58
|
|
|
@@ -176,9 +183,12 @@ export function ChatComposer({ composerRef, onSend, onStop, processing }: ChatCo
|
|
|
176
183
|
<IconPlayerStop stroke={1.5} />
|
|
177
184
|
</Button>
|
|
178
185
|
) : (
|
|
179
|
-
<
|
|
180
|
-
|
|
181
|
-
|
|
186
|
+
<ComposerSubmitButton
|
|
187
|
+
label="Send message"
|
|
188
|
+
hasContent={hasContent}
|
|
189
|
+
busy={uploading}
|
|
190
|
+
unavailableReason={unavailableReason}
|
|
191
|
+
/>
|
|
182
192
|
)}
|
|
183
193
|
</ComposerFooter>
|
|
184
194
|
</Composer>
|
|
@@ -25,6 +25,7 @@ type ChatPanelProps = {
|
|
|
25
25
|
processing: boolean
|
|
26
26
|
error?: string | null
|
|
27
27
|
onDismissError?: () => void
|
|
28
|
+
unavailableReason: string | null | undefined
|
|
28
29
|
send: (text: string) => void
|
|
29
30
|
stop: () => void
|
|
30
31
|
onSwitchThread: (sessionId: string | null) => void
|
|
@@ -48,6 +49,7 @@ export function ChatPanel({
|
|
|
48
49
|
processing,
|
|
49
50
|
error,
|
|
50
51
|
onDismissError,
|
|
52
|
+
unavailableReason,
|
|
51
53
|
send,
|
|
52
54
|
stop,
|
|
53
55
|
onSwitchThread,
|
|
@@ -141,9 +143,9 @@ export function ChatPanel({
|
|
|
141
143
|
)}
|
|
142
144
|
</div>
|
|
143
145
|
|
|
144
|
-
<div className="mx-auto flex w-full
|
|
146
|
+
<div className="mx-auto flex w-full flex-col items-center px-3">
|
|
145
147
|
{error && (
|
|
146
|
-
<div className="mb-2 flex items-start gap-2 rounded-md border border-destructive/30 bg-destructive/10 px-3 py-2 text-xs text-destructive">
|
|
148
|
+
<div className="mb-2 flex w-full max-w-(--chat-max-container) items-start gap-2 rounded-md border border-destructive/30 bg-destructive/10 px-3 py-2 text-xs text-destructive">
|
|
147
149
|
<span className="flex-1 wrap-break-word">{error}</span>
|
|
148
150
|
{onDismissError && (
|
|
149
151
|
<Button
|
|
@@ -164,6 +166,7 @@ export function ChatPanel({
|
|
|
164
166
|
onSend={handleSend}
|
|
165
167
|
onStop={stop}
|
|
166
168
|
processing={processing}
|
|
169
|
+
unavailableReason={unavailableReason}
|
|
167
170
|
/>
|
|
168
171
|
</div>
|
|
169
172
|
</div>
|
|
@@ -10,10 +10,23 @@ const remarkPlugins = [remarkGfm]
|
|
|
10
10
|
const rehypePlugins = [rehypeHighlight]
|
|
11
11
|
|
|
12
12
|
const components = {
|
|
13
|
+
code({ className, children, ...props }: ComponentProps<'code'>) {
|
|
14
|
+
return (
|
|
15
|
+
<code
|
|
16
|
+
className={cn(
|
|
17
|
+
'rounded-[4px] bg-accent px-1 py-0.5 font-mono font-normal before:content-none after:content-none',
|
|
18
|
+
className
|
|
19
|
+
)}
|
|
20
|
+
{...props}
|
|
21
|
+
>
|
|
22
|
+
{children}
|
|
23
|
+
</code>
|
|
24
|
+
)
|
|
25
|
+
},
|
|
13
26
|
pre({ children }: ComponentProps<'pre'>) {
|
|
14
27
|
return (
|
|
15
28
|
<div className="not-prose my-2 rounded-md border border-border bg-muted px-3 py-2.5">
|
|
16
|
-
<pre className="max-h-[300px] overflow-auto font-mono text-xs leading-relaxed whitespace-pre text-foreground">
|
|
29
|
+
<pre className="max-h-[300px] overflow-auto font-mono text-xs leading-relaxed whitespace-pre text-foreground [&>code]:rounded-none [&>code]:bg-transparent [&>code]:p-0">
|
|
17
30
|
{children}
|
|
18
31
|
</pre>
|
|
19
32
|
</div>
|
|
@@ -28,7 +41,12 @@ type MarkdownContentProps = {
|
|
|
28
41
|
|
|
29
42
|
export function MarkdownContent({ size = 'sm', content }: MarkdownContentProps) {
|
|
30
43
|
return (
|
|
31
|
-
<div
|
|
44
|
+
<div
|
|
45
|
+
className={cn(
|
|
46
|
+
'prose max-w-full min-w-0 wrap-anywhere prose-inherit',
|
|
47
|
+
size === 'sm' && 'prose-sm'
|
|
48
|
+
)}
|
|
49
|
+
>
|
|
32
50
|
<ReactMarkdown
|
|
33
51
|
remarkPlugins={remarkPlugins}
|
|
34
52
|
rehypePlugins={rehypePlugins}
|
|
@@ -122,13 +122,15 @@ export const ModelPicker = memo(function ModelPicker({ scope = 'active-chat' }:
|
|
|
122
122
|
<DropdownMenuTrigger
|
|
123
123
|
render={
|
|
124
124
|
<Button variant="ghost">
|
|
125
|
-
<span className="text-foreground">
|
|
125
|
+
<span className="font-normal text-foreground">
|
|
126
126
|
{headline(model.description) || model.displayName}
|
|
127
127
|
</span>
|
|
128
128
|
{currentEffort && (
|
|
129
|
-
<span className="text-muted-foreground">
|
|
129
|
+
<span className="font-normal text-muted-foreground">
|
|
130
|
+
{effortLabel(currentEffort)}
|
|
131
|
+
</span>
|
|
130
132
|
)}
|
|
131
|
-
<IconChevronDown stroke={1.5} />
|
|
133
|
+
<IconChevronDown stroke={1.5} className="text-muted-foreground" />
|
|
132
134
|
</Button>
|
|
133
135
|
}
|
|
134
136
|
/>
|
|
@@ -119,12 +119,12 @@ export const TurnView = memo(function TurnView({ turn, processing = false }: Tur
|
|
|
119
119
|
.join('\n')
|
|
120
120
|
if (!text && fileParts.length === 0) return null
|
|
121
121
|
return (
|
|
122
|
-
<div className="ml-8 flex flex-col items-end gap-1.5">
|
|
122
|
+
<div className="ml-8 flex min-w-0 flex-col items-end gap-1.5">
|
|
123
123
|
{fileParts.map((p, i) => (
|
|
124
124
|
<FilePart key={i} mediaType={p.mediaType} url={p.url} filename={p.filename} />
|
|
125
125
|
))}
|
|
126
126
|
{text && (
|
|
127
|
-
<p className="rounded-md bg-accent px-4 py-2 text-sm leading-normal whitespace-pre-wrap text-accent-foreground">
|
|
127
|
+
<p className="max-w-full min-w-0 rounded-md bg-accent px-4 py-2 text-sm leading-normal wrap-anywhere whitespace-pre-wrap text-accent-foreground">
|
|
128
128
|
{text}
|
|
129
129
|
</p>
|
|
130
130
|
)}
|
|
@@ -8,6 +8,7 @@ import type {
|
|
|
8
8
|
ClientMessage,
|
|
9
9
|
PreviewFrame,
|
|
10
10
|
ScratchOp,
|
|
11
|
+
SessionActivity,
|
|
11
12
|
StreamEvent,
|
|
12
13
|
ThreadConfig,
|
|
13
14
|
ViewState
|
|
@@ -24,17 +25,19 @@ export function reduceChatFrame(data: Record<string, unknown>, context: ChatFram
|
|
|
24
25
|
const store = liveStore.getState()
|
|
25
26
|
|
|
26
27
|
if (data.type === 'status_snapshot') {
|
|
27
|
-
store.
|
|
28
|
-
(data.
|
|
28
|
+
store.reconcileActivity(
|
|
29
|
+
(data.sessions as
|
|
30
|
+
| { workspaceId: string; sessionId: string; activity: SessionActivity }[]
|
|
31
|
+
| undefined) ?? []
|
|
29
32
|
)
|
|
30
33
|
return
|
|
31
34
|
}
|
|
32
35
|
if (data.type === 'status') {
|
|
33
36
|
const workspaceId = data.workspaceId as string
|
|
34
37
|
const sessionId = data.sessionId as string
|
|
35
|
-
const
|
|
36
|
-
store.
|
|
37
|
-
if (
|
|
38
|
+
const activity = data.activity as SessionActivity
|
|
39
|
+
store.setActivity(workspaceId, sessionId, activity)
|
|
40
|
+
if (activity !== 'running') store.clearPreviewsForSession(workspaceId, sessionId)
|
|
38
41
|
return
|
|
39
42
|
}
|
|
40
43
|
if (data.type === 'preview') {
|
|
@@ -111,10 +114,14 @@ export function reduceChatFrame(data: Record<string, unknown>, context: ChatFram
|
|
|
111
114
|
}
|
|
112
115
|
if (kind === 'error' && typeof data.content === 'string') {
|
|
113
116
|
store.setError(workspaceId, sessionId, data.content)
|
|
117
|
+
// Servers only emit `error` terminally, so it also ends the busy state —
|
|
118
|
+
// relying solely on a separate status frame left the spinner stuck when
|
|
119
|
+
// that frame was lost.
|
|
120
|
+
store.setActivity(workspaceId, sessionId, 'idle')
|
|
114
121
|
store.clearPreviewsForSession(workspaceId, sessionId)
|
|
115
122
|
}
|
|
116
123
|
if (kind === 'stopped') {
|
|
117
|
-
store.
|
|
124
|
+
store.setActivity(workspaceId, sessionId, 'idle')
|
|
118
125
|
store.clearPreviewsForSession(workspaceId, sessionId)
|
|
119
126
|
}
|
|
120
127
|
}
|
|
@@ -32,7 +32,7 @@ export function startOptimisticTurn({
|
|
|
32
32
|
}
|
|
33
33
|
})
|
|
34
34
|
)
|
|
35
|
-
liveStore.getState().
|
|
35
|
+
liveStore.getState().setActivity(workspaceId, sessionId, 'running')
|
|
36
36
|
liveStore.getState().setError(workspaceId, sessionId, null)
|
|
37
37
|
return optimisticId
|
|
38
38
|
}
|