moi-computer 0.12.1-next.4 → 0.13.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.
Files changed (35) hide show
  1. package/client/features/chat/messages/tool-group/subagent-card.tsx +1 -0
  2. package/client/features/collab/components/user-avatar.tsx +4 -10
  3. package/client/features/connectors/api.ts +12 -4
  4. package/client/features/connectors/mcp-server-cards.tsx +17 -7
  5. package/client/features/connectors/read-connectors.ts +35 -0
  6. package/client/features/dev/collab/local-user-settings.tsx +1 -1
  7. package/client/features/workspace/harness-transition.ts +1 -0
  8. package/client/features/workspace/settings/connectors-settings.tsx +31 -10
  9. package/client/features/workspace/settings/general-settings.tsx +17 -14
  10. package/dist/{chunk-g0tcwqxc.js → chunk-bncc7heg.js} +1 -1
  11. package/dist/{chunk-71fn6rmj.js → chunk-cqt3s31j.js} +23 -23
  12. package/dist/{chunk-v88n1bay.js → chunk-dcmks9sm.js} +43 -42
  13. package/dist/chunk-md45evr2.css +1 -0
  14. package/dist/{chunk-0mjzg20x.js → chunk-nmzhgyp9.js} +2 -2
  15. package/dist/chunk-q37knr3m.js +2 -0
  16. package/dist/chunk-s90m4qkz.js +1 -0
  17. package/dist/{chunk-7yg1m8hx.js → chunk-wjvd4byz.js} +2 -2
  18. package/dist/index.html +1 -1
  19. package/lib/types.ts +4 -2
  20. package/package.json +3 -1
  21. package/server/api/index.ts +26 -1
  22. package/server/harness/claude-code/index.ts +3 -6
  23. package/server/harness/claude-code/mcp.ts +17 -0
  24. package/server/harness/codex/NOTES.md +9 -2
  25. package/server/harness/codex/client.ts +8 -5
  26. package/server/harness/codex/connectors.ts +92 -0
  27. package/server/harness/codex/index.ts +2 -1
  28. package/server/harness/codex/pagination.ts +8 -5
  29. package/server/harness/codex/transport.ts +13 -6
  30. package/server/harness/types.ts +4 -1
  31. package/server/onboarding/prompt.md +2 -2
  32. package/skill/references/DESIGN.md +22 -3
  33. package/dist/chunk-5aj040e5.css +0 -1
  34. package/dist/chunk-825hys3h.js +0 -1
  35. package/dist/chunk-9bb8m9rx.js +0 -2
