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
@@ -16,7 +16,10 @@ export type AppSettingsPatch = Partial<AppSettings>
16
16
  // Whitelist of fields the API may update. Type validation is NOT duplicated
17
17
  // here — `saveAppSettings` validates the merged store against the conf schema
18
18
  // before anything is written, so a bad value throws with nothing persisted.
19
- const API_UPDATABLE = ['autoUpdateSkills'] as const satisfies readonly (keyof AppSettings)[]
19
+ const API_UPDATABLE = [
20
+ 'autoUpdateSkills',
21
+ 'showOnboarding'
22
+ ] as const satisfies readonly (keyof AppSettings)[]
20
23
 
21
24
  // Pick the API-updatable fields out of an untrusted body; unknown keys are
22
25
  // dropped. Values are intentionally unchecked — the conf schema rejects wrong
@@ -44,7 +47,8 @@ function store(): Conf<AppSettings> {
44
47
  cwd: _dir,
45
48
  configName: 'settings',
46
49
  schema: {
47
- autoUpdateSkills: { type: 'boolean', default: false }
50
+ autoUpdateSkills: { type: 'boolean', default: false },
51
+ showOnboarding: { type: 'boolean', default: true }
48
52
  }
49
53
  })
50
54
  return _store
@@ -2,10 +2,10 @@ import { parse } from '@babel/parser'
2
2
  import type { ObjectExpression, ObjectProperty, StringLiteral } from '@babel/types'
3
3
  import { basename } from 'node:path'
4
4
 
5
- import { APP_ICON_IDS, isAppIconId } from '@/lib/app-icons'
5
+ import { IDENTITY_ICON_IDS, isIdentityIconId } from '@/lib/identity-icons'
6
6
  import type { ViewConfig, WidgetConfig } from '@/lib/types'
7
7
 
8
- const APP_ICON_NAMES: readonly string[] = APP_ICON_IDS
8
+ const IDENTITY_ICON_NAMES: readonly string[] = IDENTITY_ICON_IDS
9
9
 
10
10
  const DEFAULT_CONFIG: WidgetConfig = { rowSpan: 1, colSpan: 2 }
11
11
  const VALID_SPANS = [1, 2, 3, 4] as const
@@ -108,7 +108,7 @@ export async function extractWidgetConfig(srcPath: string): Promise<WidgetConfig
108
108
  return { ...DEFAULT_CONFIG, ...result }
109
109
  }
110
110
 
111
- // A view's config: `title` + app icon registry id + advisory `requiredEnv`.
111
+ // A view's config: `title` + identity icon registry id + advisory `requiredEnv`.
112
112
  // No sizing — views are full-screen. Returns null when no `config` export is present.
