moi-computer 0.12.1-next.3 → 0.13.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/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 +4 -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 +1 -1
- package/client/app/routes/workspace-route.tsx +21 -19
- 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-test-utils.tsx +4 -3
- package/client/features/app-settings/api.ts +33 -0
- package/client/features/app-settings/general-settings.tsx +39 -0
- package/client/features/{settings → app-settings}/settings-page.tsx +5 -1
- 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/tool-group/subagent-card.tsx +1 -0
- 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/components/user-avatar.tsx +4 -10
- package/client/features/collab/workspace-users-menu.tsx +1 -1
- package/client/features/connectors/api.ts +12 -4
- package/client/features/connectors/mcp-server-cards.tsx +17 -7
- package/client/features/connectors/read-connectors.ts +35 -0
- package/client/features/demo/demo-dialog.tsx +11 -3
- package/client/features/dev/collab/local-user-settings.tsx +1 -1
- 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/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 +6 -5
- 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 +89 -0
- package/client/features/{settings → workspace/settings}/api.ts +1 -34
- package/client/features/{settings → workspace/settings}/connectors-settings.tsx +31 -10
- package/client/features/workspace/settings/general-settings.tsx +180 -0
- 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/runtime/workspace-events.ts +21 -4
- package/client/runtime/workspace-theme.ts +9 -0
- package/client/tailwind-config.ts +43 -0
- package/dist/chunk-2y59vrxg.js +5 -0
- package/dist/chunk-58dyt9bk.js +2 -0
- package/dist/{chunk-tqd3pkg8.css → chunk-60q353jq.css} +1 -1
- package/dist/chunk-bncc7heg.js +1 -0
- package/dist/{chunk-11cab5dq.css → chunk-cq2r11fg.css} +1 -1
- package/dist/chunk-cqt3s31j.js +546 -0
- package/dist/chunk-dcmks9sm.js +75 -0
- package/dist/chunk-md45evr2.css +1 -0
- package/dist/chunk-n0nab26d.js +1 -0
- package/dist/chunk-nf2wkvf9.js +14 -0
- package/dist/chunk-nmzhgyp9.js +2 -0
- package/dist/chunk-q37knr3m.js +2 -0
- package/dist/chunk-s90m4qkz.js +1 -0
- package/dist/chunk-wjvd4byz.js +2 -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 +75 -64
- 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 +11 -8
- package/server/README.md +27 -25
- package/server/api/harnesses.ts +31 -8
- package/server/api/index.ts +189 -127
- package/server/api/onboarding.ts +46 -0
- package/server/app-config.ts +16 -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 +5 -6
- package/server/harness/claude-code/mcp.ts +17 -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 +22 -10
- package/server/harness/codex/adapter.ts +14 -17
- package/server/harness/codex/client.ts +8 -5
- package/server/harness/codex/connectors.ts +92 -0
- package/server/harness/codex/index.ts +4 -1
- package/server/harness/codex/pagination.ts +8 -5
- 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/codex/transport.ts +13 -6
- 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 +30 -3
- 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 +22 -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 -6
- package/server/workspaces/layout.ts +3 -0
- package/server/workspaces/registry.ts +27 -1
- 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 +167 -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/settings/general-settings.tsx +0 -103
- package/client/features/workspace/setup/workspace-setup-panel.tsx +0 -18
- package/dist/chunk-20ynagd4.js +0 -2
- package/dist/chunk-42tde9a6.js +0 -1
- package/dist/chunk-9w543s0r.js +0 -2
- package/dist/chunk-a5372n61.js +0 -546
- package/dist/chunk-aja9y1vn.js +0 -68
- package/dist/chunk-fvcvrh3d.css +0 -1
- package/dist/chunk-gtfjw3nx.js +0 -1
- package/dist/chunk-j39y2aky.js +0 -14
- package/dist/chunk-pcnahct1.js +0 -5
- package/dist/chunk-pja30km3.js +0 -1
- package/dist/chunk-rm894bc2.js +0 -2
- package/dist/chunk-tevvtfbk.js +0 -10
- package/dist/chunk-tgt9zd0r.js +0 -2
- package/dist/chunk-tv5k5z00.js +0 -1
- package/dist/chunk-zq2ae5dx.js +0 -2
- package/lib/experimental.ts +0 -14
- package/workspace/.claude/skills/moi-workspace/references/DESIGN.md +0 -157
- /package/client/features/{settings → app-settings}/profile-settings.tsx +0 -0
- /package/client/features/{settings → app-settings}/settings-section.tsx +0 -0
- /package/client/features/{settings → app-settings}/users-settings.tsx +0 -0
- /package/client/features/{settings → workspace/settings}/environment-settings.tsx +0 -0
- /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,17 +1,25 @@
|
|
|
1
|
-
import { useQuery } from '@tanstack/react-query'
|
|
1
|
+
import { useQuery, useQueryClient } from '@tanstack/react-query'
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import { readConnectors } from './read-connectors'
|
|
4
4
|
import { workspaceKeys } from '@/client/api/workspace-keys'
|
|
5
5
|
import type { McpServer } from '@/lib/types'
|
|
6
6
|
|
|
7
7
|
export function useWorkspaceMcp(workspaceId: string, enabled: boolean) {
|
|
8
|
+
const queryClient = useQueryClient()
|
|
8
9
|
return useQuery<McpServer[]>({
|
|
9
10
|
queryKey: workspaceKeys.mcp(workspaceId),
|
|
10
|
-
queryFn: (
|
|
11
|
+
queryFn: async ({ signal }) =>
|
|
12
|
+
readConnectors(
|
|
13
|
+
await fetch(`/api/workspaces/${workspaceId}/mcp?stream=true`, { signal }),
|
|
14
|
+
connectors => {
|
|
15
|
+
if (!signal.aborted) queryClient.setQueryData(workspaceKeys.mcp(workspaceId), connectors)
|
|
16
|
+
}
|
|
17
|
+
),
|
|
18
|
+
retry: false,
|
|
11
19
|
enabled,
|
|
12
20
|
staleTime: Infinity,
|
|
13
21
|
gcTime: Infinity,
|
|
14
|
-
refetchOnMount:
|
|
22
|
+
refetchOnMount: 'always',
|
|
15
23
|
refetchOnWindowFocus: false
|
|
16
24
|
})
|
|
17
25
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { useState, type ReactNode } from 'react'
|
|
2
2
|
|
|
3
3
|
import { IconAlertCircleFilled } from '@tabler/icons-react'
|
|
4
4
|
|
|
@@ -15,16 +15,18 @@ function statusLabel(status: McpServer['status']): string {
|
|
|
15
15
|
type McpServerIconProps = {
|
|
16
16
|
name: string
|
|
17
17
|
status: McpServer['status']
|
|
18
|
+
iconUrl?: string
|
|
18
19
|
}
|
|
19
20
|
|
|
20
|
-
function McpServerIcon({ name, status }: McpServerIconProps) {
|
|
21
|
-
const
|
|
21
|
+
function McpServerIcon({ name, status, iconUrl }: McpServerIconProps) {
|
|
22
|
+
const [failedIcon, setFailedIcon] = useState<string>()
|
|
23
|
+
const icon = iconUrl ?? getMcpIcon(name)
|
|
22
24
|
const className = 'size-full rounded-lg ring-2 ring-background'
|
|
23
25
|
|
|
24
26
|
return (
|
|
25
27
|
<span className="relative size-10 shrink-0">
|
|
26
|
-
{icon ? (
|
|
27
|
-
<img src={icon} alt="" className={className} />
|
|
28
|
+
{icon && icon !== failedIcon ? (
|
|
29
|
+
<img src={icon} alt="" className={className} onError={() => setFailedIcon(icon)} />
|
|
28
30
|
) : (
|
|
29
31
|
<span className="flex size-full items-center justify-center rounded-lg bg-muted text-muted-foreground ring-2 ring-background">
|
|
30
32
|
<IconMcp className="size-5" />
|
|
@@ -68,9 +70,17 @@ function McpServerCardLayout({ icon, children }: McpServerCardLayoutProps) {
|
|
|
68
70
|
|
|
69
71
|
export function McpServerCard({ server }: McpServerCardProps) {
|
|
70
72
|
return (
|
|
71
|
-
<McpServerCardLayout
|
|
73
|
+
<McpServerCardLayout
|
|
74
|
+
icon={
|
|
75
|
+
<McpServerIcon
|
|
76
|
+
name={server.displayName ?? server.name}
|
|
77
|
+
status={server.status}
|
|
78
|
+
iconUrl={server.iconUrl}
|
|
79
|
+
/>
|
|
80
|
+
}
|
|
81
|
+
>
|
|
72
82
|
<div className="truncate text-sm font-medium text-foreground">
|
|
73
|
-
{formatMcpServerName(server.name)}
|
|
83
|
+
{server.displayName ?? formatMcpServerName(server.name)}
|
|
74
84
|
</div>
|
|
75
85
|
<span className="text-sm text-muted-foreground">{statusLabel(server.status)}</span>
|
|
76
86
|
</McpServerCardLayout>
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { McpServer } from '@/lib/types'
|
|
2
|
+
|
|
3
|
+
export async function readConnectors(
|
|
4
|
+
response: Response,
|
|
5
|
+
onProgress: (connectors: McpServer[]) => void
|
|
6
|
+
): Promise<McpServer[]> {
|
|
7
|
+
if (!response.ok || !response.body) throw new Error('Could not load connectors')
|
|
8
|
+
const reader = response.body.pipeThrough(new TextDecoderStream()).getReader()
|
|
9
|
+
let buffer = ''
|
|
10
|
+
try {
|
|
11
|
+
while (true) {
|
|
12
|
+
const chunk = await reader.read()
|
|
13
|
+
if (chunk.done) throw new Error('Connector discovery ended before completion')
|
|
14
|
+
buffer += chunk.value
|
|
15
|
+
let newline: number
|
|
16
|
+
while ((newline = buffer.indexOf('\n')) !== -1) {
|
|
17
|
+
const line = buffer.slice(0, newline)
|
|
18
|
+
buffer = buffer.slice(newline + 1)
|
|
19
|
+
if (!line.trim()) continue
|
|
20
|
+
const frame = JSON.parse(line) as {
|
|
21
|
+
connectors?: McpServer[]
|
|
22
|
+
done?: boolean
|
|
23
|
+
error?: string
|
|
24
|
+
}
|
|
25
|
+
if (frame.error) throw new Error(frame.error)
|
|
26
|
+
if (!frame.connectors) continue
|
|
27
|
+
if (frame.done) return frame.connectors
|
|
28
|
+
onProgress(frame.connectors)
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
} finally {
|
|
32
|
+
await reader.cancel().catch(() => {})
|
|
33
|
+
reader.releaseLock()
|
|
34
|
+
}
|
|
35
|
+
}
|
|
@@ -5,6 +5,7 @@ import {
|
|
|
5
5
|
IconArrowUpRight,
|
|
6
6
|
IconBrowserPlus,
|
|
7
7
|
IconMessageChatbot,
|
|
8
|
+
IconUsersGroup,
|
|
8
9
|
IconX
|
|
9
10
|
} from '@tabler/icons-react'
|
|
10
11
|
|
|
@@ -136,16 +137,23 @@ function DemoDialogContent() {
|
|
|
136
137
|
className="mt-0.5 size-8 shrink-0 text-muted-foreground"
|
|
137
138
|
/>
|
|
138
139
|
<span className="text-sm text-foreground">
|
|
139
|
-
Create as many workspaces
|
|
140
|
+
Create without limits building as many workspaces as you want
|
|
140
141
|
</span>
|
|
141
142
|
</li>
|
|
143
|
+
<li className="flex items-center gap-3">
|
|
144
|
+
<IconUsersGroup
|
|
145
|
+
stroke={0.75}
|
|
146
|
+
className="mt-0.5 size-8 shrink-0 text-muted-foreground"
|
|
147
|
+
/>
|
|
148
|
+
<span className="text-sm text-foreground">Share what you've built with anyone</span>
|
|
149
|
+
</li>
|
|
142
150
|
<li className="flex items-center gap-3">
|
|
143
151
|
<IconMessageChatbot
|
|
144
152
|
stroke={0.75}
|
|
145
153
|
className="mt-0.5 size-8 shrink-0 text-muted-foreground"
|
|
146
154
|
/>
|
|
147
155
|
<span className="text-sm text-foreground">
|
|
148
|
-
|
|
156
|
+
Use your{' '}
|
|
149
157
|
<span className="inline-flex items-baseline gap-1">
|
|
150
158
|
<img src={claudeIcon} alt="" className="size-3.5 self-center object-contain" />
|
|
151
159
|
<strong className="font-medium">Claude</strong>
|
|
@@ -155,7 +163,7 @@ function DemoDialogContent() {
|
|
|
155
163
|
<img src={openaiIcon} alt="" className="size-3.5 self-center object-contain" />
|
|
156
164
|
<strong className="font-medium">ChatGPT</strong>
|
|
157
165
|
</span>{' '}
|
|
158
|
-
|
|
166
|
+
subscription and app connectors
|
|
159
167
|
</span>
|
|
160
168
|
</li>
|
|
161
169
|
</ul>
|
|
@@ -65,7 +65,7 @@ function LocalUserEditor({ profile }: LocalUserEditorProps) {
|
|
|
65
65
|
Local user
|
|
66
66
|
</h2>
|
|
67
67
|
<p className="mt-1 text-sm text-muted-foreground">
|
|
68
|
-
Change your
|
|
68
|
+
Change your collaboration color here. Edit your name in Settings.
|
|
69
69
|
</p>
|
|
70
70
|
</header>
|
|
71
71
|
<div className="flex flex-col gap-5">
|
|
@@ -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>
|