moi-computer 0.12.1-next.2 → 0.12.1-next.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bunfig.toml +1 -5
- package/client/api/app-config.ts +1 -2
- package/client/api/app-ui-keys.ts +3 -1
- package/client/api/http.ts +4 -1
- package/client/api/workspace-keys.ts +3 -3
- package/client/app/app-provider.tsx +22 -2
- package/client/app/app-router.tsx +6 -0
- package/client/app/routes/home-route.tsx +14 -0
- package/client/app/routes/onboarding-route.tsx +11 -0
- package/client/app/routes/settings-route.tsx +10 -0
- package/client/app/routes/workspace-route.tsx +21 -19
- package/client/app/shell/sidebar-layout.tsx +34 -53
- package/client/components/shared/screen-shell.tsx +23 -0
- package/client/components/shared/ultrafast-icon.tsx +61 -0
- package/client/components/shared/workspace-icon.tsx +2 -2
- package/client/features/account/account-menu.tsx +96 -0
- package/client/features/account/account-provider.tsx +142 -0
- package/client/features/account/account-test-utils.tsx +294 -0
- package/client/features/account/api.ts +142 -0
- package/client/features/account/identity.ts +23 -0
- package/client/features/app-settings/api.ts +33 -0
- package/client/features/app-settings/general-settings.tsx +39 -0
- package/client/features/app-settings/profile-settings.tsx +95 -0
- package/client/features/app-settings/settings-page.tsx +48 -0
- package/client/features/app-settings/settings-section.tsx +26 -0
- package/client/features/app-settings/users-settings.tsx +195 -0
- package/client/features/chat/applet-chat-intents.ts +4 -20
- package/client/features/chat/chat-send.ts +17 -13
- package/client/features/chat/composer/model-order.ts +8 -4
- package/client/features/chat/composer/model-picker.tsx +88 -34
- package/client/features/chat/composer/use-workspace-composer-state.tsx +11 -3
- package/client/features/chat/composer/use-workspace-skill-updates.ts +1 -1
- package/client/features/chat/connection/chat-frames.ts +3 -15
- package/client/features/chat/messages/chat-empty-state.tsx +1 -4
- package/client/features/chat/messages/fork-history.ts +5 -5
- package/client/features/chat/messages/turn-view.tsx +3 -12
- package/client/features/chat/messages/user-message-bubble.tsx +63 -0
- package/client/features/chat/sessions/api.ts +121 -80
- package/client/features/chat/sessions/browser-tab-state.ts +14 -12
- package/client/features/chat/sessions/chat-selector.tsx +5 -6
- package/client/features/chat/sessions/use-selected-session.ts +172 -257
- package/client/features/chat/use-chat.ts +14 -19
- package/client/features/collab/applet-api.ts +15 -14
- package/client/features/collab/components/cursors.tsx +61 -24
- package/client/features/collab/components/presence-avatars.tsx +25 -12
- package/client/features/collab/components/presence-frame.tsx +20 -24
- package/client/features/collab/components/presence-group.tsx +15 -7
- package/client/features/collab/components/user-avatar-group.tsx +21 -8
- package/client/features/collab/components/user-avatar.tsx +38 -7
- package/client/features/collab/components/user.tsx +31 -12
- package/client/features/collab/users.ts +0 -5
- package/client/features/collab/workspace-users-menu.tsx +4 -4
- package/client/features/demo/demo-dialog.tsx +11 -3
- package/client/features/dev/collab/collab-playground.tsx +7 -7
- package/client/features/dev/collab/local-user-settings.tsx +7 -53
- package/client/features/dev/dev-index-page.tsx +5 -0
- package/client/features/dev/dev-routes.tsx +2 -0
- package/client/features/dev/harness-debug-page.tsx +3 -3
- package/client/features/dev/onboarding-preview-page.tsx +76 -0
- package/client/features/dev/workspace-setup-mocks.ts +16 -14
- package/client/features/dev/workspace-setup-preview.tsx +11 -17
- package/client/features/harness/api.ts +45 -15
- package/client/features/harness/device-login-steps.tsx +9 -3
- package/client/features/harness/harness-login-panel.tsx +228 -0
- package/client/features/harness/harness-presentation.ts +15 -0
- package/client/features/harness/harness-selector.tsx +119 -0
- package/client/features/harness/use-harness-login.ts +77 -0
- package/client/features/home/home-page.tsx +7 -7
- package/client/features/onboarding/agent-setup-step.tsx +57 -0
- package/client/features/onboarding/api.ts +42 -0
- package/client/features/onboarding/onboarding-idea-disk.tsx +129 -0
- package/client/features/onboarding/onboarding-page.tsx +32 -0
- package/client/features/onboarding/onboarding-screen.tsx +20 -0
- package/client/features/onboarding/onboarding-status.tsx +24 -0
- package/client/features/onboarding/workspace-setup-step.tsx +239 -0
- package/client/features/overview/default/registry.tsx +2 -2
- package/client/features/overview/default/views-widget.tsx +6 -5
- package/client/features/overview/overview.tsx +9 -11
- package/client/features/overview/widget-canvas.tsx +1 -1
- package/client/features/overview/workspace-name.tsx +2 -2
- package/client/features/update/update-control.tsx +1 -1
- package/client/features/views/api.ts +69 -16
- package/client/features/views/pending-view-screen.tsx +30 -9
- package/client/features/views/use-view-actions.ts +19 -20
- package/client/features/views/view-presentation.ts +2 -2
- package/client/features/views/view-submission.ts +28 -41
- package/client/features/workspace/add/api.ts +3 -23
- package/client/features/workspace/add/create-workspace-dialog.tsx +11 -7
- package/client/features/workspace/add/import-workspace-dialog.tsx +3 -3
- package/client/features/workspace/add/workspace-agent-options.ts +11 -12
- package/client/features/workspace/add/workspace-agent-selector.tsx +3 -132
- package/client/features/workspace/api.ts +32 -36
- package/client/features/workspace/harness-transition.ts +88 -0
- package/client/features/{settings → workspace/settings}/api.ts +1 -34
- package/client/features/{settings → workspace/settings}/connectors-settings.tsx +3 -3
- package/client/features/{settings → workspace/settings}/environment-settings.tsx +3 -3
- package/client/features/{settings → workspace/settings}/general-settings.tsx +77 -3
- package/client/features/{settings → workspace/settings}/use-env-vars.ts +1 -1
- package/client/features/{settings → workspace/settings}/workspace-icon-picker.tsx +3 -3
- package/client/features/workspace/setup/workspace-login-state.tsx +37 -156
- package/client/features/workspace/setup/workspace-recovery-states.tsx +0 -12
- package/client/features/workspace/setup/workspace-setup.tsx +34 -14
- package/client/features/workspace/setup/workspace-welcome-state.tsx +2 -2
- package/client/features/workspace/use-workspace-navigation.ts +25 -9
- package/client/features/workspace/workspace-content.tsx +11 -8
- package/client/features/workspace/workspace-frame.tsx +2 -1
- package/client/features/workspace/workspace-layout-context.tsx +5 -2
- package/client/features/workspace/workspace-menu.tsx +12 -8
- package/client/features/workspace/workspace-pending-screen.tsx +10 -10
- package/client/features/workspace/workspace-presentation.tsx +5 -13
- package/client/features/workspace/workspace-state.ts +169 -0
- package/client/features/workspace/workspace-tabs.tsx +22 -2
- package/client/index.css +2 -0
- package/client/index.tsx +3 -3
- package/client/lib/flags.ts +1 -1
- package/client/lib/{app-icon-registry.ts → identity-icon-registry.ts} +10 -14
- package/client/lib/user-display-name.ts +6 -0
- package/client/main.tsx +4 -1
- package/client/runtime/workspace-events.ts +21 -4
- package/client/runtime/workspace-theme.ts +9 -0
- package/client/tailwind-config.ts +43 -0
- package/dist/chunk-0mjzg20x.js +2 -0
- package/dist/chunk-2y59vrxg.js +5 -0
- package/dist/chunk-58dyt9bk.js +2 -0
- package/dist/chunk-5aj040e5.css +1 -0
- package/dist/{chunk-tqd3pkg8.css → chunk-60q353jq.css} +1 -1
- package/dist/chunk-71fn6rmj.js +546 -0
- package/dist/chunk-7yg1m8hx.js +2 -0
- package/dist/chunk-825hys3h.js +1 -0
- package/dist/chunk-9bb8m9rx.js +2 -0
- package/dist/{chunk-11cab5dq.css → chunk-cq2r11fg.css} +1 -1
- package/dist/chunk-g0tcwqxc.js +1 -0
- package/dist/chunk-n0nab26d.js +1 -0
- package/dist/chunk-nf2wkvf9.js +14 -0
- package/dist/chunk-v88n1bay.js +74 -0
- package/dist/index.html +1 -1
- package/lib/harness-instructions.ts +1 -1
- package/lib/{app-icons.ts → identity-icons.ts} +6 -7
- package/lib/onboarding.ts +41 -0
- package/lib/speed-mode.ts +5 -0
- package/lib/types.ts +72 -63
- package/lib/view-build-directives.ts +1 -2
- package/lib/workspace-icon.ts +2 -2
- package/lib/workspace-layout.ts +1 -1
- package/lib/workspace-name.ts +15 -12
- package/package.json +9 -8
- package/server/README.md +27 -25
- package/server/api/harnesses.ts +31 -8
- package/server/api/index.ts +164 -131
- package/server/api/onboarding.ts +46 -0
- package/server/app-config.ts +23 -24
- package/server/app-settings.ts +6 -2
- package/server/applets/config.ts +5 -5
- package/server/applets/views.ts +19 -17
- package/server/cli/commands/init.ts +3 -3
- package/server/cli/commands/skill.ts +16 -17
- package/server/cli/commands/start.ts +8 -34
- package/server/cli/server.ts +18 -6
- package/server/collab/config.ts +1 -2
- package/server/collab/manager.ts +4 -1
- package/server/collab/skill/index.ts +1 -1
- package/server/control.ts +3 -3
- package/server/data-dir.ts +1 -1
- package/server/harness/README.md +24 -8
- package/server/harness/acp/session.ts +8 -4
- package/server/harness/auth.ts +14 -17
- package/server/harness/claude-code/NOTES.md +4 -3
- package/server/harness/claude-code/index.ts +2 -0
- package/server/harness/claude-code/models.ts +2 -20
- package/server/harness/claude-code/run-action.ts +123 -0
- package/server/harness/claude-code/session-title.ts +5 -7
- package/server/harness/claude-code/session.ts +24 -16
- package/server/harness/codex/NOTES.md +14 -9
- package/server/harness/codex/adapter.ts +14 -17
- package/server/harness/codex/index.ts +2 -0
- package/server/harness/codex/run-action.ts +93 -0
- package/server/harness/codex/session-title.ts +6 -8
- package/server/harness/codex/session.ts +11 -11
- package/server/harness/command.ts +45 -0
- package/server/harness/executable.ts +5 -0
- package/server/harness/fork.ts +6 -4
- package/server/harness/install.ts +49 -0
- package/server/harness/openclaw/session.ts +1 -2
- package/server/harness/run-action.ts +85 -0
- package/server/harness/session-title.ts +0 -46
- package/server/harness/types.ts +26 -2
- package/server/onboarding/brief.ts +29 -0
- package/server/onboarding/ideas.ts +48 -0
- package/server/onboarding/jobs.ts +291 -0
- package/server/onboarding/prompt.md +49 -0
- package/server/sessions/archive.ts +5 -14
- package/server/sessions/config.ts +17 -16
- package/server/sessions/lifecycle.ts +15 -13
- package/server/sessions/pending-views.ts +79 -108
- package/server/sessions/selected.ts +75 -161
- package/server/sessions/store.ts +40 -113
- package/server/sessions/view-sessions.ts +128 -111
- package/server/skills/locations.ts +82 -0
- package/server/skills/lock.ts +29 -0
- package/server/skills/template.ts +36 -25
- package/server/skills/update.ts +52 -5
- package/server/skills/version.ts +17 -22
- package/server/skills/workspace.ts +121 -0
- package/server/web.ts +23 -8
- package/server/workspace-state/file.ts +177 -0
- package/server/workspace-state/index.ts +162 -0
- package/server/workspace-state/legacy-migration.ts +79 -0
- package/server/workspace-state/lock.ts +42 -0
- package/server/workspace-state/types.ts +16 -0
- package/server/workspaces/change-harness.ts +88 -0
- package/server/workspaces/harness-transition.ts +29 -0
- package/server/workspaces/init.ts +29 -16
- package/server/workspaces/layout.ts +3 -0
- package/server/workspaces/registry.ts +58 -10
- package/{workspace/.claude/skills/moi-workspace → skill}/SKILL.md +7 -5
- package/{workspace/.claude/skills/moi-workspace → skill}/references/COLLAB.md +4 -8
- package/skill/references/DESIGN.md +148 -0
- package/{workspace/.claude/skills/moi-workspace → skill}/references/SCRATCHPAD.md +2 -2
- package/{workspace/.claude/skills/moi-workspace → skill}/references/UI-COMPONENTS.md +3 -0
- package/ui-components/badge.tsx +1 -1
- package/client/accept-hmr-dependencies.ts +0 -22
- package/client/features/workspace/setup/workspace-setup-panel.tsx +0 -18
- package/dist/chunk-00rh9df4.js +0 -2
- package/dist/chunk-4nh7y1hq.css +0 -1
- package/dist/chunk-am4agx6v.js +0 -2
- package/dist/chunk-d7cbm65e.js +0 -2
- package/dist/chunk-hbpdv7vd.js +0 -1
- package/dist/chunk-hmka9rt5.js +0 -2
- package/dist/chunk-hvh9f5h0.js +0 -14
- package/dist/chunk-mjjregkn.js +0 -10
- package/dist/chunk-pcnahct1.js +0 -5
- package/dist/chunk-rt30jbcm.js +0 -1
- package/dist/chunk-vt6zybej.js +0 -2
- package/dist/chunk-wbkwf6cc.js +0 -68
- package/dist/chunk-xjyfyz64.js +0 -1
- package/dist/chunk-y8nbwp21.js +0 -546
- package/dist/chunk-ysfdcew7.js +0 -1
- package/lib/experimental.ts +0 -14
- package/workspace/.claude/skills/moi-workspace/references/DESIGN.md +0 -157
- /package/client/features/{settings → workspace/settings}/icon-picker-options.ts +0 -0
- /package/client/features/{settings → workspace/settings}/settings-layout.tsx +0 -0
- /package/client/features/{settings → workspace/settings}/workspace-settings-dialog.tsx +0 -0
- /package/{workspace/.claude/skills/moi-workspace → skill}/references/INTENTS.md +0 -0
|
@@ -1,15 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { useSyncExternalStore } from 'react'
|
|
2
2
|
|
|
3
|
-
import { IconArrowsShuffle } from '@tabler/icons-react'
|
|
4
|
-
|
|
5
|
-
import { Button } from '@/client/components/ui/button'
|
|
6
|
-
import { Input } from '@/client/components/ui/input'
|
|
7
|
-
import { useAppConfig } from '@/client/api/app-config'
|
|
8
3
|
import { USER_COLORS } from '@/lib/collab/colors'
|
|
9
4
|
import type { UserProfile } from '@/lib/collab/types'
|
|
10
5
|
import { User } from '@/client/features/collab/components/user'
|
|
11
6
|
import { UserAvatar } from '@/client/features/collab/components/user-avatar'
|
|
12
|
-
import { randomLocalUser } from '@/client/features/collab/local-user'
|
|
13
7
|
import {
|
|
14
8
|
getCurrentUser,
|
|
15
9
|
getCurrentUserSource,
|
|
@@ -18,7 +12,6 @@ import {
|
|
|
18
12
|
} from '@/client/features/collab/host-state'
|
|
19
13
|
|
|
20
14
|
export function LocalUserSettings() {
|
|
21
|
-
const { experimental } = useAppConfig()
|
|
22
15
|
const source = useSyncExternalStore(
|
|
23
16
|
subscribeCurrentUserStore,
|
|
24
17
|
getCurrentUserSource,
|
|
@@ -34,14 +27,7 @@ export function LocalUserSettings() {
|
|
|
34
27
|
Local user
|
|
35
28
|
</h2>
|
|
36
29
|
<p className="text-sm text-muted-foreground">
|
|
37
|
-
|
|
38
|
-
'Couldn’t resolve your user identity. Reload Moi to try again.'
|
|
39
|
-
) : (
|
|
40
|
-
<>
|
|
41
|
-
Start Moi with <code className="font-mono">--experimental-collab</code> to create a
|
|
42
|
-
local user automatically. The playground below uses its own sample users.
|
|
43
|
-
</>
|
|
44
|
-
)}
|
|
30
|
+
Couldn’t resolve your user identity. Reload Moi to try again.
|
|
45
31
|
</p>
|
|
46
32
|
</section>
|
|
47
33
|
)
|
|
@@ -64,7 +50,7 @@ function AccessUser({ profile }: AccessUserProps) {
|
|
|
64
50
|
: 'This server uses Cloudflare Access, but this page wasn’t opened through it. Open Moi at its Cloudflare Access address to appear in workspaces.'}
|
|
65
51
|
</p>
|
|
66
52
|
</header>
|
|
67
|
-
{profile && <User
|
|
53
|
+
{profile && <User profile={profile} />}
|
|
68
54
|
</section>
|
|
69
55
|
)
|
|
70
56
|
}
|
|
@@ -72,9 +58,6 @@ function AccessUser({ profile }: AccessUserProps) {
|
|
|
72
58
|
type LocalUserEditorProps = { profile: UserProfile }
|
|
73
59
|
|
|
74
60
|
function LocalUserEditor({ profile }: LocalUserEditorProps) {
|
|
75
|
-
// Keep raw input so normalization doesn't eat spaces while a name is being typed.
|
|
76
|
-
const [name, setName] = useState(profile.name ?? '')
|
|
77
|
-
|
|
78
61
|
return (
|
|
79
62
|
<section aria-labelledby="local-user-title" className="flex flex-col gap-5">
|
|
80
63
|
<header>
|
|
@@ -82,8 +65,7 @@ function LocalUserEditor({ profile }: LocalUserEditorProps) {
|
|
|
82
65
|
Local user
|
|
83
66
|
</h2>
|
|
84
67
|
<p className="mt-1 text-sm text-muted-foreground">
|
|
85
|
-
|
|
86
|
-
users, open Moi in another browser tab.
|
|
68
|
+
Change your avatar color here. Edit your name in Settings.
|
|
87
69
|
</p>
|
|
88
70
|
</header>
|
|
89
71
|
<div className="flex flex-col gap-5">
|
|
@@ -94,23 +76,9 @@ function LocalUserEditor({ profile }: LocalUserEditorProps) {
|
|
|
94
76
|
aria-label="Local user preview"
|
|
95
77
|
className="size-16 shrink-0 overflow-hidden rounded-full"
|
|
96
78
|
>
|
|
97
|
-
<UserAvatar
|
|
79
|
+
<UserAvatar profile={profile} className="data-[size=default]:size-full" />
|
|
98
80
|
</div>
|
|
99
81
|
<div className="flex w-full max-w-sm min-w-0 flex-col gap-4">
|
|
100
|
-
<label className="flex flex-col gap-1.5 text-sm">
|
|
101
|
-
Name (optional)
|
|
102
|
-
<Input
|
|
103
|
-
value={name}
|
|
104
|
-
maxLength={80}
|
|
105
|
-
placeholder="Type a name"
|
|
106
|
-
autoComplete="off"
|
|
107
|
-
spellCheck={false}
|
|
108
|
-
onChange={event => {
|
|
109
|
-
setName(event.target.value)
|
|
110
|
-
setLocalUser({ ...profile, name: event.target.value })
|
|
111
|
-
}}
|
|
112
|
-
/>
|
|
113
|
-
</label>
|
|
114
82
|
<div className="flex flex-col gap-1.5 text-sm">
|
|
115
83
|
<span id="collab-color-label">Color</span>
|
|
116
84
|
<div
|
|
@@ -140,25 +108,11 @@ function LocalUserEditor({ profile }: LocalUserEditorProps) {
|
|
|
140
108
|
))}
|
|
141
109
|
</div>
|
|
142
110
|
</div>
|
|
143
|
-
<div className="flex flex-wrap gap-2">
|
|
144
|
-
<Button
|
|
145
|
-
type="button"
|
|
146
|
-
variant="secondary"
|
|
147
|
-
size="sm"
|
|
148
|
-
onClick={() => {
|
|
149
|
-
const next = randomLocalUser({ name, color: profile.color })
|
|
150
|
-
setName(next.name)
|
|
151
|
-
setLocalUser({ ...profile, ...next })
|
|
152
|
-
}}
|
|
153
|
-
>
|
|
154
|
-
<IconArrowsShuffle stroke={1.75} />
|
|
155
|
-
Randomize
|
|
156
|
-
</Button>
|
|
157
|
-
</div>
|
|
158
111
|
</div>
|
|
159
112
|
</div>
|
|
160
113
|
<p className="text-sm text-muted-foreground">
|
|
161
|
-
Your user is saved in this browser
|
|
114
|
+
Your user is saved in this browser and shared across tabs. The playground below uses its
|
|
115
|
+
own sample users.
|
|
162
116
|
</p>
|
|
163
117
|
</div>
|
|
164
118
|
</section>
|
|
@@ -7,6 +7,11 @@ type DevRouteEntry = {
|
|
|
7
7
|
}
|
|
8
8
|
|
|
9
9
|
const DEV_ROUTES: DevRouteEntry[] = [
|
|
10
|
+
{
|
|
11
|
+
path: '/dev/onboarding',
|
|
12
|
+
title: 'Onboarding ideas',
|
|
13
|
+
description: 'Polish the real idea cards with fixed mock data and inactive build actions.'
|
|
14
|
+
},
|
|
10
15
|
{
|
|
11
16
|
path: '/dev/workspace-setup',
|
|
12
17
|
title: 'Workspace setup',
|
|
@@ -9,6 +9,7 @@ import { HarnessDebugPage } from './harness-debug-page'
|
|
|
9
9
|
import { TextureLabPage } from './texture-lab-page'
|
|
10
10
|
import { ToolCallsPage } from './tool-calls-page'
|
|
11
11
|
import { UiComponentsPage } from './ui-components/ui-components-page'
|
|
12
|
+
import { OnboardingPreviewPage } from './onboarding-preview-page'
|
|
12
13
|
|
|
13
14
|
// All /dev/* routes live with their pages here and load only in development;
|
|
14
15
|
// see the dynamic import in AppRouter. /dev itself is the index; list new
|
|
@@ -20,6 +21,7 @@ const CollabPage = lazy(() =>
|
|
|
20
21
|
export default function DevRoutes() {
|
|
21
22
|
return (
|
|
22
23
|
<Switch>
|
|
24
|
+
<Route path="/dev/onboarding" component={OnboardingPreviewPage} />
|
|
23
25
|
<Route path="/dev/collab-kit">
|
|
24
26
|
<Redirect to="/dev/collab" />
|
|
25
27
|
</Route>
|
|
@@ -7,7 +7,7 @@ import { Button } from '@/client/components/ui/button'
|
|
|
7
7
|
import { cn } from '@/client/lib/cn'
|
|
8
8
|
import { useLatestRef } from '@/client/lib/use-latest-ref'
|
|
9
9
|
import { wsUrl } from '@/client/lib/ws-url'
|
|
10
|
-
import type { Model,
|
|
10
|
+
import type { Model, WorkspaceHarness, WorkspaceEntry } from '@/lib/types'
|
|
11
11
|
|
|
12
12
|
// Scratch route for driving any harness end to end: pick a workspace, fire
|
|
13
13
|
// canned scenarios (or your own prompt), and watch three synchronized logs —
|
|
@@ -236,9 +236,9 @@ export function HarnessDebugPage() {
|
|
|
236
236
|
// Model list for the selected workspace.
|
|
237
237
|
useEffect(() => {
|
|
238
238
|
if (!workspaceId) return
|
|
239
|
-
fetch(`/api/workspaces/${workspaceId}/
|
|
239
|
+
fetch(`/api/workspaces/${workspaceId}/harness`)
|
|
240
240
|
.then(r => r.json())
|
|
241
|
-
.then((m:
|
|
241
|
+
.then((m: WorkspaceHarness) => setModels(m.models))
|
|
242
242
|
.catch(() => setModels([]))
|
|
243
243
|
}, [workspaceId])
|
|
244
244
|
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { useState } from 'react'
|
|
2
|
+
import { ScreenShell } from '@/client/components/shared/screen-shell'
|
|
3
|
+
import { Button } from '@/client/components/ui/button'
|
|
4
|
+
import { IdeaOptions } from '@/client/features/onboarding/workspace-setup-step'
|
|
5
|
+
import type { OnboardingIdea, OnboardingViewPlan } from '@/lib/onboarding'
|
|
6
|
+
|
|
7
|
+
// Fixed preview data. These actions never call discovery or create a workspace.
|
|
8
|
+
function view(name: string, icon: OnboardingViewPlan['icon']): OnboardingViewPlan {
|
|
9
|
+
return { name, icon, description: name, features: [name] }
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
const ideas: OnboardingIdea[] = [
|
|
13
|
+
{
|
|
14
|
+
id: 'review-desk',
|
|
15
|
+
name: 'Moi review desk',
|
|
16
|
+
icon: 'palette',
|
|
17
|
+
theme: { font: 'geometric', color: 'mint' },
|
|
18
|
+
description:
|
|
19
|
+
'Keep Moi’s product reviews, visual checks, and design decisions together. A focused place to turn ongoing development into clear next steps.',
|
|
20
|
+
views: [
|
|
21
|
+
view('Review queue', 'code'),
|
|
22
|
+
view('Visual checks', 'photo'),
|
|
23
|
+
view('Design decisions', 'bulb')
|
|
24
|
+
],
|
|
25
|
+
widgets: []
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
id: 'tool-notebook',
|
|
29
|
+
name: 'Agent tool notebook',
|
|
30
|
+
icon: 'flask',
|
|
31
|
+
theme: { font: 'mono', color: 'lavender' },
|
|
32
|
+
description:
|
|
33
|
+
'Keep tool invites, hands-on trials, and useful product ideas in one place. Fits your ongoing exploration of agent software and personal computing.',
|
|
34
|
+
views: [
|
|
35
|
+
view('Access tracker', 'key'),
|
|
36
|
+
view('Trial bench', 'flask'),
|
|
37
|
+
view('Useful patterns', 'brain')
|
|
38
|
+
],
|
|
39
|
+
widgets: []
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
id: 'berlin-plans',
|
|
43
|
+
name: 'Berlin plans',
|
|
44
|
+
icon: 'compass',
|
|
45
|
+
theme: { font: 'rounded', color: 'sand' },
|
|
46
|
+
description:
|
|
47
|
+
'Turn Berlin guides and cinema emails into a short list of places and plans. Keep booked outings handy and save interesting finds for later.',
|
|
48
|
+
views: [
|
|
49
|
+
view('Saved places', 'map'),
|
|
50
|
+
view('Outing planner', 'calendar'),
|
|
51
|
+
view('Tickets', 'file')
|
|
52
|
+
],
|
|
53
|
+
widgets: []
|
|
54
|
+
}
|
|
55
|
+
]
|
|
56
|
+
|
|
57
|
+
export function OnboardingPreviewPage() {
|
|
58
|
+
const [selectedIdeaId, setSelectedIdeaId] = useState<string>()
|
|
59
|
+
return (
|
|
60
|
+
<main className="flex h-dvh flex-col overflow-hidden">
|
|
61
|
+
<ScreenShell>
|
|
62
|
+
<IdeaOptions
|
|
63
|
+
ideas={ideas}
|
|
64
|
+
selectedIdeaId={selectedIdeaId}
|
|
65
|
+
onSelect={setSelectedIdeaId}
|
|
66
|
+
feedback={null}
|
|
67
|
+
footer={
|
|
68
|
+
<Button size="lg" variant="ghost" onClick={() => setSelectedIdeaId(undefined)}>
|
|
69
|
+
{selectedIdeaId ? 'Reset preview' : 'Skip onboarding'}
|
|
70
|
+
</Button>
|
|
71
|
+
}
|
|
72
|
+
/>
|
|
73
|
+
</ScreenShell>
|
|
74
|
+
</main>
|
|
75
|
+
)
|
|
76
|
+
}
|
|
@@ -2,20 +2,14 @@ import type {
|
|
|
2
2
|
AppEnvironment,
|
|
3
3
|
HarnessAvailability,
|
|
4
4
|
HarnessLoginState,
|
|
5
|
-
|
|
5
|
+
WorkspaceHarness
|
|
6
6
|
} from '@/lib/types'
|
|
7
7
|
import type { LoginHarness } from '@/client/features/harness/api'
|
|
8
8
|
|
|
9
9
|
export const PREVIEW_WORKSPACE_ID = 'setup-preview'
|
|
10
10
|
export const MOCK_CODE_SIGN_IN_URL = 'https://example.invalid/moi-code-sign-in'
|
|
11
11
|
export const MOCK_SIGN_IN_URL = 'https://example.invalid/moi-sign-in'
|
|
12
|
-
export const SETUP_SCENARIOS = [
|
|
13
|
-
'welcome',
|
|
14
|
-
'login',
|
|
15
|
-
'missing-agent',
|
|
16
|
-
'missing-folder',
|
|
17
|
-
'loading'
|
|
18
|
-
] as const
|
|
12
|
+
export const SETUP_SCENARIOS = ['welcome', 'install', 'login', 'missing-folder', 'loading'] as const
|
|
19
13
|
export type SetupScenario = (typeof SETUP_SCENARIOS)[number]
|
|
20
14
|
|
|
21
15
|
export function createSetupMocks(
|
|
@@ -24,7 +18,7 @@ export function createSetupMocks(
|
|
|
24
18
|
scenario: SetupScenario
|
|
25
19
|
) {
|
|
26
20
|
let availability: HarnessAvailability =
|
|
27
|
-
scenario === '
|
|
21
|
+
scenario === 'install'
|
|
28
22
|
? {
|
|
29
23
|
status: 'unavailable',
|
|
30
24
|
code: 'not-installed',
|
|
@@ -52,24 +46,32 @@ export function createSetupMocks(
|
|
|
52
46
|
return Response.json({
|
|
53
47
|
environment,
|
|
54
48
|
demo: false,
|
|
55
|
-
|
|
49
|
+
collab: false,
|
|
56
50
|
demoInstallUrl: ''
|
|
57
51
|
})
|
|
58
52
|
}
|
|
59
53
|
if (path === `/api/workspaces/${PREVIEW_WORKSPACE_ID}` && method === 'DELETE')
|
|
60
54
|
return new Response(null, { status: 204 })
|
|
61
|
-
if (path === `/api/workspaces/${PREVIEW_WORKSPACE_ID}/
|
|
55
|
+
if (path === `/api/workspaces/${PREVIEW_WORKSPACE_ID}/harness` && method === 'GET') {
|
|
62
56
|
return Response.json({
|
|
63
57
|
provider: harness,
|
|
64
58
|
availability,
|
|
65
59
|
models: [],
|
|
66
60
|
supportsStreaming: true,
|
|
67
61
|
supportsArchiving: true,
|
|
68
|
-
|
|
69
|
-
} satisfies
|
|
62
|
+
isFolderMissing: missingFolder
|
|
63
|
+
} satisfies WorkspaceHarness)
|
|
70
64
|
}
|
|
71
65
|
const authPath = `/api/harnesses/${harness}/auth`
|
|
72
|
-
if (path ===
|
|
66
|
+
if (path === '/api/harnesses/status' && method === 'GET')
|
|
67
|
+
return Response.json({ [harness]: { availability, login } })
|
|
68
|
+
if (path === `${authPath}/install` && method === 'POST') {
|
|
69
|
+
if (environment !== 'local')
|
|
70
|
+
return new Response('Installation is local only', { status: 400 })
|
|
71
|
+
await new Promise(resolve => setTimeout(resolve, 2000))
|
|
72
|
+
availability = { status: 'login-required', reason: 'Log in to continue' }
|
|
73
|
+
return Response.json({ ok: true })
|
|
74
|
+
}
|
|
73
75
|
if (path === `${authPath}/login` && method === 'POST') {
|
|
74
76
|
login = { state: 'starting' }
|
|
75
77
|
await new Promise(resolve => setTimeout(resolve, 500))
|
|
@@ -23,7 +23,7 @@ import { WorkspaceWelcomeState } from '@/client/features/workspace/setup/workspa
|
|
|
23
23
|
import { WorkspaceLoadingState } from '@/client/features/workspace/setup/workspace-recovery-states'
|
|
24
24
|
import type { AppEnvironment } from '@/lib/types'
|
|
25
25
|
import { workspaceTypeLabel } from '@/client/features/workspace/workspace-presentation'
|
|
26
|
-
import {
|
|
26
|
+
import { useHarnessStatus, type LoginHarness } from '@/client/features/harness/api'
|
|
27
27
|
import {
|
|
28
28
|
createSetupMocks,
|
|
29
29
|
MOCK_SIGN_IN_URL,
|
|
@@ -35,8 +35,8 @@ import type { SetupScenario } from './workspace-setup-mocks'
|
|
|
35
35
|
|
|
36
36
|
const scenarioLabels: Record<SetupScenario, string> = {
|
|
37
37
|
welcome: 'Welcome',
|
|
38
|
-
login: '
|
|
39
|
-
|
|
38
|
+
login: 'Log in',
|
|
39
|
+
install: 'Install',
|
|
40
40
|
'missing-folder': 'Folder missing',
|
|
41
41
|
loading: 'Loading'
|
|
42
42
|
}
|
|
@@ -53,7 +53,7 @@ function SetupPreview({ mocks, client, environment, harness, scenario }: SetupPr
|
|
|
53
53
|
const [provider, setProvider] = useState<'browser' | 'code' | 'closed'>()
|
|
54
54
|
const [deviceCode, setDeviceCode] = useState('')
|
|
55
55
|
const [layout, setLayout] = useState(createDefaultWorkspaceLayout)
|
|
56
|
-
const auth =
|
|
56
|
+
const auth = useHarnessStatus(harness)
|
|
57
57
|
const pendingId = auth.data?.login?.state === 'pending' ? auth.data.login.id : undefined
|
|
58
58
|
// Both local harnesses open the browser automatically.
|
|
59
59
|
const providerPage = provider ?? (environment === 'local' && pendingId ? 'browser' : 'closed')
|
|
@@ -85,7 +85,12 @@ function SetupPreview({ mocks, client, environment, harness, scenario }: SetupPr
|
|
|
85
85
|
key={value}
|
|
86
86
|
size="sm"
|
|
87
87
|
variant={environment === value ? 'default' : 'secondary'}
|
|
88
|
-
onClick={() =>
|
|
88
|
+
onClick={() =>
|
|
89
|
+
restart({
|
|
90
|
+
environment: value,
|
|
91
|
+
scenario: value === 'cloud' && scenario === 'install' ? 'login' : scenario
|
|
92
|
+
})
|
|
93
|
+
}
|
|
89
94
|
>
|
|
90
95
|
{value === 'local' ? 'Local' : 'Cloud'}
|
|
91
96
|
</Button>
|
|
@@ -109,24 +114,13 @@ function SetupPreview({ mocks, client, environment, harness, scenario }: SetupPr
|
|
|
109
114
|
key={value}
|
|
110
115
|
size="sm"
|
|
111
116
|
variant={scenario === value ? 'default' : 'secondary'}
|
|
117
|
+
disabled={value === 'install' && environment === 'cloud'}
|
|
112
118
|
onClick={() => restart({ scenario: value })}
|
|
113
119
|
>
|
|
114
120
|
{scenarioLabels[value]}
|
|
115
121
|
</Button>
|
|
116
122
|
))}
|
|
117
123
|
</div>
|
|
118
|
-
<div className="flex flex-wrap gap-2" role="group" aria-label="Layout">
|
|
119
|
-
{(['split', 'fullscreen'] as const).map(layoutMode => (
|
|
120
|
-
<Button
|
|
121
|
-
key={layoutMode}
|
|
122
|
-
size="sm"
|
|
123
|
-
variant={layout.layoutMode === layoutMode ? 'default' : 'secondary'}
|
|
124
|
-
onClick={() => setLayout(current => ({ ...current, layoutMode }))}
|
|
125
|
-
>
|
|
126
|
-
{layoutMode === 'split' ? 'Split' : 'Fullscreen'}
|
|
127
|
-
</Button>
|
|
128
|
-
))}
|
|
129
|
-
</div>
|
|
130
124
|
</header>
|
|
131
125
|
<WorkspaceLayoutContext
|
|
132
126
|
value={{
|
|
@@ -1,11 +1,6 @@
|
|
|
1
|
-
import { useQuery } from '@tanstack/react-query'
|
|
1
|
+
import { queryOptions, useMutation, useQuery, useQueryClient } from '@tanstack/react-query'
|
|
2
2
|
import { jsonRequest, requestJson, requestVoid } from '@/client/api/http'
|
|
3
|
-
import type {
|
|
4
|
-
HarnessAvailability,
|
|
5
|
-
HarnessLogin,
|
|
6
|
-
HarnessLoginState,
|
|
7
|
-
WorkspaceType
|
|
8
|
-
} from '@/lib/types'
|
|
3
|
+
import type { HarnessStatuses, HarnessLogin, WorkspaceType } from '@/lib/types'
|
|
9
4
|
|
|
10
5
|
export function startHarnessLogin(type: WorkspaceType): Promise<HarnessLogin> {
|
|
11
6
|
return requestJson(
|
|
@@ -17,20 +12,55 @@ export function startHarnessLogin(type: WorkspaceType): Promise<HarnessLogin> {
|
|
|
17
12
|
|
|
18
13
|
export type LoginHarness = 'claude-code' | 'codex'
|
|
19
14
|
|
|
20
|
-
export type
|
|
21
|
-
|
|
22
|
-
|
|
15
|
+
export type { HarnessStatus } from '@/lib/types'
|
|
16
|
+
|
|
17
|
+
const harnessStatusOptions = queryOptions({
|
|
18
|
+
queryKey: ['harness-status'],
|
|
19
|
+
queryFn: ({ signal }) => requestJson<HarnessStatuses>('/api/harnesses/status', { signal }),
|
|
20
|
+
staleTime: Infinity,
|
|
21
|
+
gcTime: Infinity,
|
|
22
|
+
refetchOnWindowFocus: 'always',
|
|
23
|
+
refetchInterval: query =>
|
|
24
|
+
Object.values(query.state.data ?? {}).some(
|
|
25
|
+
status => status.login?.state === 'starting' || status.login?.state === 'pending'
|
|
26
|
+
)
|
|
27
|
+
? 2_000
|
|
28
|
+
: false
|
|
29
|
+
})
|
|
30
|
+
|
|
31
|
+
// Only user-requested retries bypass the server's availability cache.
|
|
32
|
+
export function useRetryHarnessStatus() {
|
|
33
|
+
const client = useQueryClient()
|
|
34
|
+
return useMutation({
|
|
35
|
+
mutationFn: () => requestJson<HarnessStatuses>('/api/harnesses/status?refresh=true'),
|
|
36
|
+
onMutate: async () => {
|
|
37
|
+
await client.cancelQueries({ queryKey: harnessStatusOptions.queryKey })
|
|
38
|
+
return client.getQueryData(harnessStatusOptions.queryKey)
|
|
39
|
+
},
|
|
40
|
+
onSuccess: (statuses, _variables, previous) => {
|
|
41
|
+
// An auth event received during the retry is newer than this response.
|
|
42
|
+
if (client.getQueryData(harnessStatusOptions.queryKey) === previous)
|
|
43
|
+
client.setQueryData(harnessStatusOptions.queryKey, statuses)
|
|
44
|
+
}
|
|
45
|
+
})
|
|
23
46
|
}
|
|
24
47
|
|
|
25
|
-
export function
|
|
48
|
+
export function useHarnessStatuses() {
|
|
49
|
+
return useQuery(harnessStatusOptions)
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export function useHarnessStatus(type: WorkspaceType | undefined) {
|
|
26
53
|
return useQuery({
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
refetchInterval: 2_000
|
|
54
|
+
...harnessStatusOptions,
|
|
55
|
+
enabled: type === 'claude-code' || type === 'codex',
|
|
56
|
+
select: statuses => (type ? statuses[type] : undefined)
|
|
31
57
|
})
|
|
32
58
|
}
|
|
33
59
|
|
|
34
60
|
export function submitHarnessLoginCode(type: WorkspaceType, id: string, code: string) {
|
|
35
61
|
return requestVoid(`/api/harnesses/${type}/auth/login/${id}/code`, jsonRequest('POST', { code }))
|
|
36
62
|
}
|
|
63
|
+
|
|
64
|
+
export function installHarness(type: LoginHarness) {
|
|
65
|
+
return requestVoid(`/api/harnesses/${type}/auth/install`, { method: 'POST' })
|
|
66
|
+
}
|
|
@@ -15,9 +15,10 @@ import { cn } from '@/client/lib/cn'
|
|
|
15
15
|
type DeviceLoginStepsProps = {
|
|
16
16
|
code: string
|
|
17
17
|
url: string
|
|
18
|
+
className?: string
|
|
18
19
|
}
|
|
19
20
|
|
|
20
|
-
export function DeviceLoginSteps({ code, url }: DeviceLoginStepsProps) {
|
|
21
|
+
export function DeviceLoginSteps({ code, url, className }: DeviceLoginStepsProps) {
|
|
21
22
|
const [copied, setCopied] = useState(false)
|
|
22
23
|
|
|
23
24
|
useEffect(() => {
|
|
@@ -34,7 +35,12 @@ export function DeviceLoginSteps({ code, url }: DeviceLoginStepsProps) {
|
|
|
34
35
|
}
|
|
35
36
|
|
|
36
37
|
return (
|
|
37
|
-
<ol
|
|
38
|
+
<ol
|
|
39
|
+
className={cn(
|
|
40
|
+
'mx-auto grid w-full max-w-64 gap-6 text-left text-sm lg:max-w-3xl lg:grid-cols-3 lg:text-center',
|
|
41
|
+
className
|
|
42
|
+
)}
|
|
43
|
+
>
|
|
38
44
|
<li className="flex flex-col items-start gap-3 lg:items-center">
|
|
39
45
|
<IconCircleNumber1 size={24} stroke={1.5} className="shrink-0" />
|
|
40
46
|
<div className="flex min-w-0 flex-col items-start gap-3 lg:items-center">
|
|
@@ -86,7 +92,7 @@ export function DeviceLoginSteps({ code, url }: DeviceLoginStepsProps) {
|
|
|
86
92
|
<li className="flex flex-col items-start gap-3 lg:items-center">
|
|
87
93
|
<IconCircleNumber3 size={24} stroke={1.5} className="shrink-0" />
|
|
88
94
|
<div className="flex min-w-0 flex-col items-start gap-3 lg:items-center">
|
|
89
|
-
<p>
|
|
95
|
+
<p>Log in to ChatGPT, paste the code, then come back to Moi</p>
|
|
90
96
|
<a href={url} target="_blank" rel="noopener noreferrer" className={buttonVariants()}>
|
|
91
97
|
Open ChatGPT
|
|
92
98
|
</a>
|