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.
Files changed (243) hide show
  1. package/bunfig.toml +1 -5
  2. package/client/api/app-config.ts +1 -2
  3. package/client/api/app-ui-keys.ts +3 -1
  4. package/client/api/http.ts +4 -1
  5. package/client/api/workspace-keys.ts +3 -3
  6. package/client/app/app-provider.tsx +22 -2
  7. package/client/app/app-router.tsx +6 -0
  8. package/client/app/routes/home-route.tsx +14 -0
  9. package/client/app/routes/onboarding-route.tsx +11 -0
  10. package/client/app/routes/settings-route.tsx +10 -0
  11. package/client/app/routes/workspace-route.tsx +21 -19
  12. package/client/app/shell/sidebar-layout.tsx +34 -53
  13. package/client/components/shared/screen-shell.tsx +23 -0
  14. package/client/components/shared/ultrafast-icon.tsx +61 -0
  15. package/client/components/shared/workspace-icon.tsx +2 -2
  16. package/client/features/account/account-menu.tsx +96 -0
  17. package/client/features/account/account-provider.tsx +142 -0
  18. package/client/features/account/account-test-utils.tsx +294 -0
  19. package/client/features/account/api.ts +142 -0
  20. package/client/features/account/identity.ts +23 -0
  21. package/client/features/app-settings/api.ts +33 -0
  22. package/client/features/app-settings/general-settings.tsx +39 -0
  23. package/client/features/app-settings/profile-settings.tsx +95 -0
  24. package/client/features/app-settings/settings-page.tsx +48 -0
  25. package/client/features/app-settings/settings-section.tsx +26 -0
  26. package/client/features/app-settings/users-settings.tsx +195 -0
  27. package/client/features/chat/applet-chat-intents.ts +4 -20
  28. package/client/features/chat/chat-send.ts +17 -13
  29. package/client/features/chat/composer/model-order.ts +8 -4
  30. package/client/features/chat/composer/model-picker.tsx +88 -34
  31. package/client/features/chat/composer/use-workspace-composer-state.tsx +11 -3
  32. package/client/features/chat/composer/use-workspace-skill-updates.ts +1 -1
  33. package/client/features/chat/connection/chat-frames.ts +3 -15
  34. package/client/features/chat/messages/chat-empty-state.tsx +1 -4
  35. package/client/features/chat/messages/fork-history.ts +5 -5
  36. package/client/features/chat/messages/turn-view.tsx +3 -12
  37. package/client/features/chat/messages/user-message-bubble.tsx +63 -0
  38. package/client/features/chat/sessions/api.ts +121 -80
  39. package/client/features/chat/sessions/browser-tab-state.ts +14 -12
  40. package/client/features/chat/sessions/chat-selector.tsx +5 -6
  41. package/client/features/chat/sessions/use-selected-session.ts +172 -257
  42. package/client/features/chat/use-chat.ts +14 -19
  43. package/client/features/collab/applet-api.ts +15 -14
  44. package/client/features/collab/components/cursors.tsx +61 -24
  45. package/client/features/collab/components/presence-avatars.tsx +25 -12
  46. package/client/features/collab/components/presence-frame.tsx +20 -24
  47. package/client/features/collab/components/presence-group.tsx +15 -7
  48. package/client/features/collab/components/user-avatar-group.tsx +21 -8
  49. package/client/features/collab/components/user-avatar.tsx +38 -7
  50. package/client/features/collab/components/user.tsx +31 -12
  51. package/client/features/collab/users.ts +0 -5
  52. package/client/features/collab/workspace-users-menu.tsx +4 -4
  53. package/client/features/demo/demo-dialog.tsx +11 -3
  54. package/client/features/dev/collab/collab-playground.tsx +7 -7
  55. package/client/features/dev/collab/local-user-settings.tsx +7 -53
  56. package/client/features/dev/dev-index-page.tsx +5 -0
  57. package/client/features/dev/dev-routes.tsx +2 -0
  58. package/client/features/dev/harness-debug-page.tsx +3 -3
  59. package/client/features/dev/onboarding-preview-page.tsx +76 -0
  60. package/client/features/dev/workspace-setup-mocks.ts +16 -14
  61. package/client/features/dev/workspace-setup-preview.tsx +11 -17
  62. package/client/features/harness/api.ts +45 -15
  63. package/client/features/harness/device-login-steps.tsx +9 -3
  64. package/client/features/harness/harness-login-panel.tsx +228 -0
  65. package/client/features/harness/harness-presentation.ts +15 -0
  66. package/client/features/harness/harness-selector.tsx +119 -0
  67. package/client/features/harness/use-harness-login.ts +77 -0
  68. package/client/features/home/home-page.tsx +7 -7
  69. package/client/features/onboarding/agent-setup-step.tsx +57 -0
  70. package/client/features/onboarding/api.ts +42 -0
  71. package/client/features/onboarding/onboarding-idea-disk.tsx +129 -0
  72. package/client/features/onboarding/onboarding-page.tsx +32 -0
  73. package/client/features/onboarding/onboarding-screen.tsx +20 -0
  74. package/client/features/onboarding/onboarding-status.tsx +24 -0
  75. package/client/features/onboarding/workspace-setup-step.tsx +239 -0
  76. package/client/features/overview/default/registry.tsx +2 -2
  77. package/client/features/overview/default/views-widget.tsx +6 -5
  78. package/client/features/overview/overview.tsx +9 -11
  79. package/client/features/overview/widget-canvas.tsx +1 -1
  80. package/client/features/overview/workspace-name.tsx +2 -2
  81. package/client/features/update/update-control.tsx +1 -1
  82. package/client/features/views/api.ts +69 -16
  83. package/client/features/views/pending-view-screen.tsx +30 -9
  84. package/client/features/views/use-view-actions.ts +19 -20
  85. package/client/features/views/view-presentation.ts +2 -2
  86. package/client/features/views/view-submission.ts +28 -41
  87. package/client/features/workspace/add/api.ts +3 -23
  88. package/client/features/workspace/add/create-workspace-dialog.tsx +11 -7
  89. package/client/features/workspace/add/import-workspace-dialog.tsx +3 -3
  90. package/client/features/workspace/add/workspace-agent-options.ts +11 -12
  91. package/client/features/workspace/add/workspace-agent-selector.tsx +3 -132
  92. package/client/features/workspace/api.ts +32 -36
  93. package/client/features/workspace/harness-transition.ts +88 -0
  94. package/client/features/{settings → workspace/settings}/api.ts +1 -34
  95. package/client/features/{settings → workspace/settings}/connectors-settings.tsx +3 -3
  96. package/client/features/{settings → workspace/settings}/environment-settings.tsx +3 -3
  97. package/client/features/{settings → workspace/settings}/general-settings.tsx +77 -3
  98. package/client/features/{settings → workspace/settings}/use-env-vars.ts +1 -1
  99. package/client/features/{settings → workspace/settings}/workspace-icon-picker.tsx +3 -3
  100. package/client/features/workspace/setup/workspace-login-state.tsx +37 -156
  101. package/client/features/workspace/setup/workspace-recovery-states.tsx +0 -12
  102. package/client/features/workspace/setup/workspace-setup.tsx +34 -14
  103. package/client/features/workspace/setup/workspace-welcome-state.tsx +2 -2
  104. package/client/features/workspace/use-workspace-navigation.ts +25 -9
  105. package/client/features/workspace/workspace-content.tsx +11 -8
  106. package/client/features/workspace/workspace-frame.tsx +2 -1
  107. package/client/features/workspace/workspace-layout-context.tsx +5 -2
  108. package/client/features/workspace/workspace-menu.tsx +12 -8
  109. package/client/features/workspace/workspace-pending-screen.tsx +10 -10
  110. package/client/features/workspace/workspace-presentation.tsx +5 -13
  111. package/client/features/workspace/workspace-state.ts +169 -0
  112. package/client/features/workspace/workspace-tabs.tsx +22 -2
  113. package/client/index.css +2 -0
  114. package/client/index.tsx +3 -3
  115. package/client/lib/flags.ts +1 -1
  116. package/client/lib/{app-icon-registry.ts → identity-icon-registry.ts} +10 -14
  117. package/client/lib/user-display-name.ts +6 -0
  118. package/client/main.tsx +4 -1
  119. package/client/runtime/workspace-events.ts +21 -4
  120. package/client/runtime/workspace-theme.ts +9 -0
  121. package/client/tailwind-config.ts +43 -0
  122. package/dist/chunk-0mjzg20x.js +2 -0
  123. package/dist/chunk-2y59vrxg.js +5 -0
  124. package/dist/chunk-58dyt9bk.js +2 -0
  125. package/dist/chunk-5aj040e5.css +1 -0
  126. package/dist/{chunk-tqd3pkg8.css → chunk-60q353jq.css} +1 -1
  127. package/dist/chunk-71fn6rmj.js +546 -0
  128. package/dist/chunk-7yg1m8hx.js +2 -0
  129. package/dist/chunk-825hys3h.js +1 -0
  130. package/dist/chunk-9bb8m9rx.js +2 -0
  131. package/dist/{chunk-11cab5dq.css → chunk-cq2r11fg.css} +1 -1
  132. package/dist/chunk-g0tcwqxc.js +1 -0
  133. package/dist/chunk-n0nab26d.js +1 -0
  134. package/dist/chunk-nf2wkvf9.js +14 -0
  135. package/dist/chunk-v88n1bay.js +74 -0
  136. package/dist/index.html +1 -1
  137. package/lib/harness-instructions.ts +1 -1
  138. package/lib/{app-icons.ts → identity-icons.ts} +6 -7
  139. package/lib/onboarding.ts +41 -0
  140. package/lib/speed-mode.ts +5 -0
  141. package/lib/types.ts +72 -63
  142. package/lib/view-build-directives.ts +1 -2
  143. package/lib/workspace-icon.ts +2 -2
  144. package/lib/workspace-layout.ts +1 -1
  145. package/lib/workspace-name.ts +15 -12
  146. package/package.json +9 -8
  147. package/server/README.md +27 -25
  148. package/server/api/harnesses.ts +31 -8
  149. package/server/api/index.ts +164 -131
  150. package/server/api/onboarding.ts +46 -0
  151. package/server/app-config.ts +23 -24
  152. package/server/app-settings.ts +6 -2
  153. package/server/applets/config.ts +5 -5
  154. package/server/applets/views.ts +19 -17
  155. package/server/cli/commands/init.ts +3 -3
  156. package/server/cli/commands/skill.ts +16 -17
  157. package/server/cli/commands/start.ts +8 -34
  158. package/server/cli/server.ts +18 -6
  159. package/server/collab/config.ts +1 -2
  160. package/server/collab/manager.ts +4 -1
  161. package/server/collab/skill/index.ts +1 -1
  162. package/server/control.ts +3 -3
  163. package/server/data-dir.ts +1 -1
  164. package/server/harness/README.md +24 -8
  165. package/server/harness/acp/session.ts +8 -4
  166. package/server/harness/auth.ts +14 -17
  167. package/server/harness/claude-code/NOTES.md +4 -3
  168. package/server/harness/claude-code/index.ts +2 -0
  169. package/server/harness/claude-code/models.ts +2 -20
  170. package/server/harness/claude-code/run-action.ts +123 -0
  171. package/server/harness/claude-code/session-title.ts +5 -7
  172. package/server/harness/claude-code/session.ts +24 -16
  173. package/server/harness/codex/NOTES.md +14 -9
  174. package/server/harness/codex/adapter.ts +14 -17
  175. package/server/harness/codex/index.ts +2 -0
  176. package/server/harness/codex/run-action.ts +93 -0
  177. package/server/harness/codex/session-title.ts +6 -8
  178. package/server/harness/codex/session.ts +11 -11
  179. package/server/harness/command.ts +45 -0
  180. package/server/harness/executable.ts +5 -0
  181. package/server/harness/fork.ts +6 -4
  182. package/server/harness/install.ts +49 -0
  183. package/server/harness/openclaw/session.ts +1 -2
  184. package/server/harness/run-action.ts +85 -0
  185. package/server/harness/session-title.ts +0 -46
  186. package/server/harness/types.ts +26 -2
  187. package/server/onboarding/brief.ts +29 -0
  188. package/server/onboarding/ideas.ts +48 -0
  189. package/server/onboarding/jobs.ts +291 -0
  190. package/server/onboarding/prompt.md +49 -0
  191. package/server/sessions/archive.ts +5 -14
  192. package/server/sessions/config.ts +17 -16
  193. package/server/sessions/lifecycle.ts +15 -13
  194. package/server/sessions/pending-views.ts +79 -108
  195. package/server/sessions/selected.ts +75 -161
  196. package/server/sessions/store.ts +40 -113
  197. package/server/sessions/view-sessions.ts +128 -111
  198. package/server/skills/locations.ts +82 -0
  199. package/server/skills/lock.ts +29 -0
  200. package/server/skills/template.ts +36 -25
  201. package/server/skills/update.ts +52 -5
  202. package/server/skills/version.ts +17 -22
  203. package/server/skills/workspace.ts +121 -0
  204. package/server/web.ts +23 -8
  205. package/server/workspace-state/file.ts +177 -0
  206. package/server/workspace-state/index.ts +162 -0
  207. package/server/workspace-state/legacy-migration.ts +79 -0
  208. package/server/workspace-state/lock.ts +42 -0
  209. package/server/workspace-state/types.ts +16 -0
  210. package/server/workspaces/change-harness.ts +88 -0
  211. package/server/workspaces/harness-transition.ts +29 -0
  212. package/server/workspaces/init.ts +29 -16
  213. package/server/workspaces/layout.ts +3 -0
  214. package/server/workspaces/registry.ts +58 -10
  215. package/{workspace/.claude/skills/moi-workspace → skill}/SKILL.md +7 -5
  216. package/{workspace/.claude/skills/moi-workspace → skill}/references/COLLAB.md +4 -8
  217. package/skill/references/DESIGN.md +148 -0
  218. package/{workspace/.claude/skills/moi-workspace → skill}/references/SCRATCHPAD.md +2 -2
  219. package/{workspace/.claude/skills/moi-workspace → skill}/references/UI-COMPONENTS.md +3 -0
  220. package/ui-components/badge.tsx +1 -1
  221. package/client/accept-hmr-dependencies.ts +0 -22
  222. package/client/features/workspace/setup/workspace-setup-panel.tsx +0 -18
  223. package/dist/chunk-00rh9df4.js +0 -2
  224. package/dist/chunk-4nh7y1hq.css +0 -1
  225. package/dist/chunk-am4agx6v.js +0 -2
  226. package/dist/chunk-d7cbm65e.js +0 -2
  227. package/dist/chunk-hbpdv7vd.js +0 -1
  228. package/dist/chunk-hmka9rt5.js +0 -2
  229. package/dist/chunk-hvh9f5h0.js +0 -14
  230. package/dist/chunk-mjjregkn.js +0 -10
  231. package/dist/chunk-pcnahct1.js +0 -5
  232. package/dist/chunk-rt30jbcm.js +0 -1
  233. package/dist/chunk-vt6zybej.js +0 -2
  234. package/dist/chunk-wbkwf6cc.js +0 -68
  235. package/dist/chunk-xjyfyz64.js +0 -1
  236. package/dist/chunk-y8nbwp21.js +0 -546
  237. package/dist/chunk-ysfdcew7.js +0 -1
  238. package/lib/experimental.ts +0 -14
  239. package/workspace/.claude/skills/moi-workspace/references/DESIGN.md +0 -157
  240. /package/client/features/{settings → workspace/settings}/icon-picker-options.ts +0 -0
  241. /package/client/features/{settings → workspace/settings}/settings-layout.tsx +0 -0
  242. /package/client/features/{settings → workspace/settings}/workspace-settings-dialog.tsx +0 -0
  243. /package/{workspace/.claude/skills/moi-workspace → skill}/references/INTENTS.md +0 -0
