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
@@ -1,10 +1,15 @@
1
- import { detectInstalledHarnesses } from '../harness/executable'
1
+ import { resolveWorkspaceEnv } from '../workspaces/env'
2
+ import { changeWorkspaceHarness } from '../workspaces/change-harness'
3
+ import { HarnessTransitionError, reserveWorkspaceOperation } from '../workspaces/harness-transition'
4
+ import { onboarding } from './onboarding'
5
+ import type { SpeedMode } from '@/lib/types'
6
+ import { isSpeedMode } from '@/lib/speed-mode'
2
7
  import { isMessageAttachments } from '@/lib/message-attachments'
3
8
  import { Hono } from 'hono'
4
9
  import { serveStatic } from 'hono/bun'
5
10
  import { createMiddleware } from 'hono/factory'
6
11
  import { existsSync } from 'node:fs'
7
- import { basename, join, resolve } from 'node:path'
12
+ import { basename, resolve } from 'node:path'
8
13
 
9
14
  import { UPDATE_ACTIVE_AGENT_MESSAGE } from '@/lib/update'
10
15
  import { resolveWorkspaceTheme } from '@/lib/themes'
@@ -16,7 +21,7 @@ import type {
16
21
  HarnessAvailability,
17
22
  SelectedSessionScope,
18
23
  UploadInfo,
19
- WorkspaceAgent,
24
+ WorkspaceHarness,
20
25
  WorkspaceEntry,
21
26
  WorkspaceType
22
27
  } from '@/lib/types'
@@ -26,7 +31,7 @@ import { proxyUserState } from '../collab/cloudflare-access'
26
31
  import { collabManager } from '../collab/manager'
27
32
  import { harnessStore } from '../harness/auth'
28
33
  import { harnesses } from './harnesses'
29
- import { clientAppConfig, getAppConfig } from '../app-config'
34
+ import { clientAppConfig, createdWorkspacesRoot, getAppConfig } from '../app-config'
30
35
  import { getAppSettings, pickAppSettingsPatch, saveAppSettings } from '../app-settings'
31
36
  import { appletForModule, recordAppletError } from '../applets/log'
32
37
  import { apiBaseFor, parseAppletTail, serveWorkspaceFile } from '../applets'