@@ -24,6 +24,7 @@ const SPORT_ICONS = [IconPlayBasketball, IconPlayVolleyball, IconPlayFootball]
24
24
  function RunningSportNode() {
25
25
  const [i, setI] = useState(0)
26
26
  useEffect(() => {
27
+ if (window.matchMedia?.('(prefers-reduced-motion: reduce)').matches) return
27
28
  const t = setInterval(() => setI(n => (n + 1) % SPORT_ICONS.length), 600)
28
29
  return () => clearInterval(t)
29
30
  }, [])
@@ -40,12 +40,7 @@ export function UserAvatar({
40
40
  const name = user ? userDisplayName(user) : 'Unknown user'
41
41
 
42
42
  return (
43
- <Avatar
44
- size={size}
45
- aria-label={name}
46
- data-collab-color={user?.color ?? 'unknown'}
47
- className={cn('after:border-0', className)}
48
- >
43
+ <Avatar size={size} aria-label={name} className={cn('after:border-0', className)}>
49
44
  {user?.avatar && <AvatarImage src={user.avatar} alt="" />}
50
45
  <AvatarFallback>
51
46
  {user ? (
@@ -54,11 +49,10 @@ export function UserAvatar({
54
49
  name={user.id}
55
50
  animate="hover"
56
51
  background="circle"
57
- traits={{ 'eye.rx': 1 }}
58
52
  palette={{
59
- bg: 'var(--collab)',
60
- head: 'var(--collab)',
61
- eye: 'var(--collab-foreground)'
53
+ bg: 'color-mix(in srgb, var(--muted) 85%, var(--foreground))',
54
+ head: 'color-mix(in srgb, var(--muted) 85%, var(--foreground))',
55
+ eye: 'var(--foreground)'
62
56
  }}
63
57
  />
64
58
  ) : (
@@ -1,17 +1,25 @@
1
- import { useQuery } from '@tanstack/react-query'
1
+ import { useQuery, useQueryClient } from '@tanstack/react-query'
2
2
 
3
- import { requestJson } from '@/client/api/http'
3
+ import { readConnectors } from './read-connectors'
4
4
  import { workspaceKeys } from '@/client/api/workspace-keys'
5
5
  import type { McpServer } from '@/lib/types'
6
6
 
7
7
  export function useWorkspaceMcp(workspaceId: string, enabled: boolean) {
8
+ const queryClient = useQueryClient()
8
9
  return useQuery<McpServer[]>({
9
10
  queryKey: workspaceKeys.mcp(workspaceId),
10
- queryFn: () => requestJson(`/api/workspaces/${workspaceId}/mcp`),
11
+ queryFn: async ({ signal }) =>
12
+ readConnectors(
13
+ await fetch(`/api/workspaces/${workspaceId}/mcp?stream=true`, { signal }),
14
+ connectors => {
15
+ if (!signal.aborted) queryClient.setQueryData(workspaceKeys.mcp(workspaceId), connectors)
16
+ }
17
+ ),
18
+ retry: false,
11
19
  enabled,
12
20
  staleTime: Infinity,
13
21
  gcTime: Infinity,
14
- refetchOnMount: false,
22
+ refetchOnMount: 'always',
15
23
  refetchOnWindowFocus: false
16
24
  })
17
25
  }
@@ -1,4 +1,4 @@
1
- import type { ReactNode } from 'react'
1
+ import { useState, type ReactNode } from 'react'
2
2
 
3
3
  import { IconAlertCircleFilled } from '@tabler/icons-react'
4
4
 
@@ -15,16 +15,18 @@ function statusLabel(status: McpServer['status']): string {
15
15
  type McpServerIconProps = {
16
16
  name: string
17
17
  status: McpServer['status']
18
+ iconUrl?: string
18
19
  }
19
20
 
20
- function McpServerIcon({ name, status }: McpServerIconProps) {
21
- const icon = getMcpIcon(name)
21
+ function McpServerIcon({ name, status, iconUrl }: McpServerIconProps) {
22
+ const [failedIcon, setFailedIcon] = useState<string>()
23
+ const icon = iconUrl ?? getMcpIcon(name)
22
24
  const className = 'size-full rounded-lg ring-2 ring-background'
23
25
 
24
26
  return (
25
27
  <span className="relative size-10 shrink-0">
26
- {icon ? (
27
- <img src={icon} alt="" className={className} />
28
+ {icon && icon !== failedIcon ? (
29
+ <img src={icon} alt="" className={className} onError={() => setFailedIcon(icon)} />
28
30
  ) : (
29
31
  <span className="flex size-full items-center justify-center rounded-lg bg-muted text-muted-foreground ring-2 ring-background">
30
32
  <IconMcp className="size-5" />
@@ -68,9 +70,17 @@ function McpServerCardLayout({ icon, children }: McpServerCardLayoutProps) {
68
70
 
69
71
  export function McpServerCard({ server }: McpServerCardProps) {
70
72
  return (
71
- <McpServerCardLayout icon={<McpServerIcon name={server.name} status={server.status} />}>
73
+ <McpServerCardLayout
74
+ icon={
75
+ <McpServerIcon
76
+ name={server.displayName ?? server.name}
77
+ status={server.status}
78
+ iconUrl={server.iconUrl}
79
+ />
80
+ }
81
+ >
72
82
  <div className="truncate text-sm font-medium text-foreground">
73
- {formatMcpServerName(server.name)}
83
+ {server.displayName ?? formatMcpServerName(server.name)}
74
84
  </div>
75
85
  <span className="text-sm text-muted-foreground">{statusLabel(server.status)}</span>
76
86
  </McpServerCardLayout>
@@ -0,0 +1,35 @@
1
+ import type { McpServer } from '@/lib/types'
2
+
3
+ export async function readConnectors(
4
+ response: Response,
5
+ onProgress: (connectors: McpServer[]) => void
6
+ ): Promise<McpServer[]> {
7
+ if (!response.ok || !response.body) throw new Error('Could not load connectors')
8
+ const reader = response.body.pipeThrough(new TextDecoderStream()).getReader()
9
+ let buffer = ''
10
+ try {
11
+ while (true) {
12
+ const chunk = await reader.read()
13
+ if (chunk.done) throw new Error('Connector discovery ended before completion')
14
+ buffer += chunk.value
15
+ let newline: number
16
+ while ((newline = buffer.indexOf('\n')) !== -1) {
17
+ const line = buffer.slice(0, newline)
18
+ buffer = buffer.slice(newline + 1)
19
+ if (!line.trim()) continue
20
+ const frame = JSON.parse(line) as {
21
+ connectors?: McpServer[]
22
+ done?: boolean
23
+ error?: string
24
+ }
25
+ if (frame.error) throw new Error(frame.error)
26
+ if (!frame.connectors) continue
27
+ if (frame.done) return frame.connectors
28
+ onProgress(frame.connectors)
29
+ }
30
+ }
31
+ } finally {
32
+ await reader.cancel().catch(() => {})
33
+ reader.releaseLock()
34
+ }
35
+ }
@@ -65,7 +65,7 @@ function LocalUserEditor({ profile }: LocalUserEditorProps) {
65
65
  Local user
66
66
  </h2>
67
67
  <p className="mt-1 text-sm text-muted-foreground">
68
- Change your avatar color here. Edit your name in Settings.
68
+ Change your collaboration color here. Edit your name in Settings.
69
69
  </p>
70
70
  </header>
71
71
  <div className="flex flex-col gap-5">
@@ -39,6 +39,7 @@ export async function receiveWorkspaceHarness(
39
39
  await queryClient.cancelQueries(affected)
40
40
  // Discard the old provider snapshot before rendering the new harness status.
41
41
  void queryClient.resetQueries({ queryKey: workspaceKeys.harness(id), exact: true })
42
+ void queryClient.resetQueries({ queryKey: workspaceKeys.mcp(id), exact: true })
42
43
  queryClient.setQueryData<WorkspaceLayoutResponse>(workspaceKeys.layout(id), previous =>
43
44
  previous
44
45
  ? {
@@ -33,7 +33,7 @@ function ConnectorsContent({ connectors }: ConnectorsContentProps) {
33
33
  )
34
34
  }
35
35
 
36
- if (connectors.isError) {
36
+ if (connectors.isError && !connectors.data?.length) {
37
37
  return (
38
38
  <ConnectorsState>
39
39
  <p className="text-sm text-muted-foreground">Could not load connectors</p>
@@ -44,7 +44,7 @@ function ConnectorsContent({ connectors }: ConnectorsContentProps) {
44
44
  )
45
45
  }
46
46
 
47
- if (connectors.data.length === 0) {
47
+ if (connectors.data.length === 0 && !connectors.isFetching) {
48
48
  return (
49
49
  <ConnectorsState>
50
50
  <IconPlugConnected size={24} stroke={1.5} className="text-muted-foreground" />
@@ -54,11 +54,26 @@ function ConnectorsContent({ connectors }: ConnectorsContentProps) {
54
54
  }
55
55
 
56
56
  return (
57
- <McpServerGrid>
58
- {sortMcpServers(connectors.data).map(connector => (
59
- <McpServerCard key={connector.name} server={connector} />
60
- ))}
61
- </McpServerGrid>
57
+ <>
58
+ <McpServerGrid>
59
+ {sortMcpServers(connectors.data).map(connector => (
60
+ <McpServerCard key={connector.name} server={connector} />
61
+ ))}
62
+ </McpServerGrid>
63
+ {connectors.isFetching && (
64
+ <p role="status" className="text-sm text-muted-foreground">
65
+ Loading connectors…
66
+ </p>
67
+ )}
68
+ {connectors.isError && (
69
+ <ConnectorsState>
70
+ <p className="text-sm text-muted-foreground">Couldn’t load all connectors</p>
71
+ <Button variant="outline" size="sm" onClick={() => connectors.refetch()}>
72
+ Retry
73
+ </Button>
74
+ </ConnectorsState>
75
+ )}
76
+ </>
62
77
  )
63
78
  }
64
79
 
@@ -68,20 +83,26 @@ type ConnectorsStateProps = {
68
83
 
69
84
  function ConnectorsState({ children }: ConnectorsStateProps) {
70
85
  return (
71
- <div className="flex min-h-48 flex-col items-center justify-center gap-3 rounded-xl border border-dashed border-border px-8 py-12 text-center">
86
+ <div className="flex min-h-48 flex-col items-center justify-center gap-3 px-8 py-12 text-center">
72
87
  {children}
73
88
  </div>
74
89
  )
75
90
  }
76
91
 
77
92
  export function ConnectorsSettings() {
78
- const { workspaceId } = useWorkspaceLayoutCtx()
93
+ const { workspaceId, provider } = useWorkspaceLayoutCtx()
79
94
  const connectors = useWorkspaceMcp(workspaceId, true)
80
95
 
81
96
  return (
82
97
  <SettingsPage
83
98
  title="Connectors"
84
- description="Connectors available to the agent in this workspace"
99
+ description={
100
+ provider === 'codex'
101
+ ? 'Manage your connectors in the ChatGPT app'
102
+ : provider === 'claude-code'
103
+ ? 'Manage your connectors in the Claude app'
104
+ : 'Manage your connectors in your agent’s settings'
105
+ }
85
106
  >
86
107
  <ConnectorsContent connectors={connectors} />
87
108
  </SettingsPage>
@@ -32,7 +32,7 @@ import { useChangeWorkspaceHarness } from '@/client/features/workspace/api'
32
32
  import { SettingsPage, SettingsRow, SettingsSection } from './settings-layout'
33
33
 
34
34
  export function GeneralSettings() {
35
- const { demo } = useAppConfig()
35
+ const { demo, environment } = useAppConfig()
36
36
  const { name, cwd, workspaceId } = useWorkspaceLayoutCtx()
37
37
  const [, navigate] = useLocation()
38
38
  const removeWorkspace = useRemoveWorkspace()
@@ -45,18 +45,20 @@ export function GeneralSettings() {
45
45
  return (
46
46
  <SettingsPage title="General" description="Basic details for this space">
47
47
  <SettingsSection>
48
- <SettingsRow
49
- title="Path"
50
- control={
51
- <Input
52
- value={cwd ?? ''}
53
- aria-label="Workspace path"
54
- title={cwd ?? undefined}
55
- className="w-56"
56
- readOnly
57
- />
58
- }
59
- />
48
+ {environment === 'local' && (
49
+ <SettingsRow
50
+ title="Path"
51
+ control={
52
+ <Input
53
+ value={cwd ?? ''}
54
+ aria-label="Workspace path"
55
+ title={cwd ?? undefined}
56
+ className="w-56"
57
+ readOnly
58
+ />
59
+ }
60
+ />
61
+ )}
60
62
  <WorkspaceHarnessSetting />
61
63
  </SettingsSection>
62
64
 
@@ -64,7 +66,7 @@ export function GeneralSettings() {
64
66
  <SettingsSection label="Danger zone">
65
67
  <SettingsRow
66
68
  title="Remove space"
67
- description="Remove this space from Moi. Its folder and sessions stay on disk."
69
+ description="Removes this space from Moi, its folder and chats stay on disk"
68
70
  control={
69
71
  <AlertDialog>
70
72
  <AlertDialogTrigger
@@ -135,6 +137,7 @@ function WorkspaceHarnessSetting() {
135
137
  <>
136
138
  <SettingsRow
137
139
  title="Agent"
140
+ description="Changing the agent changes which chats you see in this space"
138
141
  control={
139
142
  <Tooltip disabled={!reason}>
140
143
  <TooltipTrigger render={<span tabIndex={reason ? 0 : undefined} aria-label={reason} />}>
@@ -1 +1 @@
1
- import{Be}from"/chunk-0mjzg20x.js";import{p}from"/chunk-58dyt9bk.js";async function r(){try{let e=await p("/api/proxy-user");if(!e||typeof e!=="object"||Array.isArray(e)||e.provider!==void 0&&e.provider!=="cloudflare-access"||e.provider===void 0&&e.profile!==void 0)return;return Be(e),e}catch{}}async function n(){return r()}export{n as loadProxyUser};
1
+ import{Be}from"/chunk-nmzhgyp9.js";import{p}from"/chunk-58dyt9bk.js";async function r(){try{let e=await p("/api/proxy-user");if(!e||typeof e!=="object"||Array.isArray(e)||e.provider!==void 0&&e.provider!=="cloudflare-access"||e.provider===void 0&&e.profile!==void 0)return;return Be(e),e}catch{}}async function n(){return r()}export{n as loadProxyUser};