@@ -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
+ }
@@ -0,0 +1,239 @@
1
+ import { useEffect, useRef, useState, type ReactNode } from 'react'
2
+ import { useMutation } from '@tanstack/react-query'
3
+ import { IconSearch } from '@tabler/icons-react'
4
+ import { Button } from '@/client/components/ui/button'
5
+ import { Spinner } from '@/client/components/ui/spinner'
6
+ import { requestJson } from '@/client/api/http'
7
+ import type { WorkspaceEntry } from '@/lib/types'
8
+ import type { IdeaDiscovery, OnboardingHarness, OnboardingIdea } from '@/lib/onboarding'
9
+ import { useCreateWorkspace } from '@/client/features/workspace/add/api'
10
+ import { usePreloadWorkspaceFonts } from '@/client/runtime/workspace-theme'
11
+ import { OnboardingScreen } from './onboarding-screen'
12
+ import { OnboardingIdeaDisk } from './onboarding-idea-disk'
13
+ import { cancelDiscovery, useOnboardingJob } from './api'
14
+
15
+ type WorkspaceSetupStepProps = {
16
+ harness: OnboardingHarness
17
+ onFinish: (workspaceId?: string) => void
18
+ finishing: boolean
19
+ finishError?: string
20
+ }
21
+ export function WorkspaceSetupStep({
22
+ harness,
23
+ onFinish,
24
+ finishing,
25
+ finishError
26
+ }: WorkspaceSetupStepProps) {
27
+ const [discovery, setDiscovery] = useState<IdeaDiscovery>()
28
+ const [selection, setSelection] = useState<{ ideaId: string; operationId: string }>()
29
+ const [retry, setRetry] = useState(false)
30
+ const ideas = useOnboardingJob('discover', discovery)
31
+ const build = useOnboardingJob(
32
+ 'create',
33
+ discovery && selection ? { ...discovery, ...selection } : undefined,
34
+ retry
35
+ )
36
+ useEffect(() => {
37
+ if (!discovery) return
38
+ return () => {
39
+ void cancelDiscovery(discovery.runId).catch(() => {})
40
+ }
41
+ }, [discovery])
42
+ const openedWorkspace = useRef<string | undefined>(undefined)
43
+ const workspaceId = build.data?.status === 'done' ? build.data.workspaceId : undefined
44
+ useEffect(() => {
45
+ if (!workspaceId || openedWorkspace.current === workspaceId) return
46
+ openedWorkspace.current = workspaceId
47
+ onFinish(workspaceId)
48
+ }, [workspaceId, onFinish])
49
+ const createWorkspace = useCreateWorkspace()
50
+ const emptyWorkspaceId = createWorkspace.data?.id
51
+ const startFromScratch = useMutation({
52
+ mutationFn: async () => {
53
+ if (emptyWorkspaceId) return emptyWorkspaceId
54
+ if (discovery) {
55
+ await cancelDiscovery(discovery.runId)
56
+ setDiscovery(undefined)
57
+ }
58
+ const workspaces = await requestJson<WorkspaceEntry[]>('/api/workspaces')
59
+ if (workspaces.length > 0) return
60
+ const entry = await createWorkspace.mutateAsync({ type: harness })
61
+ return entry.id
62
+ },
63
+ onSuccess: id => onFinish(id)
64
+ })
65
+ const discoveryError = ideas.error?.message ?? ideas.data?.error
66
+ const error =
67
+ startFromScratch.error?.message ??
68
+ build.error?.message ??
69
+ build.data?.error ??
70
+ (discoveryError
71
+ ? 'We couldn’t find ideas this time. Try again, or start on your own.'
72
+ : undefined)
73
+ function findIdeas() {
74
+ startFromScratch.reset()
75
+ setDiscovery({ harness, runId: crypto.randomUUID() })
76
+ }
77
+ function select(ideaId: string) {
78
+ setSelection(current => current ?? { ideaId, operationId: crypto.randomUUID() })
79
+ }
80
+ const busy = finishing || startFromScratch.isPending
81
+ const feedback = (
82
+ <>
83
+ {(error || finishError) && (
84
+ <p role="alert" className="text-center text-sm text-destructive">
85
+ {error || finishError}
86
+ </p>
87
+ )}
88
+ {selection && (error || finishError) && (
89
+ <Button
90
+ size="lg"
91
+ className="self-center"
92
+ variant="secondary"
93
+ disabled={busy || build.isFetching}
94
+ onClick={() => {
95
+ if (workspaceId) onFinish(workspaceId)
96
+ else if (retry) void build.refetch()
97
+ else setRetry(true)
98
+ }}
99
+ >
100
+ Try again
101
+ </Button>
102
+ )}
103
+ </>
104
+ )
105
+ const footer = !selection && (
106
+ <Button size="lg" variant="ghost" disabled={busy} onClick={() => startFromScratch.mutate()}>
107
+ {startFromScratch.isPending && <Spinner stroke={1.5} />}
108
+ {startFromScratch.isPending ? 'Creating workspace…' : 'Skip onboarding'}
109
+ </Button>
110
+ )
111
+ if (!selection && (!discovery || error || busy))
112
+ return (
113
+ <DiscoveryIntro
114
+ disabled={busy || !!emptyWorkspaceId}
115
+ failed={!!discoveryError}
116
+ onFindIdeas={findIdeas}
117
+ feedback={feedback}
118
+ footer={footer}
119
+ />
120
+ )
121
+ if (ideas.data?.status === 'done')
122
+ return (
123
+ <IdeaOptions
124
+ ideas={ideas.data.ideas ?? []}
125
+ selectedIdeaId={selection?.ideaId}
126
+ onSelect={select}
127
+ feedback={feedback}
128
+ footer={footer}
129
+ />
130
+ )
131
+ return (
132
+ <DiscoveryIntro
133
+ loading
134
+ progressMessage={ideas.data?.progress?.message}
135
+ disabled={busy}
136
+ failed={false}
137
+ onFindIdeas={findIdeas}
138
+ feedback={feedback}
139
+ footer={footer}
140
+ />
141
+ )
142
+ }
143
+
144
+ type DiscoveryIntroProps = {
145
+ loading?: boolean
146
+ progressMessage?: string
147
+ disabled: boolean
148
+ failed: boolean
149
+ onFindIdeas: () => void
150
+ feedback: ReactNode
151
+ footer: ReactNode
152
+ }
153
+ function DiscoveryIntro({
154
+ loading = false,
155
+ progressMessage,
156
+ disabled,
157
+ failed,
158
+ onFindIdeas,
159
+ feedback,
160
+ footer
161
+ }: DiscoveryIntroProps) {
162
+ return (
163
+ <OnboardingScreen className="max-w-sm" footer={footer}>
164
+ <div className="flex flex-col items-center gap-2 text-center">
165
+ <h1 className="text-xl font-medium">Choose a starting point</h1>
166
+ <p className="text-sm text-muted-foreground">
167
+ Moi can look through your recent conversations, emails, and connected apps to suggest
168
+ ideas for you to build
169
+ </p>
170
+ </div>
171
+ <div className="flex flex-col items-center gap-3">
172
+ {loading ? (
173
+ <DiscoveryProgress message={progressMessage} />
174
+ ) : (
175
+ <Button size="lg" disabled={disabled} onClick={onFindIdeas}>
176
+ <IconSearch stroke={1.5} aria-hidden="true" />
177
+ {failed ? 'Try again' : 'Find ideas'}
178
+ </Button>
179
+ )}
180
+ {feedback}
181
+ </div>
182
+ </OnboardingScreen>
183
+ )
184
+ }
185
+
186
+ type DiscoveryProgressProps = { message?: string }
187
+ function DiscoveryProgress({ message }: DiscoveryProgressProps) {
188
+ return (
189
+ <div
190
+ role="status"
191
+ aria-label="Finding ideas"
192
+ className="flex h-9 max-w-full min-w-0 items-center text-sm text-muted-foreground"
193
+ >
194
+ <span className="shimmer truncate" title={message}>
195
+ {message ?? 'Taking a first look…'}
196
+ </span>
197
+ </div>
198
+ )
199
+ }
200
+
201
+ type IdeaOptionsProps = {
202
+ ideas: OnboardingIdea[]
203
+ selectedIdeaId?: string
204
+ onSelect: (id: string) => void
205
+ feedback: ReactNode
206
+ footer: ReactNode
207
+ }
208
+ export function IdeaOptions({
209
+ ideas,
210
+ selectedIdeaId,
211
+ onSelect,
212
+ feedback,
213
+ footer
214
+ }: IdeaOptionsProps) {
215
+ usePreloadWorkspaceFonts()
216
+ return (
217
+ <OnboardingScreen className="max-w-6xl" footer={footer}>
218
+ <div className="flex flex-col items-center gap-2 text-center">
219
+ <h1 className="text-xl font-medium">Choose a starting point</h1>
220
+ <p className="text-sm text-muted-foreground">
221
+ Pick an idea to build, you can change and add things as you go
222
+ </p>
223
+ </div>
224
+ <div className="grid justify-items-stretch gap-10 px-3 pt-4 pb-8 lg:grid-cols-3 lg:gap-8">
225
+ {ideas.map(idea => (
226
+ <OnboardingIdeaDisk
227
+ key={idea.id}
228
+ idea={idea}
229
+ state={
230
+ !selectedIdeaId ? 'available' : selectedIdeaId === idea.id ? 'chosen' : 'not-chosen'
231
+ }
232
+ onSelect={() => onSelect(idea.id)}
233
+ />
234
+ ))}
235
+ </div>
236
+ {feedback}
237
+ </OnboardingScreen>
238
+ )
239
+ }
@@ -1,12 +1,12 @@
1
1
  import type { ReactNode } from 'react'
