moi-computer 0.13.1-next.0 → 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.
- package/client/api/app-config.ts +12 -2
- package/client/api/http.ts +11 -1
- package/client/app/app-router.tsx +3 -2
- package/client/app/routes/home-route.tsx +1 -1
- package/client/app/routes/workspace-registration.tsx +68 -0
- package/client/app/routes/workspace-route.tsx +37 -13
- package/client/app/shell/sidebar-layout.tsx +10 -5
- package/client/components/shared/workspace-icon.tsx +8 -17
- package/client/features/account/account-test-utils.tsx +18 -4
- package/client/features/account/api.ts +10 -8
- package/client/features/account/profile-actions.ts +5 -7
- package/client/features/app-settings/avatar-upload.tsx +62 -0
- package/client/features/app-settings/profile-settings.tsx +10 -0
- package/client/features/app-settings/settings-page.tsx +2 -1
- package/client/features/applets/api.ts +6 -6
- package/client/features/applets/applet-cache.ts +6 -5
- package/client/features/applets/applet-log.ts +2 -1
- package/client/features/applets/applet-runtime.ts +2 -1
- package/client/features/applets/use-applet.ts +73 -18
- package/client/features/applets/widget-shell.tsx +4 -2
- package/client/features/chat/applet-chat-intents.ts +5 -13
- package/client/features/chat/chat-popup.tsx +8 -4
- package/client/features/chat/chat-send.ts +2 -2
- package/client/features/chat/composer/model-order.ts +4 -4
- package/client/features/chat/composer/model-picker.tsx +12 -10
- package/client/features/chat/composer/use-workspace-composer-state.tsx +1 -1
- package/client/features/chat/sessions/api.ts +11 -28
- package/client/features/chat/sessions/use-selected-session.ts +18 -100
- package/client/features/chat/use-chat.ts +8 -12
- package/client/features/collab/applet-api.ts +1 -1
- package/client/features/collab/components/cursors.tsx +6 -1
- package/client/features/collab/components/presence-avatars.tsx +1 -1
- package/client/features/collab/components/presence-frame.tsx +1 -1
- package/client/features/collab/components/presence-group.tsx +1 -1
- package/client/features/collab/components/presence-helpers.ts +2 -2
- package/client/features/collab/components/user-avatar-group.tsx +1 -1
- package/client/features/collab/components/user-avatar.tsx +1 -1
- package/client/features/collab/components/user.tsx +1 -1
- package/client/features/collab/index.ts +3 -3
- package/client/features/collab/members/api.ts +17 -0
- package/client/features/collab/members/hooks.ts +97 -0
- package/client/features/collab/members/store.ts +148 -0
- package/client/features/{workspace-members → collab/members}/types.ts +7 -5
- package/client/features/collab/{client.ts → presence/client.ts} +4 -5
- package/client/features/collab/{hooks.tsx → presence/hooks.tsx} +1 -1
- package/client/features/collab/{provider.tsx → presence/provider.tsx} +1 -12
- package/client/features/collab/{users.ts → presence/users.ts} +19 -21
- package/client/features/collab/proxy-user.ts +1 -3
- package/client/features/collab/sharing/agent-invite.tsx +30 -0
- package/client/features/collab/sharing/workspace-members.tsx +269 -0
- package/client/features/collab/sharing/workspace-sharing-menu.tsx +179 -0
- package/client/features/collab/testing/component-fixtures.tsx +3 -3
- package/client/features/collab/testing/fake-engine.ts +2 -2
- package/client/features/dev/chat-states-page.tsx +3 -1
- package/client/features/dev/collab/collab-playground.tsx +2 -2
- package/client/features/dev/dev-index-page.tsx +0 -6
- package/client/features/dev/dev-routes.tsx +0 -2
- package/client/features/dev/harness-debug-page.tsx +7 -7
- package/client/features/dev/workspace-setup-mocks.ts +1 -2
- package/client/features/dev/workspace-setup-preview.tsx +6 -4
- package/client/features/harness/api.ts +13 -10
- package/client/features/harness/harness-login-panel.tsx +9 -5
- package/client/features/harness/harness-presentation.ts +4 -4
- package/client/features/harness/harness-selector.tsx +13 -13
- package/client/features/harness/use-harness-login.ts +5 -5
- package/client/features/home/api.ts +38 -2
- package/client/features/home/home-page.tsx +43 -13
- package/client/features/home/shared-workspaces.tsx +70 -0
- package/client/features/home/workspace-invitations.tsx +101 -0
- package/client/features/identity/host-api.ts +5 -4
- package/client/features/identity/store.ts +1 -7
- package/client/features/onboarding/agent-setup-step.tsx +8 -8
- package/client/features/onboarding/onboarding-page.tsx +3 -2
- package/client/features/onboarding/workspace-setup-step.tsx +1 -1
- package/client/features/overview/api.ts +3 -5
- package/client/features/overview/default/registry.tsx +1 -1
- package/client/features/overview/default/views-widget.tsx +2 -2
- package/client/features/overview/hidden-panel.tsx +7 -5
- package/client/features/overview/overview.tsx +18 -16
- package/client/features/overview/workspace-name.tsx +2 -2
- package/client/features/scratchpad/scratchpad.tsx +9 -7
- package/client/features/scratchpad/use-scratchpad-snapshot.tsx +13 -5
- package/client/features/views/api.ts +34 -16
- package/client/features/views/use-view-actions.ts +10 -20
- package/client/features/views/view-manager.tsx +1 -1
- package/client/features/views/view-submission.ts +2 -21
- package/client/features/workspace/add/api.ts +5 -4
- package/client/features/workspace/add/create-workspace-dialog.tsx +12 -9
- package/client/features/workspace/add/import-workspace-dialog.tsx +7 -7
- package/client/features/workspace/add/use-workspace-import.ts +10 -10
- package/client/features/workspace/add/workspace-agent-options.ts +21 -20
- package/client/features/workspace/add/workspace-agent-selector.tsx +11 -11
- package/client/features/workspace/api.ts +60 -13
- package/client/features/workspace/harness-transition.ts +7 -13
- package/client/features/workspace/remote.ts +25 -0
- package/client/features/workspace/settings/api.ts +7 -12
- package/client/features/workspace/settings/connectors-settings.tsx +3 -3
- package/client/features/workspace/settings/general-settings.tsx +8 -8
- package/client/features/workspace/setup/workspace-login-state.tsx +4 -4
- package/client/features/workspace/setup/workspace-recovery-states.tsx +43 -14
- package/client/features/workspace/setup/workspace-setup.tsx +6 -6
- package/client/features/workspace/tab-resolution.ts +2 -2
- package/client/features/workspace/use-workspace-navigation.ts +7 -4
- package/client/features/workspace/workspace-content.tsx +32 -26
- package/client/features/workspace/workspace-frame.tsx +13 -26
- package/client/features/workspace/workspace-layout-context.tsx +45 -12
- package/client/features/workspace/workspace-menu.tsx +2 -2
- package/client/features/workspace/workspace-pane.tsx +22 -0
- package/client/features/workspace/workspace-pending-screen.tsx +1 -1
- package/client/features/workspace/workspace-preferences.ts +34 -0
- package/client/features/workspace/workspace-presentation.tsx +12 -16
- package/client/features/workspace/workspace-screen.tsx +2 -2
- package/client/features/workspace/workspace-state.ts +2 -1
- package/client/features/workspace/workspace-tabs.tsx +1 -1
- package/client/features/workspace/workspace-test-utils.ts +23 -0
- package/client/runtime/use-workspace-events.ts +14 -0
- package/client/runtime/workspace-events.ts +9 -9
- package/client/store/ui.ts +29 -9
- package/dist/chunk-44khk4sp.js +2 -0
- package/dist/chunk-ba6mz56s.js +72 -0
- package/dist/chunk-ec5ennpv.js +1 -0
- package/dist/chunk-ectsnw81.js +2 -0
- package/dist/chunk-en7w5ypg.js +1 -0
- package/dist/chunk-f695wcx5.js +5 -0
- package/dist/chunk-kffcah9w.css +1 -0
- package/dist/{chunk-kdgk4dac.js → chunk-n0fawy9x.js} +1 -1
- package/dist/chunk-pdt9hxfw.js +2 -0
- package/dist/chunk-rmd0ctfx.js +546 -0
- package/dist/chunk-zv22wv0g.js +1 -0
- package/dist/index.html +1 -1
- package/lib/harness-instructions.ts +4 -4
- package/lib/harness-types.ts +13 -0
- package/lib/types.ts +34 -50
- package/lib/workspace-config.ts +48 -0
- package/lib/workspace-layout.ts +2 -4
- package/package.json +4 -2
- package/server/README.md +29 -27
- package/server/api/harnesses.ts +5 -5
- package/server/api/index.ts +170 -68
- package/server/app-config.ts +2 -7
- package/server/applets/declarations.ts +6 -7
- package/server/applets/index.ts +15 -9
- package/server/applets/views.ts +2 -17
- package/server/applets/widgets.ts +3 -2
- package/server/cli/commands/config.ts +8 -20
- package/server/cli/commands/hermes.ts +2 -2
- package/server/cli/commands/init.ts +96 -64
- package/server/cli/commands/openclaw.ts +2 -2
- package/server/cli/commands/refresh.ts +10 -1
- package/server/cli/commands/remote.ts +228 -0
- package/server/cli/commands/skill.ts +4 -4
- package/server/cli/commands/tabs.ts +5 -12
- package/server/cli/control.ts +35 -4
- package/server/cli/index.ts +10 -6
- package/server/cli/remote-command.ts +77 -0
- package/server/cli/remote-control.ts +70 -0
- package/server/cli/remote-operations.ts +244 -0
- package/server/collab/config.ts +4 -8
- package/server/collab/manager.ts +5 -2
- package/server/collab/skill/index.ts +4 -50
- package/server/control.ts +38 -11
- package/server/harness/acp/session.ts +4 -4
- package/server/harness/auth.ts +26 -31
- package/server/harness/claude-code/index.ts +1 -1
- package/server/harness/codex/discovery.ts +1 -1
- package/server/harness/codex/session.ts +1 -1
- package/server/harness/detect.ts +14 -19
- package/server/harness/executable.ts +10 -10
- package/server/harness/hermes/NOTES.md +2 -2
- package/server/harness/hermes/index.ts +1 -1
- package/server/harness/install.ts +11 -11
- package/server/harness/openclaw/index.ts +1 -1
- package/server/harness/registry.ts +7 -6
- package/server/harness/types.ts +4 -4
- package/server/onboarding/jobs.ts +1 -1
- package/server/operations/commands.ts +46 -0
- package/server/operations/files.ts +148 -0
- package/server/operations/server.ts +206 -0
- package/server/remote/agent.ts +103 -0
- package/server/remote/client.ts +665 -0
- package/server/remote/workspace.ts +34 -0
- package/server/scratchpad/document.ts +32 -12
- package/server/scratchpad/executor.ts +16 -7
- package/server/sessions/config.ts +8 -5
- package/server/sessions/pending-views.ts +16 -0
- package/server/sessions/view-sessions.ts +10 -12
- package/server/skills/locations.ts +4 -4
- package/server/skills/template.ts +3 -2
- package/server/skills/update.ts +12 -12
- package/server/skills/version.ts +7 -7
- package/server/skills/workspace.ts +13 -13
- package/server/web.ts +12 -10
- package/server/workspace-state/file.ts +2 -0
- package/server/workspace-state/index.ts +0 -4
- package/server/workspaces/api.ts +28 -0
- package/server/workspaces/change-harness.ts +15 -26
- package/server/workspaces/import.ts +4 -4
- package/server/workspaces/init.ts +15 -13
- package/server/workspaces/layout.ts +60 -66
- package/server/workspaces/registry.ts +43 -18
- package/server/workspaces/scaffold.ts +1 -0
- package/server/workspaces/shared.ts +74 -0
- package/server/workspaces/tabs.ts +6 -12
- package/skill/SKILL.md +24 -4
- package/client/api/app-ui-keys.ts +0 -6
- package/client/features/chat/sessions/browser-tab-state.ts +0 -43
- package/client/features/collab/workspace-users-menu.tsx +0 -190
- package/client/features/dev/cloud-avatar-upload.tsx +0 -58
- package/client/features/dev/cloud-page.tsx +0 -363
- package/client/features/workspace/browser-tab-state.ts +0 -51
- package/client/features/workspace/layout-save.ts +0 -13
- package/client/features/workspace-members/api.ts +0 -20
- package/client/features/workspace-members/hooks.ts +0 -127
- package/client/features/workspace-members/keys.ts +0 -6
- package/client/features/workspace-members/store.ts +0 -123
- package/dist/chunk-00s35r33.js +0 -546
- package/dist/chunk-7rz6g7g7.js +0 -1
- package/dist/chunk-af2jyddf.js +0 -2
- package/dist/chunk-cekekc3f.css +0 -1
- package/dist/chunk-ep5vh16c.js +0 -75
- package/dist/chunk-s5s1vzdw.js +0 -2
- package/dist/chunk-svxhxfeq.js +0 -2
- package/dist/chunk-t0r0bds1.js +0 -1
- package/dist/chunk-vp2qzc0d.js +0 -1
- package/dist/chunk-wz5qv1bn.js +0 -2
- package/lib/workspace-types.ts +0 -13
- package/server/workspace-state/legacy-migration.ts +0 -79
- /package/client/features/collab/{presence-publisher.ts → presence/presence-publisher.ts} +0 -0
- /package/client/features/collab/{presence-target.ts → presence/presence-target.ts} +0 -0
- /package/client/features/collab/{store.ts → presence/store.ts} +0 -0
|
@@ -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-
|
|
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 {
|
|
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<
|
|
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(
|
|
28
|
-
const { reason, command } = HARNESS_INSTRUCTIONS[
|
|
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
|
-
//
|
|
320
|
-
// GET /api/workspaces/:id/state
|
|
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
|
|
@@ -351,7 +348,6 @@ export type AppEnvironment = 'local' | 'cloud'
|
|
|
351
348
|
|
|
352
349
|
export type ClientAppConfig = {
|
|
353
350
|
environment: AppEnvironment
|
|
354
|
-
collab: boolean
|
|
355
351
|
// Demo mode: workspace creation is blocked; the UI offers the
|
|
356
352
|
// cloud-demo promo dialog instead.
|
|
357
353
|
demo: boolean
|
|
@@ -463,7 +459,7 @@ export type WorkspaceSwitchMessage = {
|
|
|
463
459
|
workspaceId: string
|
|
464
460
|
}
|
|
465
461
|
|
|
466
|
-
export type
|
|
462
|
+
export type HarnessType = 'claude-code' | 'openclaw' | 'codex' | 'hermes'
|
|
467
463
|
|
|
468
464
|
export type WorkspaceSkillStatus = {
|
|
469
465
|
name: string
|
|
@@ -481,11 +477,11 @@ export type WorkspaceSkillsUpdateFailure = WorkspaceSkillsStatus & {
|
|
|
481
477
|
error: string
|
|
482
478
|
}
|
|
483
479
|
|
|
484
|
-
export type HarnessInstallations = Record<
|
|
480
|
+
export type HarnessInstallations = Record<HarnessType, boolean>
|
|
485
481
|
|
|
486
482
|
// Shared runtime/account readiness and the current sign-in attempt.
|
|
487
483
|
export type HarnessStatus = { availability: HarnessAvailability; login?: HarnessLoginState }
|
|
488
|
-
export type HarnessStatuses = Record<
|
|
484
|
+
export type HarnessStatuses = Record<HarnessType, HarnessStatus>
|
|
489
485
|
|
|
490
486
|
export type HarnessAvailability =
|
|
491
487
|
| { status: 'available' }
|
|
@@ -524,10 +520,13 @@ export type McpServer = {
|
|
|
524
520
|
}
|
|
525
521
|
|
|
526
522
|
export type WorkspaceEntry = {
|
|
523
|
+
// Derived from .moi/.workspace.json; not persisted in workspaces.json.
|
|
524
|
+
remote?: RemoteWorkspaceTarget
|
|
527
525
|
id: string
|
|
528
526
|
path: string
|
|
529
527
|
addedAt: string
|
|
530
|
-
|
|
528
|
+
// The agent backend that runs this workspace's chats.
|
|
529
|
+
harness?: HarnessType
|
|
531
530
|
// Display name captured at add time (e.g. OpenClaw IDENTITY.md "Name:" or
|
|
532
531
|
// basename). Persisted so we don't re-probe the gateway for each listing.
|
|
533
532
|
// The list endpoint overrides this with the live layout `name` when set.
|
|
@@ -551,7 +550,7 @@ export type DiscoveredWorkspace = {
|
|
|
551
550
|
path: string
|
|
552
551
|
displayPath?: string
|
|
553
552
|
// Deduplicated in canonical provider order; empty for folders without agent history.
|
|
554
|
-
|
|
553
|
+
harnesses: HarnessType[]
|
|
555
554
|
}
|
|
556
555
|
|
|
557
556
|
export type SessionRenamedMessage = {
|
|
@@ -627,49 +626,35 @@ export type WorkspaceTabsState = {
|
|
|
627
626
|
|
|
628
627
|
export type { AgentTheme, ColorTheme, FontTheme, RadiusTheme, WorkspaceTheme } from './themes'
|
|
629
628
|
|
|
630
|
-
export type WorkspaceLayoutSave = Omit<WorkspaceLayout, 'tabs'> & {
|
|
631
|
-
tabs?: WorkspaceTabsState
|
|
632
|
-
// Captured when the edit is made, so delayed saves cannot restore another harness's defaults.
|
|
633
|
-
harness?: WorkspaceType
|
|
634
|
-
}
|
|
635
|
-
|
|
636
629
|
export type WorkspaceLayout = {
|
|
637
|
-
version:
|
|
630
|
+
version: 2
|
|
638
631
|
widgetGrid: LayoutGridItem[]
|
|
639
|
-
layoutMode: LayoutMode
|
|
640
|
-
// Open tabs and active tab for the fullscreen/split workspace chrome. The
|
|
641
|
-
// `open` order is persisted so future drag-reordering has one source of truth.
|
|
642
|
-
tabs: WorkspaceTabsState
|
|
643
632
|
// User-set display-name override. When empty/undefined the API falls back to
|
|
644
633
|
// the workspace folder name, so the resolved name always comes from the API.
|
|
645
634
|
name?: string
|
|
646
635
|
// Workspace icon override. Emoji and glyphs may use a themed background.
|
|
647
636
|
icon?: WorkspaceIcon
|
|
648
|
-
// Model id chosen in the composer picker (`supportedModels()` `value`, an
|
|
649
|
-
// alias like `sonnet`). Persisted so the choice survives a reload. Sent with
|
|
650
|
-
// each chat frame; undefined means the agent runs on the SDK default. Note
|
|
651
|
-
// the transcript records the *resolved* id (e.g. `claude-sonnet-4-6`), which
|
|
652
|
-
// doesn't map back to these aliases — hence we persist the pick here.
|
|
653
|
-
//
|
|
654
|
-
// This (with `selectedEffort` and `selectedSpeedMode`) is the *workspace
|
|
655
|
-
// default*: the value the picker edits when no session is open, and the seed a
|
|
656
|
-
// brand-new session copies. Once a session exists it carries its own per-session
|
|
657
|
-
// override (see `SessionConfig`).
|
|
658
|
-
selectedModel?: string
|
|
659
|
-
// Reasoning-effort default for new sessions (a `supportedEffortLevels` value).
|
|
660
|
-
selectedEffort?: string
|
|
661
|
-
// Speed default for new sessions. Undefined behaves as normal.
|
|
662
|
-
selectedSpeedMode?: SpeedMode
|
|
663
637
|
theme?: WorkspaceTheme
|
|
664
638
|
}
|
|
665
639
|
|
|
666
|
-
// GET /api/workspaces/:id
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
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
|
+
}
|
|
673
658
|
|
|
674
659
|
// One applet's thumbnail freshness record. Image bytes live as files in the
|
|
675
660
|
// workspace's `.moi/.cache/thumbnails/` (server/applets/thumbnails.ts), never in
|
|
@@ -781,9 +766,8 @@ export type WorkspaceHarness = {
|
|
|
781
766
|
/** Credential overrides require workspace readiness instead of shared account status. */
|
|
782
767
|
hasAuthOverrides?: boolean
|
|
783
768
|
isFolderMissing?: boolean
|
|
784
|
-
// The harness that produced this snapshot — matches the workspace
|
|
785
|
-
|
|
786
|
-
provider: WorkspaceType
|
|
769
|
+
// The harness that produced this snapshot — matches the workspace's harness.
|
|
770
|
+
harness: HarnessType
|
|
787
771
|
// Runtime presence and provider auth state, from the server-side cache.
|
|
788
772
|
availability: HarnessAvailability
|
|
789
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
|
+
}
|
package/lib/workspace-layout.ts
CHANGED
|
@@ -26,9 +26,7 @@ export function normalizeWorkspaceTabs(value: unknown): WorkspaceTabsState {
|
|
|
26
26
|
|
|
27
27
|
export function createDefaultWorkspaceLayout(): WorkspaceLayout {
|
|
28
28
|
return {
|
|
29
|
-
version:
|
|
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.
|
|
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.
|
|
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,
|
|
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.
|
|
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
|
|
60
|
-
|
|
|
61
|
-
| Workspace layout
|
|
62
|
-
| Applet source
|
|
63
|
-
| Generated bundles and thumbnails
|
|
64
|
-
| Scratchpad document and image bytes
|
|
65
|
-
| Installation-wide app settings, including `showOnboarding`
|
|
66
|
-
| Onboarding discovery results and workspace creation operation records
|
|
67
|
-
| Registered workspaces
|
|
68
|
-
|
|
|
69
|
-
| Workspace environment preferences and secrets
|
|
70
|
-
| Provider credentials and conversation history
|
|
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
|
package/server/api/harnesses.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { Hono } from 'hono'
|
|
2
2
|
|
|
3
|
-
import type {
|
|
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:
|
|
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
|
|
45
|
-
await installHarness(
|
|
46
|
-
await harnessStore.refresh(
|
|
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)
|