moi-computer 0.12.1-next.3 → 0.13.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (236) 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 +4 -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 +1 -1
  11. package/client/app/routes/workspace-route.tsx +21 -19
  12. package/client/components/shared/screen-shell.tsx +23 -0
  13. package/client/components/shared/ultrafast-icon.tsx +61 -0
  14. package/client/components/shared/workspace-icon.tsx +2 -2
  15. package/client/features/account/account-test-utils.tsx +4 -3
  16. package/client/features/app-settings/api.ts +33 -0
  17. package/client/features/app-settings/general-settings.tsx +39 -0
  18. package/client/features/{settings → app-settings}/settings-page.tsx +5 -1
  19. package/client/features/chat/applet-chat-intents.ts +4 -20
  20. package/client/features/chat/chat-send.ts +17 -13
  21. package/client/features/chat/composer/model-order.ts +8 -4
  22. package/client/features/chat/composer/model-picker.tsx +88 -34
  23. package/client/features/chat/composer/use-workspace-composer-state.tsx +11 -3
  24. package/client/features/chat/composer/use-workspace-skill-updates.ts +1 -1
  25. package/client/features/chat/connection/chat-frames.ts +3 -15
  26. package/client/features/chat/messages/chat-empty-state.tsx +1 -4
  27. package/client/features/chat/messages/fork-history.ts +5 -5
  28. package/client/features/chat/messages/tool-group/subagent-card.tsx +1 -0
  29. package/client/features/chat/messages/turn-view.tsx +3 -12
  30. package/client/features/chat/messages/user-message-bubble.tsx +63 -0
  31. package/client/features/chat/sessions/api.ts +121 -80
  32. package/client/features/chat/sessions/browser-tab-state.ts +14 -12
  33. package/client/features/chat/sessions/chat-selector.tsx +5 -6
  34. package/client/features/chat/sessions/use-selected-session.ts +172 -257
  35. package/client/features/chat/use-chat.ts +14 -19
  36. package/client/features/collab/components/user-avatar.tsx +4 -10
  37. package/client/features/collab/workspace-users-menu.tsx +1 -1
  38. package/client/features/connectors/api.ts +12 -4
  39. package/client/features/connectors/mcp-server-cards.tsx +17 -7
  40. package/client/features/connectors/read-connectors.ts +35 -0
  41. package/client/features/demo/demo-dialog.tsx +11 -3
  42. package/client/features/dev/collab/local-user-settings.tsx +1 -1
  43. package/client/features/dev/dev-index-page.tsx +5 -0
  44. package/client/features/dev/dev-routes.tsx +2 -0
  45. package/client/features/dev/harness-debug-page.tsx +3 -3
  46. package/client/features/dev/onboarding-preview-page.tsx +76 -0
  47. package/client/features/dev/workspace-setup-mocks.ts +16 -14
  48. package/client/features/dev/workspace-setup-preview.tsx +11 -17
  49. package/client/features/harness/api.ts +45 -15
  50. package/client/features/harness/device-login-steps.tsx +9 -3
  51. package/client/features/harness/harness-login-panel.tsx +228 -0
  52. package/client/features/harness/harness-presentation.ts +15 -0
  53. package/client/features/harness/harness-selector.tsx +119 -0
  54. package/client/features/harness/use-harness-login.ts +77 -0
  55. package/client/features/home/home-page.tsx +7 -7
  56. package/client/features/onboarding/agent-setup-step.tsx +57 -0
  57. package/client/features/onboarding/api.ts +42 -0
  58. package/client/features/onboarding/onboarding-idea-disk.tsx +129 -0
  59. package/client/features/onboarding/onboarding-page.tsx +32 -0
  60. package/client/features/onboarding/onboarding-screen.tsx +20 -0
  61. package/client/features/onboarding/onboarding-status.tsx +24 -0
  62. package/client/features/onboarding/workspace-setup-step.tsx +239 -0
  63. package/client/features/overview/default/registry.tsx +2 -2
  64. package/client/features/overview/default/views-widget.tsx +6 -5
  65. package/client/features/overview/overview.tsx +9 -11
  66. package/client/features/overview/widget-canvas.tsx +1 -1
  67. package/client/features/overview/workspace-name.tsx +2 -2
  68. package/client/features/views/api.ts +69 -16
  69. package/client/features/views/pending-view-screen.tsx +30 -9
  70. package/client/features/views/use-view-actions.ts +19 -20
  71. package/client/features/views/view-presentation.ts +2 -2
  72. package/client/features/views/view-submission.ts +28 -41
  73. package/client/features/workspace/add/api.ts +3 -23
  74. package/client/features/workspace/add/create-workspace-dialog.tsx +6 -5
  75. package/client/features/workspace/add/import-workspace-dialog.tsx +3 -3
  76. package/client/features/workspace/add/workspace-agent-options.ts +11 -12
  77. package/client/features/workspace/add/workspace-agent-selector.tsx +3 -132
  78. package/client/features/workspace/api.ts +32 -36
  79. package/client/features/workspace/harness-transition.ts +89 -0
  80. package/client/features/{settings → workspace/settings}/api.ts +1 -34
  81. package/client/features/{settings → workspace/settings}/connectors-settings.tsx +31 -10
  82. package/client/features/workspace/settings/general-settings.tsx +180 -0
  83. package/client/features/{settings → workspace/settings}/use-env-vars.ts +1 -1
  84. package/client/features/{settings → workspace/settings}/workspace-icon-picker.tsx +3 -3
  85. package/client/features/workspace/setup/workspace-login-state.tsx +37 -156
  86. package/client/features/workspace/setup/workspace-recovery-states.tsx +0 -12
  87. package/client/features/workspace/setup/workspace-setup.tsx +34 -14
  88. package/client/features/workspace/setup/workspace-welcome-state.tsx +2 -2
  89. package/client/features/workspace/use-workspace-navigation.ts +25 -9
  90. package/client/features/workspace/workspace-content.tsx +11 -8
  91. package/client/features/workspace/workspace-frame.tsx +2 -1
  92. package/client/features/workspace/workspace-layout-context.tsx +5 -2
  93. package/client/features/workspace/workspace-menu.tsx +12 -8
  94. package/client/features/workspace/workspace-pending-screen.tsx +10 -10
  95. package/client/features/workspace/workspace-presentation.tsx +5 -13
  96. package/client/features/workspace/workspace-state.ts +169 -0
  97. package/client/features/workspace/workspace-tabs.tsx +22 -2
  98. package/client/index.css +2 -0
  99. package/client/index.tsx +3 -3
  100. package/client/lib/flags.ts +1 -1
  101. package/client/lib/{app-icon-registry.ts → identity-icon-registry.ts} +10 -14
  102. package/client/runtime/workspace-events.ts +21 -4
  103. package/client/runtime/workspace-theme.ts +9 -0
  104. package/client/tailwind-config.ts +43 -0
  105. package/dist/chunk-2y59vrxg.js +5 -0
  106. package/dist/chunk-58dyt9bk.js +2 -0
  107. package/dist/{chunk-tqd3pkg8.css → chunk-60q353jq.css} +1 -1
  108. package/dist/chunk-bncc7heg.js +1 -0
  109. package/dist/{chunk-11cab5dq.css → chunk-cq2r11fg.css} +1 -1
  110. package/dist/chunk-cqt3s31j.js +546 -0
  111. package/dist/chunk-dcmks9sm.js +75 -0
  112. package/dist/chunk-md45evr2.css +1 -0
  113. package/dist/chunk-n0nab26d.js +1 -0
  114. package/dist/chunk-nf2wkvf9.js +14 -0
  115. package/dist/chunk-nmzhgyp9.js +2 -0
  116. package/dist/chunk-q37knr3m.js +2 -0
  117. package/dist/chunk-s90m4qkz.js +1 -0
  118. package/dist/chunk-wjvd4byz.js +2 -0
  119. package/dist/index.html +1 -1
  120. package/lib/harness-instructions.ts +1 -1
  121. package/lib/{app-icons.ts → identity-icons.ts} +6 -7
  122. package/lib/onboarding.ts +41 -0
  123. package/lib/speed-mode.ts +5 -0
  124. package/lib/types.ts +75 -64
  125. package/lib/view-build-directives.ts +1 -2
  126. package/lib/workspace-icon.ts +2 -2
  127. package/lib/workspace-layout.ts +1 -1
  128. package/lib/workspace-name.ts +15 -12
  129. package/package.json +11 -8
  130. package/server/README.md +27 -25
  131. package/server/api/harnesses.ts +31 -8
  132. package/server/api/index.ts +189 -127
  133. package/server/api/onboarding.ts +46 -0
  134. package/server/app-config.ts +16 -24
  135. package/server/app-settings.ts +6 -2
  136. package/server/applets/config.ts +5 -5
  137. package/server/applets/views.ts +19 -17
  138. package/server/cli/commands/init.ts +3 -3
  139. package/server/cli/commands/skill.ts +16 -17
  140. package/server/cli/commands/start.ts +8 -34
  141. package/server/cli/server.ts +18 -6
  142. package/server/collab/config.ts +1 -2
  143. package/server/collab/manager.ts +4 -1
  144. package/server/collab/skill/index.ts +1 -1
  145. package/server/control.ts +3 -3
  146. package/server/data-dir.ts +1 -1
  147. package/server/harness/README.md +24 -8
  148. package/server/harness/acp/session.ts +8 -4
  149. package/server/harness/auth.ts +14 -17
  150. package/server/harness/claude-code/NOTES.md +4 -3
  151. package/server/harness/claude-code/index.ts +5 -6
  152. package/server/harness/claude-code/mcp.ts +17 -0
  153. package/server/harness/claude-code/models.ts +2 -20
  154. package/server/harness/claude-code/run-action.ts +123 -0
  155. package/server/harness/claude-code/session-title.ts +5 -7
  156. package/server/harness/claude-code/session.ts +24 -16
  157. package/server/harness/codex/NOTES.md +22 -10
  158. package/server/harness/codex/adapter.ts +14 -17
  159. package/server/harness/codex/client.ts +8 -5
  160. package/server/harness/codex/connectors.ts +92 -0
  161. package/server/harness/codex/index.ts +4 -1
  162. package/server/harness/codex/pagination.ts +8 -5
  163. package/server/harness/codex/run-action.ts +93 -0
  164. package/server/harness/codex/session-title.ts +6 -8
  165. package/server/harness/codex/session.ts +11 -11
  166. package/server/harness/codex/transport.ts +13 -6
  167. package/server/harness/command.ts +45 -0
  168. package/server/harness/executable.ts +5 -0
  169. package/server/harness/fork.ts +6 -4
  170. package/server/harness/install.ts +49 -0
  171. package/server/harness/openclaw/session.ts +1 -2
  172. package/server/harness/run-action.ts +85 -0
  173. package/server/harness/session-title.ts +0 -46
  174. package/server/harness/types.ts +30 -3
  175. package/server/onboarding/brief.ts +29 -0
  176. package/server/onboarding/ideas.ts +48 -0
  177. package/server/onboarding/jobs.ts +291 -0
  178. package/server/onboarding/prompt.md +49 -0
  179. package/server/sessions/archive.ts +5 -14
  180. package/server/sessions/config.ts +17 -16
  181. package/server/sessions/lifecycle.ts +15 -13
  182. package/server/sessions/pending-views.ts +79 -108
  183. package/server/sessions/selected.ts +75 -161
  184. package/server/sessions/store.ts +40 -113
  185. package/server/sessions/view-sessions.ts +128 -111
  186. package/server/skills/locations.ts +82 -0
  187. package/server/skills/lock.ts +29 -0
  188. package/server/skills/template.ts +36 -25
  189. package/server/skills/update.ts +52 -5
  190. package/server/skills/version.ts +17 -22
  191. package/server/skills/workspace.ts +121 -0
  192. package/server/web.ts +22 -8
  193. package/server/workspace-state/file.ts +177 -0
  194. package/server/workspace-state/index.ts +162 -0
  195. package/server/workspace-state/legacy-migration.ts +79 -0
  196. package/server/workspace-state/lock.ts +42 -0
  197. package/server/workspace-state/types.ts +16 -0
  198. package/server/workspaces/change-harness.ts +88 -0
  199. package/server/workspaces/harness-transition.ts +29 -0
  200. package/server/workspaces/init.ts +29 -6
  201. package/server/workspaces/layout.ts +3 -0
  202. package/server/workspaces/registry.ts +27 -1
  203. package/{workspace/.claude/skills/moi-workspace → skill}/SKILL.md +7 -5
  204. package/{workspace/.claude/skills/moi-workspace → skill}/references/COLLAB.md +4 -8
  205. package/skill/references/DESIGN.md +167 -0
  206. package/{workspace/.claude/skills/moi-workspace → skill}/references/SCRATCHPAD.md +2 -2
  207. package/{workspace/.claude/skills/moi-workspace → skill}/references/UI-COMPONENTS.md +3 -0
  208. package/ui-components/badge.tsx +1 -1
  209. package/client/accept-hmr-dependencies.ts +0 -22
  210. package/client/features/settings/general-settings.tsx +0 -103
  211. package/client/features/workspace/setup/workspace-setup-panel.tsx +0 -18
  212. package/dist/chunk-20ynagd4.js +0 -2
  213. package/dist/chunk-42tde9a6.js +0 -1
  214. package/dist/chunk-9w543s0r.js +0 -2
  215. package/dist/chunk-a5372n61.js +0 -546
  216. package/dist/chunk-aja9y1vn.js +0 -68
  217. package/dist/chunk-fvcvrh3d.css +0 -1
  218. package/dist/chunk-gtfjw3nx.js +0 -1
  219. package/dist/chunk-j39y2aky.js +0 -14
  220. package/dist/chunk-pcnahct1.js +0 -5
  221. package/dist/chunk-pja30km3.js +0 -1
  222. package/dist/chunk-rm894bc2.js +0 -2
  223. package/dist/chunk-tevvtfbk.js +0 -10
  224. package/dist/chunk-tgt9zd0r.js +0 -2
  225. package/dist/chunk-tv5k5z00.js +0 -1
  226. package/dist/chunk-zq2ae5dx.js +0 -2
  227. package/lib/experimental.ts +0 -14
  228. package/workspace/.claude/skills/moi-workspace/references/DESIGN.md +0 -157
  229. /package/client/features/{settings → app-settings}/profile-settings.tsx +0 -0
  230. /package/client/features/{settings → app-settings}/settings-section.tsx +0 -0
  231. /package/client/features/{settings → app-settings}/users-settings.tsx +0 -0
  232. /package/client/features/{settings → workspace/settings}/environment-settings.tsx +0 -0
  233. /package/client/features/{settings → workspace/settings}/icon-picker-options.ts +0 -0
  234. /package/client/features/{settings → workspace/settings}/settings-layout.tsx +0 -0
  235. /package/client/features/{settings → workspace/settings}/workspace-settings-dialog.tsx +0 -0
  236. /package/{workspace/.claude/skills/moi-workspace → skill}/references/INTENTS.md +0 -0
