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
package/dist/index.html CHANGED
@@ -55,7 +55,7 @@
55
55
  <link rel="modulepreload" href="/vendor/react/19.2.4/production/react-dom-client.js" />
56
56
  <link rel="modulepreload" href="/vendor/react/19.2.4/production/_impl/react-dom-client.js" />
57
57
 
58
- <link rel="stylesheet" crossorigin href="/chunk-4nh7y1hq.css"><script type="module" crossorigin src="/chunk-hbpdv7vd.js"></script></head>
58
+ <link rel="stylesheet" crossorigin href="/chunk-5aj040e5.css"><script type="module" crossorigin src="/chunk-0mjzg20x.js"></script></head>
59
59
  <body>
60
60
  <div id="root"></div>
61
61
 
@@ -8,7 +8,7 @@ type HarnessInstruction = {
8
8
  export const HARNESS_INSTRUCTIONS: Record<WorkspaceType, HarnessInstruction> = {
9
9
  'claude-code': {
10
10
  reason: 'Run in terminal to install Claude:',
11
- command: 'curl -fsSL https://claude.ai/install.sh | sh'
11
+ command: 'curl -fsSL https://claude.ai/install.sh | bash'
12
12
  },
13
13
  codex: {
14
14
  reason: 'Run in terminal to install ChatGPT:',
@@ -1,4 +1,5 @@
1
- export const APP_ICON_IDS = [
1
+ // Identity glyphs for workspaces and views. UI controls use Tabler icons directly.
2
+ export const IDENTITY_ICON_IDS = [
2
3
  'rocket',
3
4
  'sparkles',
4
5
  'bolt',
@@ -23,8 +24,6 @@ export const APP_ICON_IDS = [
23
24
  'hexagon',
24
25
  'plug',
25
26
  'tool',
26
- 'settings',
27
- 'dots',
28
27
  'bug',
29
28
  'activity',
30
29
  'chart',
@@ -65,10 +64,10 @@ export const APP_ICON_IDS = [
65
64
  'chef'
66
65
  ] as const
67
66
 
68
- export type AppIconId = (typeof APP_ICON_IDS)[number]
67
+ export type IdentityIconId = (typeof IDENTITY_ICON_IDS)[number]
69
68
 
70
- const appIconIds = new Set<string>(APP_ICON_IDS)
69
+ const identityIconIds = new Set<string>(IDENTITY_ICON_IDS)
71
70
 
72
- export function isAppIconId(id: string): id is AppIconId {
73
- return appIconIds.has(id)
71
+ export function isIdentityIconId(id: string): id is IdentityIconId {
72
+ return identityIconIds.has(id)
74
73
  }
@@ -0,0 +1,41 @@
1
+ import type { IdentityIconId } from './identity-icons'
2
+ import type { WorkspaceTheme } from './themes'
3
+ import { z } from 'zod'
4
+
5
+ export const discoveryProgressSchema = z
6
+ .object({
7
+ message: z.string().trim().min(1).max(50)
8
+ })
9
+ .strict()
10
+ export type DiscoveryProgress = z.infer<typeof discoveryProgressSchema>
11
+
12
+ export type OnboardingHarness = 'claude-code' | 'codex'
13
+ export type OnboardingAppletPlan = {
14
+ name: string
15
+ description: string
16
+ features: string[]
17
+ }
18
+ export type OnboardingViewPlan = OnboardingAppletPlan & { icon: IdentityIconId }
19
+ export type OnboardingIdea = {
20
+ id: string
21
+ name: string
22
+ icon: IdentityIconId
23
+ theme: Pick<WorkspaceTheme, 'font' | 'color'>
24
+ description: string
25
+ views: OnboardingViewPlan[]
26
+ widgets: OnboardingAppletPlan[]
27
+ }
28
+ export type IdeaDiscovery = { harness: OnboardingHarness; runId: string }
29
+ export type WorkspaceBuild = {
30
+ harness: OnboardingHarness
31
+ operationId: string
32
+ idea: OnboardingIdea
33
+ }
34
+ export type OnboardingJobResult = {
35
+ status: 'running' | 'done' | 'failed'
36
+ progress?: DiscoveryProgress
37
+ ideas?: OnboardingIdea[]
38
+ workspaceId?: string
39
+ sessionId?: string
40
+ error?: string
41
+ }
@@ -0,0 +1,5 @@
1
+ import type { SpeedMode } from './types'
2
+
3
+ export function isSpeedMode(value: unknown): value is SpeedMode {
4
+ return value === 'normal' || value === 'fast' || value === 'ultrafast'
5
+ }
package/lib/types.ts CHANGED
@@ -1,6 +1,5 @@
1
1
  import type { PreviewBlock, StreamEvent } from './format'
2
- import type { AppIconId } from './app-icons'
3
- import type { ExperimentalFeatures } from './experimental'
2
+ import type { IdentityIconId } from './identity-icons'
4
3
  import type { MoiContext } from './moi-context'
5
4
  import type { WorkspaceTheme } from './themes'
6
5
  import type { AttachmentInput, WidgetConfig } from 'moi'
@@ -39,8 +38,9 @@ export type PendingView = {
39
38
  title?: string
40
39
  icon?: string
41
40
  requirements: string
42
- // Execution reference only. Ownership lives in SessionRecord.tabId.
43
- executionSessionId?: string
41
+ // The chat running the build: usually the view tab's own chat, or the
42
+ // pinned chat when one is pinned. Ownership lives in the chat's `tabId`.
43
+ buildSessionId?: string
44
44
  error?: string
45
45
  }
46
46
 
@@ -257,9 +257,8 @@ export type ClientMessage =
257
257
  // Omitted means the provider default. Harnesses apply changes before the
258
258
  // next send (see server/harness/claude-code/session.ts).
259
259
  effort?: string
260
- // Opt into the selected model's faster processing mode. Omitted inherits
261
- // the provider configuration; false explicitly disables a stored default.
262
- fastMode?: boolean
260
+ // Select processing speed. Omitted uses normal, overriding provider defaults.
261
+ speedMode?: SpeedMode
263
262
  // Opt into live token-by-token streaming for this turn. Omitted/false runs
264
263
  // the current whole-block behavior. Only honored for providers that report
265
264
  // `supportsStreaming` (Claude Code); ignored otherwise. Like effort, a
@@ -290,82 +289,76 @@ export type SessionSummary = {
290
289
  flavor?: 'chat' | 'cron' | 'subagent'
291
290
  }
292
291
 
293
- // Per-session agent settings, persisted server-side in one global file in Moi's
294
- // data dir (NOT in the workspace), exposed via GET/PUT
295
- // /api/workspaces/:id/sessions/:sessionId/config. A session reopens with the same
296
- // model/effort/Fast mode it last ran with; a brand-new session is seeded from the
297
- // corresponding workspace defaults.
292
+ // Missing speed mode behaves as normal.
293
+ export type SpeedMode = 'normal' | 'fast' | 'ultrafast'
294
+
295
+ // Per-chat agent settings, overriding the workspace defaults in
296
+ // `.moi/.workspace.json`. A chat reopens with the model/effort/speed mode it
297
+ // last ran with; a brand-new chat is seeded from the workspace defaults.
298
298
  export type SessionConfig = {
299
299
  model?: string
300
300
  effort?: string
301
- fastMode?: boolean
301
+ speedMode?: SpeedMode
302
302
  }
303
303
 
304
- type SessionForkFields =
305
- | {
306
- forkedFromSessionId?: undefined
307
- forkedThroughMessageId?: never
308
- forkedNoticeIds?: never
309
- }
310
- | {
311
- forkedFromSessionId: string
312
- // Last copied turn in the child. Without a cutoff, show its full history.
313
- forkedThroughMessageId?: string
314
- forkedNoticeIds?: string[]
315
- }
304
+ export type SessionFork = {
305
+ fromSessionId: string
306
+ // Last copied turn in the child. Without a cutoff, show its full history.
307
+ throughMessageId?: string
308
+ noticeIds?: string[]
309
+ }
316
310
 
317
- // Local session fields shared by the saved record and session-list rows.
318
- type SessionMetadata = {
311
+ // Moi's own record of one chat. Titles and history stay with the agent.
312
+ export type WorkspaceSessionState = {
313
+ // The view tab that owns this chat; absent means the overview.
319
314
  tabId?: WorkspaceTabId
320
- } & SessionForkFields
321
-
322
- export type SessionRecord = SessionMetadata & {
323
315
  config?: SessionConfig
316
+ fork?: SessionFork
324
317
  }
325
318
 
326
- export type SessionRecordPatch = Partial<Pick<SessionRecord, 'tabId' | 'config'>> &
327
- SessionForkFields
328
-
329
- // List row returned to the client after local metadata is added.
330
- export type SessionInfo = SessionSummary & SessionMetadata
331
-
332
- export type SelectedSessionState = {
333
- sessionId: string | null
319
+ // Per-user chat state for one workspace, kept in Moi's data dir and served by
320
+ // GET /api/workspaces/:id/state. Every write returns it and publishes it as
321
+ // `state:changed`.
322
+ export type WorkspaceState = {
323
+ // Goes up by one with every saved change. Lets clients drop an older copy
324
+ // that arrives after a newer one.
325
+ revision: number
326
+ // Applies to every tab and overrides `selected`.
327
+ pinnedSessionId?: string
328
+ // The chat each tab shows.
329
+ selected: Partial<Record<WorkspaceTabId, string>>
330
+ sessions: Record<string, WorkspaceSessionState>
331
+ // Views not compiled yet, keyed by view id.
332
+ pendingViews: Record<string, Omit<PendingView, 'id'>>
334
333
  }
335
334
 
336
- export type WorkspaceSessionSelection = {
337
- // A browser tab can explicitly choose an empty chat (null). An absent key
338
- // inherits the server selection, including CLI-created view handoffs.
339
- selected: Partial<Record<WorkspaceTabId, string | null>>
340
- pinned: string | null
341
- }
335
+ // A chat-list row: the agent's session plus the tab that owns it.
336
+ export type SessionInfo = SessionSummary & { tabId?: WorkspaceTabId }
342
337
 
343
338
  // App-wide settings, persisted server-side as `settings.json` in Moi's data
344
339
  // dir and exposed via GET/PATCH /api/settings. Every key has a default, so
345
340
  // GET always returns a complete object.
346
341
  export type AppSettings = {
342
+ showOnboarding: boolean
347
343
  // Apply bundled workspace-skill updates automatically when a workspace
348
344
  // with outdated skills is opened, instead of prompting each time.
349
345
  autoUpdateSkills: boolean
350
346
  }
351
347
 
352
348
  // Client-safe startup config, served by GET /api/config. Deployment settings
353
- // come from config.json and MOI_* env overrides; experimental flags come from
354
- // explicit CLI options. See server/app-config.ts.
349
+ // come from config.json and MOI_* env overrides. See server/app-config.ts.
355
350
  export type AppEnvironment = 'local' | 'cloud'
356
351
 
357
352
  export type ClientAppConfig = {
358
353
  environment: AppEnvironment
354
+ collab: boolean
359
355
  // Demo mode: workspace creation is blocked; the UI offers the
360
356
  // cloud-demo promo dialog instead.
361
357
  demo: boolean
362
- experimental: ExperimentalFeatures
363
358
  // Link target for the cloud-demo promo dialog.
364
359
  demoInstallUrl: string
365
360
  }
366
361
 
367
- export type { ExperimentalFeatures } from './experimental'
368
-
369
362
  export type UpdateStatus = {
370
363
  runningVersion: string
371
364
  availableVersion: string | null
@@ -474,6 +467,7 @@ export type WorkspaceType = 'claude-code' | 'openclaw' | 'codex' | 'hermes'
474
467
 
475
468
  export type WorkspaceSkillStatus = {
476
469
  name: string
470
+ path: string
477
471
  installed: string | null
478
472
  bundled: string | null
479
473
  }
@@ -489,8 +483,10 @@ export type WorkspaceSkillsUpdateFailure = WorkspaceSkillsStatus & {
489
483
 
490
484
  export type HarnessInstallations = Record<WorkspaceType, boolean>
491
485
 
492
- // Setup checks only runtime availability. Workspace checks may also report
493
- // that the provider needs a login the host can start.
486
+ // Shared runtime/account readiness and the current sign-in attempt.
487
+ export type HarnessStatus = { availability: HarnessAvailability; login?: HarnessLoginState }
488
+ export type HarnessStatuses = Record<WorkspaceType, HarnessStatus>
489
+
494
490
  export type HarnessAvailability =
495
491
  | { status: 'available' }
496
492
  | { status: 'login-required'; reason: string }
@@ -513,7 +509,7 @@ export type HarnessLoginState =
513
509
 
514
510
  export type WorkspaceIcon =
515
511
  | { type: 'emoji'; value: string; background?: 'theme' }
516
- | { type: 'glyph'; value: AppIconId; background?: 'theme' }
512
+ | { type: 'glyph'; value: IdentityIconId; background?: 'theme' }
517
513
  | { type: 'upload'; value: string }
518
514
 
519
515
  // One MCP server's connection status, as surfaced by GET /api/workspaces/:id/mcp
@@ -552,7 +548,7 @@ export type WorkspaceEntry = {
552
548
  export type DiscoveredWorkspace = {
553
549
  path: string
554
550
  displayPath?: string
555
- // Deduplicated in canonical provider order by the discovery API.
551
+ // Deduplicated in canonical provider order; empty for folders without agent history.
556
552
  types: WorkspaceType[]
557
553
  }
558
554
 
@@ -629,7 +625,11 @@ export type WorkspaceTabsState = {
629
625
 
630
626
  export type { AgentTheme, ColorTheme, FontTheme, RadiusTheme, WorkspaceTheme } from './themes'
631
627
 
632
- export type WorkspaceLayoutSave = Omit<WorkspaceLayout, 'tabs'> & { tabs?: WorkspaceTabsState }
628
+ export type WorkspaceLayoutSave = Omit<WorkspaceLayout, 'tabs'> & {
629
+ tabs?: WorkspaceTabsState
630
+ // Captured when the edit is made, so delayed saves cannot restore another harness's defaults.
631
+ harness?: WorkspaceType
632
+ }
633
633
 
634
634
  export type WorkspaceLayout = {
635
635
  version: 1
@@ -649,18 +649,26 @@ export type WorkspaceLayout = {
649
649
  // the transcript records the *resolved* id (e.g. `claude-sonnet-4-6`), which
650
650
  // doesn't map back to these aliases — hence we persist the pick here.
651
651
  //
652
- // This (with `selectedEffort` and `selectedFastMode`) is the *workspace
652
+ // This (with `selectedEffort` and `selectedSpeedMode`) is the *workspace
653
653
  // default*: the value the picker edits when no session is open, and the seed a
654
654
  // brand-new session copies. Once a session exists it carries its own per-session
655
655
  // override (see `SessionConfig`).
656
656
  selectedModel?: string
657
657
  // Reasoning-effort default for new sessions (a `supportedEffortLevels` value).
658
658
  selectedEffort?: string
659
- // Fast-mode default for new sessions. Undefined inherits the provider setting.
660
- selectedFastMode?: boolean
659
+ // Speed default for new sessions. Undefined behaves as normal.
660
+ selectedSpeedMode?: SpeedMode
661
661
  theme?: WorkspaceTheme
662
662
  }
663
663
 
664
+ // GET /api/workspaces/:id: layout plus the local workspace registration.
665
+ export type WorkspaceLayoutResponse = WorkspaceLayout & {
666
+ cwd: string
667
+ name: string
668
+ provider?: WorkspaceType
669
+ agentId?: string
670
+ }
671
+
664
672
  // One applet's thumbnail freshness record. Image bytes live as files in the
665
673
  // workspace's `.moi/.cache/thumbnails/` (server/applets/thumbnails.ts), never in
666
674
  // `.workspace.json` — the layout file stays small and commit-safe.
@@ -761,16 +769,17 @@ export type Model = {
761
769
  defaultEffort?: string
762
770
  supportsAdaptiveThinking?: boolean
763
771
  supportsFastMode?: boolean
764
- // Provider-resolved default when moi has no stored Fast-mode preference.
765
- defaultFastMode?: boolean
772
+ supportsUltrafastMode?: boolean
766
773
  supportsAutoMode?: boolean
767
774
  }
768
775
 
769
- // GET /api/workspaces/:id/agent. Model changes arrive on refetch;
776
+ // GET /api/workspaces/:id/harness. Model changes arrive on refetch;
770
777
  // `harness:updated` events refresh availability.
771
- export type WorkspaceAgent = {
772
- workspaceFolderMissing?: boolean
773
- // The agent backend that produced this snapshot — matches the workspace
778
+ export type WorkspaceHarness = {
779
+ /** Credential overrides require workspace readiness instead of shared account status. */
780
+ hasAuthOverrides?: boolean
781
+ isFolderMissing?: boolean
782
+ // The harness that produced this snapshot — matches the workspace
774
783
  // provider.
775
784
  provider: WorkspaceType
776
785
  // Runtime presence and provider auth state, from the server-side cache.
@@ -6,7 +6,6 @@ export function viewBuildDirectives(viewId: string, availableIcons: readonly str
6
6
  `The view id is \`${viewId}\`. Write the view source to \`.moi/views/${viewId}.tsx\`.`,
7
7
  `Before building, set a provisional title and icon: \`moi views set ${viewId} --title "<title>" --icon <icon-id>\`. Use sentence case for the title.`,
8
8
  `Available view icons: ${availableIcons.join(', ')}`,
9
- 'If the user asks for an additional view, create it with: `moi views create --requirements "<complete requirements>"`.',
10
- `When done, do not navigate. Keep the user's current tab open and end your reply with \`[Open the view](moi:/views/${viewId})\`.`
9
+ 'If the user asks for an additional view, create it with: `moi views create --requirements "<complete requirements>"`.'
11
10
  ]
12
11
  }
@@ -1,4 +1,4 @@
1
- import { isAppIconId } from './app-icons'
1
+ import { isIdentityIconId } from './identity-icons'
2
2
  import type { WorkspaceIcon } from './types'
3
3
 
4
4
  export function isWorkspaceIcon(value: unknown): value is WorkspaceIcon {
@@ -11,7 +11,7 @@ export function isWorkspaceIcon(value: unknown): value is WorkspaceIcon {
11
11
  case 'emoji':
12
12
  return icon.value.length > 0 && icon.value.length <= 64
13
13
  case 'glyph':
14
- return isAppIconId(icon.value)
14
+ return isIdentityIconId(icon.value)
15
15
  case 'upload':
16
16
  return icon.background === undefined
17
17
  default:
@@ -3,7 +3,7 @@ import type { WorkspaceLayout, WorkspaceTabsState } from './types'
3
3
  import { isWorkspaceTabId } from './workspace-tabs'
4
4
 
5
5
  export function createDefaultWorkspaceTabs(): WorkspaceTabsState {
6
- return { open: ['overview', 'scratchpad'], active: 'overview' }
6
+ return { open: ['overview'], active: 'overview' }
7
7
  }
8
8
 
9
9
  export function normalizeWorkspaceTabs(value: unknown): WorkspaceTabsState {
@@ -1,14 +1,17 @@
1
- // Validate a workspace folder name as one safe path segment. Shared by the
2
- // server endpoint and the client form so instant feedback cannot drift from the
3
- // authoritative create path.
4
- export function validateWorkspaceFolderName(name: string): string | null {
5
- if (!name) return 'Folder name is required'
6
- if (name.length > 64) return 'Folder name is too long (max 64 characters)'
7
- if (!/^[A-Za-z0-9][A-Za-z0-9._ -]*$/.test(name)) {
8
- return 'Use letters, numbers, dots, dashes, underscores and spaces, starting with a letter or number'
9
- }
10
- if (name.endsWith('.') || name.endsWith(' ')) {
11
- return 'Folder name cannot end with a dot or space'
12
- }
1
+ export function validateWorkspaceName(name: string): string | null {
2
+ if (!name.trim()) return 'Workspace name is required'
3
+ if (name.length > 100) return 'Workspace name is too long (max 100 characters)'
13
4
  return null
14
5
  }
6
+
7
+ export function workspaceIdFromName(name: string): string {
8
+ return (
9
+ name
10
+ .normalize('NFKD')
11
+ .replace(/\p{M}/gu, '')
12
+ .toLowerCase()
13
+ .replace(/[^a-z0-9]+/g, '-')
14
+ .slice(0, 60)
15
+ .replace(/^-|-$/g, '') || 'workspace'
16
+ )
17
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "moi-computer",
3
- "version": "0.12.1-next.2",
3
+ "version": "0.12.1-next.4",
4
4
  "description": "Local AI workspace powered by the Claude Agent SDK, Bun, React, and Tailwind. Requires Bun.",
5
5
  "license": "Elastic-2.0",
6
6
  "type": "module",
@@ -21,7 +21,7 @@
21
21
  "workspace",
22
22
  "cli"
23
23
  ],
24
- "packageManager": "bun@1.3.14",
24
+ "packageManager": "bun@1.4.4",
25
25
  "engines": {
26
26
  "bun": ">=1.3"
27
27
  },
@@ -33,7 +33,7 @@
33
33
  "server",
34
34
  "client",
35
35
  "lib",
36
- "workspace",
36
+ "skill",
37
37
  "registry.json",
38
38
  "ui-components",
39
39
  "bunfig.toml",
@@ -41,10 +41,7 @@
41
41
  "dist",
42
42
  "!**/*.test.ts",
43
43
  "!**/*.test.tsx",
44
- "!server/test",
45
- "!workspace/.env",
46
- "!workspace/.claude/settings.local.json",
47
- "!workspace/.moi"
44
+ "!server/test"
48
45
  ],
49
46
  "scripts": {
50
47
  "dev": "bun server/cli.ts start --dev --debug",
@@ -61,12 +58,13 @@
61
58
  "check:repo": "bun scripts/check-repo.ts"
62
59
  },
63
60
  "dependencies": {
64
- "@anthropic-ai/claude-agent-sdk": "^0.3.263",
61
+ "@anthropic-ai/claude-agent-sdk": "^0.3.317",
65
62
  "@anthropic-ai/sdk": "^0.109.1",
66
63
  "@babel/parser": "^7.29.8",
67
64
  "@base-ui/react": "^1.8.0",
68
65
  "@blobatar/react": "^2.7.0",
69
66
  "@dnd-kit/core": "^6.3.1",
67
+ "@modelcontextprotocol/sdk": "^1.29.0",
70
68
  "@tabler/icons-react": "^3.46.0",
71
69
  "@tailwindcss/typography": "^0.5.20",
72
70
  "@tanstack/react-query": "^5.102.8",
@@ -74,6 +72,7 @@
74
72
  "@tldraw/tlschema": "5.2.3",
75
73
  "@tldraw/utils": "5.2.3",
76
74
  "@types/bun": "1.3.10",
75
+ "async-mutex": "0.5.0",
77
76
  "blobatar": "^2.7.0",
78
77
  "bun-plugin-tailwind": "^0.1.2",
79
78
  "citty": "^0.2.2",
@@ -114,6 +113,7 @@
114
113
  "tw-animate-css": "^1.4.0",
115
114
  "typescript": "^5.9.3",
116
115
  "wouter": "^3.11.0",
116
+ "zod": "^4.3.6",
117
117
  "zustand": "^5.0.15"
118
118
  },
119
119
  "optionalDependencies": {
@@ -127,6 +127,7 @@
127
127
  "@types/react-dom": "^19.2.7",
128
128
  "@types/react-grid-layout": "^2.1.0",
129
129
  "@types/react-resizable": "^3.0.8",
130
+ "bun": ">=1.4.4",
130
131
  "date-fns": "^4.4.0",
131
132
  "embla-carousel-react": "^8.6.0",
132
133
  "linkedom": "0.18.12",
package/server/README.md CHANGED
@@ -5,19 +5,21 @@ WebSocket handlers, and CLI commands call the same feature modules.
5
5
 
6
6
  ## Where code belongs
7
7
 
8
- | Location | Owns |
9
- | --------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
10
- | `api/` | Hono HTTP routes, request validation, workspace lookup middleware, and API tests. `index.ts` assembles and defines the main routes; `harnesses.ts` defines login routes. |
11
- | `cli/commands/` | One module per top-level CLI command, with its subcommands and private helpers. |
12
- | `cli/` | Command registration, help, CLI access gates, terminal formatting, control requests, and server launching. |
13
- | `workspaces/` | Workspace discovery and registration, creation/import, `.moi/` scaffolding, layout, tabs, theme, icons, file previews, and environment settings. |
14
- | `sessions/` | Moi's session metadata, selection and pin state, archiving, ID renames, message attachments, and pending-view chat handoffs. Provider-owned history stays in the harnesses. |
15
- | `applets/` | View/widget manifests, source analysis, builds, CSS scoping, typechecking, bundle serving, server-function workers, thumbnails, UI component installation, and the error journal. |
16
- | `scratchpad/` | Canvas documents, assets, headless drawing, and browser screenshot requests. |
17
- | `skills/` | Bundled workspace skill installation, version checks, and updates. These modules manage the copies shipped under `workspace/`. |
18
- | `harness/` | Provider adapters, transports, sessions, discovery, authentication, and readiness. See [the harness guide](harness/README.md). |
19
- | `collab/` | Optional collaboration workers, presence, proxy identity, and the collaboration skill. |
20
- | `test/` | Integration tests and existing tests that share fixtures. Other unit tests live beside their modules. |
8
+ | Location | Owns |
9
+ | ------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
10
+ | `api/` | Hono HTTP routes, request validation, workspace lookup middleware, and API tests. `index.ts` assembles and defines the main routes; `harnesses.ts` defines login routes. |
11
+ | `cli/commands/` | One module per top-level CLI command, with its subcommands and private helpers. |
12
+ | `cli/` | Command registration, help, CLI access gates, terminal formatting, control requests, and server launching. |
13
+ | `workspaces/` | Workspace discovery and registration, creation/import, `.moi/` scaffolding, layout, tabs, theme, icons, file previews, and environment settings. |
14
+ | `sessions/` | Moi's session metadata, selection and pin state, archiving, ID renames, message attachments, and pending-view chat handoffs. Provider-owned history stays in the harnesses. |
15
+ | `workspace-state/` | Per-workspace `state.json` storage: one writer per workspace, transactions, atomic writes, lock timeout, a revision and a `state:changed` event per change, re-adoption of a removed workspace's id, and the one-time legacy migration. |
16
+ | `applets/` | View/widget manifests, source analysis, builds, CSS scoping, typechecking, bundle serving, server-function workers, thumbnails, UI component installation, and the error journal. |
17
+ | `scratchpad/` | Canvas documents, assets, headless drawing, and browser screenshot requests. |
18
+ | `skills/` | Bundled workspace skill installation, version checks, and updates. These modules manage the copies shipped under `workspace/`. |
19
+ | `harness/` | Provider adapters, transports, sessions, discovery, authentication, and readiness. See [the harness guide](harness/README.md). |
20
+ | `collab/` | Cloud collaboration workers, presence, proxy identity, and the optional collaboration skill. |
21
+ | `onboarding/` | Idea discovery, its prompt and output validation, and workspace creation jobs. HTTP handlers live in [api/onboarding.ts](api/onboarding.ts). |
22
+ | `test/` | Integration tests and existing tests that share fixtures. Other unit tests live beside their modules. |
21
23
 
22
24
  Use direct module imports such as `workspaces/registry` or `sessions/store`.
23
25
  Keep shared helpers in the feature that owns them. A folder does not imply a
@@ -54,18 +56,18 @@ corresponding directory above.
54
56
 
55
57
  ## Storage ownership
56
58
 
57
- | State | Location and owner |
58
- | ------------------------------------------------ | ---------------------------------------------------------------------------------------- |
59
- | Workspace layout, theme, and tab configuration | `.moi/.workspace.json`, read and written by `workspaces/layout.ts` |
60
- | Applet source | `.moi/views/`, `.moi/widgets/`, and shared workspace source |
61
- | Generated bundles and thumbnails | `.moi/.build/` and `.moi/.cache/`; re-creatable |
62
- | Scratchpad document and image bytes | `.moi/.scratchpad.json` and `.moi/.scratchpad/`; preserve both |
63
- | Registered workspaces | `DATA_DIR/workspaces.json`, owned by `workspaces/registry.ts` |
64
- | Session attribution, settings, and fork metadata | `DATA_DIR/sessions.json`, owned by `sessions/store.ts` |
65
- | Selected and pinned sessions | `DATA_DIR/selected-sessions.json`, owned by `sessions/selected.ts` |
66
- | Pending view creation | `DATA_DIR/pending-views.json`, owned by `sessions/pending-views.ts` |
67
- | Workspace environment preferences and secrets | `workspaces/env.ts`; metadata in `DATA_DIR`, secrets in the OS keychain or file fallback |
68
- | Provider credentials and conversation history | Owned by each provider; see `harness/README.md` |
59
+ | State | Location and owner |
60
+ | ----------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
61
+ | Workspace layout, theme, and tab configuration | `.moi/.workspace.json`, read and written by `workspaces/layout.ts` |
62
+ | Applet source | `.moi/views/`, `.moi/widgets/`, and shared workspace source |
63
+ | Generated bundles and thumbnails | `.moi/.build/` and `.moi/.cache/`; re-creatable |
64
+ | Scratchpad document and image bytes | `.moi/.scratchpad.json` and `.moi/.scratchpad/`; preserve both |
65
+ | Installation-wide app settings, including `showOnboarding` | `DATA_DIR/settings.json`, owned by `app-settings.ts` |
66
+ | Onboarding discovery results and workspace creation operation records | `DATA_DIR/onboarding/`, owned by [onboarding/jobs.ts](onboarding/jobs.ts) |
67
+ | Registered workspaces | `DATA_DIR/workspaces.json`, owned by `workspaces/registry.ts` |
68
+ | Session attribution, settings, and fork metadata; selected and pinned sessions; pending view creation | `DATA_DIR/workspaces/<workspace id>/state.json`, stored by `workspace-state/`; meaning owned by `sessions/store.ts`, `sessions/selected.ts`, and `sessions/pending-views.ts` |
69
+ | Workspace environment preferences and secrets | `workspaces/env.ts`; metadata in `DATA_DIR`, secrets in the OS keychain or file fallback |
70
+ | Provider credentials and conversation history | Owned by each provider; see `harness/README.md` |
69
71
 
70
72
  Client-local UI choices are documented in [the root instructions](../AGENTS.md)
71
73
  and [view/chat behavior](../docs/view-chats.md). Changing a module's location
@@ -2,12 +2,30 @@ import { Hono } from 'hono'
2
2
 
3
3
  import type { WorkspaceType } from '@/lib/types'
4
4
 
5
+ import { loginShellPath } from '../harness/shell-path'
6
+ import { installHarness } from '../harness/install'
5
7
  import { harnessStore } from '../harness/auth'
6
- import { harnessFor, isHarnessType } from '../harness/registry'
8
+ import { allHarnesses, harnessFor, isHarnessType } from '../harness/registry'
7
9
 
8
10
  export const harnesses = new Hono<{ Variables: { harnessType: WorkspaceType } }>()
9
11
 
10
- harnesses.use('/:type/auth/*', async (c, next) => {
12
+ harnesses.get('/status', async c => {
13
+ c.header('Cache-Control', 'no-store')
14
+ const fresh = c.req.query('refresh') === 'true'
15
+ if (fresh) await loginShellPath({ refresh: true })
16
+ const statuses = await Promise.all(
17
+ allHarnesses().map(async ({ id }) => [
18
+ id,
19
+ {
20
+ availability: await harnessStore.getAvailability(id, fresh),
21
+ login: harnessStore.getLogin(id)
22
+ }
23
+ ])
24
+ )
25
+ return c.json(Object.fromEntries(statuses))
26
+ })
27
+
28
+ harnesses.use('/:type/*', async (c, next) => {
11
29
  const type = c.req.param('type')
12
30
  if (!isHarnessType(type)) return c.text('Unknown agent', 404)
13
31
  const harness = harnessFor(type)
@@ -19,12 +37,17 @@ harnesses.use('/:type/auth/*', async (c, next) => {
19
37
  await next()
20
38
  })
21
39
 
22
- harnesses.get('/:type/auth', async c => {
23
- const context = c.get('harnessType')
24
- return c.json({
25
- availability: await harnessStore.getAvailability(context),
26
- login: harnessStore.getLogin(context)
27
- })
40
+ harnesses.post('/:type/auth/install', async c => {
41
+ const origin = c.req.header('Origin')
42
+ if (origin && origin !== new URL(c.req.url).origin) return c.text('Invalid origin', 403)
43
+ try {
44
+ const type = c.get('harnessType')
45
+ await installHarness(type)
46
+ await harnessStore.refresh(type)
47
+ return c.json({ ok: true })
48
+ } catch (error) {
49
+ return c.text(error instanceof Error ? error.message : 'Could not install agent', 400)
50
+ }
28
51
  })
29
52
 
30
53
  harnesses.post('/:type/auth/login', async c => {