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
@@ -0,0 +1 @@
1
+ import{ei}from"/chunk-n0fawy9x.js";export{ei as sanitizeSvg};
package/dist/index.html CHANGED
@@ -55,7 +55,7 @@
55
55
  <link rel="modulepreload" href="/vendor/react/19.2.4/production/react-dom-client.js" />
56
56
  <link rel="modulepreload" href="/vendor/react/19.2.4/production/_impl/react-dom-client.js" />
57
57
 
58
- <link rel="stylesheet" crossorigin href="/chunk-g4c1nte9.css"><script type="module" crossorigin src="/chunk-a47zy276.js"></script></head>
58
+ <link rel="stylesheet" crossorigin href="/chunk-kffcah9w.css"><script type="module" crossorigin src="/chunk-44khk4sp.js"></script></head>
59
59
  <body>
60
60
  <div id="root"></div>
61
61
 
@@ -1,11 +1,11 @@
1
- import type { WorkspaceType } from './types'
1
+ import type { HarnessType } from './types'
2
2
 
3
3
  type HarnessInstruction = {
4
4
  reason: string
5
5
  command: string
6
6
  }
7
7
 
8
- export const HARNESS_INSTRUCTIONS: Record<WorkspaceType, HarnessInstruction> = {
8
+ export const HARNESS_INSTRUCTIONS: Record<HarnessType, HarnessInstruction> = {
9
9
  'claude-code': {
10
10
  reason: 'Run in terminal to install Claude:',
11
11
  command: 'curl -fsSL https://claude.ai/install.sh | bash'
@@ -24,7 +24,7 @@ export const HARNESS_INSTRUCTIONS: Record<WorkspaceType, HarnessInstruction> = {
24
24
  }
25
25
  }
26
26
 
27
- export function harnessInstructionMessage(type: WorkspaceType): string {
28
- const { reason, command } = HARNESS_INSTRUCTIONS[type]
27
+ export function harnessInstructionMessage(harness: HarnessType): string {
28
+ const { reason, command } = HARNESS_INSTRUCTIONS[harness]
29
29
  return `${reason} ${command}`
30
30
  }
@@ -0,0 +1,13 @@
1
+ import type { HarnessType } from './types'
2
+
3
+ export const HARNESS_ORDER = [
4
+ 'claude-code',
5
+ 'codex',
6
+ 'openclaw',
7
+ 'hermes'
8
+ ] as const satisfies readonly HarnessType[]
9
+
10
+ export function orderHarnesses(harnesses: Iterable<HarnessType>): HarnessType[] {
11
+ const unique = new Set(harnesses)
12
+ return HARNESS_ORDER.filter(harness => unique.has(harness))
13
+ }
package/lib/types.ts CHANGED
@@ -1,3 +1,4 @@
1
+ import type { RemoteWorkspaceTarget } from './workspace-config'
1
2
  import type { PreviewBlock, StreamEvent } from './format'
2
3
  import type { IdentityIconId } from './identity-icons'
3
4
  import type { MoiContext } from './moi-context'
@@ -230,8 +231,6 @@ export type MessageAttachment =
230
231
  | ({ type: 'upload'; uploadId: string; purpose?: DrawingPurpose } & Partial<AttachmentOrigin>)
231
232
 
232
233
  // Client → server messages, routed by workspaceId over the shared WebSocket.
233
- export type SelectedSessionScope = 'shared' | 'browser-tab'
234
-
235
234
  export type ClientMessage =
236
235
  | {
237
236
  type: 'chat'
@@ -239,9 +238,6 @@ export type ClientMessage =
239
238
  content: string
240
239
  sessionId: string
241
240
  isNew: boolean
242
- // Where this tab keeps its selected session. Browser-tab selection must
243
- // not update the workspace's shared selection or switch other tabs.
244
- selectedSessionScope?: SelectedSessionScope
245
241
  // Text and upload references for this turn. The server resolves uploads
246
242
  // and describes all attachments together, preserving their order.
247
243
  attachments?: MessageAttachment[]
@@ -316,10 +312,11 @@ export type WorkspaceSessionState = {
316
312
  fork?: SessionFork
317
313
  }
318
314
 
319
- // Per-user chat state for one workspace, kept in Moi's data dir and served by
320
- // GET /api/workspaces/:id/state. Every write returns it and publishes it as
321
- // `state:changed`.
315
+ // Personal state on this Moi installation, shared across its browser windows.
316
+ // GET /api/workspaces/:id/state; writes publish `state:changed`.
322
317
  export type WorkspaceState = {
318
+ // Personal defaults for new chats on this Moi installation.
319
+ chatDefaults?: SessionConfig
323
320
  // Goes up by one with every saved change. Lets clients drop an older copy
324
321
  // that arrives after a newer one.
325
322
  revision: number
@@ -462,7 +459,7 @@ export type WorkspaceSwitchMessage = {
462
459
  workspaceId: string
463
460
  }
464
461
 
465
- export type WorkspaceType = 'claude-code' | 'openclaw' | 'codex' | 'hermes'
462
+ export type HarnessType = 'claude-code' | 'openclaw' | 'codex' | 'hermes'
466
463
 
467
464
  export type WorkspaceSkillStatus = {
468
465
  name: string
@@ -480,11 +477,11 @@ export type WorkspaceSkillsUpdateFailure = WorkspaceSkillsStatus & {
480
477
  error: string
481
478
  }
482
479
 
483
- export type HarnessInstallations = Record<WorkspaceType, boolean>
480
+ export type HarnessInstallations = Record<HarnessType, boolean>
484
481
 
485
482
  // Shared runtime/account readiness and the current sign-in attempt.
486
483
  export type HarnessStatus = { availability: HarnessAvailability; login?: HarnessLoginState }
487
- export type HarnessStatuses = Record<WorkspaceType, HarnessStatus>
484
+ export type HarnessStatuses = Record<HarnessType, HarnessStatus>
488
485
 
489
486
  export type HarnessAvailability =
490
487
  | { status: 'available' }
@@ -523,10 +520,13 @@ export type McpServer = {
523
520
  }
524
521
 
525
522
  export type WorkspaceEntry = {
523
+ // Derived from .moi/.workspace.json; not persisted in workspaces.json.
524
+ remote?: RemoteWorkspaceTarget
526
525
  id: string
527
526
  path: string
528
527
  addedAt: string
529
- type?: WorkspaceType
528
+ // The agent backend that runs this workspace's chats.
529
+ harness?: HarnessType
530
530
  // Display name captured at add time (e.g. OpenClaw IDENTITY.md "Name:" or
531
531
  // basename). Persisted so we don't re-probe the gateway for each listing.
532
532
  // The list endpoint overrides this with the live layout `name` when set.
@@ -550,7 +550,7 @@ export type DiscoveredWorkspace = {
550
550
  path: string
551
551
  displayPath?: string
552
552
  // Deduplicated in canonical provider order; empty for folders without agent history.
553
- types: WorkspaceType[]
553
+ harnesses: HarnessType[]
554
554
  }
555
555
 
556
556
  export type SessionRenamedMessage = {
@@ -626,49 +626,35 @@ export type WorkspaceTabsState = {
626
626
 
627
627
  export type { AgentTheme, ColorTheme, FontTheme, RadiusTheme, WorkspaceTheme } from './themes'
628
628
 
629
- export type WorkspaceLayoutSave = Omit<WorkspaceLayout, 'tabs'> & {
630
- tabs?: WorkspaceTabsState
631
- // Captured when the edit is made, so delayed saves cannot restore another harness's defaults.
632
- harness?: WorkspaceType
633
- }
634
-
635
629
  export type WorkspaceLayout = {
636
- version: 1
630
+ version: 2
637
631
  widgetGrid: LayoutGridItem[]
638
- layoutMode: LayoutMode
639
- // Open tabs and active tab for the fullscreen/split workspace chrome. The
640
- // `open` order is persisted so future drag-reordering has one source of truth.
641
- tabs: WorkspaceTabsState
642
632
  // User-set display-name override. When empty/undefined the API falls back to
643
633
  // the workspace folder name, so the resolved name always comes from the API.
644
634
  name?: string
645
635
  // Workspace icon override. Emoji and glyphs may use a themed background.
646
636
  icon?: WorkspaceIcon
647
- // Model id chosen in the composer picker (`supportedModels()` `value`, an
648
- // alias like `sonnet`). Persisted so the choice survives a reload. Sent with
649
- // each chat frame; undefined means the agent runs on the SDK default. Note
650
- // the transcript records the *resolved* id (e.g. `claude-sonnet-4-6`), which
651
- // doesn't map back to these aliases — hence we persist the pick here.
652
- //
653
- // This (with `selectedEffort` and `selectedSpeedMode`) is the *workspace
654
- // default*: the value the picker edits when no session is open, and the seed a
655
- // brand-new session copies. Once a session exists it carries its own per-session
656
- // override (see `SessionConfig`).
657
- selectedModel?: string
658
- // Reasoning-effort default for new sessions (a `supportedEffortLevels` value).
659
- selectedEffort?: string
660
- // Speed default for new sessions. Undefined behaves as normal.
661
- selectedSpeedMode?: SpeedMode
662
637
  theme?: WorkspaceTheme
663
638
  }
664
639
 
665
- // GET /api/workspaces/:id: layout plus the local workspace registration.
666
- export type WorkspaceLayoutResponse = WorkspaceLayout & {
667
- cwd: string
668
- name: string
669
- provider?: WorkspaceType
670
- agentId?: string
671
- }
640
+ // GET /api/workspaces/:id returns either a complete local layout or a remote reference.
641
+ type WorkspaceRouting = { apiBase: string; cwd: string }
642
+ type WorkspaceMetadata = { name: string; harness?: HarnessType; agentId?: string }
643
+ export type WorkspaceInfoResponse =
644
+ | (WorkspaceLayout & WorkspaceRouting & WorkspaceMetadata & { isRemote: false })
645
+ | (WorkspaceRouting &
646
+ Pick<WorkspaceMetadata, 'harness' | 'agentId'> & {
647
+ version: 2
648
+ isRemote: true
649
+ remote: RemoteWorkspaceTarget
650
+ })
651
+
652
+ // The client resolves a remote reference before exposing a complete layout to consumers.
653
+ export type WorkspaceLayoutResponse = WorkspaceLayout &
654
+ WorkspaceRouting &
655
+ WorkspaceMetadata & {
656
+ isRemote: boolean
657
+ }
672
658
 
673
659
  // One applet's thumbnail freshness record. Image bytes live as files in the
674
660
  // workspace's `.moi/.cache/thumbnails/` (server/applets/thumbnails.ts), never in
@@ -780,9 +766,8 @@ export type WorkspaceHarness = {
780
766
  /** Credential overrides require workspace readiness instead of shared account status. */
781
767
  hasAuthOverrides?: boolean
782
768
  isFolderMissing?: boolean
783
- // The harness that produced this snapshot — matches the workspace
784
- // provider.
785
- provider: WorkspaceType
769
+ // The harness that produced this snapshot — matches the workspace's harness.
770
+ harness: HarnessType
786
771
  // Runtime presence and provider auth state, from the server-side cache.
787
772
  availability: HarnessAvailability
788
773
  models: Model[]
@@ -0,0 +1,48 @@
1
+ import { validateWorkspaceId } from './ids'
2
+ import type { WorkspaceLayout } from './types'
3
+
4
+ export type RemoteWorkspaceTarget = {
5
+ user_id: string
6
+ workspace_id: string
7
+ }
8
+
9
+ export type RemoteWorkspaceConfig = {
10
+ version: 2
11
+ remote: RemoteWorkspaceTarget
12
+ }
13
+
14
+ export type LocalWorkspaceConfig = WorkspaceLayout & { remote?: never }
15
+
16
+ export type WorkspaceFileConfig = LocalWorkspaceConfig | RemoteWorkspaceConfig
17
+
18
+ // Shared address format for workspace APIs, Cloud membership, and CLI operations.
19
+ export function workspaceAddress(id: string, userId?: string): string {
20
+ return userId ? `${encodeURIComponent(userId)}:${encodeURIComponent(id)}` : encodeURIComponent(id)
21
+ }
22
+
23
+ export function workspaceApiBase(id: string, userId?: string): string {
24
+ return `/api/workspaces/${workspaceAddress(id, userId)}`
25
+ }
26
+
27
+ export function parseRemoteWorkspaceTarget(value: unknown): RemoteWorkspaceTarget {
28
+ if (!value || typeof value !== 'object' || Array.isArray(value))
29
+ throw new Error('Invalid remote workspace address')
30
+ const target = value as Record<string, unknown>
31
+ if (typeof target.user_id !== 'string' || !/^[A-Za-z0-9_-]{1,64}$/.test(target.user_id))
32
+ throw new Error('Invalid remote owner ID')
33
+ if (typeof target.workspace_id !== 'string') throw new Error('Invalid remote workspace ID')
34
+ const error = validateWorkspaceId(target.workspace_id)
35
+ if (error) throw new Error(error)
36
+ return { user_id: target.user_id, workspace_id: target.workspace_id }
37
+ }
38
+
39
+ export function parseRemoteWorkspaceAddress(value: string): RemoteWorkspaceTarget {
40
+ const parts = value.split(':')
41
+ if (parts.length !== 2) throw new Error('Use a remote workspace address: ownerId:workspaceId')
42
+ return parseRemoteWorkspaceTarget({ user_id: parts[0], workspace_id: parts[1] })
43
+ }
44
+
45
+ export function parseRemoteWorkspaceConfig(value: Record<string, unknown>): RemoteWorkspaceConfig {
46
+ if (value.version !== 2) throw new Error('Invalid remote workspace config')
47
+ return { version: 2, remote: parseRemoteWorkspaceTarget(value.remote) }
48
+ }
@@ -26,9 +26,7 @@ export function normalizeWorkspaceTabs(value: unknown): WorkspaceTabsState {
26
26
 
27
27
  export function createDefaultWorkspaceLayout(): WorkspaceLayout {
28
28
  return {
29
- version: 1,
30
- widgetGrid: createDefaultWidgetGrid(),
31
- layoutMode: 'split',
32
- tabs: createDefaultWorkspaceTabs()
29
+ version: 2,
30
+ widgetGrid: createDefaultWidgetGrid()
33
31
  }
34
32
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "moi-computer",
3
- "version": "0.13.1-next.1",
3
+ "version": "0.13.1-next.2",
4
4
  "description": "Local AI workspace powered by the Claude Agent SDK, Bun, React, and Tailwind. Requires Bun.",
5
5
  "license": "Elastic-2.0",
6
6
  "type": "module",
@@ -97,6 +97,7 @@
97
97
  "pathe": "^2.0.3",
98
98
  "picocolors": "^1.1.1",
99
99
  "postcss": "^8.5.28",
100
+ "proper-lockfile": "4.1.2",
100
101
  "react": "19.2.4",
101
102
  "react-dom": "19.2.4",
102
103
  "react-grid-layout": "^2.2.4",
@@ -125,11 +126,12 @@
125
126
  "@agentclientprotocol/sdk": "^1.4.0",
126
127
  "@babel/types": "^7.29.8",
127
128
  "@types/culori": "^4.0.1",
129
+ "@types/proper-lockfile": "^4.1.4",
128
130
  "@types/react": "^19.2.18",
129
131
  "@types/react-dom": "^19.2.7",
130
132
  "@types/react-grid-layout": "^2.1.0",
131
133
  "@types/react-resizable": "^3.0.8",
132
- "@uiverify/bun": "1.0.0",
134
+ "@uiverify/bun": "1.0.1",
133
135
  "bun": ">=1.4.4",
134
136
  "date-fns": "^4.4.0",
135
137
  "embla-carousel-react": "^8.6.0",
package/server/README.md CHANGED
@@ -5,21 +5,21 @@ WebSocket handlers, and CLI commands call the same feature modules.
5
5
 
6
6
  ## Where code belongs
7
7
 
8
- | Location | Owns |
9
- | ------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
10
- | `api/` | Hono HTTP routes, request validation, workspace lookup middleware, and API tests. `index.ts` assembles and defines the main routes; `harnesses.ts` defines login routes. |
11
- | `cli/commands/` | One module per top-level CLI command, with its subcommands and private helpers. |
12
- | `cli/` | Command registration, help, CLI access gates, terminal formatting, control requests, and server launching. |
13
- | `workspaces/` | Workspace discovery and registration, creation/import, `.moi/` scaffolding, layout, tabs, theme, icons, file previews, and environment settings. |
14
- | `sessions/` | Moi's session metadata, selection and pin state, archiving, ID renames, message attachments, and pending-view chat handoffs. Provider-owned history stays in the harnesses. |
15
- | `workspace-state/` | Per-workspace `state.json` storage: one writer per workspace, transactions, atomic writes, lock timeout, a revision and a `state:changed` event per change, re-adoption of a removed workspace's id, and the one-time legacy migration. |
16
- | `applets/` | View/widget manifests, source analysis, builds, CSS scoping, typechecking, bundle serving, server-function workers, thumbnails, UI component installation, and the error journal. |
17
- | `scratchpad/` | Canvas documents, assets, headless drawing, and browser screenshot requests. |
18
- | `skills/` | Bundled workspace skill installation, version checks, and updates. These modules manage the copies shipped under `workspace/`. |
19
- | `harness/` | Provider adapters, transports, sessions, discovery, authentication, and readiness. See [the harness guide](harness/README.md). |
20
- | `collab/` | Cloud collaboration workers, presence, proxy identity, and the optional collaboration skill. |
21
- | `onboarding/` | Idea discovery, its prompt and output validation, and workspace creation jobs. HTTP handlers live in [api/onboarding.ts](api/onboarding.ts). |
22
- | `test/` | Integration tests and existing tests that share fixtures. Other unit tests live beside their modules. |
8
+ | Location | Owns |
9
+ | ------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
10
+ | `api/` | Hono HTTP routes, request validation, workspace lookup middleware, and API tests. `index.ts` assembles and defines the main routes; `harnesses.ts` defines login routes. |
11
+ | `cli/commands/` | One module per top-level CLI command, with its subcommands and private helpers. |
12
+ | `cli/` | Command registration, help, CLI access gates, terminal formatting, control requests, and server launching. |
13
+ | `workspaces/` | Workspace discovery and registration, creation/import, `.moi/` scaffolding, shared layout, theme, icons, file previews, and environment settings. |
14
+ | `sessions/` | Moi's session metadata, selection and pin state, archiving, ID renames, message attachments, and pending-view chat handoffs. Provider-owned history stays in the harnesses. |
15
+ | `workspace-state/` | Per-workspace `state.json` storage: one writer per workspace, transactions, atomic writes, lock timeout, a revision and a `state:changed` event per change, re-adoption of a removed workspace's id. |
16
+ | `applets/` | View/widget manifests, source analysis, builds, CSS scoping, typechecking, bundle serving, server-function workers, thumbnails, UI component installation, and the error journal. |
17
+ | `scratchpad/` | Canvas documents, assets, headless drawing, and browser screenshot requests. |
18
+ | `skills/` | Bundled workspace skill installation, version checks, and updates. These modules manage the copies shipped under `workspace/`. |
19
+ | `harness/` | Provider adapters, transports, sessions, discovery, authentication, and readiness. See [the harness guide](harness/README.md). |
20
+ | `collab/` | Cloud collaboration workers, presence, proxy identity, and the optional collaboration skill. |
21
+ | `onboarding/` | Idea discovery, its prompt and output validation, and workspace creation jobs. HTTP handlers live in [api/onboarding.ts](api/onboarding.ts). |
22
+ | `test/` | Integration tests and existing tests that share fixtures. Other unit tests live beside their modules. |
23
23
 
24
24
  Use direct module imports such as `workspaces/registry` or `sessions/store`.
25
25
  Keep shared helpers in the feature that owns them. A folder does not imply a
@@ -56,18 +56,20 @@ corresponding directory above.
56
56
 
57
57
  ## Storage ownership
58
58
 
59
- | State | Location and owner |
60
- | ----------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
61
- | Workspace layout, theme, and tab configuration | `.moi/.workspace.json`, read and written by `workspaces/layout.ts` |
62
- | Applet source | `.moi/views/`, `.moi/widgets/`, and shared workspace source |
63
- | Generated bundles and thumbnails | `.moi/.build/` and `.moi/.cache/`; re-creatable |
64
- | Scratchpad document and image bytes | `.moi/.scratchpad.json` and `.moi/.scratchpad/`; preserve both |
65
- | Installation-wide app settings, including `showOnboarding` | `DATA_DIR/settings.json`, owned by `app-settings.ts` |
66
- | Onboarding discovery results and workspace creation operation records | `DATA_DIR/onboarding/`, owned by [onboarding/jobs.ts](onboarding/jobs.ts) |
67
- | Registered workspaces | `DATA_DIR/workspaces.json`, owned by `workspaces/registry.ts` |
68
- | Session attribution, settings, and fork metadata; selected and pinned sessions; pending view creation | `DATA_DIR/workspaces/<workspace id>/state.json`, stored by `workspace-state/`; meaning owned by `sessions/store.ts`, `sessions/selected.ts`, and `sessions/pending-views.ts` |
69
- | Workspace environment preferences and secrets | `workspaces/env.ts`; metadata in `DATA_DIR`, secrets in the OS keychain or file fallback |
70
- | Provider credentials and conversation history | Owned by each provider; see `harness/README.md` |
59
+ | State | Location and owner |
60
+ | -------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
61
+ | Workspace widget layout and theme | `.moi/.workspace.json`, read and written by `workspaces/layout.ts` |
62
+ | Applet source | `.moi/views/`, `.moi/widgets/`, and shared workspace source |
63
+ | Generated bundles and thumbnails | `.moi/.build/` and `.moi/.cache/`; re-creatable |
64
+ | Scratchpad document and image bytes | `.moi/.scratchpad.json` and `.moi/.scratchpad/`; preserve both |
65
+ | Installation-wide app settings, including `showOnboarding` | `DATA_DIR/settings.json`, owned by `app-settings.ts` |
66
+ | Onboarding discovery results and workspace creation operation records | `DATA_DIR/onboarding/`, owned by [onboarding/jobs.ts](onboarding/jobs.ts) |
67
+ | Registered workspaces | `DATA_DIR/workspaces.json`, owned by `workspaces/registry.ts` |
68
+ | Chat defaults; session attribution, settings, and fork metadata; selected and pinned sessions; pending view creation | `DATA_DIR/workspaces/<workspace id>/state.json`, stored by `workspace-state/`; meaning owned by `sessions/store.ts`, `sessions/selected.ts`, and `sessions/pending-views.ts` |
69
+ | Workspace environment preferences and secrets | `workspaces/env.ts`; metadata in `DATA_DIR`, secrets in the OS keychain or file fallback |
70
+ | Provider credentials and conversation history | Owned by each provider; see `harness/README.md` |
71
+
72
+ Open tabs, the active tab, split/fullscreen mode and panel widths live per workspace in the browser UI store (`moi:ui` in localStorage).
71
73
 
72
74
  Client-local UI choices are documented in [the root instructions](../AGENTS.md)
73
75
  and [view/chat behavior](../docs/view-chats.md). Changing a module's location
@@ -1,13 +1,13 @@
1
1
  import { Hono } from 'hono'
2
2
 
3
- import type { WorkspaceType } from '@/lib/types'
3
+ import type { HarnessType } from '@/lib/types'
4
4
 
5
5
  import { loginShellPath } from '../harness/shell-path'
6
6
  import { installHarness } from '../harness/install'
7
7
  import { harnessStore } from '../harness/auth'
8
8
  import { allHarnesses, harnessFor, isHarnessType } from '../harness/registry'
9
9
 
10
- export const harnesses = new Hono<{ Variables: { harnessType: WorkspaceType } }>()
10
+ export const harnesses = new Hono<{ Variables: { harnessType: HarnessType } }>()
11
11
 
12
12
  harnesses.get('/status', async c => {
13
13
  c.header('Cache-Control', 'no-store')
@@ -41,9 +41,9 @@ harnesses.post('/:type/auth/install', async c => {
41
41
  const origin = c.req.header('Origin')
42
42
  if (origin && origin !== new URL(c.req.url).origin) return c.text('Invalid origin', 403)
43
43
  try {
44
- const type = c.get('harnessType')
45
- await installHarness(type)
46
- await harnessStore.refresh(type)
44
+ const harness = c.get('harnessType')
45
+ await installHarness(harness)
46
+ await harnessStore.refresh(harness)
47
47
  return c.json({ ok: true })
48
48
  } catch (error) {
49
49
  return c.text(error instanceof Error ? error.message : 'Could not install agent', 400)