package/bunfig.toml CHANGED
@@ -1,10 +1,6 @@
1
1
 
2
2
  [serve.static]
3
- plugins = [
4
- "bun-plugin-tailwind",
5
- "./client/externalize-react.ts",
6
- "./client/accept-hmr-dependencies.ts"
7
- ]
3
+ plugins = ["bun-plugin-tailwind", "./client/externalize-react.ts"]
8
4
  # Inline only PUBLIC_*-prefixed env vars into the client bundle (e.g. the tldraw
9
5
  # license key, PUBLIC_TLDRAW_LICENSE_KEY). The prefix keeps private secrets out
10
6
  # of the browser bundle. Mirrored for prod builds in scripts/build-client.ts.
@@ -1,7 +1,6 @@
1
1
  import { useSyncExternalStore } from 'react'
2
2
 
3
3
  import type { ClientAppConfig } from '@/lib/types'
4
- import { EXPERIMENTAL_DEFAULTS } from '@/lib/experimental'
5
4
 
6
5
  import { requestJson } from './http'
7
6
 
@@ -13,8 +12,8 @@ import { requestJson } from './http'
13
12
 
14
13
  const DEFAULTS: ClientAppConfig = {
15
14
  environment: 'local',
15
+ collab: false,
16
16
  demo: false,
17
- experimental: { ...EXPERIMENTAL_DEFAULTS },
18
17
  demoInstallUrl: 'https://moi.computer'
19
18
  }