@@ -60,17 +65,16 @@ import {
60
65
  import { loadScratchpadDoc, saveScratchpadDoc } from '../scratchpad/document'
61
66
  import { MAX_ASSET_BYTES, scratchpadAssetFile, storeScratchpadAsset } from '../scratchpad/assets'
62
67
  import {
68
+ deselectSession,
63
69
  getPinnedSession,
64
- getSelectedSession,
65
- getWorkspaceSessionSelection,
66
70
  pinSession,
67
- saveSelectedSession
71
+ saveSelectedSession,
72
+ unpinSession
68
73
  } from '../sessions/selected'
69
- import type { SelectedSessionUpdate } from '../sessions/selected'
70
74
  import { saveSessionConfig } from '../sessions/config'
71
75
  import type { SessionConfigPatch } from '../sessions/config'
72
- import { getSessionRecord, withSessionRecords } from '../sessions/store'
73
76
  import { archiveWorkspaceSession } from '../sessions/archive'
77
+ import { getWorkspaceState } from '../workspace-state'
74
78
  import { DIST_DIR, prebuilt } from '../static'
75
79
  import { getWorkspaceSkillsStatus, updateWorkspaceSkills } from '../skills/update'
76
80
  import { serveWorkspaceImagePreview } from '../workspaces/preview'
@@ -94,11 +98,8 @@ import {
94
98
  import { submitView, ViewStartupError } from '../sessions/view-sessions'
95
99
  import { listWidgets, serveWidget } from '../applets/widgets'
96
100
  import { getWorkspaceConfig, setWorkspaceConfig } from '../workspaces/config'
97
- import {
98
- createdWorkspacesRoot,
99
- provisionWorkspace,
100
- validateWorkspaceFolderName
101
- } from '../workspaces/init'
101
+ import { createWorkspaceDirectory, provisionWorkspace } from '../workspaces/init'
102
+ import { validateWorkspaceName } from '@/lib/workspace-name'
102
103
  import { resolveWorkspaceImportMetadata } from '../workspaces/import'
103
104
  import type { WorkspaceImportMetadata } from '../workspaces/import'
104
105
  import { getWorkspaceEnvView, parseEnvUpdate, updateWorkspaceEnv } from '../workspaces/env'
@@ -121,15 +122,6 @@ function eventOrigin(value: unknown): string | undefined {
121
122
  return typeof value === 'string' ? value : undefined
122
123
  }
123
124
 
124
- function publishSelectedSession(workspaceId: string, update: SelectedSessionUpdate): void {
125
- if (!update.changed) return
126
- publishEvent({
127
- type: 'selected-session:updated',
128
- workspaceId,
129
- sessionId: update.sessionId
130
- })
131
- }
132
-
133
125
  async function handleFunctionCall(
134
126
  req: Request,
135
127
  tail: string,
@@ -174,15 +166,37 @@ async function handleFunctionCall(
174
166
  const withWorkspace = createMiddleware<ApiEnv>(async (c, next) => {
175
167
  const id = c.req.param('id')
176
168
  if (!id) return c.text('Workspace not found', 404)
177
- const ws = await getWorkspace(id)
178
- if (!ws) return c.text('Workspace not found', 404)
179
- c.set('ws', ws)
180
- await next()
169
+ let release: (() => void) | undefined
170
+ try {
171
+ if (c.req.method !== 'GET' && !c.req.path.endsWith('/harness'))
172
+ release = reserveWorkspaceOperation(id)
173
+ const ws = await getWorkspace(id)
174
+ if (!ws) return c.text('Workspace not found', 404)
175
+ c.set('ws', ws)
176
+ await next()
177
+ } catch (error) {
178
+ if (error instanceof HarnessTransitionError) return c.text(error.message, 409)
179
+ throw error
180
+ } finally {
181
+ release?.()
182
+ }
181
183
  })
182
184
 
183
185
  // ---- single workspace: /api/workspaces/:id/* --------------------------------
184
186
  const one = new Hono<ApiEnv>()
185
187
  one.use('*', withWorkspace)
188
+ one.patch('/harness', async c => {
189
+ if (getAppConfig().demo) return c.text('Changing agents is unavailable in the demo', 403)
190
+ const body = await c.req.json().catch(() => null)
191
+ if (!body || !['claude-code', 'codex'].includes(body.type))
192
+ return c.text('Invalid agent selection', 400)
193
+ try {
194
+ return c.json(await changeWorkspaceHarness(c.get('ws'), body.type))
195
+ } catch (error) {
196
+ if (error instanceof HarnessTransitionError) return c.text(error.message, 409)
197
+ throw error
198
+ }
199
+ })
186
200
 
187
201
  one.get('/widgets', c => listWidgets(c.get('ws').path))
188
202
 
@@ -204,7 +218,7 @@ one.get('/views', c => listViews(c.get('ws').path))
204
218
  one.patch('/views/:viewId', async c => {
205
219
  const ws = c.get('ws')
206
220
  const body = await c.req.json().catch(() => null)
207
- if (await getPendingView(ws.path, c.req.param('viewId'))) {
221
+ if (await getPendingView(ws, c.req.param('viewId'))) {
208
222
  try {
209
223
  if (
210
224
  typeof body?.requirements !== 'string' &&
@@ -213,7 +227,7 @@ one.patch('/views/:viewId', async c => {
213
227
  )
214
228
  return c.text('Expected requirements, title, or icon', 400)
215
229
  return c.json(
216
- await updatePendingView(ws.id, ws.path, c.req.param('viewId'), {
230
+ await updatePendingView(ws, c.req.param('viewId'), {
217
231
  requirements: typeof body.requirements === 'string' ? body.requirements : undefined,
218
232
  title: typeof body.title === 'string' ? body.title.trim() : undefined,
219
233
  icon: typeof body.icon === 'string' ? body.icon : undefined
@@ -240,7 +254,7 @@ one.delete('/views/:viewId', async c => {
240
254
  const ws = c.get('ws')
241
255
  try {
242
256
  const viewId = c.req.param('viewId')
243
- if (await getPendingView(ws.path, viewId)) {
257
+ if (await getPendingView(ws, viewId)) {
244
258
  const active = new Set(
245
259
  harnessFor(ws)
246
260
  .activeSessions()
@@ -266,7 +280,7 @@ one.get('/views/*', c => {
266
280
 
267
281
  one.post('/views', async c => {
268
282
  const ws = c.get('ws')
269
- return c.json(await createPendingView(ws.id, ws.path), 201)
283
+ return c.json(await createPendingView(ws), 201)
270
284
  })
271
285
 
272
286
  one.post('/views/:viewId/submit', async c => {
@@ -278,7 +292,7 @@ one.post('/views/:viewId/submit', async c => {
278
292
  selectedSessionScope?: SelectedSessionScope
279
293
  model?: string
280
294
  effort?: string
281
- fastMode?: boolean
295
+ speedMode?: SpeedMode
282
296
  stream?: boolean
283
297
  attachments?: unknown
284
298
  }>()
@@ -314,7 +328,7 @@ one.post('/views/:viewId/submit', async c => {
314
328
  optimisticId: body.optimisticId,
315
329
  model: typeof body.model === 'string' ? body.model : undefined,
316
330
  effort: typeof body.effort === 'string' ? body.effort : undefined,
317
- fastMode: typeof body.fastMode === 'boolean' ? body.fastMode : undefined,
331
+ speedMode: isSpeedMode(body.speedMode) ? body.speedMode : undefined,
318
332
  stream: body.stream === true ? true : undefined
319
333
  })
320
334
  return c.json(result)
@@ -482,64 +496,94 @@ one.get('/uploads/:uploadId', c => {
482
496
  })
483
497
  })
484
498
 
499
+ // Per-user chat state: pin, the chat each tab shows, per-chat settings and
500
+ // fork history, and views being built. Every write below answers with the new
501
+ // state; other clients get it as `state:changed`.
502
+ one.get('/state', async c => c.json(await getWorkspaceState(c.get('ws'))))
503
+
504
+ // The agent's chats. Tab ownership and settings come from `/state`.
485
505
  one.get('/sessions', async c => {
486
506
  const ws = c.get('ws')
487
- return c.json(await withSessionRecords(ws.path, await harnessFor(ws).listSessions(ws)))
507
+ return c.json(await harnessFor(ws).listSessions(ws))
488
508
  })
489
509
 
490
- one.get('/selected-session', async c => {
491
- return c.json(await getWorkspaceSessionSelection(c.get('ws').path))
510
+ one.put('/sessions/:sessionId/pin', async c => {
511
+ const ws = c.get('ws')
512
+ const sessionId = c.req.param('sessionId')
513
+ const harness = harnessFor(ws)
514
+ const found = (await harness.listSessions(ws)).some(session => session.sessionId === sessionId)
515
+ const active = harness
516
+ .activeSessions()
517
+ .some(session => session.workspaceId === ws.id && session.sessionId === sessionId)
518
+ if (!found && !active) return c.text('Chat not found', 404)
519
+ await pinSession(ws, sessionId)
520
+ return c.json(await getWorkspaceState(ws))
492
521
  })
493
522
 
494
- one.put('/pinned-session', async c => {
523
+ one.delete('/sessions/:sessionId/pin', async c => {
495
524
  const ws = c.get('ws')
496
- const body = await c.req.json<{ sessionId: string | null }>()
497
- if (body.sessionId !== null && typeof body.sessionId !== 'string')
498
- return c.text('Invalid chat', 400)
499
- if (body.sessionId) {
500
- const harness = harnessFor(ws)
501
- const found = (await harness.listSessions(ws)).some(
502
- session => session.sessionId === body.sessionId
503
- )
504
- const active = harness
505
- .activeSessions()
506
- .some(session => session.workspaceId === ws.id && session.sessionId === body.sessionId)
507
- if (!found && !active) return c.text('Chat not found', 404)
508
- }
509
- await pinSession(ws.path, body.sessionId)
510
- publishEvent({
511
- type: 'selected-session:updated',
512
- workspaceId: ws.id,
513
- sessionId: (await getSelectedSession(ws.path)) ?? null
514
- })
515
- return c.json({ pinnedSessionId: body.sessionId })
525
+ await unpinSession(ws, c.req.param('sessionId'))
526
+ return c.json(await getWorkspaceState(ws))
516
527
  })
517
528
 
518
- one.put('/selected-session', async c => {
529
+ // Show the chat in a tab. `ifMatch` (a chat id, or null for none) applies the
530
+ // change only while the tab still shows that chat.
531
+ one.put('/sessions/:sessionId/selection', async c => {
519
532
  const ws = c.get('ws')
520
533
  const body: unknown = await c.req.json().catch(() => null)
521
534
  if (!body || typeof body !== 'object') return c.text('Bad request', 400)
535
+ const input = body as { tabId?: unknown; ifMatch?: unknown }
536
+ if (!isWorkspaceTabId(input.tabId)) return c.text('Invalid chat tab', 400)
537
+ const hasIfMatch = Object.prototype.hasOwnProperty.call(input, 'ifMatch')
538
+ if (hasIfMatch && input.ifMatch !== null && typeof input.ifMatch !== 'string')
539
+ return c.text('ifMatch must be a chat id or null', 400)
540
+ if (await getPinnedSession(ws)) return c.text('Unpin chat before switching', 409)
541
+ await saveSelectedSession(
542
+ ws,
543
+ c.req.param('sessionId'),
544
+ input.tabId,
545
+ hasIfMatch ? (input.ifMatch as string | null) : undefined
546
+ )
547
+ return c.json(await getWorkspaceState(ws))
548
+ })
522
549
 
523
- const input = body as { sessionId?: unknown; previousSessionId?: unknown; tabId?: unknown }
524
- const tabId = input.tabId ?? 'overview'
550
+ // Stop showing the chat in a tab, which then opens a new chat. A tab showing
551
+ // another chat is left alone.
552
+ one.delete('/sessions/:sessionId/selection', async c => {
553
+ const ws = c.get('ws')
554
+ const body: unknown = await c.req.json().catch(() => null)
555
+ const tabId = (body as { tabId?: unknown } | null)?.tabId
525
556
  if (!isWorkspaceTabId(tabId)) return c.text('Invalid chat tab', 400)
526
- if (await getPinnedSession(ws.path)) return c.text('Unpin chat before switching', 409)
527
- const validSessionId = input.sessionId === null || typeof input.sessionId === 'string'
528
- const hasPreviousSessionId = Object.prototype.hasOwnProperty.call(input, 'previousSessionId')
529
- const validPreviousSessionId =
530
- !hasPreviousSessionId ||
531
- input.previousSessionId === null ||
532
- typeof input.previousSessionId === 'string'
533
- if (!validSessionId || !validPreviousSessionId) return c.text('Bad request', 400)
534
-
535
- const update = await saveSelectedSession(
536
- ws.path,
537
- input.sessionId as string | null,
538
- hasPreviousSessionId ? (input.previousSessionId as string | null) : undefined,
539
- tabId
540
- )
541
- publishSelectedSession(ws.id, update)
542
- return c.json({ sessionId: update.sessionId })
557
+ await deselectSession(ws, c.req.param('sessionId'), tabId)
558
+ return c.json(await getWorkspaceState(ws))
559
+ })
560
+
561
+ // Change run settings. Omitted fields stay; null clears one.
562
+ one.patch('/sessions/:sessionId/config', async c => {
563
+ const body = await c.req.json().catch(() => null)
564
+ if (typeof body !== 'object' || body === null) {
565
+ return c.text('Expected a JSON object', 400)
566
+ }
567
+ const patch: SessionConfigPatch = {}
568
+ const record = body as Record<string, unknown>
569
+ for (const key of ['model', 'effort'] as const) {
570
+ if (!(key in record)) continue
571
+ const value = record[key]
572
+ if (value !== null && typeof value !== 'string') {
573
+ return c.text(`${key} must be a string or null`, 400)
574
+ }
575
+ patch[key] = value
576
+ }
577
+ if ('speedMode' in record) {
578
+ const value = record.speedMode
579
+ if (value !== null && !isSpeedMode(value)) {
580
+ return c.text('speedMode must be "normal", "fast", "ultrafast", or null', 400)
581
+ }
582
+ patch.speedMode = value
583
+ }
584
+ const ws = c.get('ws')
585
+ await saveSessionConfig(ws, c.req.param('sessionId'), patch)
586
+ return c.json(await getWorkspaceState(ws))
543
587
  })
544
588
 
545
589
  one.post('/sessions/:sessionId/archive', async c => {
@@ -550,7 +594,7 @@ one.post('/sessions/:sessionId/archive', async c => {
550
594
 
551
595
  try {
552
596
  await archiveWorkspaceSession(ws, sessionId)
553
- return c.body(null, 204)
597
+ return c.json(await getWorkspaceState(ws))
554
598
  } catch (error) {
555
599
  console.error(`[api] archive chat failed for ${harness.id}`, error)
556
600
  // Harnesses translate backend refusals into actionable one-liners (e.g.
@@ -567,39 +611,6 @@ one.get('/sessions/:sessionId/events', async c => {
567
611
  return c.json(await harnessFor(ws).sessionEvents(ws, sessionId))
568
612
  })
569
613
 
570
- one.get('/sessions/:sessionId', async c => {
571
- return c.json(await getSessionRecord(c.get('ws').path, c.req.param('sessionId')))
572
- })
573
-
574
- // Patch run settings and return the complete session record. null clears a setting.
575
- one.put('/sessions/:sessionId/config', async c => {
576
- const body = await c.req.json().catch(() => null)
577
- if (typeof body !== 'object' || body === null) {
578
- return c.text('Expected a JSON object', 400)
579
- }
580
- const patch: SessionConfigPatch = {}
581
- const record = body as Record<string, unknown>
582
- for (const key of ['model', 'effort'] as const) {
583
- if (!(key in record)) continue
584
- const value = record[key]
585
- if (value !== null && typeof value !== 'string') {
586
- return c.text(`${key} must be a string or null`, 400)
587
- }
588
- patch[key] = value
589
- }
590
- if ('fastMode' in record) {
591
- const value = record.fastMode
592
- if (value !== null && typeof value !== 'boolean') {
593
- return c.text('fastMode must be a boolean or null', 400)
594
- }
595
- patch.fastMode = value
596
- }
597
- const workspacePath = c.get('ws').path
598
- const sessionId = c.req.param('sessionId')
599
- await saveSessionConfig(workspacePath, sessionId, patch)
600
- return c.json(await getSessionRecord(workspacePath, sessionId))
601
- })
602
-
603
614
  one.get('/mcp', async c => {
604
615
  const ws = c.get('ws')
605
616
  return c.json((await harnessFor(ws).mcpStatus?.(ws)) ?? [])
@@ -664,10 +675,9 @@ one.post('/skills/update', async c => {
664
675
  return c.json(result.status)
665
676
  })
666
677
 
667
- // The workspace's agent backend in one snapshot: provider, availability
668
- // (runtime presence + auth), the model catalog, and capabilities.
669
- // Workspace readiness stays fresh via `harness:updated` events and refetches.
670
- one.get('/agent', async c => {
678
+ // Workspace configuration and models. Shared account status is served by
679
+ // /harnesses/status; only workspace overrides and gateways are probed here.
680
+ one.get('/harness', async c => {
671
681
  const ws = c.get('ws')
672
682
  const harness = harnessFor(ws)
673
683
  const capabilities = {
@@ -678,18 +688,35 @@ one.get('/agent', async c => {
678
688
  if (!existsSync(ws.path)) {
679
689
  return c.json({
680
690
  ...capabilities,
681
- workspaceFolderMissing: true,
691
+ isFolderMissing: true,
682
692
  availability: { status: 'unavailable', reason: 'Workspace folder not found' },
683
693
  models: []
684
- } satisfies WorkspaceAgent)
694
+ } satisfies WorkspaceHarness)
685
695
  }
696
+ const authEnv =
697
+ harness.id === 'codex'
698
+ ? /^(OPENAI_|CODEX_)/
699
+ : /^(ANTHROPIC_|CLAUDE_|AWS_|GOOGLE_|AZURE_|CLOUD_ML_)/
700
+ const hasAuthOverrides =
701
+ harness.authStatus &&
702
+ Object.entries(await resolveWorkspaceEnv(ws.path)).some(
703
+ ([key, value]) =>
704
+ value !== process.env[key] &&
705
+ (authEnv.test(key) || /^(HOME|USERPROFILE|XDG_CONFIG_HOME)$/.test(key))
706
+ )
686
707
  const refresh = c.req.query('refresh') === 'true'
687
708
  if (refresh) await loginShellPath({ refresh: true })
688
709
  // A backend that can't answer (codex CLI missing, gateway down) degrades to
689
710
  // an empty catalog — the picker hides and chat surfaces the real problem via
690
711
  // workspace setup, instead of this endpoint failing on page load.
691
712
  const [availability, models] = await Promise.all([
692
- refresh ? harnessStore.refresh(ws) : harnessStore.getAvailability(ws),
713
+ // Shared account status comes from /harnesses/status.
714
+ // Gateway-backed harnesses still have workspace-specific readiness.
715
+ harness.authStatus && !hasAuthOverrides
716
+ ? Promise.resolve({ status: 'available' as const })
717
+ : refresh
718
+ ? harnessStore.refresh(ws)
719
+ : harnessStore.getAvailability(ws),
693
720
  harness.listModels(ws).catch(err => {
694
721
  console.error(`[api] listModels failed for ${harness.id}`, err)
695
722
  return []
@@ -698,8 +725,9 @@ one.get('/agent', async c => {
698
725
  return c.json({
699
726
  ...capabilities,
700
727
  availability,
728
+ hasAuthOverrides: Boolean(hasAuthOverrides),
701
729
  models
702
- } satisfies WorkspaceAgent)
730
+ } satisfies WorkspaceHarness)
703
731
  })
704
732
 
705
733
  // Workspace identity. Uploads use the image route below.
@@ -885,11 +913,16 @@ one.put('/', async c => {
885
913
  const body = await c.req.json()
886
914
  if (!body || body.version !== 1) return c.text('Bad request', 400)
887
915
  // `origin` is the writing tab's id, echoed so that tab skips its own event.
888
- const { origin, ...layout } = body
916
+ const { origin, harness, ...layout } = body
889
917
  // Preserve server-owned identity (name/icon) across a grid/theme save so the
890
918
  // client's PUT can't erase a `moi config`-set name. See mergeLayoutForSave.
891
919
  const existing = await loadLayout(ws.path)
892
920
  const next = mergeLayoutForSave(existing, layout)
921
+ if (harness !== undefined && harness !== (ws.type ?? 'claude-code')) {
922
+ next.selectedModel = existing.selectedModel
923
+ next.selectedEffort = existing.selectedEffort
924
+ next.selectedSpeedMode = existing.selectedSpeedMode
925
+ }
893
926
  await saveLayout(next, ws.path)
894
927
  if (
895
928
  JSON.stringify(resolveWorkspaceTheme(existing.theme)) !==
@@ -1021,12 +1054,6 @@ async function workspaceTypeAvailability(type: WorkspaceType): Promise<HarnessAv
1021
1054
  return (await harnessFor(type).availability?.()) ?? { status: 'available' }
1022
1055
  }
1023
1056
 
1024
- // Both workspace dialogs only need installation facts to offer agent choices.
1025
- workspaces.get('/create', async c => {
1026
- c.header('Cache-Control', 'no-store')
1027
- return c.json({ installed: await detectInstalledHarnesses() })
1028
- })
1029
-
1030
1057
  // Create a brand-new workspace: a fresh folder under createdWorkspacesRoot(),
1031
1058
  // provisioned (skills + `.moi/` scaffold) and registered.
1032
1059
  workspaces.post('/create', async c => {
@@ -1042,18 +1069,23 @@ workspaces.post('/create', async c => {
1042
1069
  }
1043
1070
  const availability = await workspaceTypeAvailability(type)
1044
1071
  if (availability.status !== 'available') return c.text(availability.reason, 400)
1045
- const name = typeof body?.name === 'string' ? body.name.trim() : ''
1046
- const invalid = validateWorkspaceFolderName(name)
1072
+ const name =
1073
+ body?.name === undefined
1074
+ ? 'My workspace'
1075
+ : typeof body.name === 'string'
1076
+ ? body.name.trim()
1077
+ : ''
1078
+ const invalid = validateWorkspaceName(name)
1047
1079
  if (invalid) return c.text(invalid, 400)
1048
- const path = join(createdWorkspacesRoot(), name)
1049
- if (existsSync(path)) return c.text('A folder with that name already exists', 409)
1080
+ const path = await createWorkspaceDirectory(name, createdWorkspacesRoot())
1050
1081
  try {
1051
1082
  await provisionWorkspace(path, type)
1052
1083
  } catch (err) {
1053
1084
  const message = err instanceof Error ? err.message : String(err)
1054
1085
  return c.text(`Could not create workspace: ${message}`, 500)
1055
1086
  }
1056
- const entry = await registerWorkspace(path, { type })
1087
+ await setWorkspaceConfig(path, { name })
1088
+ const entry = await registerWorkspace(path, { id: basename(path), type, name })
1057
1089
  // Nudge every connected client (the sidebar list) to refetch.
1058
1090
  publishEvent({ type: 'workspaces-list:updated' })
1059
1091
  return c.json(entry, 201)
@@ -1069,6 +1101,7 @@ export const api = new Hono()
1069
1101
 
1070
1102
  api.route('/api/workspaces', workspaces)
1071
1103
  api.route('/api/harnesses', harnesses)
1104
+ api.route('/api/onboarding', onboarding)
1072
1105
 
1073
1106
  // Startup config (config.json in the data dir + MOI_* env), client-safe
1074
1107
  // subset. Immutable for the process lifetime — clients cache it forever.
@@ -0,0 +1,46 @@
1
+ import { Hono } from 'hono'
2
+ import { z } from 'zod'
3
+ import { getAppConfig } from '../app-config'
4
+ import { getAppSettings } from '../app-settings'
5
+ import { cancelIdeas, createFromIdea, discoverIdeas } from '../onboarding/jobs'
6
+
7
+ const discoverySchema = z.object({
8
+ harness: z.enum(['claude-code', 'codex']),
9
+ runId: z.string().uuid()
10
+ })
11
+ const buildSchema = discoverySchema.extend({
12
+ ideaId: z.string().uuid(),
13
+ operationId: z.string().uuid(),
14
+ retry: z.boolean().optional()
15
+ })
16
+ export const onboarding = new Hono()
17
+ onboarding.use('*', async (c, next) => {
18
+ if (getAppConfig().demo || !getAppSettings().showOnboarding)
19
+ return c.json({ error: 'Onboarding is not enabled' }, 403)
20
+ c.header('Cache-Control', 'no-store')
21
+ await next()
22
+ })
23
+ onboarding.post('/discover', async c => {
24
+ const parsed = discoverySchema.safeParse(await c.req.json().catch(() => undefined))
25
+ if (!parsed.success) return c.json({ error: 'Invalid discovery request' }, 400)
26
+ return c.json(await discoverIdeas(parsed.data))
27
+ })
28
+ onboarding.post('/cancel', async c => {
29
+ const parsed = z
30
+ .object({ runId: z.string().uuid() })
31
+ .safeParse(await c.req.json().catch(() => undefined))
32
+ if (!parsed.success) return c.json({ error: 'Invalid discovery request' }, 400)
33
+ await cancelIdeas(parsed.data.runId)
34
+ return c.json({ status: 'done' })
35
+ })
36
+ onboarding.post('/create', async c => {
37
+ const parsed = buildSchema.safeParse(await c.req.json().catch(() => undefined))
38
+ if (!parsed.success) return c.json({ error: 'Invalid workspace request' }, 400)
39
+ const { harness, runId, ideaId, operationId, retry } = parsed.data
40
+ // Use the validated server result, never a browser-supplied workspace plan.
41
+ const discovery = await discoverIdeas({ harness, runId })
42
+ const idea = discovery.ideas?.find(idea => idea.id === ideaId)
43
+ if (discovery.status !== 'done' || !idea)
44
+ return c.json({ error: 'Choose an available idea' }, 409)
45
+ return c.json(await createFromIdea({ harness, operationId, idea }, retry))
46
+ })
@@ -1,8 +1,8 @@
1
1
  import { readFileSync } from 'node:fs'
2
+ import { homedir } from 'node:os'
2
3
  import { isAbsolute, join } from 'path'
3
4
 
4
- import type { AppEnvironment, ClientAppConfig, ExperimentalFeatures } from '@/lib/types'
5
- import { EXPERIMENTAL_DEFAULTS } from '@/lib/experimental'
5
+ import type { AppEnvironment, ClientAppConfig } from '@/lib/types'
6
6
 
7
7
  import { DATA_DIR } from './data-dir'
8
8
 
@@ -12,17 +12,16 @@ import { DATA_DIR } from './data-dir'
12
12
  // runtime): config.json describes the deployment itself — nothing here changes
13
13
  // without a server restart, and no API writes it.
14
14
  //
15
- // Resolution: defaults < config.json < env. Experimental features are enabled
16
- // only by explicit CLI flags.
15
+ // Resolution: defaults < config.json < env.
17
16
  // A missing file is the normal local case; a malformed file or wrong-typed key
18
17
  // warns on stderr and falls back per-key, so a broken config never takes the
19
18
  // CLI or server down with it.
20
19
  export type AppConfig = {
21
20
  environment: AppEnvironment
21
+ collab: boolean
22
22
  // Demo mode: workspace creation is blocked (UI shows the
23
23
  // cloud-demo promo dialog instead) and `moi` system commands are disabled.
24
24
  demo: boolean
25
- experimental: ExperimentalFeatures
26
25
  // Link target for the cloud-demo promo dialog.
27
26
  demoInstallUrl: string
28
27
  // Cloudflare Access (Zero Trust) in front of this deployment: each viewer
@@ -47,12 +46,11 @@ export type CloudflareAccessConfig = {
47
46
  audience: readonly string[]
48
47
  }
49
48
 
50
- type DeploymentConfig = Omit<AppConfig, 'experimental'>
51
-
52
49
  const DEFAULTS: AppConfig = {
53
50
  environment: 'local',
51
+ // Temporarily disabled while collaboration is being reconsidered.
52
+ collab: false,
54
53
  demo: false,
55
- experimental: { ...EXPERIMENTAL_DEFAULTS },
56
54
  demoInstallUrl: 'https://moi.computer',
57
55
  cloudflareAccess: null,
58
56
  workspacesDir: null,
@@ -196,8 +194,8 @@ function readConfigFile(file: string): Record<string, unknown> {
196
194
  return parsed as Record<string, unknown>
197
195
  }
198
196
 
199
- function fileValues(raw: Record<string, unknown>): Partial<DeploymentConfig> {
200
- const out: Partial<DeploymentConfig> = {}
197
+ function fileValues(raw: Record<string, unknown>): Partial<AppConfig> {
198
+ const out: Partial<AppConfig> = {}
201
199
  const environment = parseEnvironment(raw.environment)
202
200
  if (environment !== undefined) out.environment = environment
203
201
  if (raw.demo !== undefined) {
@@ -220,33 +218,28 @@ function fileValues(raw: Record<string, unknown>): Partial<DeploymentConfig> {
220
218
  // Pure resolver, exported for tests. `getAppConfig` is the cached entrypoint.
221
219
  export function loadAppConfig(
222
220
  file: string = APP_CONFIG_FILE,
223
- env: Record<string, string | undefined> = process.env,
224
- cliExperimental: Partial<ExperimentalFeatures> = {}
221
+ env: Record<string, string | undefined> = process.env
225
222
  ): AppConfig {
226
223
  const raw = readConfigFile(file)
227
224
  const fromFile = fileValues(raw)
228
- const fromEnv: Partial<DeploymentConfig> = {
225
+ const fromEnv: Partial<AppConfig> = {
229
226
  environment: parseEnvironment(env.MOI_ENVIRONMENT),
230
227
  demo: parseBool(env.MOI_DEMO),
231
228
  demoInstallUrl: parseString(env.MOI_DEMO_INSTALL_URL)
232
229
  }
233
230
  const merged = { ...DEFAULTS, ...fromFile }
234
- for (const key of Object.keys(fromEnv) as (keyof DeploymentConfig)[]) {
231
+ for (const key of Object.keys(fromEnv) as (keyof AppConfig)[]) {
235
232
  if (fromEnv[key] === undefined) delete fromEnv[key]
236
233
  }
237
234
  const cloudflareAccess = resolveCloudflareAccess(raw.cloudflareAccess, env)
238
- const experimental = Object.freeze({
239
- ...DEFAULTS.experimental,
240
- ...cliExperimental
241
- })
242
- return Object.freeze({ ...merged, ...fromEnv, cloudflareAccess, experimental })
235
+ return Object.freeze({ ...merged, ...fromEnv, cloudflareAccess })
243
236
  }
244
237
 
245
238
  let _config: AppConfig | null = null
246
239
 
247
- // The CLI supplies explicit startup flags before importing the web server.
248
- export function initializeAppConfig(experimental: Partial<ExperimentalFeatures> = {}): void {
249
- _config = loadAppConfig(undefined, undefined, experimental)
240
+ // Resolve deployment settings before importing the web server.
241
+ export function initializeAppConfig(): void {
242
+ _config = loadAppConfig()
250
243
  }
251
244
 
252
245
  export function getAppConfig(): AppConfig {
@@ -254,6 +247,12 @@ export function getAppConfig(): AppConfig {
254
247
  return _config
255
248
  }
256
249
 
250
+ // Folder for workspaces created from the UI. Managed machines override it
251
+ // with workspacesDir in config.json.
252
+ export function createdWorkspacesRoot(): string {
253
+ return getAppConfig().workspacesDir ?? join(homedir(), 'moi')
254
+ }
255
+
257
256
  // Test seam: drop the cached config so the next getAppConfig() re-resolves
258
257
  // (tests point MOI_DATA_DIR elsewhere or set MOI_DEMO).
259
258
  export function resetAppConfig(): void {
@@ -263,6 +262,6 @@ export function resetAppConfig(): void {
263
262
  // The only shape that reaches the browser (GET /api/config). Server-only keys
264
263
  // added to AppConfig later stay out unless explicitly forwarded here.
265
264
  export function clientAppConfig(): ClientAppConfig {
266
- const { environment, demo, experimental, demoInstallUrl } = getAppConfig()
267
- return { environment, demo, experimental: { ...experimental }, demoInstallUrl }
265
+ const { environment, collab, demo, demoInstallUrl } = getAppConfig()
266
+ return { environment, collab, demo, demoInstallUrl }
268
267
  }