moi-computer 0.13.0 → 0.13.1-next.1
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 +0 -1
- package/client/api/query-client.ts +5 -0
- package/client/app/app-router.tsx +1 -1
- package/client/app/routes/workspace-route.tsx +5 -6
- package/client/features/account/account-provider.tsx +28 -77
- package/client/features/account/account-test-utils.tsx +103 -93
- package/client/features/account/api.ts +36 -111
- package/client/features/account/profile-actions.ts +31 -0
- 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 +0 -4
- package/client/features/chat/applet-chat-intents.ts +4 -4
- package/client/features/chat/sessions/api.ts +5 -5
- package/client/features/chat/sessions/use-selected-session.ts +3 -3
- package/client/features/chat/use-chat.ts +4 -4
- 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/host-state.ts +45 -85
- package/client/features/collab/index.ts +3 -3
- package/client/features/collab/members/api.ts +23 -0
- package/client/features/collab/members/hooks.ts +103 -0
- package/client/features/collab/members/keys.ts +6 -0
- package/client/features/collab/members/store.ts +123 -0
- package/client/features/collab/members/types.ts +53 -0
- package/client/features/collab/{client.ts → presence/client.ts} +38 -13
- package/client/features/collab/{hooks.tsx → presence/hooks.tsx} +9 -8
- package/client/features/collab/{provider.tsx → presence/provider.tsx} +1 -12
- package/client/features/collab/{users.ts → presence/users.ts} +19 -33
- package/client/features/collab/sharing/agent-invite.tsx +30 -0
- package/client/features/collab/sharing/workspace-members.tsx +277 -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 +15 -3
- package/client/features/dev/collab/collab-playground.tsx +2 -2
- package/client/features/dev/workspace-setup-mocks.ts +0 -1
- package/client/features/identity/host-api.ts +34 -0
- package/client/features/identity/store.ts +32 -0
- package/client/features/identity/types.ts +41 -0
- package/client/features/identity/use-identity.ts +6 -0
- package/client/features/views/use-view-actions.ts +3 -3
- package/client/features/workspace/browser-tab-state.ts +6 -6
- package/client/features/workspace/workspace-content.tsx +10 -6
- package/client/index.html +1 -1
- package/client/index.tsx +5 -9
- package/client/main.tsx +2 -2
- package/dist/{chunk-cqt3s31j.js → chunk-3smkkcfw.js} +86 -86
- package/dist/chunk-47h9c2qy.js +2 -0
- package/dist/chunk-8qed2gqp.js +75 -0
- package/dist/{chunk-bncc7heg.js → chunk-8zy3vesm.js} +1 -1
- package/dist/chunk-a47zy276.js +2 -0
- package/dist/chunk-g4c1nte9.css +1 -0
- package/dist/chunk-kcactdr4.js +2 -0
- package/dist/chunk-m8bhx6tw.js +1 -0
- package/dist/{chunk-58dyt9bk.js → chunk-pf19zcrn.js} +2 -2
- package/dist/{chunk-2y59vrxg.js → chunk-th91xfnp.js} +1 -1
- package/dist/chunk-ygzxah0e.js +1 -0
- package/dist/index.html +2 -2
- package/lib/types.ts +0 -1
- package/package.json +5 -4
- package/server/app-config.ts +2 -5
- package/server/applets/declarations.ts +6 -7
- package/server/cli/commands/init.ts +0 -11
- package/server/collab/config.ts +1 -5
- package/server/collab/manager.ts +5 -2
- package/server/collab/skill/index.ts +1 -47
- package/server/skills/template.ts +3 -2
- package/server/skills/update.ts +1 -1
- package/server/skills/workspace.ts +0 -2
- package/server/web.ts +1 -2
- package/server/workspaces/scaffold.ts +1 -0
- package/skill/SKILL.md +1 -1
- package/client/features/account/identity.ts +0 -23
- package/client/features/app-settings/users-settings.tsx +0 -195
- package/client/features/collab/workspace-users-menu.tsx +0 -190
- package/dist/chunk-dcmks9sm.js +0 -75
- package/dist/chunk-md45evr2.css +0 -1
- package/dist/chunk-n0nab26d.js +0 -1
- package/dist/chunk-nmzhgyp9.js +0 -2
- package/dist/chunk-q37knr3m.js +0 -2
- package/dist/chunk-s90m4qkz.js +0 -1
- package/dist/chunk-wjvd4byz.js +0 -2
- /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
|
@@ -1,190 +0,0 @@
|
|
|
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/workspace-tabs'
|
|
18
|
-
|
|
19
|
-
import { UserContainer } from './components/user'
|
|
20
|
-
import { UserAvatarGroupContainer as UserAvatarGroup } from './components/user-avatar-group'
|
|
21
|
-
import { pageFromPath, useCollabEnabled, useCollabEngine } from './provider'
|
|
22
|
-
import { useConnectionState, useWorkspaceUsers } 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 currentUser = useSyncExternalStore(
|
|
46
|
-
engine.subscribeCurrentUser,
|
|
47
|
-
engine.getCurrentUser,
|
|
48
|
-
engine.getCurrentUser
|
|
49
|
-
)
|
|
50
|
-
const router = useRouter()
|
|
51
|
-
const page = pageFromPath(usePathname(router), workspaceId, router.base)
|
|
52
|
-
const users = summarizeWorkspaceUsers(state.connections, {
|
|
53
|
-
currentUser,
|
|
54
|
-
connectionId: state.connectionId,
|
|
55
|
-
users: workspaceUsers,
|
|
56
|
-
page
|
|
57
|
-
})
|
|
58
|
-
const avatarIds = users
|
|
59
|
-
.filter(user => user.self || user.status !== 'offline')
|
|
60
|
-
.map(user => user.profile.id)
|
|
61
|
-
const [open, setOpen] = useState(false)
|
|
62
|
-
|
|
63
|
-
if (!enabled || workspaceUsers.length <= 1) return null
|
|
64
|
-
|
|
65
|
-
return (
|
|
66
|
-
<Popover open={open} onOpenChange={setOpen}>
|
|
67
|
-
<PopoverTrigger
|
|
68
|
-
render={
|
|
69
|
-
<Button
|
|
70
|
-
variant="ghost"
|
|
71
|
-
size="sm"
|
|
72
|
-
aria-label="Users in this workspace"
|
|
73
|
-
className="gap-0.5 rounded-full pr-1 pl-1 data-popup-open:bg-accent"
|
|
74
|
-
/>
|
|
75
|
-
}
|
|
76
|
-
>
|
|
77
|
-
<UserAvatarGroup ids={avatarIds} size="xs" max={4} />
|
|
78
|
-
<IconChevronDown stroke={2.5} className="size-3! text-muted-foreground" />
|
|
79
|
-
</PopoverTrigger>
|
|
80
|
-
<PopoverContent align="end" className="max-w-64 p-1">
|
|
81
|
-
<PopoverTitle className="sr-only">Users in this workspace</PopoverTitle>
|
|
82
|
-
<WorkspaceUsersList
|
|
83
|
-
users={users}
|
|
84
|
-
page={page}
|
|
85
|
-
describeTab={describeTab}
|
|
86
|
-
onOpenTab={tab => {
|
|
87
|
-
setOpen(false)
|
|
88
|
-
onOpenTab(tab)
|
|
89
|
-
}}
|
|
90
|
-
/>
|
|
91
|
-
{users.length === 0 && (
|
|
92
|
-
<p className="px-2 py-1 text-xs text-muted-foreground">No workspace users to show.</p>
|
|
93
|
-
)}
|
|
94
|
-
</PopoverContent>
|
|
95
|
-
</Popover>
|
|
96
|
-
)
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
type WorkspaceUsersListProps = {
|
|
100
|
-
users: WorkspaceUserInfo[]
|
|
101
|
-
page: string
|
|
102
|
-
describeTab: DescribeTab
|
|
103
|
-
onOpenTab: (tab: WorkspaceTabId) => void
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
export function WorkspaceUsersList({
|
|
107
|
-
users,
|
|
108
|
-
page,
|
|
109
|
-
describeTab,
|
|
110
|
-
onOpenTab
|
|
111
|
-
}: WorkspaceUsersListProps) {
|
|
112
|
-
const sorted = users.toSorted(
|
|
113
|
-
(a, b) =>
|
|
114
|
-
USER_STATUS_ORDER[a.status] - USER_STATUS_ORDER[b.status] || Number(b.self) - Number(a.self)
|
|
115
|
-
)
|
|
116
|
-
return (
|
|
117
|
-
<ul className="flex max-h-80 scroll-fade flex-col overflow-y-auto">
|
|
118
|
-
{sorted.map(user => (
|
|
119
|
-
<UserRow
|
|
120
|
-
key={user.profile.id}
|
|
121
|
-
user={user}
|
|
122
|
-
page={page}
|
|
123
|
-
describeTab={describeTab}
|
|
124
|
-
onOpenTab={onOpenTab}
|
|
125
|
-
/>
|
|
126
|
-
))}
|
|
127
|
-
</ul>
|
|
128
|
-
)
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
type UserRowProps = Omit<WorkspaceUsersListProps, 'users'> & { user: WorkspaceUserInfo }
|
|
132
|
-
|
|
133
|
-
function UserRow({ user, page, describeTab, onOpenTab }: UserRowProps) {
|
|
134
|
-
const tabs = user.pages.map(candidate => {
|
|
135
|
-
const tab = tabFromPath(candidate)
|
|
136
|
-
return { tab, info: tab ? describeTab(tab) : null }
|
|
137
|
-
})
|
|
138
|
-
const destination =
|
|
139
|
-
user.self || user.status === 'offline'
|
|
140
|
-
? undefined
|
|
141
|
-
: tabs.find(({ tab, info }) => tab !== null && info !== null && tab !== page)
|
|
142
|
-
const target = destination?.tab
|
|
143
|
-
const labels = [
|
|
144
|
-
...new Set(tabs.map(({ tab, info }) => info?.label ?? tab ?? 'Another tab'))
|
|
145
|
-
].join(', ')
|
|
146
|
-
const where =
|
|
147
|
-
user.status === 'offline'
|
|
148
|
-
? 'Offline'
|
|
149
|
-
: user.status === 'away'
|
|
150
|
-
? labels
|
|
151
|
-
? `${labels} · Away`
|
|
152
|
-
: 'Away'
|
|
153
|
-
: labels || 'Another tab'
|
|
154
|
-
const Icon = user.status === 'offline' ? undefined : tabs[0]?.info?.Icon
|
|
155
|
-
const content = (
|
|
156
|
-
<UserContainer
|
|
157
|
-
id={user.profile.id}
|
|
158
|
-
className="flex-1"
|
|
159
|
-
size="sm"
|
|
160
|
-
showYouLabel
|
|
161
|
-
description={
|
|
162
|
-
<span className="flex items-center gap-1 text-xs">
|
|
163
|
-
{Icon && <Icon size={12} stroke={1.75} className="shrink-0" />}
|
|
164
|
-
<span className="truncate">{where}</span>
|
|
165
|
-
</span>
|
|
166
|
-
}
|
|
167
|
-
/>
|
|
168
|
-
)
|
|
169
|
-
const row = 'flex w-full items-center gap-2.5 rounded-md px-2 py-1 text-left'
|
|
170
|
-
|
|
171
|
-
return (
|
|
172
|
-
<li>
|
|
173
|
-
{target ? (
|
|
174
|
-
<button
|
|
175
|
-
type="button"
|
|
176
|
-
title={`Go to ${destination?.info?.label}`}
|
|
177
|
-
className={cn(
|
|
178
|
-
row,
|
|
179
|
-
'cursor-pointer outline-none hover:bg-accent focus-visible:ring-3 focus-visible:ring-ring/50'
|
|
180
|
-
)}
|
|
181
|
-
onClick={() => onOpenTab(target)}
|
|
182
|
-
>
|
|
183
|
-
{content}
|
|
184
|
-
</button>
|
|
185
|
-
) : (
|
|
186
|
-
<div className={row}>{content}</div>
|
|
187
|
-
)}
|
|
188
|
-
</li>
|
|
189
|
-
)
|
|
190
|
-
}
|