moi-computer 0.13.1-next.1 → 0.13.1-next.2

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 (195) hide show
  1. package/client/api/app-config.ts +12 -1
  2. package/client/api/http.ts +11 -1
  3. package/client/app/app-router.tsx +3 -2
  4. package/client/app/routes/home-route.tsx +1 -1
  5. package/client/app/routes/workspace-registration.tsx +68 -0
  6. package/client/app/routes/workspace-route.tsx +33 -6
  7. package/client/app/shell/sidebar-layout.tsx +10 -5
  8. package/client/components/shared/workspace-icon.tsx +8 -17
  9. package/client/features/account/account-test-utils.tsx +15 -9
  10. package/client/features/account/api.ts +6 -6
  11. package/client/features/account/profile-actions.ts +5 -7
  12. package/client/features/app-settings/settings-page.tsx +2 -1
  13. package/client/features/applets/api.ts +6 -6
  14. package/client/features/applets/applet-cache.ts +6 -5
  15. package/client/features/applets/applet-log.ts +2 -1
  16. package/client/features/applets/applet-runtime.ts +2 -1
  17. package/client/features/applets/use-applet.ts +73 -18
  18. package/client/features/applets/widget-shell.tsx +4 -2
  19. package/client/features/chat/applet-chat-intents.ts +5 -13
  20. package/client/features/chat/chat-popup.tsx +8 -4
  21. package/client/features/chat/chat-send.ts +2 -2
  22. package/client/features/chat/composer/model-order.ts +4 -4
  23. package/client/features/chat/composer/model-picker.tsx +12 -10
  24. package/client/features/chat/composer/use-workspace-composer-state.tsx +1 -1
  25. package/client/features/chat/sessions/api.ts +11 -28
  26. package/client/features/chat/sessions/use-selected-session.ts +18 -100
  27. package/client/features/chat/use-chat.ts +8 -12
  28. package/client/features/collab/members/api.ts +4 -10
  29. package/client/features/collab/members/hooks.ts +32 -38
  30. package/client/features/collab/members/store.ts +96 -71
  31. package/client/features/collab/members/types.ts +5 -3
  32. package/client/features/collab/presence/client.ts +2 -3
  33. package/client/features/collab/presence/hooks.tsx +1 -1
  34. package/client/features/collab/proxy-user.ts +1 -3
  35. package/client/features/collab/sharing/workspace-members.tsx +0 -8
  36. package/client/features/dev/chat-states-page.tsx +3 -1
  37. package/client/features/dev/harness-debug-page.tsx +7 -7
  38. package/client/features/dev/workspace-setup-mocks.ts +1 -1
  39. package/client/features/dev/workspace-setup-preview.tsx +6 -4
  40. package/client/features/harness/api.ts +13 -10
  41. package/client/features/harness/harness-login-panel.tsx +9 -5
  42. package/client/features/harness/harness-presentation.ts +4 -4
  43. package/client/features/harness/harness-selector.tsx +13 -13
  44. package/client/features/harness/use-harness-login.ts +5 -5
  45. package/client/features/home/api.ts +38 -2
  46. package/client/features/home/home-page.tsx +43 -13
  47. package/client/features/home/shared-workspaces.tsx +70 -0
  48. package/client/features/home/workspace-invitations.tsx +101 -0
  49. package/client/features/identity/host-api.ts +3 -2
  50. package/client/features/identity/store.ts +1 -7
  51. package/client/features/onboarding/agent-setup-step.tsx +8 -8
  52. package/client/features/onboarding/onboarding-page.tsx +3 -2
  53. package/client/features/onboarding/workspace-setup-step.tsx +1 -1
  54. package/client/features/overview/api.ts +3 -5
  55. package/client/features/overview/default/registry.tsx +1 -1
  56. package/client/features/overview/default/views-widget.tsx +2 -2
  57. package/client/features/overview/hidden-panel.tsx +7 -5
  58. package/client/features/overview/overview.tsx +18 -16
  59. package/client/features/overview/workspace-name.tsx +2 -2
  60. package/client/features/scratchpad/scratchpad.tsx +9 -7
  61. package/client/features/scratchpad/use-scratchpad-snapshot.tsx +13 -5
  62. package/client/features/views/api.ts +34 -16
  63. package/client/features/views/use-view-actions.ts +10 -20
  64. package/client/features/views/view-manager.tsx +1 -1
  65. package/client/features/views/view-submission.ts +2 -21
  66. package/client/features/workspace/add/api.ts +5 -4
  67. package/client/features/workspace/add/create-workspace-dialog.tsx +12 -9
  68. package/client/features/workspace/add/import-workspace-dialog.tsx +7 -7
  69. package/client/features/workspace/add/use-workspace-import.ts +10 -10
  70. package/client/features/workspace/add/workspace-agent-options.ts +21 -20
  71. package/client/features/workspace/add/workspace-agent-selector.tsx +11 -11
  72. package/client/features/workspace/api.ts +60 -13
  73. package/client/features/workspace/harness-transition.ts +7 -13
  74. package/client/features/workspace/remote.ts +25 -0
  75. package/client/features/workspace/settings/api.ts +7 -12
  76. package/client/features/workspace/settings/connectors-settings.tsx +3 -3
  77. package/client/features/workspace/settings/general-settings.tsx +8 -8
  78. package/client/features/workspace/setup/workspace-login-state.tsx +4 -4
  79. package/client/features/workspace/setup/workspace-recovery-states.tsx +43 -14
  80. package/client/features/workspace/setup/workspace-setup.tsx +6 -6
  81. package/client/features/workspace/tab-resolution.ts +2 -2
  82. package/client/features/workspace/use-workspace-navigation.ts +7 -4
  83. package/client/features/workspace/workspace-content.tsx +22 -20
  84. package/client/features/workspace/workspace-frame.tsx +13 -26
  85. package/client/features/workspace/workspace-layout-context.tsx +45 -12
  86. package/client/features/workspace/workspace-menu.tsx +2 -2
  87. package/client/features/workspace/workspace-pane.tsx +22 -0
  88. package/client/features/workspace/workspace-pending-screen.tsx +1 -1
  89. package/client/features/workspace/workspace-preferences.ts +34 -0
  90. package/client/features/workspace/workspace-presentation.tsx +12 -16
  91. package/client/features/workspace/workspace-screen.tsx +2 -2
  92. package/client/features/workspace/workspace-state.ts +2 -1
  93. package/client/features/workspace/workspace-tabs.tsx +1 -1
  94. package/client/features/workspace/workspace-test-utils.ts +23 -0
  95. package/client/runtime/use-workspace-events.ts +14 -0
  96. package/client/runtime/workspace-events.ts +9 -9
  97. package/client/store/ui.ts +29 -9
  98. package/dist/chunk-44khk4sp.js +2 -0
  99. package/dist/chunk-ba6mz56s.js +72 -0
  100. package/dist/chunk-ec5ennpv.js +1 -0
  101. package/dist/chunk-ectsnw81.js +2 -0
  102. package/dist/chunk-en7w5ypg.js +1 -0
  103. package/dist/chunk-f695wcx5.js +5 -0
  104. package/dist/chunk-kffcah9w.css +1 -0
  105. package/dist/{chunk-th91xfnp.js → chunk-n0fawy9x.js} +1 -1
  106. package/dist/chunk-pdt9hxfw.js +2 -0
  107. package/dist/chunk-rmd0ctfx.js +546 -0
  108. package/dist/chunk-zv22wv0g.js +1 -0
  109. package/dist/index.html +1 -1
  110. package/lib/harness-instructions.ts +4 -4
  111. package/lib/harness-types.ts +13 -0
  112. package/lib/types.ts +34 -49
  113. package/lib/workspace-config.ts +48 -0
  114. package/lib/workspace-layout.ts +2 -4
  115. package/package.json +4 -2
  116. package/server/README.md +29 -27
  117. package/server/api/harnesses.ts +5 -5
  118. package/server/api/index.ts +170 -68
  119. package/server/applets/index.ts +15 -9
  120. package/server/applets/views.ts +2 -17
  121. package/server/applets/widgets.ts +3 -2
  122. package/server/cli/commands/config.ts +8 -20
  123. package/server/cli/commands/hermes.ts +2 -2
  124. package/server/cli/commands/init.ts +96 -53
  125. package/server/cli/commands/openclaw.ts +2 -2
  126. package/server/cli/commands/refresh.ts +10 -1
  127. package/server/cli/commands/remote.ts +228 -0
  128. package/server/cli/commands/skill.ts +4 -4
  129. package/server/cli/commands/tabs.ts +5 -12
  130. package/server/cli/control.ts +35 -4
  131. package/server/cli/index.ts +10 -6
  132. package/server/cli/remote-command.ts +77 -0
  133. package/server/cli/remote-control.ts +70 -0
  134. package/server/cli/remote-operations.ts +244 -0
  135. package/server/collab/config.ts +3 -3
  136. package/server/collab/skill/index.ts +3 -3
  137. package/server/control.ts +38 -11
  138. package/server/harness/acp/session.ts +4 -4
  139. package/server/harness/auth.ts +26 -31
  140. package/server/harness/claude-code/index.ts +1 -1
  141. package/server/harness/codex/discovery.ts +1 -1
  142. package/server/harness/codex/session.ts +1 -1
  143. package/server/harness/detect.ts +14 -19
  144. package/server/harness/executable.ts +10 -10
  145. package/server/harness/hermes/NOTES.md +2 -2
  146. package/server/harness/hermes/index.ts +1 -1
  147. package/server/harness/install.ts +11 -11
  148. package/server/harness/openclaw/index.ts +1 -1
  149. package/server/harness/registry.ts +7 -6
  150. package/server/harness/types.ts +4 -4
  151. package/server/onboarding/jobs.ts +1 -1
  152. package/server/operations/commands.ts +46 -0
  153. package/server/operations/files.ts +148 -0
  154. package/server/operations/server.ts +206 -0
  155. package/server/remote/agent.ts +103 -0
  156. package/server/remote/client.ts +665 -0
  157. package/server/remote/workspace.ts +34 -0
  158. package/server/scratchpad/document.ts +32 -12
  159. package/server/scratchpad/executor.ts +16 -7
  160. package/server/sessions/config.ts +8 -5
  161. package/server/sessions/pending-views.ts +16 -0
  162. package/server/sessions/view-sessions.ts +10 -12
  163. package/server/skills/locations.ts +4 -4
  164. package/server/skills/update.ts +11 -11
  165. package/server/skills/version.ts +7 -7
  166. package/server/skills/workspace.ts +13 -11
  167. package/server/web.ts +11 -8
  168. package/server/workspace-state/file.ts +2 -0
  169. package/server/workspace-state/index.ts +0 -4
  170. package/server/workspaces/api.ts +28 -0
  171. package/server/workspaces/change-harness.ts +15 -26
  172. package/server/workspaces/import.ts +4 -4
  173. package/server/workspaces/init.ts +15 -13
  174. package/server/workspaces/layout.ts +60 -66
  175. package/server/workspaces/registry.ts +43 -18
  176. package/server/workspaces/shared.ts +74 -0
  177. package/server/workspaces/tabs.ts +6 -12
  178. package/skill/SKILL.md +24 -4
  179. package/client/api/app-ui-keys.ts +0 -6
  180. package/client/features/chat/sessions/browser-tab-state.ts +0 -43
  181. package/client/features/collab/members/keys.ts +0 -6
  182. package/client/features/workspace/browser-tab-state.ts +0 -51
  183. package/client/features/workspace/layout-save.ts +0 -13
  184. package/dist/chunk-3smkkcfw.js +0 -546
  185. package/dist/chunk-47h9c2qy.js +0 -2
  186. package/dist/chunk-8qed2gqp.js +0 -75
  187. package/dist/chunk-8zy3vesm.js +0 -1
  188. package/dist/chunk-a47zy276.js +0 -2
  189. package/dist/chunk-g4c1nte9.css +0 -1
  190. package/dist/chunk-kcactdr4.js +0 -2
  191. package/dist/chunk-m8bhx6tw.js +0 -1
  192. package/dist/chunk-pf19zcrn.js +0 -2
  193. package/dist/chunk-ygzxah0e.js +0 -1
  194. package/lib/workspace-types.ts +0 -13
  195. package/server/workspace-state/legacy-migration.ts +0 -79
