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
package/server/applets/views.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { existsSync } from 'node:fs'
|
|
2
2
|
|
|
3
|
-
import { viewTabId } from '@/lib/workspace-tabs'
|
|
4
3
|
import type { CompiledView, ViewConfig, ViewInfo, WorkspaceEntry } from '@/lib/types'
|
|
5
4
|
|
|
6
5
|
import { syncAppletLogAfterBuild } from './log'
|
|
@@ -14,7 +13,6 @@ import {
|
|
|
14
13
|
} from './'
|
|
15
14
|
import { serializeWorkspaceBundle } from './bundle-queue'
|
|
16
15
|
import { reloadModules } from './functions'
|
|
17
|
-
import { loadLayout, saveLayout } from '../workspaces/layout'
|
|
18
16
|
import { completeViewBuild, listPendingViews } from '../sessions/pending-views'
|
|
19
17
|
import { archiveViewSessions } from '../sessions/archive'
|
|
20
18
|
import type { WorkspaceRef } from '../workspace-state'
|
|
@@ -222,7 +220,7 @@ export async function handleBundleViews(
|
|
|
222
220
|
const changedServerModules = new Set<string>()
|
|
223
221
|
for (const r of results) {
|
|
224
222
|
if (r.status === 'built') {
|
|
225
|
-
publish({ type: 'view:updated', name: r.name, config: r.config ?? null })
|
|
223
|
+
publish({ type: 'view:updated', workspaceId, name: r.name, config: r.config ?? null })
|
|
226
224
|
await completeViewBuild({ id: workspaceId, path: workspacePath }, r.name)
|
|
227
225
|
for (const m of r.serverModules ?? []) changedServerModules.add(m)
|
|
228
226
|
}
|
|
@@ -307,21 +305,8 @@ export async function deleteView(
|
|
|
307
305
|
}
|
|
308
306
|
reloadModules([`views/${viewId}`], workspacePath)
|
|
309
307
|
await completeViewBuild(ws, viewId)
|
|
310
|
-
const layout = await loadLayout(workspacePath)
|
|
311
|
-
const tab = viewTabId(viewId)
|
|
312
|
-
await saveLayout(
|
|
313
|
-
{
|
|
314
|
-
...layout,
|
|
315
|
-
tabs: {
|
|
316
|
-
open: layout.tabs.open.filter(candidate => candidate !== tab),
|
|
317
|
-
active: layout.tabs.active === tab ? 'overview' : layout.tabs.active
|
|
318
|
-
}
|
|
319
|
-
},
|
|
320
|
-
workspacePath
|
|
321
|
-
)
|
|
322
|
-
|
|
323
308
|
publish({ type: 'view:deleted', workspaceId, name: viewId })
|
|
324
|
-
publish({ type: 'workspace:updated' })
|
|
309
|
+
publish({ type: 'workspace:updated', workspaceId })
|
|
325
310
|
await handleBundleViews(publish, workspaceId, workspacePath, false, viewId)
|
|
326
311
|
})
|
|
327
312
|
}
|
|
@@ -123,6 +123,7 @@ export async function listWidgets(workspacePath: string): Promise<Response> {
|
|
|
123
123
|
|
|
124
124
|
export async function handleBundle(
|
|
125
125
|
publish: (msg: unknown) => void,
|
|
126
|
+
workspaceId: string,
|
|
126
127
|
workspacePath: string,
|
|
127
128
|
force = false,
|
|
128
129
|
target?: string
|
|
@@ -151,7 +152,7 @@ export async function handleBundle(
|
|
|
151
152
|
const changedServerModules = new Set<string>()
|
|
152
153
|
for (const r of results) {
|
|
153
154
|
if (r.status === 'built') {
|
|
154
|
-
publish({ type: 'widget:updated', name: r.name, config: r.config ?? null })
|
|
155
|
+
publish({ type: 'widget:updated', workspaceId, name: r.name, config: r.config ?? null })
|
|
155
156
|
for (const m of r.serverModules ?? []) changedServerModules.add(m)
|
|
156
157
|
}
|
|
157
158
|
}
|
|
@@ -162,7 +163,7 @@ export async function handleBundle(
|
|
|
162
163
|
|
|
163
164
|
if (layoutChanged) {
|
|
164
165
|
const widgets = await getWidgetList(workspacePath)
|
|
165
|
-
publish({ type: 'widget-layout:updated', widgets })
|
|
166
|
+
publish({ type: 'widget-layout:updated', workspaceId, widgets })
|
|
166
167
|
}
|
|
167
168
|
|
|
168
169
|
return results
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import { defineCommand } from 'citty'
|
|
2
2
|
import { resolve } from 'path'
|
|
3
|
-
import {
|
|
4
|
-
import { staleSkillNotice } from '../../skills/version'
|
|
5
|
-
import { exitControlUnreachable } from '../control'
|
|
3
|
+
import { sendControl } from '../control'
|
|
6
4
|
import pc from '../pc'
|
|
7
5
|
|
|
8
6
|
async function sendConfig(payload: {
|
|
@@ -12,27 +10,21 @@ async function sendConfig(payload: {
|
|
|
12
10
|
clearName?: boolean
|
|
13
11
|
clearIcon?: boolean
|
|
14
12
|
}) {
|
|
15
|
-
|
|
16
|
-
const ws = new WebSocket(CONTROL_URL)
|
|
17
|
-
ws.onopen = () => ws.send(JSON.stringify({ type: 'config', ...payload }))
|
|
18
|
-
ws.onmessage = event => {
|
|
19
|
-
const res = JSON.parse(String(event.data))
|
|
20
|
-
if (res.error) {
|
|
21
|
-
console.error('\n' + pc.red(pc.bold('Error:')) + ' ' + res.error + '\n')
|
|
22
|
-
ws.close()
|
|
23
|
-
process.exit(1)
|
|
24
|
-
}
|
|
13
|
+
await sendControl(payload.path, { type: 'config', ...payload }, res => {
|
|
25
14
|
console.log()
|
|
26
15
|
if (res.ok) {
|
|
27
16
|
if (res.clearedName) console.log(pc.green('✓') + ' Name reset to ' + pc.dim('(folder name)'))
|
|
28
|
-
else if (res.name) console.log(pc.green('✓') + ' Name set to ' + pc.bold(res.name))
|
|
17
|
+
else if (res.name) console.log(pc.green('✓') + ' Name set to ' + pc.bold(String(res.name)))
|
|
29
18
|
if (res.clearedIcon)
|
|
30
19
|
console.log(pc.green('✓') + ' Icon reset to ' + pc.dim('default (provider)'))
|
|
31
20
|
else if (res.icon) console.log(pc.green('✓') + ' Icon updated ' + pc.dim('(128×128 webp)'))
|
|
32
21
|
} else {
|
|
33
22
|
console.log(pc.bold('moi config') + ' — workspace identity\n')
|
|
34
23
|
console.log(
|
|
35
|
-
' ' +
|
|
24
|
+
' ' +
|
|
25
|
+
pc.dim('name') +
|
|
26
|
+
' ' +
|
|
27
|
+
(res.name ? pc.bold(String(res.name)) : pc.dim('(folder name)'))
|
|
36
28
|
)
|
|
37
29
|
console.log(
|
|
38
30
|
' ' +
|
|
@@ -42,11 +34,7 @@ async function sendConfig(payload: {
|
|
|
42
34
|
)
|
|
43
35
|
}
|
|
44
36
|
console.log()
|
|
45
|
-
|
|
46
|
-
ws.close()
|
|
47
|
-
process.exit(0)
|
|
48
|
-
}
|
|
49
|
-
ws.onerror = () => void exitControlUnreachable()
|
|
37
|
+
})
|
|
50
38
|
}
|
|
51
39
|
|
|
52
40
|
// A terse cheat sheet — one line per command — so an agent can grasp the
|
|
@@ -78,7 +78,7 @@ const hermesInit = defineCommand({
|
|
|
78
78
|
skillsDir: skillsRoot,
|
|
79
79
|
installLogPath
|
|
80
80
|
} = await provisionWorkspace(target.path, 'hermes')
|
|
81
|
-
if (scaffold !== 'exists') {
|
|
81
|
+
if (scaffold !== 'exists' && scaffold !== 'skipped') {
|
|
82
82
|
if (scaffold === 'installing') {
|
|
83
83
|
console.log('\n' + pc.dim(' Widget dependencies still installing in .moi/ (background)'))
|
|
84
84
|
console.log(pc.dim(' Install log: ' + installLogPath))
|
|
@@ -93,7 +93,7 @@ const hermesInit = defineCommand({
|
|
|
93
93
|
}
|
|
94
94
|
|
|
95
95
|
const entry = await registerWorkspace(target.path, {
|
|
96
|
-
|
|
96
|
+
harness: 'hermes',
|
|
97
97
|
name: target.name,
|
|
98
98
|
agentId: target.agentId,
|
|
99
99
|
isDefault: target.isDefault
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { initializeRemoteWorkspace } from '../../remote/workspace'
|
|
2
|
+
import { loadWorkspaceFileConfig } from '../../workspaces/layout'
|
|
3
|
+
import { parseRemoteWorkspaceAddress } from '@/lib/workspace-config'
|
|
4
|
+
import type { HarnessType, WorkspaceEntry } from '@/lib/types'
|
|
2
5
|
import { defineCommand } from 'citty'
|
|
3
6
|
import { existsSync } from 'node:fs'
|
|
4
7
|
import { join, resolve } from 'path'
|
|
5
|
-
import { installCollabSkill } from '../../collab/skill'
|
|
6
8
|
import { PORT } from '../../constants'
|
|
7
9
|
import type { DetectedAgent } from '../../harness/detect'
|
|
8
10
|
import {
|
|
@@ -35,7 +37,7 @@ import { keyValue } from '../ui'
|
|
|
35
37
|
async function resolveInitHarness(
|
|
36
38
|
target: string,
|
|
37
39
|
requested: string | undefined
|
|
38
|
-
): Promise<{
|
|
40
|
+
): Promise<{ harness: HarnessType; agent: DetectedAgent | null }> {
|
|
39
41
|
if (requested !== undefined) {
|
|
40
42
|
const value = requested.trim()
|
|
41
43
|
if (!isHarnessName(value)) {
|
|
@@ -62,7 +64,7 @@ async function resolveInitHarness(
|
|
|
62
64
|
pc.dim(' to bind it once ' + harnessLabel[value] + ' can see the workspace.')
|
|
63
65
|
)
|
|
64
66
|
}
|
|
65
|
-
return {
|
|
67
|
+
return { harness: value, agent }
|
|
66
68
|
}
|
|
67
69
|
|
|
68
70
|
// A registered workspace has already answered this question, and may carry no
|
|
@@ -71,12 +73,12 @@ async function resolveInitHarness(
|
|
|
71
73
|
// to refresh skills.
|
|
72
74
|
const known = (await listWorkspaces()).find(e => e.path === target)
|
|
73
75
|
if (known) {
|
|
74
|
-
const
|
|
76
|
+
const harness = known.harness ?? 'claude-code'
|
|
75
77
|
console.log(
|
|
76
|
-
'\n' + pc.dim(' Already registered — initializing for ') + pc.bold(harnessLabel[
|
|
78
|
+
'\n' + pc.dim(' Already registered — initializing for ') + pc.bold(harnessLabel[harness])
|
|
77
79
|
)
|
|
78
80
|
return {
|
|
79
|
-
|
|
81
|
+
harness,
|
|
80
82
|
agent: known.agentId
|
|
81
83
|
? {
|
|
82
84
|
agentId: known.agentId,
|
|
@@ -96,10 +98,10 @@ async function resolveInitHarness(
|
|
|
96
98
|
' Detected ' +
|
|
97
99
|
detected.reason +
|
|
98
100
|
' — initializing for ' +
|
|
99
|
-
pc.bold(harnessLabel[detected.
|
|
101
|
+
pc.bold(harnessLabel[detected.harness]) +
|
|
100
102
|
'.'
|
|
101
103
|
)
|
|
102
|
-
return {
|
|
104
|
+
return { harness: detected.harness, agent: detected.agent ?? null }
|
|
103
105
|
}
|
|
104
106
|
|
|
105
107
|
console.error('\n' + pc.red('✗') + ' No agent harness detected in ' + pc.bold(target))
|
|
@@ -120,9 +122,11 @@ async function resolveInitHarness(
|
|
|
120
122
|
export const init = defineCommand({
|
|
121
123
|
meta: {
|
|
122
124
|
name: 'init',
|
|
123
|
-
description: 'Initialize
|
|
125
|
+
description: 'Initialize a local or remote workspace and install its skill'
|
|
124
126
|
},
|
|
125
127
|
args: {
|
|
128
|
+
remote: { type: 'string', description: 'Remote workspace address: ownerId:workspaceId' },
|
|
129
|
+
json: { type: 'boolean', description: 'Print remote initialization as JSON' },
|
|
126
130
|
dir: {
|
|
127
131
|
type: 'positional',
|
|
128
132
|
default: '.',
|
|
@@ -137,11 +141,6 @@ export const init = defineCommand({
|
|
|
137
141
|
default: false,
|
|
138
142
|
description: 'Start the web server if not already running'
|
|
139
143
|
},
|
|
140
|
-
collab: {
|
|
141
|
-
type: 'boolean',
|
|
142
|
-
default: false,
|
|
143
|
-
description: 'Include the optional collaboration guide and applet types'
|
|
144
|
-
},
|
|
145
144
|
id: {
|
|
146
145
|
type: 'string',
|
|
147
146
|
description:
|
|
@@ -149,13 +148,23 @@ export const init = defineCommand({
|
|
|
149
148
|
}
|
|
150
149
|
},
|
|
151
150
|
async run({ args }) {
|
|
151
|
+
if (
|
|
152
|
+
(args.remote !== undefined && (args.harness || args.id)) ||
|
|
153
|
+
(args.json && (args.remote === undefined || args.web))
|
|
154
|
+
) {
|
|
155
|
+
console.error(
|
|
156
|
+
'--remote cannot be combined with --harness or --id; --json requires --remote without --web'
|
|
157
|
+
)
|
|
158
|
+
process.exitCode = 1
|
|
159
|
+
return
|
|
160
|
+
}
|
|
152
161
|
const requested = resolve(args.dir)
|
|
153
162
|
// Locate the workspace root first: if invoked from inside a `.moi/` (or a
|
|
154
163
|
// deeper accidental `.moi/.moi/…`), lift to the directory that owns it
|
|
155
164
|
// instead of scaffolding a nested workspace. This is what stops the
|
|
156
165
|
// `.moi/.moi` bug at the source.
|
|
157
166
|
const target = liftToWorkspaceRoot(requested)
|
|
158
|
-
if (target !== requested) {
|
|
167
|
+
if (target !== requested && !args.json) {
|
|
159
168
|
console.log(
|
|
160
169
|
'\n' +
|
|
161
170
|
pc.yellow('◆') +
|
|
@@ -169,7 +178,7 @@ export const init = defineCommand({
|
|
|
169
178
|
// Flag a stray nested `.moi/.moi` left by the old cwd bug — harmless but
|
|
170
179
|
// confusing, and easy to remove.
|
|
171
180
|
const stray = join(target, '.moi', '.moi')
|
|
172
|
-
if (existsSync(stray)) {
|
|
181
|
+
if (existsSync(stray) && !args.json) {
|
|
173
182
|
console.log(
|
|
174
183
|
'\n' +
|
|
175
184
|
pc.yellow('⚠') +
|
|
@@ -194,57 +203,80 @@ export const init = defineCommand({
|
|
|
194
203
|
const projectRoot = PACKAGE_ROOT
|
|
195
204
|
const isInteractive = process.stdout.isTTY
|
|
196
205
|
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
// Provision: bundled skills + the `.moi/` bootstrap (widgets dir +
|
|
204
|
-
// package.json + bun install). An existing `.moi/` is left untouched.
|
|
205
|
-
console.log()
|
|
206
|
-
const { scaffold, skillsDir, installLogPath } = await provisionWorkspace(target, type)
|
|
207
|
-
if (args['collab']) {
|
|
208
|
-
const { referencePath } = await installCollabSkill(target, type)
|
|
209
|
-
console.log(pc.dim(' Collaboration guide installed to ' + referencePath))
|
|
210
|
-
console.log(pc.dim(' Live presence is available in the cloud environment'))
|
|
211
|
-
}
|
|
212
|
-
if (scaffold !== 'exists') {
|
|
213
|
-
if (scaffold === 'installing') {
|
|
214
|
-
console.log(pc.dim(' Widget dependencies still installing in .moi/ (background)'))
|
|
215
|
-
console.log(pc.dim(' Install log: ' + installLogPath))
|
|
216
|
-
} else if (scaffold === 0) {
|
|
217
|
-
console.log(pc.dim(' Installed widget dependencies in .moi/'))
|
|
218
|
-
} else {
|
|
219
|
-
console.warn(
|
|
220
|
-
pc.yellow(` bun install failed (exit ${scaffold}) — run it manually in .moi/`)
|
|
206
|
+
let entry: Pick<WorkspaceEntry, 'id'>
|
|
207
|
+
if (args.remote !== undefined) {
|
|
208
|
+
try {
|
|
209
|
+
const result = await initializeRemoteWorkspace(
|
|
210
|
+
target,
|
|
211
|
+
parseRemoteWorkspaceAddress(args.remote)
|
|
221
212
|
)
|
|
222
|
-
|
|
213
|
+
if (args.json) {
|
|
214
|
+
console.log(JSON.stringify(result))
|
|
215
|
+
return
|
|
216
|
+
}
|
|
217
|
+
entry = result
|
|
218
|
+
console.log(pc.green('✓') + ' Initialized ' + pc.bold(result.path) + ' for ' + args.remote)
|
|
219
|
+
} catch (error) {
|
|
220
|
+
console.error(error instanceof Error ? error.message : 'Remote initialization failed')
|
|
221
|
+
process.exitCode = 1
|
|
222
|
+
return
|
|
223
223
|
}
|
|
224
|
-
}
|
|
224
|
+
} else {
|
|
225
|
+
const config = await loadWorkspaceFileConfig(target)
|
|
226
|
+
if (config.remote) {
|
|
227
|
+
console.error(
|
|
228
|
+
`This is a remote workspace — use moi init --remote ${config.remote.user_id}:${config.remote.workspace_id}`
|
|
229
|
+
)
|
|
230
|
+
process.exitCode = 1
|
|
231
|
+
return
|
|
232
|
+
}
|
|
233
|
+
// Which backend this workspace is for has to be settled before
|
|
234
|
+
// provisioning: each harness reads skills from a different directory, and
|
|
235
|
+
// agent-owned ones (OpenClaw, Hermes) need their agent metadata on the
|
|
236
|
+
// registry entry — same as `moi <provider> init`.
|
|
237
|
+
const { harness, agent } = await resolveInitHarness(target, args.harness)
|
|
225
238
|
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
+
// Provision: bundled skills + the `.moi/` bootstrap (widgets dir +
|
|
240
|
+
// package.json + bun install). An existing `.moi/` is left untouched.
|
|
241
|
+
console.log()
|
|
242
|
+
const { scaffold, skillsDir, installLogPath } = await provisionWorkspace(target, harness)
|
|
243
|
+
if (scaffold !== 'exists' && scaffold !== 'skipped') {
|
|
244
|
+
if (scaffold === 'installing') {
|
|
245
|
+
console.log(pc.dim(' Widget dependencies still installing in .moi/ (background)'))
|
|
246
|
+
console.log(pc.dim(' Install log: ' + installLogPath))
|
|
247
|
+
} else if (scaffold === 0) {
|
|
248
|
+
console.log(pc.dim(' Installed widget dependencies in .moi/'))
|
|
249
|
+
} else {
|
|
250
|
+
console.warn(
|
|
251
|
+
pc.yellow(` bun install failed (exit ${scaffold}) — run it manually in .moi/`)
|
|
252
|
+
)
|
|
253
|
+
console.warn(pc.dim(' Install log: ' + installLogPath))
|
|
254
|
+
}
|
|
255
|
+
}
|
|
239
256
|
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
257
|
+
// Always register the workspace in the persistent registry
|
|
258
|
+
entry = await registerWorkspace(target, {
|
|
259
|
+
...(args.id ? { id: args.id } : {}),
|
|
260
|
+
harness: harness,
|
|
261
|
+
...(agent
|
|
262
|
+
? {
|
|
263
|
+
name: agent.name,
|
|
264
|
+
agentId: agent.agentId,
|
|
265
|
+
isDefault: agent.isDefault,
|
|
266
|
+
lastRunAt: agent.lastRunAt
|
|
267
|
+
}
|
|
268
|
+
: {})
|
|
269
|
+
})
|
|
270
|
+
|
|
271
|
+
console.log(pc.green('✓') + ' Initialized ' + pc.bold(target) + pc.dim(' (' + harness + ')'))
|
|
272
|
+
console.log(
|
|
273
|
+
' Skills installed to ' +
|
|
274
|
+
pc.dim(skillsDir) +
|
|
275
|
+
' — ask ' +
|
|
276
|
+
(harness === 'claude-code' ? 'Claude' : 'your agent') +
|
|
277
|
+
' to build a widget or a view to get started\n'
|
|
278
|
+
)
|
|
279
|
+
}
|
|
248
280
|
|
|
249
281
|
// If --web and server not running, start it (stay alive as wrapper)
|
|
250
282
|
let running = await isServerRunning()
|
|
@@ -91,7 +91,7 @@ const openclawInit = defineCommand({
|
|
|
91
91
|
skillsDir: skillsRoot,
|
|
92
92
|
installLogPath
|
|
93
93
|
} = await provisionWorkspace(target.path, 'openclaw')
|
|
94
|
-
if (scaffold !== 'exists') {
|
|
94
|
+
if (scaffold !== 'exists' && scaffold !== 'skipped') {
|
|
95
95
|
if (scaffold === 'installing') {
|
|
96
96
|
console.log('\n' + pc.dim(' Widget dependencies still installing in .moi/ (background)'))
|
|
97
97
|
console.log(pc.dim(' Install log: ' + installLogPath))
|
|
@@ -108,7 +108,7 @@ const openclawInit = defineCommand({
|
|
|
108
108
|
// Register in the moi registry so the agent's workspace appears in the
|
|
109
109
|
// UI workspace list. Mirrors what `moi init` does for Claude Code.
|
|
110
110
|
const entry = await registerWorkspace(target.path, {
|
|
111
|
-
|
|
111
|
+
harness: 'openclaw',
|
|
112
112
|
name: target.name,
|
|
113
113
|
agentId: target.agentId,
|
|
114
114
|
isDefault: target.isDefault,
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { currentRemoteWorkspace } from '../../remote/workspace'
|
|
1
2
|
import { defineCommand } from 'citty'
|
|
2
3
|
import { CONTROL_URL } from '../../constants'
|
|
3
4
|
import { staleSkillNotice } from '../../skills/version'
|
|
@@ -17,9 +18,17 @@ export const refresh = defineCommand({
|
|
|
17
18
|
async run({ args }) {
|
|
18
19
|
const only = readAppletSelector(args.only)
|
|
19
20
|
const notice = await staleSkillNotice(process.cwd())
|
|
21
|
+
const linked = await currentRemoteWorkspace()
|
|
20
22
|
const ws = new WebSocket(CONTROL_URL)
|
|
21
23
|
|
|
22
|
-
ws.onopen = () =>
|
|
24
|
+
ws.onopen = () =>
|
|
25
|
+
ws.send(
|
|
26
|
+
JSON.stringify({
|
|
27
|
+
type: 'applets:refresh',
|
|
28
|
+
only,
|
|
29
|
+
path: linked?.path ?? process.env.MOI_REMOTE_WORKSPACE
|
|
30
|
+
})
|
|
31
|
+
)
|
|
23
32
|
|
|
24
33
|
ws.onmessage = event => {
|
|
25
34
|
const data = JSON.parse(String(event.data))
|
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
import { AGENT_CLIENTS } from '../../remote/agent'
|
|
2
|
+
import { defineCommand } from 'citty'
|
|
3
|
+
import open from 'open'
|
|
4
|
+
import { remoteOperations } from '../remote-operations'
|
|
5
|
+
import { clearLine, cursorTo } from 'node:readline'
|
|
6
|
+
import { currentRemoteWorkspace } from '../../remote/workspace'
|
|
7
|
+
import { parseRemoteWorkspaceAddress } from '@/lib/workspace-config'
|
|
8
|
+
import pc from '../pc'
|
|
9
|
+
import {
|
|
10
|
+
login as signIn,
|
|
11
|
+
logout as signOut,
|
|
12
|
+
CloudSignInRequired,
|
|
13
|
+
remoteConfig,
|
|
14
|
+
remoteStatus,
|
|
15
|
+
invitations as listInvitations,
|
|
16
|
+
accept as acceptInvitation,
|
|
17
|
+
renameAgent,
|
|
18
|
+
leave as leaveWorkspace
|
|
19
|
+
} from '../../remote/client'
|
|
20
|
+
|
|
21
|
+
// Profile fields are user supplied; they must not control the terminal.
|
|
22
|
+
// oxlint-disable-next-line no-control-regex -- Deliberately remove terminal control characters.
|
|
23
|
+
const text = (value: string) => Bun.stripANSI(value).replace(/[\u0000-\u001f\u007f-\u009f]/g, '')
|
|
24
|
+
|
|
25
|
+
async function reportErrors(action: () => Promise<void>): Promise<void> {
|
|
26
|
+
try {
|
|
27
|
+
await action()
|
|
28
|
+
} catch (error) {
|
|
29
|
+
if (
|
|
30
|
+
error instanceof CloudSignInRequired ||
|
|
31
|
+
(error instanceof Error && error.message === 'Not signed in — run moi remote login')
|
|
32
|
+
) {
|
|
33
|
+
console.error(`${pc.dim('›')} Signed out`)
|
|
34
|
+
console.error(
|
|
35
|
+
pc.dim('› Run ') + pc.cyan('moi remote login') + pc.dim(' to connect to Moi Cloud')
|
|
36
|
+
)
|
|
37
|
+
} else {
|
|
38
|
+
console.error(error instanceof Error ? error.message : 'Cloud request failed')
|
|
39
|
+
}
|
|
40
|
+
process.exitCode = 1
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
function waitingForLogin(): () => void {
|
|
45
|
+
const message = 'Waiting for authentication…'
|
|
46
|
+
if (!process.stderr.isTTY) {
|
|
47
|
+
console.error(message)
|
|
48
|
+
return () => {}
|
|
49
|
+
}
|
|
50
|
+
const frames = ['⠋', '⠙', '⠹', '⠸', '⠼', '⠴', '⠦', '⠧', '⠇', '⠏']
|
|
51
|
+
let frame = 0
|
|
52
|
+
const draw = () => {
|
|
53
|
+
cursorTo(process.stderr, 0)
|
|
54
|
+
process.stderr.write(pc.dim(`${frames[frame++ % frames.length]} ${message}`))
|
|
55
|
+
}
|
|
56
|
+
draw()
|
|
57
|
+
const timer = setInterval(draw, 80)
|
|
58
|
+
const stop = () => {
|
|
59
|
+
clearInterval(timer)
|
|
60
|
+
clearLine(process.stderr, 0)
|
|
61
|
+
cursorTo(process.stderr, 0)
|
|
62
|
+
process.removeListener('SIGINT', interrupt)
|
|
63
|
+
}
|
|
64
|
+
const interrupt = () => {
|
|
65
|
+
stop()
|
|
66
|
+
process.exit(130)
|
|
67
|
+
}
|
|
68
|
+
process.once('SIGINT', interrupt)
|
|
69
|
+
return stop
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
const login = defineCommand({
|
|
73
|
+
meta: { name: 'login', description: 'Sign in to Moi Cloud in your browser' },
|
|
74
|
+
args: {
|
|
75
|
+
browser: {
|
|
76
|
+
type: 'boolean',
|
|
77
|
+
default: true,
|
|
78
|
+
description: 'Open the login page (use --no-browser to print its URL only)'
|
|
79
|
+
}
|
|
80
|
+
},
|
|
81
|
+
async run({ args }) {
|
|
82
|
+
await reportErrors(async () => {
|
|
83
|
+
let stopWaiting = () => {}
|
|
84
|
+
try {
|
|
85
|
+
await signIn(async (url, code) => {
|
|
86
|
+
console.log(`\nVisit ${pc.bold(url)}\nCode: ${text(code)}\n`)
|
|
87
|
+
if (args.browser) await open(url).catch(() => {})
|
|
88
|
+
stopWaiting = waitingForLogin()
|
|
89
|
+
})
|
|
90
|
+
} finally {
|
|
91
|
+
stopWaiting()
|
|
92
|
+
}
|
|
93
|
+
console.log(`\n${pc.green('Congratulations!')} You are now signed in.\n`)
|
|
94
|
+
})
|
|
95
|
+
}
|
|
96
|
+
})
|
|
97
|
+
|
|
98
|
+
const logout = defineCommand({
|
|
99
|
+
meta: { name: 'logout', description: 'Sign out of Moi Cloud' },
|
|
100
|
+
args: { yes: { type: 'boolean', description: 'Confirm permanently revoking this agent login' } },
|
|
101
|
+
async run({ args }) {
|
|
102
|
+
await reportErrors(async () => {
|
|
103
|
+
await signOut(args.yes)
|
|
104
|
+
console.log(`${pc.green('✓')} Signed out`)
|
|
105
|
+
})
|
|
106
|
+
}
|
|
107
|
+
})
|
|
108
|
+
|
|
109
|
+
const jsonArg = { type: 'boolean' as const, description: 'Print JSON' }
|
|
110
|
+
const pathArg = {
|
|
111
|
+
type: 'string' as const,
|
|
112
|
+
description: 'Local workspace folder (defaults to current folder)'
|
|
113
|
+
}
|
|
114
|
+
const rename = defineCommand({
|
|
115
|
+
meta: { name: 'rename-agent', description: 'Change your agent name across workspaces' },
|
|
116
|
+
args: { name: { type: 'positional', required: true }, json: jsonArg },
|
|
117
|
+
async run({ args }) {
|
|
118
|
+
await reportErrors(async () => {
|
|
119
|
+
const result = await renameAgent(args.name)
|
|
120
|
+
console.log(args.json ? JSON.stringify(result) : `Agent renamed to ${text(result.name)}`)
|
|
121
|
+
})
|
|
122
|
+
}
|
|
123
|
+
})
|
|
124
|
+
const invitations = defineCommand({
|
|
125
|
+
meta: { name: 'invitations', description: 'List pending workspace invitations' },
|
|
126
|
+
args: { json: jsonArg },
|
|
127
|
+
async run({ args }) {
|
|
128
|
+
await reportErrors(async () => {
|
|
129
|
+
const result = await listInvitations()
|
|
130
|
+
if (args.json) console.log(JSON.stringify(result))
|
|
131
|
+
else if (!result.length) console.log('No pending invitations')
|
|
132
|
+
else
|
|
133
|
+
for (const invitation of result)
|
|
134
|
+
console.log(
|
|
135
|
+
`${text(invitation.id)} ${text(invitation.workspaceName)} — ${text(invitation.inviter.name)}`
|
|
136
|
+
)
|
|
137
|
+
})
|
|
138
|
+
}
|
|
139
|
+
})
|
|
140
|
+
const accept = defineCommand({
|
|
141
|
+
meta: { name: 'accept', description: 'Accept a workspace invitation as a human or agent' },
|
|
142
|
+
args: {
|
|
143
|
+
invite: { type: 'positional', required: true },
|
|
144
|
+
name: { type: 'string', description: 'Name for a new agent identity' },
|
|
145
|
+
client: { type: 'string', description: 'Agent client: ' + AGENT_CLIENTS.join(', ') },
|
|
146
|
+
json: jsonArg
|
|
147
|
+
},
|
|
148
|
+
async run({ args }) {
|
|
149
|
+
await reportErrors(async () => {
|
|
150
|
+
const result = await acceptInvitation(args.invite, args.name, args.client)
|
|
151
|
+
console.log(
|
|
152
|
+
args.json
|
|
153
|
+
? JSON.stringify(result)
|
|
154
|
+
: `Invitation accepted\n\nmoi init --remote ${result.remote.user_id}:${result.remote.workspace_id}`
|
|
155
|
+
)
|
|
156
|
+
})
|
|
157
|
+
}
|
|
158
|
+
})
|
|
159
|
+
const leave = defineCommand({
|
|
160
|
+
meta: { name: 'leave', description: 'Leave a shared workspace; keep local files' },
|
|
161
|
+
args: {
|
|
162
|
+
workspace: {
|
|
163
|
+
type: 'positional',
|
|
164
|
+
required: false,
|
|
165
|
+
description: 'ownerId:workspaceId (defaults to current folder)'
|
|
166
|
+
},
|
|
167
|
+
path: pathArg,
|
|
168
|
+
json: jsonArg
|
|
169
|
+
},
|
|
170
|
+
async run({ args }) {
|
|
171
|
+
await reportErrors(async () => {
|
|
172
|
+
if (args.workspace !== undefined && args.path)
|
|
173
|
+
throw new Error('Use a workspace address or --path, not both')
|
|
174
|
+
const target =
|
|
175
|
+
args.workspace !== undefined
|
|
176
|
+
? parseRemoteWorkspaceAddress(args.workspace)
|
|
177
|
+
: await currentRemoteWorkspace(args.path)
|
|
178
|
+
if (!target)
|
|
179
|
+
throw new Error('No remote workspace here — provide ownerId:workspaceId or --path')
|
|
180
|
+
const result = await leaveWorkspace(target.user_id, target.workspace_id)
|
|
181
|
+
console.log(args.json ? JSON.stringify(result) : 'Left the workspace; local files kept')
|
|
182
|
+
})
|
|
183
|
+
}
|
|
184
|
+
})
|
|
185
|
+
const remoteSubCommands = {
|
|
186
|
+
...remoteOperations(reportErrors),
|
|
187
|
+
login,
|
|
188
|
+
logout,
|
|
189
|
+
'rename-agent': rename,
|
|
190
|
+
invitations,
|
|
191
|
+
accept,
|
|
192
|
+
leave
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
export const remote = defineCommand({
|
|
196
|
+
meta: { name: 'remote', description: 'Show your cloud account and shared workspaces' },
|
|
197
|
+
args: { json: jsonArg, path: pathArg },
|
|
198
|
+
subCommands: remoteSubCommands,
|
|
199
|
+
async run({ args, rawArgs }) {
|
|
200
|
+
// citty also runs the parent after a subcommand; only bare `remote` shows status.
|
|
201
|
+
const sub = rawArgs.find(arg => !arg.startsWith('-'))
|
|
202
|
+
if (sub && Object.hasOwn(remoteSubCommands, sub)) return
|
|
203
|
+
await reportErrors(async () => {
|
|
204
|
+
const status = {
|
|
205
|
+
...(await remoteStatus()),
|
|
206
|
+
currentWorkspace: await currentRemoteWorkspace(args.path)
|
|
207
|
+
}
|
|
208
|
+
if (args.json) {
|
|
209
|
+
console.log(JSON.stringify(status, null, 2))
|
|
210
|
+
return
|
|
211
|
+
}
|
|
212
|
+
console.log(
|
|
213
|
+
`\n${text(status.me.name || ('email' in status.me ? status.me.email : status.me.client))} <${text('email' in status.me ? status.me.email : status.me.client)}>\nAccount: ${text(status.me.id)}\nCloud: ${(await remoteConfig()).url}\n`
|
|
214
|
+
)
|
|
215
|
+
if (status.currentWorkspace)
|
|
216
|
+
console.log(
|
|
217
|
+
`Remote workspace: ${text(status.currentWorkspace.user_id)}:${text(status.currentWorkspace.workspace_id)}\n`
|
|
218
|
+
)
|
|
219
|
+
console.log('Shared workspaces')
|
|
220
|
+
if (!status.workspaces.length) console.log(' No shared workspaces')
|
|
221
|
+
for (const workspace of status.workspaces)
|
|
222
|
+
console.log(
|
|
223
|
+
` ${text(workspace.owner.id)}:${text(workspace.id)} — ${text(workspace.owner.name || workspace.owner.email)} <${text(workspace.owner.email)}>`
|
|
224
|
+
)
|
|
225
|
+
console.log()
|
|
226
|
+
})
|
|
227
|
+
}
|
|
228
|
+
})
|