113
113
  export async function extractViewConfig(srcPath: string): Promise<ViewConfig | null> {
114
114
  const source = await Bun.file(srcPath).text()
@@ -131,9 +131,9 @@ export async function extractViewConfig(srcPath: string): Promise<ViewConfig | n
131
131
  if (key === 'icon') {
132
132
  if (prop.value.type === 'StringLiteral') {
133
133
  const icon = prop.value.value
134
- if (!isAppIconId(icon)) {
134
+ if (!isIdentityIconId(icon)) {
135
135
  throw new Error(
136
- `Unknown view icon id "${icon}". Use one of: ${APP_ICON_NAMES.join(', ')}`
136
+ `Unknown view icon id "${icon}". Use one of: ${IDENTITY_ICON_NAMES.join(', ')}`
137
137
  )
138
138
  }
139
139
  result.icon = icon
@@ -17,6 +17,7 @@ import { reloadModules } from './functions'
17
17
  import { loadLayout, saveLayout } from '../workspaces/layout'
18
18
  import { completeViewBuild, listPendingViews } from '../sessions/pending-views'
19
19
  import { archiveViewSessions } from '../sessions/archive'
20
+ import type { WorkspaceRef } from '../workspace-state'
20
21
  import { setViewSourceTitle } from './config'
21
22
  import { deleteViewSourceFiles, readViewSource, ViewSourceInUseError } from './view-source'
22
23
 
@@ -172,15 +173,17 @@ export async function collectViewRequiredEnv(
172
173
  return out
173
174
  }
174
175
 
175
- export async function getWorkspaceViews(workspacePath: string): Promise<ViewInfo[]> {
176
- const compiled = await listCompiledViews(workspacePath)
176
+ export async function getWorkspaceViews(ws: WorkspaceRef): Promise<ViewInfo[]> {
177
+ const compiled = await listCompiledViews(ws.path)
177
178
  const ids = new Set(compiled.map(view => view.id))
178
- const pending = (await listPendingViews(workspacePath)).filter(view => !ids.has(view.id))
179
+ const pending = (await listPendingViews(ws)).filter(view => !ids.has(view.id))
179
180
  return [...compiled, ...pending]
180
181
  }
181
182
 
183
+ // The API lists compiled views only; clients read pending views from the
184
+ // workspace state, which `state:changed` keeps current.
182
185
  export async function listViews(workspacePath: string): Promise<Response> {
183
- return Response.json({ views: await getWorkspaceViews(workspacePath) })
186
+ return Response.json({ views: await listCompiledViews(workspacePath) })
184
187
  }
185
188
 
186
189
  export async function handleBundleViews(
@@ -200,23 +203,27 @@ export async function handleBundleViews(
200
203
  // superseded by a successful rebuild (see docs/self-correction.md).
201
204
  syncAppletLogAfterBuild(workspacePath, 'view', results)
202
205
 
203
- const identityChanged = results.some(
204
- r =>
205
- r.status === 'built' &&
206
- ((before.config[r.name]?.title ?? '') !== (r.config?.title ?? '') ||
207
- (before.config[r.name]?.icon ?? '') !== (r.config?.icon ?? ''))
208
- )
209
206
  const orderChanged = before.order.join('\0') !== after.order.join('\0')
210
207
  const membershipChanged =
211
208
  beforeBuilt.size !== afterBuilt.size ||
212
209
  [...beforeBuilt].some(n => !afterBuilt.has(n)) ||
213
210
  [...afterBuilt].some(n => !beforeBuilt.has(n))
214
211
 
212
+ // Install compiled views in the browser before removing their pending entries.
213
+ // Otherwise tab cleanup can mistake the handoff for a deleted view.
214
+ if (results.some(r => r.status === 'built') || orderChanged || membershipChanged) {
215
+ publish({
216
+ type: 'view-layout:updated',
217
+ workspaceId,
218
+ views: await listCompiledViews(workspacePath)
219
+ })
220
+ }
221
+
215
222
  const changedServerModules = new Set<string>()
216
223
  for (const r of results) {
217
224
  if (r.status === 'built') {
218
225
  publish({ type: 'view:updated', name: r.name, config: r.config ?? null })
219
- await completeViewBuild(workspaceId, workspacePath, r.name)
226
+ await completeViewBuild({ id: workspaceId, path: workspacePath }, r.name)
220
227
  for (const m of r.serverModules ?? []) changedServerModules.add(m)
221
228
  }
222
229
  }
@@ -225,11 +232,6 @@ export async function handleBundleViews(
225
232
  reloadModules([...changedServerModules], workspacePath)
226
233
  }
227
234
 
228
- const views = await listCompiledViews(workspacePath)
229
- if (identityChanged || orderChanged || membershipChanged) {
230
- publish({ type: 'view-layout:updated', views })
231
- }
232
-
233
235
  return results
234
236
  }
235
237
 
@@ -304,7 +306,7 @@ export async function deleteView(
304
306
  throw error
305
307
  }
306
308
  reloadModules([`views/${viewId}`], workspacePath)
307
- await completeViewBuild(workspaceId, workspacePath, viewId)
309
+ await completeViewBuild(ws, viewId)
308
310
  const layout = await loadLayout(workspacePath)
309
311
  const tab = viewTabId(viewId)
310
312
  await saveLayout(
@@ -137,7 +137,7 @@ export const init = defineCommand({
137
137
  default: false,
138
138
  description: 'Start the web server if not already running'
139
139
  },
140
- 'experimental-collab': {
140
+ collab: {
141
141
  type: 'boolean',
142
142
  default: false,
143
143
  description: 'Include the optional collaboration guide and applet types'
@@ -204,10 +204,10 @@ export const init = defineCommand({
204
204
  // package.json + bun install). An existing `.moi/` is left untouched.
205
205
  console.log()
206
206
  const { scaffold, skillsDir, installLogPath } = await provisionWorkspace(target, type)
207
- if (args['experimental-collab']) {
207
+ if (args['collab']) {
208
208
  const { referencePath } = await installCollabSkill(target, type)
209
209
  console.log(pc.dim(' Collaboration guide installed to ' + referencePath))
210
- console.log(pc.dim(' Live presence requires moi start --experimental-collab'))
210
+ console.log(pc.dim(' Live presence is available in the cloud environment'))
211
211
  }
212
212
  if (scaffold !== 'exists') {
213
213
  if (scaffold === 'installing') {
@@ -2,6 +2,8 @@ import type { WorkspaceSkillStatus } from '@/lib/types'
2
2
  import { defineCommand } from 'citty'
3
3
  import { resolve } from 'path'
4
4
  import { updateWorkspaceSkills } from '../../skills/update'
5
+ import type { WorkspaceSkillUpdateResult } from '../../skills/update'
6
+ import { displaySkillPath } from '../../skills/locations'
5
7
  import { isBehind, isMinorBehind, resolveWorkspace, skillStatuses } from '../../skills/version'
6
8
  import { dirArg } from '../args'
7
9
  import pc from '../pc'
@@ -11,38 +13,34 @@ import { columns } from '../ui'
11
13
  // filesystem op — no running server needed. Resolves the workspace root the
12
14
  // same way `moi bundle` does, so it works from `.moi/` or any subdirectory.
13
15
  async function runSkillUpdate(cwd: string): Promise<void> {
14
- // Type-aware: an OpenClaw workspace keeps its skills in `skills/`, so the
15
- // update must target the same dir the agent actually loads from.
16
+ // Include the primary harness destination and existing copies for other agents.
16
17
  const { root, type } = await resolveWorkspace(cwd)
17
- const { before, status, changedSkills, updatedAppletTypes } = await updateWorkspaceSkills(
18
- root,
19
- type ?? 'claude-code'
20
- )
21
- const after = status.skills
18
+ const result = await updateWorkspaceSkills(root, type)
19
+ const { changedSkills, updatedAppletTypes } = result
22
20
  const heading = changedSkills.length > 0 ? 'Skills updated in ' : 'Skills unchanged in '
23
21
 
24
22
  console.log('\n' + pc.green('✓') + ' ' + heading + pc.bold(root) + '\n')
25
- printSkillUpdateTable(before, after, changedSkills)
23
+ printSkillUpdateTable(root, result)
26
24
  for (const file of updatedAppletTypes) {
27
25
  console.log(pc.dim(' Applet types regenerated: ') + pc.bold(`.moi/${file}\n`))
28
26
  }
29
27
  }
30
28
 
31
29
  function printSkillUpdateTable(
32
- before: WorkspaceSkillStatus[],
33
- after: WorkspaceSkillStatus[],
34
- changedSkills: string[]
30
+ root: string,
31
+ { before, status, changedSkills, changedSkillPaths }: WorkspaceSkillUpdateResult
35
32
  ): void {
36
- const changedSkillNames = new Set(changedSkills)
33
+ const changedPaths = new Set(changedSkillPaths)
37
34
  console.log(
38
35
  columns(
39
- ['skill', 'from', 'to'].map(h => pc.dim(h)),
40
- after.map(s => {
41
- const prev = before.find(b => b.name === s.name)?.installed ?? null
36
+ ['skill', 'path', 'from', 'to'].map(h => pc.dim(h)),
37
+ status.skills.map(s => {
38
+ const prev = before.find(b => b.name === s.name && b.path === s.path)?.installed ?? null
42
39
  const versionChanged = prev !== s.installed
43
- const filesChanged = changedSkillNames.has(s.name)
40
+ const filesChanged = changedPaths.has(s.path)
44
41
  return [
45
42
  s.name,
43
+ displaySkillPath(root, s.path),
46
44
  prev ?? pc.dim('none'),
47
45
  versionChanged
48
46
  ? pc.green(s.installed ?? '?')
@@ -105,9 +103,10 @@ export const skill = defineCommand({
105
103
  console.log('\n' + pc.bold('moi skill') + pc.dim(' — workspace skills') + '\n')
106
104
  console.log(
107
105
  columns(
108
- ['skill', 'installed', 'bundled', 'status'].map(h => pc.dim(h)),
106
+ ['skill', 'path', 'installed', 'bundled', 'status'].map(h => pc.dim(h)),
109
107
  statuses.map(s => [
110
108
  s.name,
109
+ displaySkillPath(root, s.path),
111
110
  s.installed ?? pc.dim('—'),
112
111
  s.bundled ?? pc.dim('—'),
113
112
  skillState(s)
@@ -1,5 +1,3 @@
1
- import type { ExperimentalFeatures } from '@/lib/experimental'
2
- import { EXPERIMENTAL_FEATURES, experimentalFlagName } from '@/lib/experimental'
3
1
  import { defineCommand } from 'citty'
4
2
  import { getAppConfig, initializeAppConfig } from '../../app-config'
5
3
  import { CONTROL_PORT, PORT } from '../../constants'
@@ -9,15 +7,7 @@ import { superviseServerUpdates } from '../../update'
9
7
  import { PACKAGE_ROOT } from '../../version'
10
8
  import { isServerRunning } from '../control'
11
9
  import pc from '../pc'
12
- import { runDevSupervisor, spawnServer } from '../server'
13
-
14
- const experimentalArgs = Object.fromEntries(
15
- EXPERIMENTAL_FEATURES.map(feature => {
16
- const name = experimentalFlagName(feature)
17
- const label = name.slice('experimental-'.length).replaceAll('-', ' ')
18
- return [name, { type: 'boolean' as const, description: `Enable experimental ${label}` }]
19
- })
20
- )
10
+ import { assertDevRuntime, runDevSupervisor, spawnServer } from '../server'
21
11
 
22
12
  export const start = defineCommand({
23
13
  meta: { name: 'start', description: 'Start the Moi web server' },
@@ -25,27 +15,13 @@ export const start = defineCommand({
25
15
  port: {
26
16
  type: 'string',
27
17
  description: 'HTTP port to listen on (default: 13337)'
28
- },
29
- ...experimentalArgs
30
- },
31
- async run({ args, rawArgs }) {
32
- const knownFlags = new Set(EXPERIMENTAL_FEATURES.map(experimentalFlagName))
33
- for (const arg of rawArgs) {
34
- if (arg.startsWith('--experimental-') && !knownFlags.has(arg.slice(2))) {
35
- throw new Error(`Unknown experimental feature: ${arg.slice('--experimental-'.length)}`)
36
- }
37
- }
38
- const experimental: Partial<ExperimentalFeatures> = {}
39
- const experimentalFlags: string[] = []
40
- for (const feature of EXPERIMENTAL_FEATURES) {
41
- const flag = experimentalFlagName(feature)
42
- if (args[flag] !== true) continue
43
- experimental[feature] = true
44
- experimentalFlags.push(`--${flag}`)
45
18
  }
19
+ },
20
+ async run({ args }) {
46
21
  const projectRoot = PACKAGE_ROOT
47
22
  // Undocumented: --dev runs the watch-and-full-restart dev supervisor.
48
23
  const dev = process.argv.includes('--dev')
24
+ if (dev) assertDevRuntime()
49
25
  // Undocumented: --debug turns on the messaging trace (MOI_DEBUG) in the
50
26
  // server — console lines for each message/session/turn in the chat pipeline.
51
27
  const debug = process.argv.includes('--debug')
@@ -94,20 +70,18 @@ export const start = defineCommand({
94
70
  ...(debug ? { MOI_DEBUG: '1' } : {})
95
71
  }
96
72
  if (dev) {
97
- await runDevSupervisor(projectRoot, env, experimentalFlags)
73
+ await runDevSupervisor(projectRoot, env)
98
74
  return
99
75
  }
100
76
  const cwd = serverCwd(projectRoot, dev)
101
- const proc = spawnServer(cwd, env, experimentalFlags)
102
- process.exit(
103
- await superviseServerUpdates(proc, () => spawnServer(cwd, env, experimentalFlags))
104
- )
77
+ const proc = spawnServer(cwd, env)
78
+ process.exit(await superviseServerUpdates(proc, () => spawnServer(cwd, env)))
105
79
  }
106
80
 
107
81
  // This IS the server process (MOI_SERVER=1). cwd is the package root when the
108
82
  // dev bundler runs (bunfig loaded at Bun startup) or a neutral dir for a
109
83
  // prebuilt install — see serverCwd().
110
- initializeAppConfig(experimental)
84
+ initializeAppConfig()
111
85
  try {
112
86
  await import('../../web')
113
87
  } catch (err) {
@@ -1,7 +1,19 @@
1
1
  import { join } from 'path'
2
+ import { packageManager } from '../../package.json'
2
3
  import { PACKAGE_ROOT } from '../version'
3
4
  import pc from './pc'
4
5
 
6
+ export function assertDevRuntime(version = Bun.version): void {
7
+ // Reuse CI's baseline; packageManager does not select the local executable.
8
+ const requiredVersion = packageManager.slice('bun@'.length)
9
+ if (!Bun.semver.satisfies(version, `>=${requiredVersion}`)) {
10
+ throw new Error(
11
+ `Moi development requires Bun ${requiredVersion} or newer (running ${version}). ` +
12
+ `Run \`bun upgrade --version ${requiredVersion}\`, then restart \`bun run dev\`.`
13
+ )
14
+ }
15
+ }
16
+
5
17
  // Spawn the server as a child. MOI_SERVER=1 tells the child it is the actual
6
18
  // server process. No `--hot`: frontend HMR comes from Bun.serve's dev bundler,
7
19
  // and server reloads are a full process restart driven by the dev supervisor
@@ -9,9 +21,10 @@ import pc from './pc'
9
21
  export function spawnServer(
10
22
  cwd: string,
11
23
  env: Record<string, string | undefined> = process.env,
12
- experimentalFlags: string[] = []
24
+ args: string[] = []
13
25
  ): ReturnType<typeof Bun.spawn> {
14
- const argv = ['bun', join(PACKAGE_ROOT, 'server', 'cli.ts'), 'start', ...experimentalFlags]
26
+ // Keep the checked runtime instead of resolving a different Bun on PATH.
27
+ const argv = [process.execPath, join(PACKAGE_ROOT, 'server', 'cli.ts'), 'start', ...args]
15
28
  return Bun.spawn(argv, {
16
29
  stdin: 'inherit',
17
30
  stdout: 'inherit',
@@ -31,12 +44,11 @@ export function spawnServer(
31
44
  // (closing servers + killing function workers), so restarts leak nothing.
32
45
  export async function runDevSupervisor(
33
46
  projectRoot: string,
34
- env: Record<string, string | undefined>,
35
- experimentalFlags: string[]
47
+ env: Record<string, string | undefined>
36
48
  ): Promise<void> {
37
49
  const { watch } = await import('node:fs')
38
50
 
39
- let child = spawnServer(projectRoot, env, experimentalFlags)
51
+ let child = spawnServer(projectRoot, env)
40
52
  let restarting = false
41
53
  let debounce: ReturnType<typeof setTimeout> | undefined
42
54
 
@@ -55,7 +67,7 @@ export async function runDevSupervisor(
55
67
  await child.exited
56
68
  clearTimeout(sigkill)
57
69
  restarting = false
58
- child = spawnServer(projectRoot, env, experimentalFlags)
70
+ child = spawnServer(projectRoot, env)
59
71
  }
60
72
 
61
73
  for (const dir of ['server', 'lib']) {
@@ -3,9 +3,8 @@ import type { WorkspaceType } from '@/lib/types'
3
3
  import { getAppConfig } from '../app-config'
4
4
  import { collabSkillReferencePath } from './skill'
5
5
 
6
- // Only an explicit startup CLI flag enables this process setting.
7
6
  export function isCollabEnabled(): boolean {
8
- return getAppConfig().experimental.collab
7
+ return getAppConfig().collab
9
8
  }
10
9
 
11
10
  export async function getCollabReferencePath(
@@ -108,7 +108,10 @@ export class CollabManager {
108
108
  binding.workspacePaths.add(canonicalPath)
109
109
  if (binding.closed) throw new CollabRuntimeError('unavailable', 'Collab connection closed')
110
110
  if (!(await (this.options.enabled ?? isCollabEnabled)(canonicalPath))) {
111
- throw new CollabRuntimeError('unavailable', 'Start Moi with --experimental-collab')
111
+ throw new CollabRuntimeError(
112
+ 'unavailable',
113
+ 'Collaboration is only available in the cloud environment'
114
+ )
112
115
  }
113
116
  if (this.closed || binding.closed)
114
117
  throw new CollabRuntimeError('unavailable', 'Collab connection closed')
@@ -27,7 +27,7 @@ async function writeChanged(path: string, contents: string): Promise<void> {
27
27
  await Bun.write(path, contents)
28
28
  }
29
29
 
30
- // Only an explicit `moi init --experimental-collab` installs the guide and types.
30
+ // Only an explicit `moi init --collab` installs the guide and types.
31
31
  export async function installCollabSkill(
32
32
  workspacePath: string,
33
33
  type?: WorkspaceType
package/server/control.ts CHANGED
@@ -300,7 +300,7 @@ export const control = Bun.serve({
300
300
  return
301
301
  }
302
302
  try {
303
- const view = await updatePendingView(match.id, match.path, appletId, {
303
+ const view = await updatePendingView(match, appletId, {
304
304
  title,
305
305
  icon
306
306
  })
@@ -321,7 +321,7 @@ export const control = Bun.serve({
321
321
  if (!match) return
322
322
  const [layout, views] = await Promise.all([
323
323
  loadLayout(match.path),
324
- getWorkspaceViews(match.path)
324
+ getWorkspaceViews(match)
325
325
  ])
326
326
  ws.send(JSON.stringify({ ok: true, tabs: assembleTabRows(views, layout.tabs.active) }))
327
327
  return
@@ -336,7 +336,7 @@ export const control = Bun.serve({
336
336
  if (!href.startsWith('moi:/') || href.startsWith('moi:/files/'))
337
337
  throw new Error('Navigation needs a workspace page address')
338
338
  const tab = href.slice(5).split('?', 1)[0]
339
- if (isWorkspaceTabId(tab)) assertNavigableTab(tab, await getWorkspaceViews(match.path))
339
+ if (isWorkspaceTabId(tab)) assertNavigableTab(tab, await getWorkspaceViews(match))
340
340
  await navigationRelay.navigate(match.id, href)
341
341
  ws.send(JSON.stringify({ ok: true, href }))
342
342
  } catch (error) {
@@ -1,5 +1,5 @@
1
1
  // Single source of truth for the OS data dir holding moi's global state
2
- // (workspaces.json, settings.json, session-config.json, selected-sessions.json, …).
2
+ // (workspaces.json, settings.json, workspaces/<id>/state.json, …).
3
3
  //
4
4
  // MOI_DATA_DIR overrides it wholesale. This is the isolation seam for CLI
5
5
  // e2e tests: env-paths only honors XDG_DATA_HOME on Linux, so on macOS a
@@ -224,7 +224,10 @@ workspace's environment. Login credentials remain owned by the provider CLI.
224
224
  `account/login/start` uses browser OAuth locally and `chatgptDeviceCode` in
225
225
  cloud. Local login opens the browser; cloud returns a URL and device code.
226
226
 
227
- `GET /api/harnesses/:type/auth` returns cached global readiness and login state.
227
+ `GET /api/harnesses/status` returns one status map for all harnesses, including
228
+ installation availability and login state. Checks run concurrently.
229
+ Normal reads reuse the server’s 30-second availability cache. Explicit retries use
230
+ `?refresh=true` to recheck external sign-in/sign-out and installation changes.
228
231
  `POST /api/harnesses/:type/auth/login` starts or reuses an attempt;
229
232
  `POST /api/harnesses/:type/auth/login/:id/code` submits a manual authorization
230
233
  code. The attempt ID rejects submissions from an older login. Startup reports
@@ -232,12 +235,15 @@ code. The attempt ID rejects submissions from an older login. Startup reports
232
235
 
233
236
  During login, the server rechecks readiness until the provider confirms
234
237
  completion and readiness succeeds, or the attempt fails or reaches its
235
- ten-minute deadline. Shutdown cancels active attempts. Auth changes trigger
236
- independent readiness checks for registered workspaces using that harness,
237
- published as `harness:updated` events.
238
-
239
- `GET /api/workspaces/:id/agent` returns workspace readiness and the model
240
- catalog. Adding `?refresh=true` refreshes the shell PATH and bypasses the
238
+ ten-minute deadline. Shutdown cancels active attempts. Auth changes publish `harness-status:changed` once for all consumers. The client
239
+ shares one status query across onboarding and workspace navigation. It
240
+ reads cached status on focus, reconnect, and authentication changes, and polls only during
241
+ an active login.
242
+
243
+ `GET /api/workspaces/:id/harness` returns the workspace model catalog, capabilities,
244
+ and folder checks. Only workspaces with credential environment overrides or gateway-backed
245
+ harnesses probe workspace readiness; ordinary Claude and Codex workspaces use
246
+ the shared account status. Adding `?refresh=true` refreshes the shell PATH and bypasses the
241
247
  readiness cache.
242
248
 
243
249
  ## What a harness adapter must support
@@ -348,7 +354,17 @@ describes what Moi exposes, not every RPC available in the upstream protocol.
348
354
  | Home card preview | ✅ session file scan | ✅ cached first message | ⚠️ live app-server only | ⚠️ live process only |
349
355
  | MCP status | ✅ `mcpServerStatus()` | n/a | ✅ `mcpServerStatus/list` | ⚠️ per-session config, no status RPC |
350
356
  | Usage reporting | ⚠️ cost/duration on `result` (adapter drops tokens) | ✅ tokens + cost per turn | ✅ per-turn tokens and duration | ✅ tokens per turn |
351
- | Structured output | ❌ | ❌ | ⚠️ title generation only | ❌ |
357
+ | Structured output | ✅ ephemeral actions | ❌ | ✅ ephemeral actions via Codex exec | ❌ |
358
+
359
+ ## Ephemeral actions
360
+
361
+ Claude and Codex support `Harness.runAction` for read/search tasks without a workspace
362
+ or visible chat. Pass a prompt, Zod `resultSchema`, and cancellation signal to get a
363
+ validated, typed result. For progress updates, supply `progressSchema` and `onProgress`
364
+ together. See [the action runner](run-action.ts) for implementation details.
365
+
366
+ Optional `model: 'fast' | 'normal' | 'smart'` selects a harness-owned model and
367
+ reasoning effort. Omission uses `normal`.
352
368
 
353
369
  ## Design lessons so far
354
370
 
@@ -609,8 +609,7 @@ export async function sendAcpMessage(
609
609
  if (realId !== input.sessionId) {
610
610
  aliases.set(recKey(input.workspaceId, input.sessionId), realId)
611
611
  await renameSessionReferences(
612
- input.workspaceId,
613
- input.workspacePath,
612
+ { id: input.workspaceId, path: input.workspacePath },
614
613
  input.sessionId,
615
614
  realId
616
615
  )
@@ -626,8 +625,13 @@ export async function sendAcpMessage(
626
625
  })
627
626
  await applyNoPromptMode(client, config, realId)
628
627
  if (input.model) await setSessionModel(config, rec, client, input.model)
629
- if (input.model && !(await hasSessionConfig(input.workspacePath, realId))) {
630
- await saveSessionConfig(input.workspacePath, realId, { model: input.model })
628
+ if (
629
+ input.model &&
630
+ !(await hasSessionConfig({ id: input.workspaceId, path: input.workspacePath }, realId))
631
+ ) {
632
+ await saveSessionConfig({ id: input.workspaceId, path: input.workspacePath }, realId, {
633
+ model: input.model
634
+ })
631
635
  }
632
636
  } else {
633
637
  rec = await resumeSession(config, input)
@@ -1,3 +1,4 @@
1
+ import { pathHarnessAvailability } from './executable'
1
2
  // Login is global per harness. Workspace readiness is checked independently
2
3
  // using each workspace’s environment.
3
4
  import type {
@@ -7,7 +8,6 @@ import type {
7
8
  WorkspaceType
8
9
  } from '@/lib/types'
9
10
 
10
- import { listWorkspaces } from '../workspaces/registry'
11
11
  import { publishEvent } from '../events'
12
12
  import { harnessFor } from './registry'
13
13
  import type { HarnessWorkspace, HarnessLoginAttempt } from './types'
@@ -29,7 +29,7 @@ export type HarnessStoreOptions = {
29
29
  probe: (ws: HarnessTarget) => Promise<HarnessAvailability>
30
30
  startLogin: (type: WorkspaceType) => Promise<HarnessLoginAttempt>
31
31
  publish: (event: HarnessUpdatedEvent) => void
32
- onAuthChanged?: (type: WorkspaceType) => Promise<void>
32
+ onAuthChanged?: (type: WorkspaceType, availability: HarnessAvailability) => Promise<void>
33
33
  availabilityTtlMs?: number
34
34
  loginPollMs?: number
35
35
  loginDeadlineMs?: number
@@ -83,7 +83,7 @@ export function createHarnessStore(options: HarnessStoreOptions) {
83
83
  }
84
84
 
85
85
  async function publish(context: HarnessTarget, availability: HarnessAvailability) {
86
- if (typeof context === 'string') return options.onAuthChanged?.(context)
86
+ if (typeof context === 'string') return options.onAuthChanged?.(context, availability)
87
87
  options.publish({
88
88
  type: 'harness:updated',
89
89
  workspaceId: context.id,
@@ -106,9 +106,9 @@ export function createHarnessStore(options: HarnessStoreOptions) {
106
106
  return value
107
107
  }
108
108
 
109
- async function getAvailability(ws: HarnessTarget): Promise<HarnessAvailability> {
109
+ async function getAvailability(ws: HarnessTarget, fresh = false): Promise<HarnessAvailability> {
110
110
  const entry = entryFor(ws)
111
- if (entry.cached && Date.now() - entry.cached.checkedAt < ttlMs) {
111
+ if (!fresh && entry.cached && Date.now() - entry.cached.checkedAt < ttlMs) {
112
112
  return entry.cached.value
113
113
  }
114
114
  return probeFresh(ws)
@@ -279,8 +279,9 @@ export const harnessStore = createHarnessStore({
279
279
  if (typeof context !== 'string') {
280
280
  return (await harness.availability?.(context)) ?? { status: 'available' }
281
281
  }
282
- if (!harness.authStatus)
283
- return { status: 'unavailable', reason: 'This agent requires terminal sign-in' }
282
+ if (!harness.authStatus) return pathHarnessAvailability(harness.id)
283
+ const runtime = await harness.availability?.()
284
+ if (runtime && runtime.status !== 'available') return runtime
284
285
  return harness.authStatus()
285
286
  },
286
287
  startLogin: type => {
@@ -289,15 +290,11 @@ export const harnessStore = createHarnessStore({
289
290
  return start()
290
291
  },
291
292
  publish: publishEvent,
292
- onAuthChanged: async type => {
293
- // Shared credentials still need an independent check in each workspace.
294
- try {
295
- const workspaces = await listWorkspaces()
296
- await Promise.all(
297
- workspaces.filter(ws => harnessFor(ws).id === type).map(ws => harnessStore.refresh(ws))
298
- )
299
- } catch (error) {
300
- console.error('[harness-auth] could not refresh workspaces after login', error)
301
- }
293
+ onAuthChanged: async (type, availability) => {
294
+ publishEvent({
295
+ type: 'harness-status:changed',
296
+ harness: type,
297
+ status: { availability, login: harnessStore.getLogin(type) }
298
+ })
302
299
  }
303
300
  })
@@ -59,8 +59,9 @@ while Moi keeps running, changing which models are available.
59
59
  survives planned subprocess replacement.
60
60
  - Settings apply immediately before dispatch. Rejected setters fail the send.
61
61
  Model uses `setModel`; effort and fast mode use `applyFlagSettings` together.
62
- An absent effort or fast-mode value clears that flag with `null`, restoring
63
- provider defaults.
62
+ An absent effort clears that flag with `null`, restoring the provider default.
63
+ Moi speed mode maps to the SDK boolean: Fast is `true`; Normal, unset, and
64
+ unsupported Ultrafast are `false`.
64
65
  - Background jobs retain their subprocess. Messages requiring a replacement
65
66
  wait in Moi until those jobs finish, including replacements for streaming
66
67
  changes. `background_tasks_changed` replaces the complete task set, including
@@ -71,7 +72,7 @@ while Moi keeps running, changing which models are available.
71
72
  chat busy.
72
73
  - Stop cancels queued messages and waits for interrupt acknowledgement and
73
74
  turn completion. An unexpected process exit rejects pending sends.
74
- - The picker gets the new lineup on the client's next `/agent` refetch (window
75
+ - The picker gets the new lineup on the client's next `/harness` refetch (window
75
76
  focus, reconnect). `moi status` prints the version the catalog was probed
76
77
  for next to the executable path.
77
78