20
19
 
@@ -1,4 +1,6 @@
1
1
  export const appUiKeys = {
2
2
  all: ['app-ui'] as const,
3
- sessionSelection: (workspaceId: string) => ['app-ui', 'session-selection', workspaceId] as const
3
+ // Collab: this browser tab's own chat choice per workspace tab.
4
+ browserTabSelection: (workspaceId: string) =>
5
+ ['app-ui', 'browser-tab-selection', workspaceId] as const
4
6
  }
@@ -22,7 +22,10 @@ export async function requestVoid(
22
22
  if (!response.ok) throw await errorFrom(response, error)
23
23
  }
24
24
 
25
- export function jsonRequest(method: 'POST' | 'PUT' | 'PATCH', body?: unknown): RequestInit {
25
+ export function jsonRequest(
26
+ method: 'POST' | 'PUT' | 'PATCH' | 'DELETE',
27
+ body?: unknown
28
+ ): RequestInit {
26
29
  return {
27
30
  method,
28
31
  headers: { 'Content-Type': 'application/json' },
@@ -1,7 +1,6 @@
1
1
  export const workspaceKeys = {
2
2
  all: ['workspaces'] as const,
3
3
  discover: ['workspaces', 'discover'] as const,
4
- creationInfo: ['workspaces', 'creation-info'] as const,
5
4
  // Every workspace's home-card preview, fetched in one batch.
6
5
  previews: ['workspaces', 'previews'] as const,
7
6
  layout: (id: string) => ['workspaces', 'layout', id] as const,
@@ -10,9 +9,10 @@ export const workspaceKeys = {
10
9
  views: (id: string) => ['workspaces', 'views', id] as const,
11
10
  sessions: (id: string) => ['workspaces', 'sessions', id] as const,
12
11
  events: (id: string, sessionId: string) => ['workspaces', 'events', id, sessionId] as const,
13
- session: (id: string, sessionId: string) => ['workspaces', 'session', id, sessionId] as const,
12
+ // Per-user chat state (`GET /api/workspaces/:id/state`).
13
+ state: (id: string) => ['workspaces', 'state', id] as const,
14
14
  mcp: (id: string) => ['workspaces', 'mcp', id] as const,
15
- agent: (id: string) => ['workspaces', 'agent', id] as const,
15
+ harness: (id: string) => ['workspaces', 'harness', id] as const,
16
16
  skills: (id: string) => ['workspaces', 'skills', id] as const,
17
17
  env: (id: string) => ['workspaces', 'env', id] as const
18
18
  }
@@ -1,3 +1,5 @@
1
+ import type { HarnessStatuses } from '@/lib/types'
2
+ import { useQueryClient } from '@tanstack/react-query'
1
3
  import { type ReactNode, useEffect, useState } from 'react'
2
4
 
3
5
  import { wsUrl } from '@/client/lib/ws-url'
@@ -12,14 +14,32 @@ type AppProviderProps = {
12
14
  // events socket when the app mounts and closes it when the app unmounts, so
13
15
  // the connection outlives every route.
14
16
  export function AppProvider({ children }: AppProviderProps) {
17
+ const client = useQueryClient()
15
18
  const [value] = useState<AppContextValue>(() => ({
16
19
  events: new WorkspaceEventsClient(wsUrl('/api/workspaces/ws'))
17
20
  }))
18
21
 
19
22
  useEffect(() => {
23
+ const unsubscribe = value.events.subscribe(event => {
24
+ if (event.type === 'harness-status:changed') {
25
+ const queryKey = ['harness-status']
26
+ void client.cancelQueries({ queryKey })
27
+ client.setQueryData<HarnessStatuses>(queryKey, previous =>
28
+ previous ? { ...previous, [event.harness]: event.status } : undefined
29
+ )
30
+ if (!client.getQueryData(queryKey)) void client.invalidateQueries({ queryKey })
31
+ if (event.status.availability.status === 'available')
32
+ void client.invalidateQueries({ queryKey: ['workspaces', 'harness'] })
33
+ } else if (event.type === 'connection:opened' || event.type === 'harness:updated') {
34
+ void client.invalidateQueries({ queryKey: ['harness-status'] })
35
+ }
36
+ })
20
37
  value.events.connect()
21
- return () => value.events.close()
22
- }, [value])
38
+ return () => {
39
+ unsubscribe()
40
+ value.events.close()
41
+ }
42
+ }, [value, client])
23
43
 
24
44
  return <AppContext value={value}>{children}</AppContext>
25
45
  }
@@ -1,8 +1,10 @@
1
+ import { OnboardingRoute } from './routes/onboarding-route'
1
2
  import { Suspense, lazy, useEffect } from 'react'
2
3
 
3
4
  import { Redirect, Route, Switch, useLocation } from 'wouter'
4
5
 
5
6
  import { setWorkspaceSwitchHandler } from '@/client/features/chat/connection/chat-connection'
7
+ import { useWorkspaceStateSync } from '@/client/features/workspace/workspace-state'
6
8
 
7
9
  import { SettingsRoute } from './routes/settings-route'
8
10
  import { HomeRoute } from './routes/home-route'
@@ -30,6 +32,7 @@ function DevLazy() {
30
32
  // Top-level router — sets up all client-side routes
31
33
  export function AppRouter() {
32
34
  const [, navigate] = useLocation()
35
+ useWorkspaceStateSync()
33
36
 
34
37
  // When the server broadcasts a workspace:switch (e.g. from `moi start`),
35
38
  // navigate to that workspace
@@ -42,6 +45,7 @@ export function AppRouter() {
42
45
  <Switch>
43
46
  <Route path="/dev/*?" component={DevLazy} />
44
47
  <Route path="/" component={HomeRoute} />
48
+ <Route path="/onboarding" component={OnboardingRoute} />
45
49
  <Route path="/settings" component={SettingsRoute} />
46
50
  {/* The wildcard is the destination path (`views/orders`, `overview`, …) —
47
51
  the URL is the tab address, read downstream with `useParams`. This
@@ -1,8 +1,22 @@
1
+ import { ScreenShell } from '@/client/components/shared/screen-shell'
2
+ import { Redirect } from 'wouter'
3
+ import { useOnboardingSettings } from '@/client/features/onboarding/api'
4
+ import { OnboardingStatus } from '@/client/features/onboarding/onboarding-status'
1
5
  import { SidebarLayout } from '@/client/app/shell/sidebar-layout'
2
6
  import { HomePage } from '@/client/features/home/home-page'
3
7
 
4
8
  // The `/` route: the app shell wrapping the workspaces view.
5
9
  export function HomeRoute() {
10
+ const onboarding = useOnboardingSettings()
11
+ if (onboarding.loading || onboarding.error)
12
+ return (
13
+ <main className="flex h-dvh flex-col overflow-hidden">
14
+ <ScreenShell>
15
+ <OnboardingStatus error={onboarding.error || undefined} onRetry={onboarding.retry} />
16
+ </ScreenShell>
17
+ </main>
18
+ )
19
+ if (onboarding.enabled && onboarding.data?.showOnboarding) return <Redirect to="/onboarding" />
6
20
  return (
7
21
  <SidebarLayout showWorkspaces={false}>
8
22
  <div className="min-h-0 flex-1 overflow-y-auto">
@@ -0,0 +1,11 @@
1
+ import { ScreenShell } from '@/client/components/shared/screen-shell'
2
+ import { OnboardingPage } from '@/client/features/onboarding/onboarding-page'
3
+ export function OnboardingRoute() {
4
+ return (
5
+ <main className="flex h-dvh flex-col overflow-hidden">
6
+ <ScreenShell>
7
+ <OnboardingPage />
8
+ </ScreenShell>
9
+ </main>
10
+ )
11
+ }
@@ -1,5 +1,5 @@
1
1
  import { SidebarLayout } from '@/client/app/shell/sidebar-layout'
2
- import { SettingsPage } from '@/client/features/settings/settings-page'
2
+ import { SettingsPage } from '@/client/features/app-settings/settings-page'
3
3
 
4
4
  export function SettingsRoute() {
5
5
  return (
@@ -1,3 +1,4 @@
1
+ import { useWorkspaceHarnessChanges } from '@/client/features/workspace/harness-transition'
1
2
  import { useWorkspaceTheme } from '@/client/runtime/workspace-theme'
2
3
  import { CollabProvider, useCollabEnabled } from '@/client/features/collab'
3
4
  import { useQueryClient } from '@tanstack/react-query'
@@ -25,16 +26,18 @@ type WorkspaceRouteProps = {
25
26
  // Navigation reads the raw browser address so encoded paths and query params
26
27
  // are decoded exactly once; the route only owns the workspace ID.
27
28
  export function WorkspaceRoute({ id }: WorkspaceRouteProps) {
28
- const { experimental } = useAppConfig()
29
+ const { collab } = useAppConfig()
29
30
 
30
31
  return (
31
- <Workspace id={id}>
32
- <WorkspaceLayoutProvider id={id}>
33
- <CollabProvider workspaceId={id} enabled={experimental.collab}>
34
- <WorkspaceContent id={id} />
35
- </CollabProvider>
36
- </WorkspaceLayoutProvider>
37
- </Workspace>
32
+ <SidebarLayout>
33
+ <Workspace id={id}>
34
+ <WorkspaceLayoutProvider id={id}>
35
+ <CollabProvider workspaceId={id} enabled={collab}>
36
+ <WorkspaceContent id={id} />
37
+ </CollabProvider>
38
+ </WorkspaceLayoutProvider>
39
+ </Workspace>
40
+ </SidebarLayout>
38
41
  )
39
42
  }
40
43
 
@@ -42,7 +45,8 @@ function WorkspaceContent({ id }: WorkspaceRouteProps) {
42
45
  const collabEnabled = useCollabEnabled()
43
46
  const queryClient = useQueryClient()
44
47
  const [selectedSessionId] = useSelectedSession()
45
- const { isLoading: layoutLoading, layout } = useWorkspaceLayoutCtx()
48
+ const { isLoading: layoutLoading, layout, provider } = useWorkspaceLayoutCtx()
49
+ useWorkspaceHarnessChanges(id, provider)
46
50
  useWorkspaceTheme(layout.theme)
47
51
  const widgets = useWidgets(id)
48
52
  const views = useViews(id)
@@ -58,7 +62,7 @@ function WorkspaceContent({ id }: WorkspaceRouteProps) {
58
62
  // widget:updated too: a rebundle bumps the widget's content revision, and
59
63
  // the thumbnail invalidation hook reads it off this query.
60
64
  queryClient.invalidateQueries({ queryKey: workspaceKeys.widgets(id) })
61
- } else if (event.type === 'view-layout:updated' || event.type === 'view:updated') {
65
+ } else if (event.type === 'view:updated') {
62
66
  // view:updated also bumps the built bundle revision used by thumbnail
63
67
  // freshness checks.
64
68
  queryClient.invalidateQueries({ queryKey: workspaceKeys.views(id) })
@@ -69,14 +73,12 @@ function WorkspaceContent({ id }: WorkspaceRouteProps) {
69
73
  layoutLoading || selectedSessionId === undefined || widgets.isLoading || views.isLoading
70
74
 
71
75
  return (
72
- <SidebarLayout>
73
- {/* Reset the screen when switching between shared and browser tab state. */}
74
- <WorkspaceScreen
75
- key={collabEnabled ? 'browser-tab' : 'shared'}
76
- contentPending={contentPending}
77
- widgets={widgets.data}
78
- views={views.data ?? []}
79
- />
80
- </SidebarLayout>
76
+ // Reset the screen when switching between shared and browser tab state.
77
+ <WorkspaceScreen
78
+ key={collabEnabled ? 'browser-tab' : 'shared'}
79
+ contentPending={contentPending}
80
+ widgets={widgets.data}
81
+ views={views.data ?? []}
82
+ />
81
83
  )
82
84
  }
@@ -0,0 +1,23 @@
1
+ import type { ComponentProps } from 'react'
2
+
3
+ import { cn } from '@/client/lib/cn'
4
+
5
+ type ScreenShellProps = ComponentProps<'section'>
6
+
7
+ // Shared backdrop for standalone flows and setup panes. The caller controls
8
+ // the available height, content width, spacing, and alignment.
9
+ export function ScreenShell({ children, className, ...props }: ScreenShellProps) {
10
+ return (
11
+ <section
12
+ {...props}
13
+ className={cn(
14
+ 'flex min-h-0 flex-1 flex-col overflow-y-auto bg-muted texture-checker-20',
15
+ className
16
+ )}
17
+ >
18
+ <div className="flex flex-1 flex-col bg-radial from-background from-25% to-transparent">
19
+ {children}
20
+ </div>
21
+ </section>
22
+ )
23
+ }
@@ -0,0 +1,61 @@
1
+ /**
2
+ * Two scaled copies of Tabler’s filled bolt.
3
+ *
4
+ * MIT License
5
+ *
6
+ * Copyright (c) 2020-2026 Paweł Kuna
7
+ *
8
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
9
+ * of this software and associated documentation files (the "Software"), to deal
10
+ * in the Software without restriction, including without limitation the rights
11
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12
+ * copies of the Software, and to permit persons to whom the Software is
13
+ * furnished to do so, subject to the following conditions:
14
+ *
15
+ * The above copyright notice and this permission notice shall be included in all
16
+ * copies or substantial portions of the Software.
17
+ *
18
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
24
+ * SOFTWARE.
25
+ */
26
+ import { createReactComponent, type IconProps } from '@tabler/icons-react'
27
+ import { useId } from 'react'
28
+
29
+ const boltPath =
30
+ 'M13 2l.018 .001l.016 .001l.083 .005l.011 .002h.011l.038 .009l.052 .008l.016 .006l.011 .001l.029 .011l.052 .014l.019 .009l.015 .004l.028 .014l.04 .017l.021 .012l.022 .01l.023 .015l.031 .017l.034 .024l.018 .011l.013 .012l.024 .017l.038 .034l.022 .017l.008 .01l.014 .012l.036 .041l.026 .027l.006 .009c.12 .147 .196 .322 .218 .513l.001 .012l.002 .041l.004 .064v6h5a1 1 0 0 1 .868 1.497l-.06 .091l-8 11c-.568 .783 -1.808 .38 -1.808 -.588v-6h-5a1 1 0 0 1 -.868 -1.497l.06 -.091l8 -11l.01 -.013l.018 -.024l.033 -.038l.018 -.022l.009 -.008l.013 -.014l.04 -.036l.028 -.026l.008 -.006a1 1 0 0 1 .402 -.199l.011 -.001l.027 -.005l.074 -.013l.011 -.001l.041 -.002z'
31
+
32
+ const UltrafastSvg = createReactComponent('filled', 'ultrafast', 'Ultrafast', [])
33
+ const frontTransform = 'translate(5 2.4) scale(.8)'
34
+ const backTransform = 'translate(-1 2.4) scale(.8)'
35
+
36
+ type IconUltrafastProps = IconProps
37
+
38
+ export function IconUltrafast(props: IconUltrafastProps) {
39
+ const maskId = useId()
40
+ return (
41
+ <UltrafastSvg {...props}>
42
+ <defs>
43
+ <mask id={maskId} x="0" y="0" width="24" height="24" maskUnits="userSpaceOnUse">
44
+ <rect width="24" height="24" fill="white" />
45
+ <path
46
+ d={boltPath}
47
+ transform={frontTransform}
48
+ fill="black"
49
+ stroke="black"
50
+ strokeWidth="4"
51
+ strokeLinejoin="round"
52
+ />
53
+ </mask>
54
+ </defs>
55
+ <g mask={`url(#${maskId})`}>
56
+ <path d={boltPath} transform={backTransform} />
57
+ </g>
58
+ <path d={boltPath} transform={frontTransform} />
59
+ </UltrafastSvg>
60
+ )
61
+ }
@@ -4,7 +4,7 @@ import claudeIcon from '@/client/assets/claude.svg'
4
4
  import hermesIcon from '@/client/assets/hermes.png'
5
5
  import openaiIcon from '@/client/assets/openai.svg'
6
6
  import openclawIcon from '@/client/assets/openclaw.svg'
7
- import { resolveAppIcon } from '@/client/lib/app-icon-registry'
7
+ import { resolveIdentityIcon } from '@/client/lib/identity-icon-registry'
8
8
  import { cn } from '@/client/lib/cn'
9
9
  import { DEFAULT_PRIMARY_COLOR, deriveThemeColors, resolveThemeColorOverrides } from '@/lib/themes'
10
10
  import type {
@@ -48,7 +48,7 @@ function renderIconContent(
48
48
  case 'upload':
49
49
  return <img src={icon.value} alt="" className="size-full" />
50
50
  case 'glyph': {
51
- const Glyph = resolveAppIcon(icon.value)
51
+ const Glyph = resolveIdentityIcon(icon.value)
52
52
  if (Glyph) {
53
53
  return createElement(Glyph, {
54
54
  'aria-hidden': true,
@@ -112,8 +112,8 @@ export async function mountAccount({
112
112
  const configSpy = spyOn(config, 'useAppConfig').mockReturnValue({
113
113
  environment,
114
114
  demo,
115
- demoInstallUrl: '/',
116
- experimental: { collab: true }
115
+ collab: false,
116
+ demoInstallUrl: '/'
117
117
  })
118
118
  let cloudSession: CloudSession = signedOut
119
119
  ? null
@@ -122,7 +122,7 @@ export async function mountAccount({
122
122
  const failures = { signOut: false, mutation: false, team: failTeam, session: failSession }
123
123
  const mutationRequest = Promise.withResolvers<void>()
124
124
  const teamResponse = Promise.withResolvers<Response>()
125
- const calls: { path: string; body?: Record<string, string> }[] = []
125
+ const calls: { path: string; body?: Record<string, unknown> }[] = []
126
126
  const fetchSpy = spyOn(globalThis, 'fetch').mockImplementation(
127
127
  Object.assign(
128
128
  async (input: RequestInfo | URL, init?: RequestInit) => {
@@ -157,6 +157,7 @@ export async function mountAccount({
157
157
  await mutationRequest.promise
158
158
  if (failures.mutation)
159
159
  return Response.json({ error: 'Only the owner can do that.' }, { status: 403 })
160
+ if (path === '/api/settings') return Response.json({ autoUpdateSkills: false, ...body })
160
161
  if (path.endsWith('/profile')) {
161
162
  cloudSession = { user: { ...session!.user, name: body!.name! } }
162
163
  team.members[0]!.name = body!.name!
@@ -0,0 +1,33 @@
1
+ import { useMutation, useQuery, useQueryClient } from '@tanstack/react-query'
2
+ import { jsonRequest, requestJson } from '@/client/api/http'
3
+ import { useWorkspaceEvent } from '@/client/runtime/use-workspace-events'
4
+ import type { AppSettings } from '@/lib/types'
5
+
6
+ export const appSettingsKey = ['app-settings'] as const
7
+
8
+ export function useAppSettings() {
9
+ const queryClient = useQueryClient()
10
+ // Another client can change settings; the server broadcasts the new value
11
+ // over the live-events socket so every open client stays in sync.
12
+ useWorkspaceEvent(event => {
13
+ if (event.type === 'settings:updated') {
14
+ queryClient.setQueryData<AppSettings>(appSettingsKey, event.settings)
15
+ }
16
+ })
17
+ return useQuery<AppSettings>({
18
+ queryKey: appSettingsKey,
19
+ queryFn: () => requestJson('/api/settings'),
20
+ staleTime: 30_000
21
+ })
22
+ }
23
+
24
+ export function useSaveAppSettings() {
25
+ const queryClient = useQueryClient()
26
+ return useMutation<AppSettings, Error, Partial<AppSettings>>({
27
+ mutationFn: patch =>
28
+ requestJson('/api/settings', jsonRequest('PATCH', patch), 'Failed to save settings'),
29
+ onSuccess: next => {
30
+ queryClient.setQueryData<AppSettings>(appSettingsKey, next)
31
+ }
32
+ })
33
+ }
@@ -0,0 +1,39 @@
1
+ import { useLocation } from 'wouter'
2
+ import { Button } from '@/client/components/ui/button'
3
+ import {
4
+ Field,
5
+ FieldContent,
6
+ FieldDescription,
7
+ FieldGroup,
8
+ FieldTitle
9
+ } from '@/ui-components/field'
10
+ import { useSaveAppSettings } from './api'
11
+ import { SettingsSection } from './settings-section'
12
+
13
+ export function GeneralSettings() {
14
+ const save = useSaveAppSettings()
15
+ const [, navigate] = useLocation()
16
+ return (
17
+ <SettingsSection title="General">
18
+ <FieldGroup>
19
+ <Field orientation="responsive">
20
+ <FieldContent>
21
+ <FieldTitle>Restart onboarding</FieldTitle>
22
+ <FieldDescription>Go through the onboarding without logging out</FieldDescription>
23
+ </FieldContent>
24
+ <Button
25
+ variant="secondary"
26
+ aria-label="Restart onboarding"
27
+ disabled={save.isPending}
28
+ onClick={() =>
29
+ save.mutate({ showOnboarding: true }, { onSuccess: () => navigate('/onboarding') })
30
+ }
31
+ >
32
+ {save.isPending ? 'Opening…' : 'Restart'}
33
+ </Button>
34
+ </Field>
35
+ </FieldGroup>
36
+ {save.isError && <p role="alert">Couldn’t restart onboarding. Try again</p>}
37
+ </SettingsSection>
38
+ )
39
+ }
@@ -5,8 +5,11 @@ import { Skeleton } from '@/client/components/ui/skeleton'
5
5
  import { useAccount } from '../account/account-provider'
6
6
  import { ProfileSettings } from './profile-settings'
7
7
  import { UsersSettings } from './users-settings'
8
+ import { useAppConfig } from '@/client/api/app-config'
9
+ import { GeneralSettings } from './general-settings'
8
10
 
9
11
  export function SettingsPage() {
12
+ const { collab } = useAppConfig()
10
13
  const account = useAccount()
11
14
  useEffect(() => {
12
15
  if (account.cloud && !account.demo && account.status === 'signed-out') {
@@ -35,7 +38,8 @@ export function SettingsPage() {
35
38
  ) : (
36
39
  <div className="flex w-full max-w-xl min-w-0 flex-col gap-4">
37
40
  <ProfileSettings />
38
- {account.registered && <UsersSettings />}
41
+ {collab && account.registered && <UsersSettings />}
42
+ <GeneralSettings />
39
43
  </div>
40
44
  )}
41
45
  </div>
@@ -13,13 +13,10 @@ import { prepareChatAttachments, type ChatSendOptions, type PreparedAttachments
13
13
  import { useLayoutEffect } from 'react'
14
14
  import { useQueryClient, type QueryClient } from '@tanstack/react-query'
15
15
  import { toast } from '@/client/components/ui/toast'
16
- import {
17
- selectedSessionForTab,
18
- selectedSessionKey
19
- } from '@/client/features/chat/sessions/use-selected-session'
16
+ import { cachedSelectedSession } from '@/client/features/chat/sessions/use-selected-session'
20
17
  import { useCollabEnabled } from '@/client/features/collab'
21
18
  import { useLatestRef } from '@/client/lib/use-latest-ref'
22
- import type { SelectedSessionScope, WorkspaceSessionSelection, WorkspaceTabId } from '@/lib/types'
19
+ import type { SelectedSessionScope, WorkspaceTabId } from '@/lib/types'
23
20
  import { useCurrentTabId } from './sessions/use-selected-session'
24
21
  import { useWorkspaceId } from '@/client/features/workspace/workspace-context'
25
22
  import type { AgentAvailability } from '@/client/lib/agent-availability'
@@ -62,21 +59,8 @@ export function createAppletMessageHandler(
62
59
  ) {
63
60
  const pending = new Set<() => void>()
64
61
  let disposed = false
65
- const selectedSession = () => {
66
- const state = queryClient.getQueryData<WorkspaceSessionSelection>(
67
- selectedSessionKey(workspaceId, scope)
68
- )
69
- const shared = queryClient.getQueryData<WorkspaceSessionSelection>(
70
- selectedSessionKey(workspaceId)
71
- )
72
- return (
73
- selectedSessionForTab(
74
- shared,
75
- getOptions().tabId,
76
- scope === 'browser-tab' ? state : undefined
77
- ) ?? null
78
- )
79
- }
62
+ const selectedSession = () =>
63
+ cachedSelectedSession(queryClient, workspaceId, getOptions().tabId, scope) ?? null
80
64
 
81
65
  async function handle(event: AppletChatMessage): Promise<void> {
82
66
  if (disposed) return
@@ -1,3 +1,4 @@
1
+ import type { SpeedMode } from '@/lib/types'
1
2
  import type {
2
3
  AttachmentInput,
3
4
  AttachmentOrigin,
@@ -12,16 +13,17 @@ import { composerDraftKey } from '@/lib/session-drafts'
12
13
  import type { QueryClient } from '@tanstack/react-query'
13
14
 
14
15
  import { workspaceKeys } from '@/client/api/workspace-keys'
16
+ import { changeWorkspaceStateCache } from '@/client/features/workspace/workspace-state'
15
17
  import { attachmentKey, liveStore } from '@/client/features/chat/chat-store'
16
18
  import { useUiStore } from '@/client/store/ui'
17
19
  import type { StagedAttachment } from '@/client/features/chat/composer/attachments/types'
18
- import { resolveSelectedModel } from '@/client/features/chat/composer/model-order'
20
+ import { resolveSpeedMode, resolveSelectedModel } from '@/client/features/chat/composer/model-order'
19
21
  import type { MoiUserMessageOptions } from '@/client/features/workspace/moi-context'
20
22
  import { STREAM_RESPONSES } from '@/client/lib/flags'
21
23
  import { formatChatTitle } from '@/lib/chat-title'
22
24
  import { applyEvent, emptyViewState } from '@/lib/format'
23
25
  import { messageAttachmentLimitError } from '@/lib/message-attachments'
24
- import type { Part, SessionInfo, ViewState, WorkspaceAgent } from '@/lib/types'
26
+ import type { Part, SessionSummary, ViewState, WorkspaceHarness, WorkspaceTabId } from '@/lib/types'
25
27
 
26
28
  // Explicit attachments belong to this send, independently of the user's draft.
27
29
  export type PreparedAttachments = {
@@ -163,7 +165,7 @@ export function startOptimisticTurn({
163
165
  }
164
166
 
165
167
  type StartOptimisticSessionInput = {
166
- tabId?: SessionInfo['tabId']
168
+ tabId?: WorkspaceTabId
167
169
  queryClient: QueryClient
168
170
  workspaceId: string
169
171
  sessionId: string
@@ -179,20 +181,25 @@ export function startOptimisticSession({
179
181
  text,
180
182
  filenames = []
181
183
  }: StartOptimisticSessionInput): void {
184
+ // File the chat under its tab now; the server confirms it with the send.
185
+ if (tabId && tabId !== 'overview')
186
+ changeWorkspaceStateCache(queryClient, workspaceId, draft => {
187
+ draft.sessions[sessionId] = { ...draft.sessions[sessionId], tabId }
188
+ })
182
189
  const summary = formatChatTitle(text, filenames)
183
190
  if (!summary) return
184
- queryClient.setQueryData<SessionInfo[]>(workspaceKeys.sessions(workspaceId), current => [
185
- { sessionId, summary, lastModified: Date.now(), ...(tabId ? { tabId } : {}) },
191
+ queryClient.setQueryData<SessionSummary[]>(workspaceKeys.sessions(workspaceId), current => [
192
+ { sessionId, summary, lastModified: Date.now() },
186
193
  ...(current ?? []).filter(session => session.sessionId !== sessionId)
187
194
  ])
188
195
  }
189
196
 
190
197
  export function resolveChatRunOptions(
191
- modelsData: WorkspaceAgent | undefined,
198
+ modelsData: WorkspaceHarness | undefined,
192
199
  pickedModel: string | undefined,
193
200
  pickedEffort: string | undefined,
194
- pickedFastMode?: boolean
195
- ): { model?: string; effort?: string; fastMode?: boolean; stream?: true } {
201
+ pickedSpeedMode?: SpeedMode
202
+ ): { model?: string; effort?: string; speedMode?: SpeedMode; stream?: true } {
196
203
  const models = modelsData?.models
197
204
  const savedModel =
198
205
  !pickedModel || !models || models.some(candidate => candidate.value === pickedModel)
@@ -213,15 +220,12 @@ export function resolveChatRunOptions(
213
220
  pickedEffort && (!modelInfo || (modelInfo.supportedEffortLevels ?? []).includes(pickedEffort))
214
221
  ? pickedEffort
215
222
  : undefined
216
- const fastMode =
217
- pickedFastMode === undefined || !modelInfo || modelInfo.supportsFastMode
218
- ? pickedFastMode
219
- : false
223
+ const speedMode = modelInfo ? resolveSpeedMode(modelInfo, pickedSpeedMode) : pickedSpeedMode
220
224
  const stream = STREAM_RESPONSES && modelsData?.supportsStreaming ? true : undefined
221
225
  return {
222
226
  model,
223
227
  effort,
224
- ...(fastMode !== undefined ? { fastMode } : {}),
228
+ ...(speedMode !== undefined ? { speedMode } : {}),
225
229
  stream
226
230
  }
227
231
  }
@@ -1,4 +1,4 @@
1
- import type { Model, WorkspaceType } from '@/lib/types'
1
+ import type { SpeedMode, Model, WorkspaceType } from '@/lib/types'
2
2
 
3
3
  export const DEFAULT_EFFORT = 'high'
4
4
 
@@ -79,9 +79,13 @@ export function hasEffortChoice(levels: readonly string[]): boolean {
79
79
  return levels.length > 1
80
80
  }
81
81
 
82
- export function resolveFastMode(model: Model, selectedFastMode: boolean | undefined): boolean {
83
- if (model.supportsFastMode !== true) return false
84
- return selectedFastMode ?? model.defaultFastMode ?? false
82
+ export function resolveSpeedMode(
83
+ model: Model,
84
+ selectedSpeedMode: SpeedMode | undefined
85
+ ): SpeedMode {
86
+ const mode = selectedSpeedMode ?? 'normal'
87
+ if (mode === 'ultrafast' && model.supportsUltrafastMode) return mode
88
+ return mode !== 'normal' && model.supportsFastMode ? 'fast' : 'normal'
85
89
  }
86
90
 
87
91
  export function sortModelsByProviderOrder(models: Model[], provider: WorkspaceType): Model[] {