@@ -1,12 +1,7 @@
1
1
  import { pathHarnessAvailability } from './executable'
2
2
  // Login is global per harness. Workspace readiness is checked independently
3
3
  // using each workspace’s environment.
4
- import type {
5
- HarnessLoginState,
6
- HarnessAvailability,
7
- HarnessLogin,
8
- WorkspaceType
9
- } from '@/lib/types'
4
+ import type { HarnessLoginState, HarnessAvailability, HarnessLogin, HarnessType } from '@/lib/types'
10
5
 
11
6
  import { publishEvent } from '../events'
12
7
  import { harnessFor } from './registry'
@@ -19,7 +14,7 @@ export type HarnessUpdatedEvent = {
19
14
  }
20
15
 
21
16
  // Readiness can target a harness account or an individual workspace.
22
- type HarnessTarget = WorkspaceType | HarnessWorkspace
17
+ type HarnessTarget = HarnessType | HarnessWorkspace
23
18
 
24
19
  function entryKey(context: HarnessTarget): string {
25
20
  return typeof context === 'string' ? `default:${context}` : `workspace:${context.id}`
@@ -27,9 +22,9 @@ function entryKey(context: HarnessTarget): string {
27
22
 
28
23
  export type HarnessStoreOptions = {
29
24
  probe: (ws: HarnessTarget) => Promise<HarnessAvailability>
30
- startLogin: (type: WorkspaceType) => Promise<HarnessLoginAttempt>
25
+ startLogin: (harness: HarnessType) => Promise<HarnessLoginAttempt>
31
26
  publish: (event: HarnessUpdatedEvent) => void
32
- onAuthChanged?: (type: WorkspaceType, availability: HarnessAvailability) => Promise<void>
27
+ onAuthChanged?: (harness: HarnessType, availability: HarnessAvailability) => Promise<void>
33
28
  availabilityTtlMs?: number
34
29
  loginPollMs?: number
35
30
  loginDeadlineMs?: number
@@ -124,14 +119,14 @@ export function createHarnessStore(options: HarnessStoreOptions) {
124
119
  return value
125
120
  }
126
121
 
127
- function getLogin(context: WorkspaceType): HarnessLoginState | undefined {
122
+ function getLogin(context: HarnessType): HarnessLoginState | undefined {
128
123
  return entries.get(entryKey(context))?.login?.state
129
124
  }
130
125
 
131
126
  // Re-probe until the login lands or the deadline passes. One loop per
132
127
  // ceremony; a replaced or completed ceremony stops its loop.
133
128
  function watch(
134
- type: WorkspaceType,
129
+ harness: HarnessType,
135
130
  login: LoginCeremony,
136
131
  initialAvailability: HarnessAvailability
137
132
  ) {
@@ -144,12 +139,12 @@ export function createHarnessStore(options: HarnessStoreOptions) {
144
139
  clearTimeout(timer)
145
140
  }
146
141
  const tick = async () => {
147
- const value = await probeFresh(type)
142
+ const value = await probeFresh(harness)
148
143
  if (stopped) return
149
- const entry = entryFor(type)
144
+ const entry = entryFor(harness)
150
145
  if (value.status === 'available' && (!login.attempt?.completed || login.completed)) {
151
146
  entry.login = undefined
152
- await publish(type, value)
147
+ await publish(harness, value)
153
148
  return
154
149
  }
155
150
  if (Date.now() >= deadline) {
@@ -157,12 +152,12 @@ export function createHarnessStore(options: HarnessStoreOptions) {
157
152
  // startLogin replaces it.
158
153
  stopLogin(login)
159
154
  login.state = { state: 'failed', reason: 'Sign-in did not complete. Try again' }
160
- await publish(type, value)
155
+ await publish(harness, value)
161
156
  return
162
157
  }
163
158
  if (!sameAvailability(value, publishedAvailability)) {
164
159
  publishedAvailability = value
165
- await publish(type, value)
160
+ await publish(harness, value)
166
161
  }
167
162
  timer = setTimeout(tick, pollMs)
168
163
  timer.unref?.()
@@ -172,8 +167,8 @@ export function createHarnessStore(options: HarnessStoreOptions) {
172
167
  timer.unref?.()
173
168
  }
174
169
 
175
- async function startLogin(type: WorkspaceType): Promise<HarnessLogin> {
176
- const entry = entryFor(type)
170
+ async function startLogin(harness: HarnessType): Promise<HarnessLogin> {
171
+ const entry = entryFor(harness)
177
172
  // Concurrent starts share the provider call; active attempts reuse their instructions.
178
173
  const current = entry.login
179
174
  if (current?.starting) return current.starting
@@ -183,7 +178,7 @@ export function createHarnessStore(options: HarnessStoreOptions) {
183
178
  }
184
179
 
185
180
  if (current) stopLogin(current)
186
- const starting = options.startLogin(type).then(attempt => {
181
+ const starting = options.startLogin(harness).then(attempt => {
187
182
  const { completed, cancel: _cancel, submitCode: _submitCode, ...instructions } = attempt
188
183
  login.attempt = attempt
189
184
  if (entry.login !== login) {
@@ -197,7 +192,7 @@ export function createHarnessStore(options: HarnessStoreOptions) {
197
192
  if (entry.login !== login) return
198
193
  stopLogin(login)
199
194
  login.state = { state: 'failed', reason: 'Sign-in failed or expired. Try again' }
200
- void refresh(type)
195
+ void refresh(harness)
201
196
  }
202
197
  )
203
198
  return instructions
@@ -213,8 +208,8 @@ export function createHarnessStore(options: HarnessStoreOptions) {
213
208
  status: 'login-required',
214
209
  reason: 'Waiting for sign-in'
215
210
  }
216
- await publish(type, availability)
217
- if (login.state.state === 'pending') watch(type, login, availability)
211
+ await publish(harness, availability)
212
+ if (login.state.state === 'pending') watch(harness, login, availability)
218
213
  return result
219
214
  } catch (err) {
220
215
  if (entry.login === login) entry.login = undefined
@@ -239,16 +234,16 @@ export function createHarnessStore(options: HarnessStoreOptions) {
239
234
  .catch(() => {})
240
235
  }
241
236
 
242
- function activeLogin(type: WorkspaceType, id: string) {
243
- const login = entryFor(type).login
237
+ function activeLogin(harness: HarnessType, id: string) {
238
+ const login = entryFor(harness).login
244
239
  if (!login || login.state.state !== 'pending' || login.state.id !== id) {
245
240
  throw new Error('This sign-in attempt has ended. Start again')
246
241
  }
247
242
  return login
248
243
  }
249
244
 
250
- async function submitCode(type: WorkspaceType, id: string, code: string) {
251
- const login = activeLogin(type, id)
245
+ async function submitCode(harness: HarnessType, id: string, code: string) {
246
+ const login = activeLogin(harness, id)
252
247
  if (!login.attempt?.submitCode) throw new Error('This sign-in does not accept a code')
253
248
  await login.attempt.submitCode(code)
254
249
  }
@@ -284,17 +279,17 @@ export const harnessStore = createHarnessStore({
284
279
  if (runtime && runtime.status !== 'available') return runtime
285
280
  return harness.authStatus()
286
281
  },
287
- startLogin: type => {
288
- const start = harnessFor(type).startLogin
282
+ startLogin: harness => {
283
+ const start = harnessFor(harness).startLogin
289
284
  if (!start) throw new Error('This agent requires terminal sign-in')
290
285
  return start()
291
286
  },
292
287
  publish: publishEvent,
293
- onAuthChanged: async (type, availability) => {
288
+ onAuthChanged: async (harness, availability) => {
294
289
  publishEvent({
295
290
  type: 'harness-status:changed',
296
- harness: type,
297
- status: { availability, login: harnessStore.getLogin(type) }
291
+ harness: harness,
292
+ status: { availability, login: harnessStore.getLogin(harness) }
298
293
  })
299
294
  }
300
295
  })
@@ -69,7 +69,7 @@ async function discoverWorkspaces(
69
69
  const worktree = await Promise.all(candidates.map(isLinkedGitWorktree))
70
70
  return candidates
71
71
  .filter((_, i) => !worktree[i])
72
- .map(path => ({ path, type: 'claude-code' as const }))
72
+ .map(path => ({ path, harness: 'claude-code' as const }))
73
73
  } catch {
74
74
  return []
75
75
  }
@@ -100,7 +100,7 @@ export async function discoverCodexWorkspaces(
100
100
  } catch {
101
101
  continue // directory deleted since the session ran
102
102
  }
103
- out.push({ path: cwd, type: 'codex' })
103
+ out.push({ path: cwd, harness: 'codex' })
104
104
  }
105
105
  return out
106
106
  }
@@ -462,7 +462,7 @@ function applyCompletionMeta(
462
462
 
463
463
  // A failed send may reflect an external logout. Refresh the cached banner now.
464
464
  function refreshAvailability(workspaceId: string, workspacePath: string) {
465
- void harnessStore.refresh({ id: workspaceId, path: workspacePath, type: 'codex' })
465
+ void harnessStore.refresh({ id: workspaceId, path: workspacePath, harness: 'codex' })
466
466
  }
467
467
 
468
468
  function handleNotification(rec: SessionRecord, method: string, params: Record<string, unknown>) {
@@ -11,7 +11,7 @@
11
11
  import { existsSync } from 'node:fs'
12
12
  import { join, resolve } from 'node:path'
13
13
 
14
- import type { WorkspaceType } from '@/lib/types'
14
+ import type { HarnessType } from '@/lib/types'
15
15
 
16
16
  import { discoverCodexWorkspaces } from './codex/discovery'
17
17
  import { type HermesProfile, discoverHermesProfiles } from './hermes/discovery'
@@ -19,21 +19,16 @@ import { type OpenClawAgent, discoverOpenClawAgents } from './openclaw/discovery
19
19
 
20
20
  // Harness names accepted by `--harness`, in the order they are listed to the
21
21
  // user. Detection order is separate (see detectHarness).
22
- export const HARNESS_TYPES: readonly WorkspaceType[] = [
23
- 'claude-code',
24
- 'codex',
25
- 'hermes',
26
- 'openclaw'
27
- ]
28
-
29
- export const harnessLabel: Record<WorkspaceType, string> = {
22
+ export const HARNESS_TYPES: readonly HarnessType[] = ['claude-code', 'codex', 'hermes', 'openclaw']
23
+
24
+ export const harnessLabel: Record<HarnessType, string> = {
30
25
  'claude-code': 'Claude Code',
31
26
  codex: 'Codex',
32
27
  hermes: 'Hermes',
33
28
  openclaw: 'OpenClaw'
34
29
  }
35
30
 
36
- export function isHarnessName(value: string): value is WorkspaceType {
31
+ export function isHarnessName(value: string): value is HarnessType {
37
32
  return (HARNESS_TYPES as readonly string[]).includes(value)
38
33
  }
39
34
 
@@ -48,7 +43,7 @@ export type DetectedAgent = {
48
43
  }
49
44
 
50
45
  export type HarnessDetection = {
51
- type: WorkspaceType
46
+ harness: HarnessType
52
47
  agent?: DetectedAgent
53
48
  // What gave it away, as a noun phrase for the CLI's "Detected …" line.
54
49
  reason: string
@@ -91,7 +86,7 @@ async function safely<T>(fn: () => Promise<T>, fallback: T): Promise<T> {
91
86
 
92
87
  function detectionForProfile(profile: HermesProfile): HarnessDetection {
93
88
  return {
94
- type: 'hermes',
89
+ harness: 'hermes',
95
90
  agent: {
96
91
  agentId: profile.agentId,
97
92
  ...(profile.name ? { name: profile.name } : {}),
@@ -103,7 +98,7 @@ function detectionForProfile(profile: HermesProfile): HarnessDetection {
103
98
 
104
99
  function detectionForAgent(agent: OpenClawAgent): HarnessDetection {
105
100
  return {
106
- type: 'openclaw',
101
+ harness: 'openclaw',
107
102
  agent: {
108
103
  agentId: agent.agentId,
109
104
  ...(agent.name ? { name: agent.name } : {}),
@@ -128,7 +123,7 @@ export async function detectHarness(
128
123
  if (agent) return detectionForAgent(agent)
129
124
 
130
125
  if ((await safely(src.codexWorkspaces, [])).includes(path)) {
131
- return { type: 'codex', reason: 'Codex session history here' }
126
+ return { harness: 'codex', reason: 'Codex session history here' }
132
127
  }
133
128
 
134
129
  // Session history first, then the config directory: history means the CLI
@@ -136,10 +131,10 @@ export async function detectHarness(
136
131
  // the history scan drops linked git worktrees, so a worktree is recognized
137
132
  // by its `.claude/` directory or not at all.
138
133
  if ((await safely(src.claudeCodeWorkspaces, [])).includes(path)) {
139
- return { type: 'claude-code', reason: 'Claude Code session history here' }
134
+ return { harness: 'claude-code', reason: 'Claude Code session history here' }
140
135
  }
141
136
  if (src.hasClaudeConfigDir(path)) {
142
- return { type: 'claude-code', reason: 'a .claude/ directory here' }
137
+ return { harness: 'claude-code', reason: 'a .claude/ directory here' }
143
138
  }
144
139
 
145
140
  return null
@@ -150,18 +145,18 @@ export async function detectHarness(
150
145
  // would have found. Null for the directory-only harnesses, and for a provider
151
146
  // that cannot confirm the path (gateway down, profile removed).
152
147
  export async function agentBindingFor(
153
- type: WorkspaceType,
148
+ harness: HarnessType,
154
149
  workspacePath: string,
155
150
  sources: Partial<DetectionSources> = {}
156
151
  ): Promise<DetectedAgent | null> {
157
152
  const src = { ...defaultSources, ...sources }
158
153
  const path = resolve(workspacePath)
159
154
 
160
- if (type === 'hermes') {
155
+ if (harness === 'hermes') {
161
156
  const profile = (await safely(src.hermesProfiles, [])).find(p => p.path === path)
162
157
  return profile ? (detectionForProfile(profile).agent ?? null) : null
163
158
  }
164
- if (type === 'openclaw') {
159
+ if (harness === 'openclaw') {
165
160
  const agent = (await safely(src.openclawAgents, [])).find(a => a.path === path)
166
161
  return agent ? (detectionForAgent(agent).agent ?? null) : null
167
162
  }
@@ -3,7 +3,7 @@ import { homedir } from 'node:os'
3
3
  import { delimiter, join, resolve } from 'node:path'
4
4
 
5
5
  import { harnessInstructionMessage } from '@/lib/harness-instructions'
6
- import type { HarnessAvailability, HarnessInstallations, WorkspaceType } from '@/lib/types'
6
+ import type { HarnessAvailability, HarnessInstallations, HarnessType } from '@/lib/types'
7
7
 
8
8
  import { cachedLoginShellPath, loginShellPath, mergeSearchPaths } from './shell-path'
9
9
 
@@ -17,7 +17,7 @@ type ExecutableConfig = {
17
17
  fallbackPaths?: readonly string[]
18
18
  }
19
19
 
20
- const executableConfig: Record<WorkspaceType, ExecutableConfig> = {
20
+ const executableConfig: Record<HarnessType, ExecutableConfig> = {
21
21
  'claude-code': {
22
22
  command: 'claude',
23
23
  fallbackPaths: [
@@ -76,8 +76,8 @@ export function firstExecutable(paths: readonly string[]): string | null {
76
76
 
77
77
  // `path` is a test seam: when given, only that PATH is searched — no
78
78
  // login-shell merge, no bundle fallbacks.
79
- export function findHarnessExecutable(type: WorkspaceType, path?: string): string | null {
80
- const config = executableConfig[type]
79
+ export function findHarnessExecutable(harness: HarnessType, path?: string): string | null {
80
+ const config = executableConfig[harness]
81
81
  // bun run adds our dependency commands to PATH; those are not user installs.
82
82
  const searchPath = (path ?? mergeSearchPaths(cachedLoginShellPath(), process.env.PATH))
83
83
  .split(delimiter)
@@ -89,25 +89,25 @@ export function findHarnessExecutable(type: WorkspaceType, path?: string): strin
89
89
  : (executable ?? firstExecutable(config.fallbackPaths ?? []))
90
90
  }
91
91
 
92
- export function requireHarnessExecutable(type: WorkspaceType, path?: string): string {
93
- const executable = findHarnessExecutable(type, path)
94
- if (!executable) throw new Error(executableConfig[type].unavailableReason)
92
+ export function requireHarnessExecutable(harness: HarnessType, path?: string): string {
93
+ const executable = findHarnessExecutable(harness, path)
94
+ if (!executable) throw new Error(executableConfig[harness].unavailableReason)
95
95
  return executable
96
96
  }
97
97
 
98
98
  export async function pathHarnessAvailability(
99
- type: WorkspaceType,
99
+ harness: HarnessType,
100
100
  path?: string
101
101
  ): Promise<HarnessAvailability> {
102
102
  // Availability is asked per request (and long after startup), but await the
103
103
  // probe anyway so the very first request can't report a false negative.
104
104
  if (path === undefined) await loginShellPath()
105
- return findHarnessExecutable(type, path)
105
+ return findHarnessExecutable(harness, path)
106
106
  ? { status: 'available' }
107
107
  : {
108
108
  status: 'unavailable',
109
109
  code: 'not-installed',
110
- reason: executableConfig[type].unavailableReason
110
+ reason: executableConfig[harness].unavailableReason
111
111
  }
112
112
  }
113
113
 
@@ -578,10 +578,10 @@ server/harness/hermes/
578
578
  ```
579
579
 
580
580
  Touch points outside the folder are small and already enumerated by the Codex
581
- precedent: `lib/types.ts` (`WorkspaceType` union), `lib/workspace-types.ts`
581
+ precedent: `lib/types.ts` (`HarnessType` union), `lib/harness-types.ts`
582
582
  (ordering), `lib/format.ts` (`provider` union), `server/harness/registry.ts`,
583
583
  `server/harness/executable.ts` (PATH lookup), `server/api/index.ts`
584
- (`CREATABLE_TYPES`), and a handful of client files that branch on provider
584
+ (`CREATABLE_HARNESSES`), and a handful of client files that branch on provider
585
585
  (`client/features/chat/messages/tool-group/format/index.ts`,
586
586
  `client/features/workspace/setup/workspace-login-state.tsx`,
587
587
  `client/features/dev/harness-debug-page.tsx`).
@@ -120,7 +120,7 @@ export const hermesHarness: Harness = {
120
120
  const profiles = await discoverHermesProfiles()
121
121
  return profiles
122
122
  .filter(p => !registeredPaths.has(p.path))
123
- .map((p): DiscoveredWorkspaceCandidate => ({ path: p.path, type: 'hermes' }))
123
+ .map((p): DiscoveredWorkspaceCandidate => ({ path: p.path, harness: 'hermes' }))
124
124
  },
125
125
 
126
126
  availability: async (ws): Promise<HarnessAvailability> => {
@@ -1,24 +1,24 @@
1
1
  import { HARNESS_INSTRUCTIONS } from '@/lib/harness-instructions'
2
2
  import { getAppConfig } from '../app-config'
3
- import type { WorkspaceType } from '@/lib/types'
3
+ import type { HarnessType } from '@/lib/types'
4
4
  import { detectInstalledHarnesses } from './executable'
5
5
 
6
- const installations = new Map<WorkspaceType, Promise<void>>()
6
+ const installations = new Map<HarnessType, Promise<void>>()
7
7
 
8
- export function installHarness(type: WorkspaceType): Promise<void> {
8
+ export function installHarness(harness: HarnessType): Promise<void> {
9
9
  const config = getAppConfig()
10
10
  if (config.environment !== 'local' || config.demo || config.agentLauncher) {
11
11
  throw new Error('Agents can only be installed in local Moi')
12
12
  }
13
- if (type !== 'claude-code' && type !== 'codex') {
13
+ if (harness !== 'claude-code' && harness !== 'codex') {
14
14
  throw new Error('This agent requires manual installation')
15
15
  }
16
- const pending = installations.get(type)
16
+ const pending = installations.get(harness)
17
17
  if (pending) return pending
18
18
  const installation = (async () => {
19
- if ((await detectInstalledHarnesses())[type]) return
19
+ if ((await detectInstalledHarnesses())[harness]) return
20
20
  const url =
21
- type === 'claude-code' ? 'https://claude.ai/install' : 'https://chatgpt.com/codex/install'
21
+ harness === 'claude-code' ? 'https://claude.ai/install' : 'https://chatgpt.com/codex/install'
22
22
  const command =
23
23
  process.platform === 'win32'
24
24
  ? [
@@ -30,7 +30,7 @@ export function installHarness(type: WorkspaceType): Promise<void> {
30
30
  '-Command',
31
31
  `$ErrorActionPreference = 'Stop'; irm ${url}.ps1 | iex`
32
32
  ]
33
- : ['bash', '-o', 'pipefail', '-c', HARNESS_INSTRUCTIONS[type].command]
33
+ : ['bash', '-o', 'pipefail', '-c', HARNESS_INSTRUCTIONS[harness].command]
34
34
  const child = Bun.spawn(command, {
35
35
  stdin: 'ignore',
36
36
  stdout: 'inherit',
@@ -40,10 +40,10 @@ export function installHarness(type: WorkspaceType): Promise<void> {
40
40
  if ((await child.exited) !== 0) {
41
41
  throw new Error('Installation failed or timed out. Try again.')
42
42
  }
43
- if (!(await detectInstalledHarnesses())[type]) {
43
+ if (!(await detectInstalledHarnesses())[harness]) {
44
44
  throw new Error('The installer finished, but the agent could not be found. Restart Moi.')
45
45
  }
46
- })().finally(() => installations.delete(type))
47
- installations.set(type, installation)
46
+ })().finally(() => installations.delete(harness))
47
+ installations.set(harness, installation)
48
48
  return installation
49
49
  }
@@ -94,7 +94,7 @@ export const openclawHarness: Harness = {
94
94
  .map(
95
95
  (a): DiscoveredWorkspaceCandidate => ({
96
96
  path: a.path,
97
- type: 'openclaw'
97
+ harness: 'openclaw'
98
98
  })
99
99
  )
100
100
  },
@@ -1,8 +1,8 @@
1
- // WorkspaceType → Harness lookup. This is the single import surface for the
1
+ // HarnessType → Harness lookup. This is the single import surface for the
2
2
  // rest of the server: web.ts/api/index.ts/etc. dispatch through harnessFor()
3
3
  // instead of branching on workspace.type (documented exceptions: cli.ts
4
4
  // provisioning and tests import harness internals directly).
5
- import type { WorkspaceEntry, WorkspaceType } from '@/lib/types'
5
+ import type { WorkspaceEntry, HarnessType } from '@/lib/types'
6
6
 
7
7
  import { claudeCodeHarness } from './claude-code'
8
8
  import { codexHarness } from './codex'
@@ -17,13 +17,14 @@ const harnesses = {
17
17
  openclaw: openclawHarness,
18
18
  codex: codexHarness,
19
19
  hermes: hermesHarness
20
- } satisfies Partial<Record<WorkspaceType, Harness>>
20
+ } satisfies Partial<Record<HarnessType, Harness>>
21
21
 
22
22
  // An untyped registry entry is a Claude Code workspace (pre-typing legacy).
23
- export function harnessFor(ws: Pick<WorkspaceEntry, 'type'> | WorkspaceType | undefined): Harness {
24
- const type = typeof ws === 'string' ? ws : ws?.type
23
+ export function harnessFor(ws: Pick<WorkspaceEntry, 'harness'> | HarnessType | undefined): Harness {
24
+ const harness = typeof ws === 'string' ? ws : ws?.harness
25
25
  return (
26
- (type && type in harnesses && harnesses[type as keyof typeof harnesses]) || claudeCodeHarness
26
+ (harness && harness in harnesses && harnesses[harness as keyof typeof harnesses]) ||
27
+ claudeCodeHarness
27
28
  )
28
29
  }
29
30
 
@@ -16,7 +16,7 @@ import type {
16
16
  SessionSummary,
17
17
  StreamEvent,
18
18
  WorkspaceEntry,
19
- WorkspaceType
19
+ HarnessType
20
20
  } from '@/lib/types'
21
21
 
22
22
  // The superset of what any backend needs to accept a user message; harnesses
@@ -78,10 +78,10 @@ export type WorkspaceActivityPreview = {
78
78
 
79
79
  export type DiscoveredWorkspaceCandidate = {
80
80
  path: string
81
- type: WorkspaceType
81
+ harness: HarnessType
82
82
  }
83
83
 
84
- export type HarnessWorkspace = Pick<WorkspaceEntry, 'id' | 'path' | 'type' | 'agentId'>
84
+ export type HarnessWorkspace = Pick<WorkspaceEntry, 'id' | 'path' | 'harness' | 'agentId'>
85
85
 
86
86
  export type ActionModel = 'fast' | 'normal' | 'smart'
87
87
 
@@ -100,7 +100,7 @@ export type HarnessActionInput<TResult = unknown, TProgress = never> = {
100
100
  )
101
101
 
102
102
  export type Harness = {
103
- id: WorkspaceType
103
+ id: HarnessType
104
104
  capabilities: HarnessCapabilities
105
105
 
106
106
  // Ephemeral read/search action without a workspace or visible chat.
@@ -208,7 +208,7 @@ export function createOnboardingJobs(overrides: Partial<typeof defaults> = {}) {
208
208
  }
209
209
  const ws = await deps.registerWorkspace(path, {
210
210
  id: job.workspaceId ?? basename(path),
211
- type: progress.harness,
211
+ harness: progress.harness,
212
212
  name: idea.name
213
213
  })
214
214
  job.workspaceId = ws.id
@@ -0,0 +1,46 @@
1
+ import { join } from 'node:path'
2
+ import { PACKAGE_ROOT } from '../version'
3
+ import { OperationError } from './files'
4
+
5
+ export const workspaceCommands = [
6
+ 'bundle',
7
+ 'check',
8
+ 'call-server-fn',
9
+ 'theme',
10
+ 'ui-components',
11
+ 'views',
12
+ 'debug'
13
+ ] as const
14
+
15
+ export function commandArguments(command: string, args: string[]): string[] {
16
+ if (
17
+ !(workspaceCommands as readonly string[]).includes(command) ||
18
+ (command === 'debug' && args[0] !== 'logs')
19
+ )
20
+ throw new OperationError('Unsupported workspace command')
21
+ // The target comes from the URL. Do not let command flags switch workspace.
22
+ if (args.some(arg => /^--(?:dir|path)(?:=|$)/.test(arg)))
23
+ throw new OperationError('Workspace is selected by the remote link, not --dir or --path')
24
+ if (['bundle', 'check', 'views'].includes(command)) {
25
+ // These commands use a positional directory, unlike the other commands.
26
+ const index = command === 'views' ? (args[0] === 'set' ? 2 : 1) : 0
27
+ const result = [...args]
28
+ result.splice(index, 0, '.')
29
+ return [command, ...result]
30
+ }
31
+ return [command, ...args]
32
+ }
33
+
34
+ export function spawnWorkspaceCommand(root: string, command: string, args: string[]) {
35
+ return Bun.spawn(
36
+ [process.execPath, join(PACKAGE_ROOT, 'server/cli.ts'), ...commandArguments(command, args)],
37
+ {
38
+ cwd: root,
39
+ stdin: 'ignore',
40
+ stdout: 'pipe',
41
+ stderr: 'pipe',
42
+ detached: true,
43
+ env: { ...process.env, NO_COLOR: '1', FORCE_COLOR: '0', MOI_REMOTE_WORKSPACE: root }
44
+ }
45
+ )
46
+ }