moi-computer 0.12.1-next.3 → 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 +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/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/workspace-users-menu.tsx +1 -1
- package/client/features/demo/demo-dialog.tsx +11 -3
- 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 +88 -0
- package/client/features/{settings → workspace/settings}/api.ts +1 -34
- package/client/features/{settings → workspace/settings}/general-settings.tsx +76 -2
- 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-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 +71 -62
- 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 +163 -126
- 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 +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 +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 +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-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}/connectors-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
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import { IconCircleCheckFilled } from '@tabler/icons-react'
|
|
2
|
+
import { Tooltip, TooltipContent, TooltipTrigger } from '@/client/components/ui/tooltip'
|
|
3
|
+
import { cn } from '@/client/lib/cn'
|
|
4
|
+
import type { WorkspaceType } from '@/lib/types'
|
|
5
|
+
import { harnessLabel, harnessIcon } from './harness-presentation'
|
|
6
|
+
|
|
7
|
+
export type HarnessOption = {
|
|
8
|
+
type: WorkspaceType
|
|
9
|
+
description: string
|
|
10
|
+
disabled: boolean
|
|
11
|
+
disabledReason?: string
|
|
12
|
+
disabledCommand?: string
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
type HarnessSelectorProps = {
|
|
16
|
+
mode?: 'select' | 'action'
|
|
17
|
+
cardClassName?: string
|
|
18
|
+
disabled: boolean
|
|
19
|
+
options: HarnessOption[]
|
|
20
|
+
selectedType?: WorkspaceType
|
|
21
|
+
onTypeChange: (type: WorkspaceType) => void
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export function HarnessSelector({
|
|
25
|
+
mode = 'select',
|
|
26
|
+
cardClassName,
|
|
27
|
+
disabled,
|
|
28
|
+
options,
|
|
29
|
+
selectedType,
|
|
30
|
+
onTypeChange
|
|
31
|
+
}: HarnessSelectorProps) {
|
|
32
|
+
return (
|
|
33
|
+
<fieldset
|
|
34
|
+
disabled={disabled}
|
|
35
|
+
aria-label="Agent"
|
|
36
|
+
className="flex min-w-0 flex-wrap justify-center gap-2"
|
|
37
|
+
>
|
|
38
|
+
{options.map(option => (
|
|
39
|
+
<HarnessOptionButton
|
|
40
|
+
key={option.type}
|
|
41
|
+
option={option}
|
|
42
|
+
className={cardClassName}
|
|
43
|
+
selected={mode === 'select' ? selectedType === option.type : undefined}
|
|
44
|
+
onSelect={onTypeChange}
|
|
45
|
+
/>
|
|
46
|
+
))}
|
|
47
|
+
</fieldset>
|
|
48
|
+
)
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
type HarnessOptionButtonProps = {
|
|
52
|
+
className?: string
|
|
53
|
+
option: HarnessOption
|
|
54
|
+
selected?: boolean
|
|
55
|
+
onSelect: (type: WorkspaceType) => void
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
function HarnessOptionButton({ option, selected, onSelect, className }: HarnessOptionButtonProps) {
|
|
59
|
+
const showDisabledTooltip = Boolean(option.disabledReason)
|
|
60
|
+
const button = (
|
|
61
|
+
<button
|
|
62
|
+
type="button"
|
|
63
|
+
disabled={option.disabled && !showDisabledTooltip}
|
|
64
|
+
aria-disabled={option.disabled || undefined}
|
|
65
|
+
aria-pressed={selected}
|
|
66
|
+
onClick={event => {
|
|
67
|
+
if (option.disabled) {
|
|
68
|
+
event.preventDefault()
|
|
69
|
+
return
|
|
70
|
+
}
|
|
71
|
+
onSelect(option.type)
|
|
72
|
+
}}
|
|
73
|
+
className={cn(
|
|
74
|
+
'relative flex h-32 min-w-32 flex-1 flex-col items-start justify-between gap-6 rounded-xl bg-card p-4 text-left ring-1 ring-border transition-opacity outline-none focus-visible:ring-3 focus-visible:ring-ring/50',
|
|
75
|
+
(selected === false || option.disabled) && 'opacity-70',
|
|
76
|
+
!selected && !option.disabled && 'cursor-pointer hover:opacity-100',
|
|
77
|
+
option.disabled && 'cursor-not-allowed',
|
|
78
|
+
className
|
|
79
|
+
)}
|
|
80
|
+
>
|
|
81
|
+
<span className="relative inline-flex">
|
|
82
|
+
<img src={harnessIcon[option.type]} alt="" className="size-8 shrink-0" />
|
|
83
|
+
{selected && (
|
|
84
|
+
<IconCircleCheckFilled
|
|
85
|
+
size={16}
|
|
86
|
+
stroke={1.75}
|
|
87
|
+
aria-hidden="true"
|
|
88
|
+
className="absolute -top-1.5 -right-1.5"
|
|
89
|
+
/>
|
|
90
|
+
)}
|
|
91
|
+
</span>
|
|
92
|
+
<span className="flex min-w-0 flex-col gap-0.5">
|
|
93
|
+
<span className="text-sm font-medium text-foreground">{harnessLabel[option.type]}</span>
|
|
94
|
+
<span className="text-xs leading-4 text-muted-foreground">{option.description}</span>
|
|
95
|
+
</span>
|
|
96
|
+
</button>
|
|
97
|
+
)
|
|
98
|
+
|
|
99
|
+
if (!showDisabledTooltip) return button
|
|
100
|
+
|
|
101
|
+
return (
|
|
102
|
+
<Tooltip>
|
|
103
|
+
<TooltipTrigger render={button} />
|
|
104
|
+
<TooltipContent className="max-w-[calc(100vw-2rem)] leading-5 sm:max-w-96">
|
|
105
|
+
<span className="text-center">
|
|
106
|
+
{option.disabledReason}
|
|
107
|
+
{option.disabledCommand && (
|
|
108
|
+
<>
|
|
109
|
+
<br />
|
|
110
|
+
<code className="rounded-xs bg-accent px-1 py-0.5 font-mono wrap-anywhere">
|
|
111
|
+
{option.disabledCommand}
|
|
112
|
+
</code>
|
|
113
|
+
</>
|
|
114
|
+
)}
|
|
115
|
+
</span>
|
|
116
|
+
</TooltipContent>
|
|
117
|
+
</Tooltip>
|
|
118
|
+
)
|
|
119
|
+
}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { useState } from 'react'
|
|
2
|
+
import { useMutation, useQueryClient } from '@tanstack/react-query'
|
|
3
|
+
import { useAppConfig } from '@/client/api/app-config'
|
|
4
|
+
import {
|
|
5
|
+
installHarness,
|
|
6
|
+
startHarnessLogin,
|
|
7
|
+
submitHarnessLoginCode,
|
|
8
|
+
useHarnessStatus,
|
|
9
|
+
type LoginHarness
|
|
10
|
+
} from './api'
|
|
11
|
+
|
|
12
|
+
export function useHarnessLogin(type: LoginHarness) {
|
|
13
|
+
const { environment, demo } = useAppConfig()
|
|
14
|
+
const auth = useHarnessStatus(type)
|
|
15
|
+
const queryClient = useQueryClient()
|
|
16
|
+
const [code, setCode] = useState('')
|
|
17
|
+
const [manualLogin, setManualLogin] = useState(false)
|
|
18
|
+
const login = auth.data?.login
|
|
19
|
+
const pending = login?.state === 'pending' ? login : undefined
|
|
20
|
+
const starting = login?.state === 'starting'
|
|
21
|
+
const waitingForBrowser = environment === 'local' && !manualLogin
|
|
22
|
+
const availability = auth.data?.availability
|
|
23
|
+
const action = useMutation({
|
|
24
|
+
mutationFn: async (kind: 'install' | 'start' | 'submit') => {
|
|
25
|
+
if (kind === 'install') {
|
|
26
|
+
await installHarness(type)
|
|
27
|
+
const refreshed = await auth.refetch({ throwOnError: true })
|
|
28
|
+
if (refreshed.data?.availability.status === 'available') return
|
|
29
|
+
}
|
|
30
|
+
if (kind === 'start' || kind === 'install') {
|
|
31
|
+
setManualLogin(false)
|
|
32
|
+
setCode('')
|
|
33
|
+
await startHarnessLogin(type)
|
|
34
|
+
}
|
|
35
|
+
if (kind === 'submit' && pending) {
|
|
36
|
+
await submitHarnessLoginCode(type, pending.id, code)
|
|
37
|
+
setCode('')
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
onSettled: () => queryClient.invalidateQueries({ queryKey: ['harness-status'] })
|
|
41
|
+
})
|
|
42
|
+
const needsInstall =
|
|
43
|
+
environment === 'local' &&
|
|
44
|
+
!demo &&
|
|
45
|
+
availability?.status === 'unavailable' &&
|
|
46
|
+
availability.code === 'not-installed'
|
|
47
|
+
const checkError = auth.isError || availability?.status === 'unavailable'
|
|
48
|
+
const failure = action.error?.message ?? (login?.state === 'failed' ? login.reason : undefined)
|
|
49
|
+
// Keep the install button busy until the next screen's status has arrived.
|
|
50
|
+
const installing =
|
|
51
|
+
action.variables === 'install' &&
|
|
52
|
+
(action.isPending ||
|
|
53
|
+
(action.isSuccess &&
|
|
54
|
+
!pending &&
|
|
55
|
+
availability?.status !== 'available' &&
|
|
56
|
+
!checkError &&
|
|
57
|
+
!failure))
|
|
58
|
+
const connected =
|
|
59
|
+
!needsInstall && !installing && !starting && !pending && availability?.status === 'available'
|
|
60
|
+
|
|
61
|
+
return {
|
|
62
|
+
auth,
|
|
63
|
+
needsInstall,
|
|
64
|
+
installing,
|
|
65
|
+
code,
|
|
66
|
+
setCode,
|
|
67
|
+
manualLogin,
|
|
68
|
+
setManualLogin,
|
|
69
|
+
pending,
|
|
70
|
+
starting,
|
|
71
|
+
waitingForBrowser,
|
|
72
|
+
connected,
|
|
73
|
+
action,
|
|
74
|
+
checkError,
|
|
75
|
+
failure
|
|
76
|
+
}
|
|
77
|
+
}
|
|
@@ -88,7 +88,7 @@ export function HomePage() {
|
|
|
88
88
|
{count > 0 ? (
|
|
89
89
|
<section className="mb-12">
|
|
90
90
|
<div className="mb-4 flex items-center justify-between gap-2">
|
|
91
|
-
<h1 className="text-sm font-medium text-foreground">
|
|
91
|
+
<h1 className="text-sm font-medium text-foreground">Workspaces</h1>
|
|
92
92
|
<CreateWorkspaceDialog
|
|
93
93
|
trigger={
|
|
94
94
|
<Button variant="outline" size="sm">
|
|
@@ -107,15 +107,15 @@ export function HomePage() {
|
|
|
107
107
|
</section>
|
|
108
108
|
) : (
|
|
109
109
|
<div className="mb-10 flex flex-col items-center gap-4 px-8 pt-8 pb-16 text-center">
|
|
110
|
-
<IconEggCracked size={
|
|
110
|
+
<IconEggCracked size={56} stroke={0.75} className="text-muted-foreground" />
|
|
111
111
|
<div className="flex flex-col gap-1.5">
|
|
112
|
-
<h2 className="font-medium">
|
|
112
|
+
<h2 className="font-medium">Create your first workspace</h2>
|
|
113
113
|
<p className="mx-auto max-w-sm text-sm text-muted-foreground">
|
|
114
|
-
Workspace is a place for all
|
|
115
|
-
|
|
114
|
+
Workspace is a place for all views and widgets that share the same context. Create a
|
|
115
|
+
new one or import an existing folder you’ve worked in before.
|
|
116
116
|
</p>
|
|
117
117
|
</div>
|
|
118
|
-
<CreateWorkspaceDialog trigger={<Button>
|
|
118
|
+
<CreateWorkspaceDialog trigger={<Button>New workspace</Button>} />
|
|
119
119
|
</div>
|
|
120
120
|
)}
|
|
121
121
|
|
|
@@ -133,7 +133,7 @@ export function HomePage() {
|
|
|
133
133
|
'text-muted-foreground group-data-open:text-foreground hover:text-foreground'
|
|
134
134
|
)}
|
|
135
135
|
>
|
|
136
|
-
<span className="text-sm font-medium">Import
|
|
136
|
+
<span className="text-sm font-medium">Import other workspaces</span>
|
|
137
137
|
<IconChevronRight
|
|
138
138
|
size={16}
|
|
139
139
|
stroke={2}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { useAppConfig } from '@/client/api/app-config'
|
|
2
|
+
import { useCallback, useState } from 'react'
|
|
3
|
+
import { HarnessSelector } from '@/client/features/harness/harness-selector'
|
|
4
|
+
import { HarnessLoginPanel } from '@/client/features/harness/harness-login-panel'
|
|
5
|
+
import { harnessDescription } from '@/client/features/harness/harness-presentation'
|
|
6
|
+
import { useHarnessStatuses, useRetryHarnessStatus } from '@/client/features/harness/api'
|
|
7
|
+
import type { OnboardingHarness } from '@/lib/onboarding'
|
|
8
|
+
import { OnboardingStatus } from './onboarding-status'
|
|
9
|
+
import { OnboardingScreen } from './onboarding-screen'
|
|
10
|
+
|
|
11
|
+
type AgentSetupStepProps = { onComplete: (harness: OnboardingHarness) => void }
|
|
12
|
+
export function AgentSetupStep({ onComplete }: AgentSetupStepProps) {
|
|
13
|
+
const [harness, setHarness] = useState<OnboardingHarness>()
|
|
14
|
+
const onConnected = useCallback(() => {
|
|
15
|
+
if (harness) onComplete(harness)
|
|
16
|
+
}, [harness, onComplete])
|
|
17
|
+
if (!harness) return <ChooseAgent onSelect={setHarness} />
|
|
18
|
+
return <HarnessLoginPanel type={harness} onConnected={onConnected} />
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
type ChooseAgentProps = { onSelect: (harness: OnboardingHarness) => void }
|
|
22
|
+
function ChooseAgent({ onSelect }: ChooseAgentProps) {
|
|
23
|
+
const { environment, demo } = useAppConfig()
|
|
24
|
+
const canInstall = environment === 'local' && !demo
|
|
25
|
+
const installed = useHarnessStatuses()
|
|
26
|
+
const retry = useRetryHarnessStatus()
|
|
27
|
+
if (installed.isPending || installed.error)
|
|
28
|
+
return <OnboardingStatus error={installed.error ?? undefined} onRetry={() => retry.mutate()} />
|
|
29
|
+
const options = (['claude-code', 'codex'] as const).map(type => ({
|
|
30
|
+
type,
|
|
31
|
+
description: harnessDescription[type],
|
|
32
|
+
disabled: !canInstall && installed.data[type].availability.status === 'unavailable',
|
|
33
|
+
disabledReason:
|
|
34
|
+
canInstall || installed.data[type].availability.status !== 'unavailable'
|
|
35
|
+
? undefined
|
|
36
|
+
: 'This agent is not installed on your computer'
|
|
37
|
+
}))
|
|
38
|
+
return (
|
|
39
|
+
<OnboardingScreen className="max-w-sm">
|
|
40
|
+
<div className="flex flex-col items-center gap-2 text-center">
|
|
41
|
+
<h1 className="text-xl font-medium">Choose your agent</h1>
|
|
42
|
+
<p className="max-w-60 text-sm text-muted-foreground">
|
|
43
|
+
Connect an existing subscription to build and personalize Moi
|
|
44
|
+
</p>
|
|
45
|
+
</div>
|
|
46
|
+
<HarnessSelector
|
|
47
|
+
options={options}
|
|
48
|
+
mode="action"
|
|
49
|
+
cardClassName="h-36"
|
|
50
|
+
disabled={false}
|
|
51
|
+
onTypeChange={type => {
|
|
52
|
+
if (type === 'claude-code' || type === 'codex') onSelect(type)
|
|
53
|
+
}}
|
|
54
|
+
/>
|
|
55
|
+
</OnboardingScreen>
|
|
56
|
+
)
|
|
57
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { useQuery } from '@tanstack/react-query'
|
|
2
|
+
import { useAppConfig } from '@/client/api/app-config'
|
|
3
|
+
import { jsonRequest, requestJson } from '@/client/api/http'
|
|
4
|
+
import { useAppSettings } from '@/client/features/app-settings/api'
|
|
5
|
+
import type { IdeaDiscovery, OnboardingJobResult } from '@/lib/onboarding'
|
|
6
|
+
|
|
7
|
+
export function useOnboardingSettings() {
|
|
8
|
+
const config = useAppConfig()
|
|
9
|
+
const enabled = !config.demo
|
|
10
|
+
const settings = useAppSettings()
|
|
11
|
+
return {
|
|
12
|
+
...settings,
|
|
13
|
+
enabled,
|
|
14
|
+
loading: enabled && settings.isPending,
|
|
15
|
+
error: enabled ? settings.error : undefined,
|
|
16
|
+
retry: () => void settings.refetch()
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export function cancelDiscovery(runId: string) {
|
|
21
|
+
return requestJson('/api/onboarding/cancel', jsonRequest('POST', { runId }))
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
type BuildRequest = IdeaDiscovery & { ideaId: string; operationId: string }
|
|
25
|
+
export function useOnboardingJob(
|
|
26
|
+
action: 'discover' | 'create',
|
|
27
|
+
request?: IdeaDiscovery | BuildRequest,
|
|
28
|
+
retry = false
|
|
29
|
+
) {
|
|
30
|
+
return useQuery({
|
|
31
|
+
queryKey: ['onboarding-job', action, request, retry],
|
|
32
|
+
queryFn: ({ signal }) =>
|
|
33
|
+
requestJson<OnboardingJobResult>(`/api/onboarding/${action}`, {
|
|
34
|
+
...jsonRequest('POST', { ...request, retry }),
|
|
35
|
+
signal
|
|
36
|
+
}),
|
|
37
|
+
enabled: !!request,
|
|
38
|
+
retry: false,
|
|
39
|
+
refetchOnWindowFocus: false,
|
|
40
|
+
refetchInterval: query => (query.state.data?.status === 'running' ? 1500 : false)
|
|
41
|
+
})
|
|
42
|
+
}
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import { createElement, useId, useState } from 'react'
|
|
2
|
+
import { Badge } from '@/ui-components/badge'
|
|
3
|
+
import { cn } from '@/client/lib/cn'
|
|
4
|
+
import { resolveIdentityIcon } from '@/client/lib/identity-icon-registry'
|
|
5
|
+
import { resolveWorkspaceTheme } from '@/lib/themes'
|
|
6
|
+
import { getWorkspaceThemeStyle } from '@/client/runtime/workspace-theme'
|
|
7
|
+
import { WorkspaceIcon } from '@/client/components/shared/workspace-icon'
|
|
8
|
+
import type { OnboardingIdea, OnboardingViewPlan } from '@/lib/onboarding'
|
|
9
|
+
|
|
10
|
+
type OnboardingIdeaDiskProps = {
|
|
11
|
+
idea: OnboardingIdea
|
|
12
|
+
state: 'available' | 'chosen' | 'not-chosen'
|
|
13
|
+
onSelect: () => void
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export function OnboardingIdeaDisk({ idea, state, onSelect }: OnboardingIdeaDiskProps) {
|
|
17
|
+
const theme = resolveWorkspaceTheme(idea.theme)
|
|
18
|
+
const descriptionId = useId()
|
|
19
|
+
|
|
20
|
+
return (
|
|
21
|
+
<button
|
|
22
|
+
type="button"
|
|
23
|
+
aria-label={`Build ${idea.name}`}
|
|
24
|
+
aria-describedby={descriptionId}
|
|
25
|
+
aria-busy={state === 'chosen'}
|
|
26
|
+
disabled={state !== 'available'}
|
|
27
|
+
onClick={onSelect}
|
|
28
|
+
style={getWorkspaceThemeStyle(theme)}
|
|
29
|
+
className={cn(
|
|
30
|
+
'relative mx-auto flex min-h-96 w-full max-w-sm min-w-0 flex-col rounded-2xl bg-transparent px-5 pb-6 text-center font-sans text-primary-foreground drop-shadow-sm outline-none lg:max-w-none',
|
|
31
|
+
'lg:first:translate-y-6 lg:first:-rotate-4 lg:last:translate-y-5 lg:last:rotate-3',
|
|
32
|
+
'focus-visible:ring-3 focus-visible:ring-ring/50 enabled:cursor-pointer enabled:hover:drop-shadow-lg',
|
|
33
|
+
'motion-safe:transition-[translate,filter] motion-safe:duration-200 motion-safe:enabled:hover:-translate-y-1 motion-safe:enabled:active:translate-y-0',
|
|
34
|
+
'lg:motion-safe:first:enabled:hover:translate-y-5 lg:motion-safe:last:enabled:hover:translate-y-4 lg:motion-safe:first:enabled:active:translate-y-3 lg:motion-safe:last:enabled:active:translate-y-3',
|
|
35
|
+
'disabled:cursor-default',
|
|
36
|
+
state === 'chosen' &&
|
|
37
|
+
'motion-safe:animate-out motion-safe:ease-in-out motion-safe:animation-duration-1500 motion-safe:direction-alternate motion-safe:repeat-infinite motion-safe:[animation-composition:add] motion-safe:spin-out-3',
|
|
38
|
+
state === 'not-chosen' && 'invisible'
|
|
39
|
+
)}
|
|
40
|
+
>
|
|
41
|
+
<DiskBackground className="fill-primary" />
|
|
42
|
+
<span
|
|
43
|
+
aria-hidden="true"
|
|
44
|
+
className="relative mb-4 ml-2 h-24 w-2/3 shrink-0 overflow-hidden rounded-b-xl"
|
|
45
|
+
>
|
|
46
|
+
<span className="absolute inset-x-0 -top-2 bottom-0 flex justify-end rounded-b-lg px-1.5 pt-2 pb-1.5 inset-shadow-[0_0_2px_1px] inset-shadow-foreground/15">
|
|
47
|
+
<span className="relative w-3/4 rounded-b-lg bg-background/80">
|
|
48
|
+
<span className="absolute inset-y-2 right-4 w-1/4 rounded-xs bg-primary" />
|
|
49
|
+
</span>
|
|
50
|
+
</span>
|
|
51
|
+
</span>
|
|
52
|
+
<span className="relative mx-2 my-2 flex flex-1 rounded-lg p-1.5 inset-shadow-[0_0_2px_1px] inset-shadow-foreground/15">
|
|
53
|
+
<span className="relative flex flex-1 flex-col items-center justify-center gap-3 rounded-md bg-background px-4 py-8 text-foreground">
|
|
54
|
+
<span className="flex max-w-full items-center justify-center gap-2">
|
|
55
|
+
<WorkspaceIcon
|
|
56
|
+
icon={{ type: 'glyph', value: idea.icon, background: 'theme' }}
|
|
57
|
+
workspaceTheme={theme}
|
|
58
|
+
className="size-5 rounded-sm"
|
|
59
|
+
/>
|
|
60
|
+
<span className="min-w-0 text-lg font-semibold wrap-break-word">{idea.name}</span>
|
|
61
|
+
</span>
|
|
62
|
+
<span id={descriptionId} className="text-sm wrap-break-word">
|
|
63
|
+
{idea.description}
|
|
64
|
+
</span>
|
|
65
|
+
{idea.views.map((view, index) => (
|
|
66
|
+
<ViewSticker key={index} view={view} index={index} />
|
|
67
|
+
))}
|
|
68
|
+
</span>
|
|
69
|
+
</span>
|
|
70
|
+
</button>
|
|
71
|
+
)
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
type ViewStickerProps = { view: OnboardingViewPlan; index: number }
|
|
75
|
+
|
|
76
|
+
function ViewSticker({ view, index }: ViewStickerProps) {
|
|
77
|
+
const Icon = resolveIdentityIcon(view.icon)
|
|
78
|
+
const [rotation] = useState(() => {
|
|
79
|
+
const angles = ['-rotate-3', '-rotate-2', '-rotate-1', 'rotate-1', 'rotate-2', 'rotate-3']
|
|
80
|
+
return angles[Math.floor(Math.random() * angles.length)]
|
|
81
|
+
})
|
|
82
|
+
|
|
83
|
+
return (
|
|
84
|
+
<Badge
|
|
85
|
+
variant="outline"
|
|
86
|
+
className={cn(
|
|
87
|
+
'absolute h-8 max-w-1/2 min-w-0 gap-1.5 rounded-md border-0 bg-background px-2 py-1.5 text-xs font-normal ring-1 ring-border',
|
|
88
|
+
rotation,
|
|
89
|
+
index === 0 && 'top-0 right-8 -translate-y-1/2',
|
|
90
|
+
index === 1 && 'bottom-0 -left-2 translate-y-1/2',
|
|
91
|
+
index === 2 && '-right-2 bottom-0 translate-y-1/2'
|
|
92
|
+
)}
|
|
93
|
+
>
|
|
94
|
+
{Icon &&
|
|
95
|
+
createElement(Icon, { className: 'size-4 shrink-0', stroke: 1.75, 'aria-hidden': true })}
|
|
96
|
+
<span className="truncate font-medium">{view.name}</span>
|
|
97
|
+
</Badge>
|
|
98
|
+
)
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
type DiskBackgroundProps = { className: string }
|
|
102
|
+
|
|
103
|
+
function DiskBackground({ className }: DiskBackgroundProps) {
|
|
104
|
+
const shapeId = useId()
|
|
105
|
+
const clipId = useId()
|
|
106
|
+
|
|
107
|
+
return (
|
|
108
|
+
<svg
|
|
109
|
+
aria-hidden="true"
|
|
110
|
+
viewBox="0 0 360 400"
|
|
111
|
+
preserveAspectRatio="none"
|
|
112
|
+
className={cn('pointer-events-none absolute inset-0 size-full', className)}
|
|
113
|
+
>
|
|
114
|
+
<defs>
|
|
115
|
+
<path
|
|
116
|
+
id={shapeId}
|
|
117
|
+
d="M12 0H324C328 0 330 1 333 4L356 27C359 30 360 32 360 36V388C360 394.63 354.63 400 348 400H12C5.37 400 0 394.63 0 388V12C0 5.37 5.37 0 12 0Z"
|
|
118
|
+
/>
|
|
119
|
+
<clipPath id={clipId}>
|
|
120
|
+
<use href={`#${shapeId}`} />
|
|
121
|
+
</clipPath>
|
|
122
|
+
</defs>
|
|
123
|
+
<use href={`#${shapeId}`} />
|
|
124
|
+
<foreignObject width="360" height="400" clipPath={`url(#${clipId})`}>
|
|
125
|
+
<div className="size-full rounded-xl inset-shadow-[0_0_16px_color-mix(in_oklab,var(--color-white)_20%,transparent)]" />
|
|
126
|
+
</foreignObject>
|
|
127
|
+
</svg>
|
|
128
|
+
)
|
|
129
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { useState } from 'react'
|
|
2
|
+
import { Redirect } from 'wouter'
|
|
3
|
+
import { useSaveAppSettings } from '@/client/features/app-settings/api'
|
|
4
|
+
import type { OnboardingHarness } from '@/lib/onboarding'
|
|
5
|
+
import { useOnboardingSettings } from './api'
|
|
6
|
+
import { OnboardingStatus } from './onboarding-status'
|
|
7
|
+
import { AgentSetupStep } from './agent-setup-step'
|
|
8
|
+
import { WorkspaceSetupStep } from './workspace-setup-step'
|
|
9
|
+
|
|
10
|
+
export function OnboardingPage() {
|
|
11
|
+
const onboarding = useOnboardingSettings()
|
|
12
|
+
const save = useSaveAppSettings()
|
|
13
|
+
const [destination, setDestination] = useState('/')
|
|
14
|
+
const [harness, setHarness] = useState<OnboardingHarness>()
|
|
15
|
+
if (onboarding.loading || onboarding.error)
|
|
16
|
+
return <OnboardingStatus error={onboarding.error || undefined} onRetry={onboarding.retry} />
|
|
17
|
+
if (!onboarding.enabled || !onboarding.data?.showOnboarding) return <Redirect to={destination} />
|
|
18
|
+
|
|
19
|
+
function finish(workspaceId?: string) {
|
|
20
|
+
setDestination(workspaceId ? `/workspace/${workspaceId}/overview` : '/')
|
|
21
|
+
save.mutate({ showOnboarding: false })
|
|
22
|
+
}
|
|
23
|
+
if (!harness) return <AgentSetupStep onComplete={setHarness} />
|
|
24
|
+
return (
|
|
25
|
+
<WorkspaceSetupStep
|
|
26
|
+
harness={harness}
|
|
27
|
+
onFinish={finish}
|
|
28
|
+
finishing={save.isPending}
|
|
29
|
+
finishError={save.error?.message}
|
|
30
|
+
/>
|
|
31
|
+
)
|
|
32
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { ReactNode } from 'react'
|
|
2
|
+
import { cn } from '@/client/lib/cn'
|
|
3
|
+
|
|
4
|
+
type OnboardingScreenProps = {
|
|
5
|
+
children: ReactNode
|
|
6
|
+
className: string
|
|
7
|
+
footer?: ReactNode
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
// Shared spacing and centering only. Each screen chooses its own width.
|
|
11
|
+
export function OnboardingScreen({ children, className, footer }: OnboardingScreenProps) {
|
|
12
|
+
return (
|
|
13
|
+
<div className="grid flex-1 grid-rows-[1fr_auto_1fr] p-6">
|
|
14
|
+
<div className={cn('row-start-2 mx-auto flex w-full flex-col gap-6 py-8', className)}>
|
|
15
|
+
{children}
|
|
16
|
+
</div>
|
|
17
|
+
<div className="row-start-3 flex min-h-9 items-end justify-center">{footer}</div>
|
|
18
|
+
</div>
|
|
19
|
+
)
|
|
20
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { Button } from '@/client/components/ui/button'
|
|
2
|
+
import { Spinner } from '@/client/components/ui/spinner'
|
|
3
|
+
|
|
4
|
+
type OnboardingStatusProps = { error?: Error; onRetry: () => void }
|
|
5
|
+
export function OnboardingStatus({ error, onRetry }: OnboardingStatusProps) {
|
|
6
|
+
if (error)
|
|
7
|
+
return (
|
|
8
|
+
<div role="alert" className="flex flex-1 flex-col items-center justify-center gap-4 p-6">
|
|
9
|
+
<p className="text-sm text-muted-foreground">{error.message}</p>
|
|
10
|
+
<Button variant="secondary" onClick={onRetry}>
|
|
11
|
+
Try again
|
|
12
|
+
</Button>
|
|
13
|
+
</div>
|
|
14
|
+
)
|
|
15
|
+
return (
|
|
16
|
+
<div
|
|
17
|
+
role="status"
|
|
18
|
+
aria-label="Loading onboarding"
|
|
19
|
+
className="flex flex-1 items-center justify-center"
|
|
20
|
+
>
|
|
21
|
+
<Spinner className="size-6 text-muted-foreground" stroke={1.5} />
|
|
22
|
+
</div>
|
|
23
|
+
)
|
|
24
|
+
}
|