moi-computer 0.11.1-next.4 → 0.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/client/api/app-config.ts +7 -4
- package/client/app/AppRouter.tsx +2 -2
- package/client/app/routes/WorkspaceRoute.tsx +27 -19
- package/client/features/applets/{AppletMount.tsx → AppletContainer.tsx} +7 -5
- package/client/features/applets/WidgetShell.tsx +3 -3
- package/client/features/applets/applet-cache.ts +3 -5
- package/client/features/applets/applet-runtime.ts +27 -12
- package/client/features/applets/applet-thumbnail.ts +2 -1
- package/client/features/chat/applet-chat-intents.ts +14 -6
- package/client/features/chat/composer/attachments/draft-attachments.ts +21 -4
- package/client/features/chat/messages/MarkdownContent.tsx +5 -2
- package/client/features/chat/sessions/browser-tab-state.ts +18 -0
- package/client/features/chat/sessions/useSelectedSession.ts +55 -21
- package/client/features/chat/useChat.ts +4 -0
- package/client/features/collab/applet-api.ts +34 -0
- package/client/features/collab/client.ts +239 -0
- package/client/features/collab/components/cursors.tsx +199 -0
- package/client/features/collab/components/presence-avatars.tsx +61 -0
- package/client/features/collab/components/presence-frame.tsx +126 -0
- package/client/features/collab/components/presence-group.tsx +23 -0
- package/client/features/collab/components/presence-helpers.ts +50 -0
- package/client/features/collab/components/user-avatar-group.tsx +22 -0
- package/client/features/collab/components/user-avatar.tsx +40 -0
- package/client/features/collab/components/user.tsx +50 -0
- package/client/features/collab/hooks.tsx +164 -0
- package/client/features/collab/host-state.ts +254 -0
- package/client/features/collab/index.ts +5 -0
- package/client/features/collab/local-user.ts +46 -0
- package/client/features/collab/presence-publisher.ts +30 -0
- package/client/features/collab/presence-target.ts +8 -0
- package/client/features/collab/provider.tsx +79 -0
- package/client/features/collab/proxy-user.ts +35 -0
- package/client/features/collab/store.ts +156 -0
- package/client/features/collab/testing/component-fixtures.tsx +54 -0
- package/client/features/collab/testing/fake-engine.ts +129 -0
- package/client/features/collab/users.ts +106 -0
- package/client/features/collab/workspace-users-menu.tsx +194 -0
- package/client/features/connectors/mcp-icons.ts +0 -2
- package/client/features/dev/DevIndexPage.tsx +5 -0
- package/client/features/dev/DevRoutes.tsx +16 -4
- package/client/features/dev/collab/collab-page.tsx +24 -0
- package/client/features/dev/collab/collab-playground.tsx +614 -0
- package/client/features/dev/collab/local-user-settings.tsx +166 -0
- package/client/features/dev/collab/playground-room.ts +33 -0
- package/client/features/dev/{UiComponentsPage.tsx → ui-components/ui-components-page.tsx} +1 -1
- package/client/features/overview/WidgetCanvas.tsx +3 -1
- package/client/features/views/ViewManager.tsx +12 -7
- package/client/features/views/api.ts +2 -2
- package/client/features/views/useViewBuilderActions.ts +3 -0
- package/client/features/workspace/WorkspaceContext.tsx +1 -1
- package/client/features/workspace/WorkspaceLayoutContext.tsx +8 -2
- package/client/features/workspace/WorkspaceScreen.tsx +19 -11
- package/client/features/workspace/WorkspaceTabs.tsx +3 -3
- package/client/features/workspace/api.ts +2 -1
- package/client/features/workspace/browser-tab-state.ts +44 -0
- package/client/features/workspace/layout-save.ts +13 -0
- package/client/features/workspace/moi-context.ts +2 -1
- package/client/features/workspace/useWorkspaceNavigation.ts +20 -8
- package/client/index.css +45 -0
- package/client/index.tsx +9 -4
- package/client/main.tsx +1 -11
- package/client/theme.css +4 -1
- package/dist/chunk-2jncyq65.js +1 -0
- package/dist/{chunk-brr0zbeh.js → chunk-3a48fyf7.js} +2 -2
- package/dist/{chunk-tzz101ea.js → chunk-97eg9mjn.js} +1 -1
- package/dist/chunk-e2q5ken7.js +68 -0
- package/dist/{chunk-zs4mte79.js → chunk-efdyz6xp.js} +1 -1
- package/dist/chunk-h2kj1ysj.js +1 -0
- package/dist/chunk-jf6czgrz.js +2 -0
- package/dist/chunk-nez8sdta.js +1 -0
- package/dist/chunk-nzwgm8vc.css +1 -0
- package/dist/chunk-ph0h6h86.js +1 -0
- package/dist/chunk-ryg9z3kn.js +10 -0
- package/dist/chunk-tpn177bt.js +2 -0
- package/dist/chunk-vfpsc75k.js +2 -0
- package/dist/{chunk-m1fvqssh.js → chunk-z3byfve5.js} +2 -2
- package/dist/index.html +1 -1
- package/lib/collab/colors.ts +30 -0
- package/lib/collab/protocol.ts +84 -0
- package/lib/collab/types.ts +52 -0
- package/lib/experimental.ts +14 -0
- package/lib/moi-context.ts +11 -3
- package/lib/navigation.ts +25 -5
- package/lib/types.ts +20 -33
- package/package.json +2 -2
- package/server/AGENTS.md +1 -1
- package/server/api.ts +28 -5
- package/server/app-config.ts +127 -34
- package/server/applet-typecheck.ts +8 -3
- package/server/applets/applet-css.ts +1 -1
- package/server/applets/build-applet.ts +9 -3
- package/server/applets/declarations/base.d.ts +75 -0
- package/server/applets/declarations/collab.d.ts +88 -0
- package/server/applets/declarations.ts +46 -0
- package/server/applets/index.ts +8 -8
- package/server/applets/runtime/collab.ts +94 -0
- package/server/applets/runtime/moi.ts +12 -19
- package/server/applets/runtime/rpc.ts +2 -4
- package/server/chat-selection.ts +22 -0
- package/server/cli.ts +86 -21
- package/server/collab/cloudflare-access.ts +78 -0
- package/server/collab/config.ts +18 -0
- package/server/collab/manager.ts +407 -0
- package/server/collab/service.ts +136 -0
- package/server/collab/skill/index.ts +53 -0
- package/server/collab/worker-messages.ts +10 -0
- package/server/collab/worker.ts +52 -0
- package/server/layout.ts +10 -3
- package/server/moi-scaffold.ts +55 -84
- package/server/preview.ts +1 -1
- package/server/skill-update.ts +7 -9
- package/server/skills-template.ts +14 -2
- package/server/web.ts +65 -17
- package/server/workspace-init.ts +6 -3
- package/ui-components/avatar.tsx +24 -11
- package/ui-components/button.tsx +9 -9
- package/ui-components/docs/avatar.md +11 -30
- package/workspace/.claude/skills/moi-workspace/SKILL.md +14 -11
- package/workspace/.claude/skills/moi-workspace/references/COLLAB.md +262 -0
- package/workspace/.claude/skills/moi-workspace/references/INTENTS.md +10 -7
- package/client/assets/mcp/agentation.png +0 -0
- package/dist/agentation-4s0nn45p.png +0 -0
- package/dist/chunk-2gs8jjx4.css +0 -1
- package/dist/chunk-7vvg5fyz.js +0 -68
- package/dist/chunk-94m3q9ce.js +0 -1
- package/dist/chunk-by2wqgak.js +0 -1
- package/dist/chunk-p34hvqt3.js +0 -1
- package/dist/chunk-p83f0jnj.js +0 -2
- package/dist/chunk-xg01f6pn.js +0 -10
- /package/client/features/dev/{UiComponentPreviews.tsx → ui-components/ui-component-previews.tsx} +0 -0
- /package/server/applets/{runtime/base.ts → api-base.ts} +0 -0
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
import { useState, useSyncExternalStore } from 'react'
|
|
2
|
+
|
|
3
|
+
import { IconChevronDown } from '@tabler/icons-react'
|
|
4
|
+
import type { Icon as TabIcon } from '@tabler/icons-react'
|
|
5
|
+
import { useRouter } from 'wouter'
|
|
6
|
+
import { usePathname } from 'wouter/use-browser-location'
|
|
7
|
+
|
|
8
|
+
import { Button } from '@/client/components/ui/button'
|
|
9
|
+
import {
|
|
10
|
+
Popover,
|
|
11
|
+
PopoverContent,
|
|
12
|
+
PopoverTitle,
|
|
13
|
+
PopoverTrigger
|
|
14
|
+
} from '@/client/components/ui/popover'
|
|
15
|
+
import { cn } from '@/client/lib/cn'
|
|
16
|
+
import type { WorkspaceTabId } from '@/lib/types'
|
|
17
|
+
import { tabFromPath } from '@/lib/navigation'
|
|
18
|
+
|
|
19
|
+
import { User } from './components/user'
|
|
20
|
+
import { UserAvatarGroup } from './components/user-avatar-group'
|
|
21
|
+
import { pageFromPath, useCollabEnabled, useCollabEngine } from './provider'
|
|
22
|
+
import { useConnectionState, useWorkspaceUsers, useWorkspaceDirectory } from './hooks'
|
|
23
|
+
import { summarizeWorkspaceUsers } from './users'
|
|
24
|
+
import type { WorkspaceUserInfo } from './users'
|
|
25
|
+
|
|
26
|
+
export type TabInfo = { label: string; Icon: TabIcon }
|
|
27
|
+
type DescribeTab = (tab: WorkspaceTabId) => TabInfo | null
|
|
28
|
+
const USER_STATUS_ORDER = { active: 0, away: 1, offline: 2 }
|
|
29
|
+
|
|
30
|
+
type WorkspaceUsersMenuProps = {
|
|
31
|
+
workspaceId: string
|
|
32
|
+
describeTab: DescribeTab
|
|
33
|
+
onOpenTab: (tab: WorkspaceTabId) => void
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export function WorkspaceUsersMenu({
|
|
37
|
+
workspaceId,
|
|
38
|
+
describeTab,
|
|
39
|
+
onOpenTab
|
|
40
|
+
}: WorkspaceUsersMenuProps) {
|
|
41
|
+
const enabled = useCollabEnabled()
|
|
42
|
+
const engine = useCollabEngine()
|
|
43
|
+
const state = useConnectionState()
|
|
44
|
+
const workspaceUsers = useWorkspaceUsers()
|
|
45
|
+
const directory = useWorkspaceDirectory()
|
|
46
|
+
const currentUser = useSyncExternalStore(
|
|
47
|
+
engine.subscribeCurrentUser,
|
|
48
|
+
engine.getCurrentUser,
|
|
49
|
+
engine.getCurrentUser
|
|
50
|
+
)
|
|
51
|
+
const router = useRouter()
|
|
52
|
+
const page = pageFromPath(usePathname(router), workspaceId, router.base)
|
|
53
|
+
const users = summarizeWorkspaceUsers(state.connections, {
|
|
54
|
+
currentUser,
|
|
55
|
+
connectionId: state.connectionId,
|
|
56
|
+
users: workspaceUsers,
|
|
57
|
+
page
|
|
58
|
+
})
|
|
59
|
+
const avatarIds = users
|
|
60
|
+
.filter(user => user.self || user.status !== 'offline')
|
|
61
|
+
.map(user => user.profile.id)
|
|
62
|
+
const [open, setOpen] = useState(false)
|
|
63
|
+
|
|
64
|
+
if (!enabled) return null
|
|
65
|
+
|
|
66
|
+
return (
|
|
67
|
+
<Popover open={open} onOpenChange={setOpen}>
|
|
68
|
+
<PopoverTrigger
|
|
69
|
+
render={
|
|
70
|
+
<Button
|
|
71
|
+
variant="ghost"
|
|
72
|
+
size="sm"
|
|
73
|
+
aria-label="Users in this workspace"
|
|
74
|
+
className="gap-0.5 rounded-full pr-1 pl-1 data-popup-open:bg-accent"
|
|
75
|
+
/>
|
|
76
|
+
}
|
|
77
|
+
>
|
|
78
|
+
<UserAvatarGroup ids={avatarIds} size="xs" max={4} />
|
|
79
|
+
<IconChevronDown stroke={2.5} className="size-3! text-muted-foreground" />
|
|
80
|
+
</PopoverTrigger>
|
|
81
|
+
<PopoverContent align="end" className="max-w-64 p-1">
|
|
82
|
+
<PopoverTitle className="sr-only">Users in this workspace</PopoverTitle>
|
|
83
|
+
<WorkspaceUsersList
|
|
84
|
+
users={users}
|
|
85
|
+
page={page}
|
|
86
|
+
describeTab={describeTab}
|
|
87
|
+
onOpenTab={tab => {
|
|
88
|
+
setOpen(false)
|
|
89
|
+
onOpenTab(tab)
|
|
90
|
+
}}
|
|
91
|
+
/>
|
|
92
|
+
{directory?.status === 'loading' && (
|
|
93
|
+
<p className="px-2 py-1 text-xs text-muted-foreground">Loading workspace users…</p>
|
|
94
|
+
)}
|
|
95
|
+
{users.length === 0 && directory?.status !== 'loading' && (
|
|
96
|
+
<p className="px-2 py-1 text-xs text-muted-foreground">No workspace users to show.</p>
|
|
97
|
+
)}
|
|
98
|
+
</PopoverContent>
|
|
99
|
+
</Popover>
|
|
100
|
+
)
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
type WorkspaceUsersListProps = {
|
|
104
|
+
users: WorkspaceUserInfo[]
|
|
105
|
+
page: string
|
|
106
|
+
describeTab: DescribeTab
|
|
107
|
+
onOpenTab: (tab: WorkspaceTabId) => void
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
export function WorkspaceUsersList({
|
|
111
|
+
users,
|
|
112
|
+
page,
|
|
113
|
+
describeTab,
|
|
114
|
+
onOpenTab
|
|
115
|
+
}: WorkspaceUsersListProps) {
|
|
116
|
+
const sorted = users.toSorted(
|
|
117
|
+
(a, b) =>
|
|
118
|
+
USER_STATUS_ORDER[a.status] - USER_STATUS_ORDER[b.status] || Number(b.self) - Number(a.self)
|
|
119
|
+
)
|
|
120
|
+
return (
|
|
121
|
+
<ul className="flex max-h-80 scroll-fade flex-col overflow-y-auto">
|
|
122
|
+
{sorted.map(user => (
|
|
123
|
+
<UserRow
|
|
124
|
+
key={user.profile.id}
|
|
125
|
+
user={user}
|
|
126
|
+
page={page}
|
|
127
|
+
describeTab={describeTab}
|
|
128
|
+
onOpenTab={onOpenTab}
|
|
129
|
+
/>
|
|
130
|
+
))}
|
|
131
|
+
</ul>
|
|
132
|
+
)
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
type UserRowProps = Omit<WorkspaceUsersListProps, 'users'> & { user: WorkspaceUserInfo }
|
|
136
|
+
|
|
137
|
+
function UserRow({ user, page, describeTab, onOpenTab }: UserRowProps) {
|
|
138
|
+
const tabs = user.pages.map(candidate => {
|
|
139
|
+
const tab = tabFromPath(candidate)
|
|
140
|
+
return { tab, info: tab ? describeTab(tab) : null }
|
|
141
|
+
})
|
|
142
|
+
const destination =
|
|
143
|
+
user.self || user.status === 'offline'
|
|
144
|
+
? undefined
|
|
145
|
+
: tabs.find(({ tab, info }) => tab !== null && info !== null && tab !== page)
|
|
146
|
+
const target = destination?.tab
|
|
147
|
+
const labels = [
|
|
148
|
+
...new Set(tabs.map(({ tab, info }) => info?.label ?? tab ?? 'Another tab'))
|
|
149
|
+
].join(', ')
|
|
150
|
+
const where =
|
|
151
|
+
user.status === 'offline'
|
|
152
|
+
? 'Offline'
|
|
153
|
+
: user.status === 'away'
|
|
154
|
+
? labels
|
|
155
|
+
? `${labels} · Away`
|
|
156
|
+
: 'Away'
|
|
157
|
+
: labels || 'Another tab'
|
|
158
|
+
const Icon = user.status === 'offline' ? undefined : tabs[0]?.info?.Icon
|
|
159
|
+
const content = (
|
|
160
|
+
<User
|
|
161
|
+
id={user.profile.id}
|
|
162
|
+
className="flex-1"
|
|
163
|
+
size="sm"
|
|
164
|
+
showYouLabel
|
|
165
|
+
description={
|
|
166
|
+
<span className="flex items-center gap-1 text-xs">
|
|
167
|
+
{Icon && <Icon size={12} stroke={1.75} className="shrink-0" />}
|
|
168
|
+
<span className="truncate">{where}</span>
|
|
169
|
+
</span>
|
|
170
|
+
}
|
|
171
|
+
/>
|
|
172
|
+
)
|
|
173
|
+
const row = 'flex w-full items-center gap-2.5 rounded-md px-2 py-1 text-left'
|
|
174
|
+
|
|
175
|
+
return (
|
|
176
|
+
<li>
|
|
177
|
+
{target ? (
|
|
178
|
+
<button
|
|
179
|
+
type="button"
|
|
180
|
+
title={`Go to ${destination?.info?.label}`}
|
|
181
|
+
className={cn(
|
|
182
|
+
row,
|
|
183
|
+
'cursor-pointer outline-none hover:bg-accent focus-visible:ring-3 focus-visible:ring-ring/50'
|
|
184
|
+
)}
|
|
185
|
+
onClick={() => onOpenTab(target)}
|
|
186
|
+
>
|
|
187
|
+
{content}
|
|
188
|
+
</button>
|
|
189
|
+
) : (
|
|
190
|
+
<div className={row}>{content}</div>
|
|
191
|
+
)}
|
|
192
|
+
</li>
|
|
193
|
+
)
|
|
194
|
+
}
|
|
@@ -10,7 +10,6 @@
|
|
|
10
10
|
// that prefix is stripped before lookup so the underlying service resolves.
|
|
11
11
|
// Unknown servers fall back to a generic tabler icon — see
|
|
12
12
|
// `client/components/TurnView.tsx`.
|
|
13
|
-
import agentationIcon from '@/client/assets/mcp/agentation.png'
|
|
14
13
|
import airtableIcon from '@/client/assets/mcp/airtable.png'
|
|
15
14
|
import apolloIcon from '@/client/assets/mcp/apollo.png'
|
|
16
15
|
import asanaIcon from '@/client/assets/mcp/asana.png'
|
|
@@ -63,7 +62,6 @@ import vercelIcon from '@/client/assets/mcp/vercel.png'
|
|
|
63
62
|
import zapierIcon from '@/client/assets/mcp/zapier.png'
|
|
64
63
|
|
|
65
64
|
const ICONS: Record<string, string> = {
|
|
66
|
-
agentation: agentationIcon,
|
|
67
65
|
airtable: airtableIcon,
|
|
68
66
|
apollo: apolloIcon,
|
|
69
67
|
asana: asanaIcon,
|
|
@@ -7,6 +7,11 @@ type DevRouteEntry = {
|
|
|
7
7
|
}
|
|
8
8
|
|
|
9
9
|
const DEV_ROUTES: DevRouteEntry[] = [
|
|
10
|
+
{
|
|
11
|
+
path: '/dev/collab',
|
|
12
|
+
title: 'Collab',
|
|
13
|
+
description: 'Collaboration components, live hook previews, and local user settings.'
|
|
14
|
+
},
|
|
10
15
|
{
|
|
11
16
|
path: '/dev/blobatar-shapes',
|
|
12
17
|
title: 'Blobatar shape builder',
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { lazy, Suspense } from 'react'
|
|
2
|
+
import { Redirect, Route, Switch } from 'wouter'
|
|
2
3
|
|
|
3
4
|
import { ChatStatesPage } from './ChatStatesPage'
|
|
4
5
|
import { BlobatarShapesPage } from './BlobatarShapesPage'
|
|
@@ -6,15 +7,26 @@ import { DevIndexPage } from './DevIndexPage'
|
|
|
6
7
|
import { HarnessDebugPage } from './HarnessDebugPage'
|
|
7
8
|
import { TextureLabPage } from './TextureLabPage'
|
|
8
9
|
import { ToolCallsPage } from './ToolCallsPage'
|
|
9
|
-
import { UiComponentsPage } from './
|
|
10
|
+
import { UiComponentsPage } from './ui-components/ui-components-page'
|
|
10
11
|
|
|
11
|
-
// All /dev/* routes
|
|
12
|
-
// (and its dependencies) lives in this folder and loads as one lazy chunk —
|
|
12
|
+
// All /dev/* routes live with their pages here and load only in development;
|
|
13
13
|
// see the dynamic import in AppRouter. /dev itself is the index; list new
|
|
14
14
|
// routes there too.
|
|
15
|
+
const CollabPage = lazy(() =>
|
|
16
|
+
import('./collab/collab-page').then(module => ({ default: module.CollabPage }))
|
|
17
|
+
)
|
|
18
|
+
|
|
15
19
|
export default function DevRoutes() {
|
|
16
20
|
return (
|
|
17
21
|
<Switch>
|
|
22
|
+
<Route path="/dev/collab-kit">
|
|
23
|
+
<Redirect to="/dev/collab" />
|
|
24
|
+
</Route>
|
|
25
|
+
<Route path="/dev/collab">
|
|
26
|
+
<Suspense fallback={null}>
|
|
27
|
+
<CollabPage />
|
|
28
|
+
</Suspense>
|
|
29
|
+
</Route>
|
|
18
30
|
<Route path="/dev/harness" component={HarnessDebugPage} />
|
|
19
31
|
<Route path="/dev/blobatar-shapes" component={BlobatarShapesPage} />
|
|
20
32
|
<Route path="/dev/chat-states" component={ChatStatesPage} />
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { Link } from 'wouter'
|
|
2
|
+
|
|
3
|
+
import { LocalUserSettings } from './local-user-settings'
|
|
4
|
+
import { CollabPlayground } from './collab-playground'
|
|
5
|
+
|
|
6
|
+
export function CollabPage() {
|
|
7
|
+
return (
|
|
8
|
+
<main className="mx-auto flex w-full max-w-6xl flex-col gap-10 px-6 py-10">
|
|
9
|
+
<div>
|
|
10
|
+
<Link href="/dev" className="text-sm text-muted-foreground hover:text-foreground">
|
|
11
|
+
← Dev pages
|
|
12
|
+
</Link>
|
|
13
|
+
<header className="mt-5">
|
|
14
|
+
<h1 className="text-xl font-medium">Collab</h1>
|
|
15
|
+
<p className="mt-1 text-sm text-muted-foreground">
|
|
16
|
+
Try collaboration components and hooks, and edit your local user for workspace testing.
|
|
17
|
+
</p>
|
|
18
|
+
</header>
|
|
19
|
+
</div>
|
|
20
|
+
<LocalUserSettings />
|
|
21
|
+
<CollabPlayground />
|
|
22
|
+
</main>
|
|
23
|
+
)
|
|
24
|
+
}
|