2
2
 
3
- import type { CompiledView } from '@/lib/types'
3
+ import type { ViewInfo } from '@/lib/types'
4
4
  import { DEFAULT_VIEWS_WIDGET, isDefaultWidget, type DefaultWidgetId } from '@/lib/default-widgets'
5
5
 
6
6
  import { ViewsWidget } from './views-widget'
7
7
 
8
8
  export type DefaultWidgetRenderContext = {
9
- views: CompiledView[]
9
+ views: ViewInfo[]
10
10
  onOpenView: (viewId: string) => void
11
11
  onCreateView: () => void
12
12
  showOnboarding: boolean
@@ -33,7 +33,7 @@ import { useDeleteView, useRenameView } from '@/client/features/views/api'
33
33
  import { getViewIcon, getViewLabel } from '@/client/features/views/view-presentation'
34
34
  import { useWorkspaceLayoutCtx } from '@/client/features/workspace/workspace-layout-context'
35
35
  import { cn } from '@/client/lib/cn'
36
- import type { CompiledView } from '@/lib/types'
36
+ import type { ViewInfo } from '@/lib/types'
37
37
 
38
38
  type NewViewButtonProps = {
39
39
  outlined: boolean
@@ -74,7 +74,7 @@ function NewViewButton({ outlined, onClick }: NewViewButtonProps) {
74
74
  }
75
75
 
76
76
  type ViewItemProps = {
77
- view: CompiledView
77
+ view: ViewInfo
78
78
  Icon: TablerIcon
79
79
  onOpen: () => void
80
80
  }
@@ -206,14 +206,15 @@ function ViewItem({ view, Icon, onOpen }: ViewItemProps) {
206
206
  }
207
207
 
208
208
  type ViewsWidgetProps = {
209
- views: CompiledView[]
209
+ views: ViewInfo[]
210
210
  onOpenView: (viewId: string) => void
211
211
  onCreateView: () => void
212
212
  showOnboarding: boolean
213
213
  }
214
214
 
215
215
  export function ViewsWidget({ views, onOpenView, onCreateView, showOnboarding }: ViewsWidgetProps) {
216
- const empty = views.length === 0
216
+ const visibleViews = views.filter(view => view.status !== 'draft')
217
+ const empty = visibleViews.length === 0
217
218
 
218
219
  return (
219
220
  <div className="relative no-scrollbar flex size-full items-center overflow-hidden bg-muted">
@@ -225,7 +226,7 @@ export function ViewsWidget({ views, onOpenView, onCreateView, showOnboarding }:
225
226
  )}
226
227
  <h2 className="relative pr-6 pl-12 text-2xl font-semibold text-foreground">Views</h2>
227
228
  <div className="relative no-scrollbar flex scroll-fade-x gap-2 overflow-x-auto px-6 pt-4 [--scroll-fade-reveal:16px]">
228
- {views.map(view => (
229
+ {visibleViews.map(view => (
229
230
  <ViewItem
230
231
  key={view.id}
231
232
  view={view}
@@ -15,7 +15,7 @@ import { useAppletThumbnails } from '@/client/features/applets/applet-thumbnail'
15
15
  import {
16
16
  WorkspaceSettingsDialog,
17
17
  WorkspaceSettingsDialogTrigger
18
- } from '@/client/features/settings/workspace-settings-dialog'
18
+ } from '@/client/features/workspace/settings/workspace-settings-dialog'
19
19
  import { useWorkspaceLayoutCtx } from '@/client/features/workspace/workspace-layout-context'
20
20
  import { renderDefaultWidget } from '@/client/features/overview/default/registry'
21
21
  import { findWidgetPosition, updateStoredGridPositions } from '@/client/features/overview/grid'
@@ -24,7 +24,7 @@ import { WidgetShell } from '@/client/features/applets/widget-shell'
24
24
  import { Button } from '@/client/components/ui/button'
25
25
  import { cn } from '@/client/lib/cn'
26
26
  import { useUiStore } from '@/client/store/ui'
27
- import type { CompiledView, WidgetInfo } from '@/lib/types'
27
+ import type { ViewInfo, WidgetInfo } from '@/lib/types'
28
28
  import { isDefaultWidget } from '@/lib/default-widgets'
29
29
 
30
30
  import { HiddenPanel } from './hidden-panel'
@@ -38,15 +38,13 @@ type NoWidgetsCreatedProps = {
38
38
 
39
39
  function NoWidgetsCreated({ onCreateWidget, showOnboarding }: NoWidgetsCreatedProps) {
40
40
  return (
41
- <div className="relative grid size-full grid-cols-4 grid-rows-2 gap-2 overflow-hidden">
42
- <div className="col-span-2 overflow-hidden rounded-2xl bg-muted texture-checker squircle">
43
- <div className="flex size-full items-start justify-start bg-radial-[at_top_left] from-muted from-40% to-transparent p-12">
41
+ <div className="relative grid size-full grid-cols-2 grid-rows-1 gap-2 overflow-hidden">
42
+ <div className="overflow-hidden rounded-2xl bg-muted texture-checker squircle">
43
+ <div className="flex size-full items-center justify-start bg-linear-to-r from-muted from-40% to-transparent p-12">
44
44
  <h2 className="text-2xl font-semibold text-foreground">Widgets</h2>
45
45
  </div>
46
46
  </div>
47
- <div className="col-span-2 overflow-hidden rounded-2xl bg-muted texture-checker squircle" />
48
- <div className="col-span-2 overflow-hidden rounded-2xl bg-muted texture-checker squircle" />
49
- <div className="col-span-2 overflow-hidden rounded-2xl bg-muted texture-checker squircle">
47
+ <div className="overflow-hidden rounded-2xl bg-muted texture-checker squircle">
50
48
  {showOnboarding && (
51
49
  <div className="flex size-full items-end justify-end">
52
50
  <span className="m-8 max-w-56 text-right text-sm text-muted-foreground">
@@ -60,11 +58,11 @@ function NoWidgetsCreated({ onCreateWidget, showOnboarding }: NoWidgetsCreatedPr
60
58
  variant="outline"
61
59
  className={cn(
62
60
  'absolute inset-0 m-auto h-fit w-fit',
63
- 'flex-col gap-1 rounded-2xl border-0 py-4 pr-12 pl-12! text-xs shadow-sm transition-shadow duration-300 ease-out squircle hover:bg-background hover:shadow-lg [&_svg]:size-8'
61
+ 'flex-col gap-1 rounded-2xl border-0 py-4 pr-8 pl-8! text-xs shadow-sm transition-shadow duration-300 ease-out squircle hover:bg-background hover:shadow-lg [&_svg]:size-8'
64
62
  )}
65
63
  onClick={onCreateWidget}
66
64
  >
67
- <IconPlus data-icon="inline-start" stroke={1} />
65
+ <IconPlus data-icon="inline-start" stroke={1.5} />
68
66
  New widget
69
67
  </Button>
70
68
  </div>
@@ -177,7 +175,7 @@ type OverviewProps = {
177
175
  onCustomizingChange: (customizing: boolean) => void
178
176
  // Authoritative widget set from useWidgets; positions come from layout.
179
177
  widgets: WidgetInfo[]
180
- views: CompiledView[]
178
+ views: ViewInfo[]
181
179
  }
182
180
 
183
181
  export function Overview({
@@ -74,7 +74,7 @@ function WidgetGrid({
74
74
  x: 0,
75
75
  y: layout.reduce((bottom, item) => Math.max(bottom, item.y + item.h), 0),
76
76
  w: 4,
77
- h: 2,
77
+ h: 1,
78
78
  static: true
79
79
  }
80
80
  ]
@@ -2,8 +2,8 @@ import { useEffect, useState } from 'react'
2
2
 
3
3
  import { Popover, PopoverContent, PopoverTrigger } from '@/client/components/ui/popover'
4
4
  import { WorkspaceIdentity } from '@/client/features/workspace/workspace-identity'
5
- import { useSaveWorkspaceName } from '@/client/features/settings/api'
6
- import { WorkspaceIconPicker } from '@/client/features/settings/workspace-icon-picker'
5
+ import { useSaveWorkspaceName } from '@/client/features/workspace/settings/api'
6
+ import { WorkspaceIconPicker } from '@/client/features/workspace/settings/workspace-icon-picker'
7
7
  import { useWorkspaceLayoutCtx } from '@/client/features/workspace/workspace-layout-context'
8
8
 
9
9
  export function WorkspaceName() {
@@ -83,7 +83,7 @@ export function UpdateButton({ busy, blocked, label, errorMessage, onClick }: Up
83
83
  <div>
84
84
  <Button
85
85
  type="button"
86
- size="icon"
86
+ size="icon-sm"
87
87
  variant={busy ? 'ghost' : 'default'}
88
88
  aria-label={label}
89
89
  disabled={blocked || busy}