moi-computer 0.3.1-next.0 → 0.3.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.
Files changed (92) hide show
  1. package/client/api/workspace-keys.ts +2 -2
  2. package/client/app/AppRouter.tsx +0 -2
  3. package/client/app/shell/SidebarLayout.tsx +3 -16
  4. package/client/assets/openai.svg +1 -3
  5. package/client/components/shared/Composer.tsx +53 -2
  6. package/client/components/ui/button.tsx +1 -1
  7. package/client/components/ui/tooltip.tsx +12 -15
  8. package/client/features/chat/ChatComposer.tsx +25 -15
  9. package/client/features/chat/ChatPanel.tsx +5 -2
  10. package/client/features/chat/MarkdownContent.tsx +20 -2
  11. package/client/features/chat/ModelPicker.tsx +5 -3
  12. package/client/features/chat/TurnView.tsx +2 -2
  13. package/client/features/chat/chat-frames.ts +13 -6
  14. package/client/features/chat/chat-send.ts +1 -1
  15. package/client/features/chat/chat-store.ts +22 -17
  16. package/client/features/chat/tool-group/ToolOutput.tsx +4 -12
  17. package/client/features/chat/tool-group/format.ts +0 -6
  18. package/client/features/chat/useChat.ts +11 -2
  19. package/client/features/connectors/McpServerCards.tsx +95 -0
  20. package/client/features/connectors/api.ts +0 -11
  21. package/client/features/home/HomePage.tsx +33 -28
  22. package/client/features/home/api.ts +24 -12
  23. package/client/features/home/workspace-presentation.tsx +17 -15
  24. package/client/features/home/workspace-setup/CreateWorkspaceDialog.tsx +243 -0
  25. package/client/features/home/workspace-setup/ImportWorkspaceDialog.tsx +95 -0
  26. package/client/features/home/workspace-setup/WorkspaceAgentStep.tsx +230 -0
  27. package/client/features/home/workspace-setup/WorkspaceDialogContent.tsx +35 -0
  28. package/client/features/home/workspace-setup/useWorkspaceImport.ts +61 -0
  29. package/client/features/settings/ConnectorsSettings.tsx +89 -0
  30. package/client/features/settings/SettingsLayout.tsx +2 -2
  31. package/client/features/settings/WorkspaceSettings.tsx +8 -4
  32. package/client/features/views/ViewBuilderTab.tsx +19 -15
  33. package/client/features/views/useViewBuilderActions.ts +1 -1
  34. package/client/features/workspace/WorkspaceLayoutContext.tsx +3 -4
  35. package/client/features/workspace/WorkspaceScreen.tsx +11 -3
  36. package/client/features/workspace/api.ts +19 -1
  37. package/client/features/workspace/moi-context.ts +85 -0
  38. package/client/main.tsx +7 -4
  39. package/dist/{chunk-cs8vbert.js → chunk-1dfbr7n2.js} +2 -2
  40. package/dist/chunk-339jds4x.js +15 -0
  41. package/dist/chunk-3xsvsnhr.css +1 -0
  42. package/dist/{chunk-zpxrb1ce.js → chunk-anqmsbjt.js} +2 -2
  43. package/dist/chunk-hbvfb6sk.js +63 -0
  44. package/dist/{chunk-kxmvv1ax.js → chunk-qwm5f6qk.js} +1 -1
  45. package/dist/{chunk-axszxe4c.js → chunk-sxbfh73c.js} +1 -1
  46. package/dist/chunk-yp4srgqt.js +10 -0
  47. package/dist/index.html +1 -1
  48. package/dist/openai-ep9ht2pq.svg +1 -0
  49. package/lib/ids.ts +15 -0
  50. package/lib/moi-context.ts +170 -0
  51. package/lib/types.ts +29 -11
  52. package/lib/view-builder-directives.ts +16 -0
  53. package/lib/workspace-types.ts +12 -0
  54. package/package.json +2 -1
  55. package/server/api.ts +92 -30
  56. package/server/harness/README.md +25 -9
  57. package/server/harness/claude-code/NOTES.md +20 -6
  58. package/server/harness/claude-code/adapter.ts +2 -2
  59. package/server/harness/claude-code/git-worktree.ts +32 -0
  60. package/server/harness/claude-code/index.ts +32 -12
  61. package/server/harness/claude-code/mcp.ts +16 -65
  62. package/server/harness/claude-code/models.ts +3 -0
  63. package/server/harness/claude-code/session.ts +196 -61
  64. package/server/harness/codex/NOTES.md +41 -11
  65. package/server/harness/codex/adapter.ts +21 -7
  66. package/server/harness/codex/client.ts +33 -17
  67. package/server/harness/codex/discovery.ts +114 -0
  68. package/server/harness/codex/index.ts +9 -5
  69. package/server/harness/codex/probe.ts +4 -2
  70. package/server/harness/codex/session.ts +57 -5
  71. package/server/harness/executable.ts +82 -0
  72. package/server/harness/openclaw/adapter.ts +8 -1
  73. package/server/harness/openclaw/index.ts +8 -14
  74. package/server/harness/openclaw/session.ts +50 -10
  75. package/server/harness/openclaw/strip.ts +2 -2
  76. package/server/harness/shell-path.ts +79 -0
  77. package/server/harness/types.ts +22 -5
  78. package/server/registry.ts +57 -12
  79. package/server/view-builders.ts +3 -2
  80. package/server/web.ts +24 -8
  81. package/server/workspace-import.ts +45 -0
  82. package/workspace/.claude/skills/moi-workspace/SKILL.md +3 -3
  83. package/client/features/connectors/ConnectorsPage.tsx +0 -92
  84. package/client/features/connectors/McpMenu.tsx +0 -145
  85. package/client/features/home/CreateWorkspaceDialog.tsx +0 -130
  86. package/client/features/home/CreateWorkspaceDialogSteps.tsx +0 -234
  87. package/dist/chunk-4vf1t6v1.js +0 -10
  88. package/dist/chunk-b3ynfk4g.js +0 -62
  89. package/dist/chunk-b4b276wx.js +0 -15
  90. package/dist/chunk-npwq6jmr.css +0 -1
  91. package/dist/openai-h13pza4b.svg +0 -3
  92. package/lib/view-builder-meta.ts +0 -35
@@ -0,0 +1,95 @@
1
+ import { useState } from 'react'
2
+
3
+ import { Button } from '@/client/components/ui/button'
4
+ import { Dialog } from '@/client/components/ui/dialog'
5
+ import { workspaceDisplayName } from '@/client/features/home/workspace-presentation'
6
+ import type { HarnessAvailability, WorkspaceType } from '@/lib/types'
7
+
8
+ import { WorkspaceAgentStep } from './WorkspaceAgentStep'
9
+ import { WorkspaceDialogContent } from './WorkspaceDialogContent'
10
+ import type { WorkspaceImportChoice } from './useWorkspaceImport'
11
+
12
+ type ImportWorkspaceStepProps = {
13
+ choice: WorkspaceImportChoice
14
+ availability?: Partial<Record<WorkspaceType, HarnessAvailability>>
15
+ isPending: boolean
16
+ errorMessage?: string
17
+ onTypeChange: (type: WorkspaceType) => void
18
+ onCancel: () => void
19
+ onSubmit: () => void
20
+ }
21
+
22
+ export function ImportWorkspaceStep({
23
+ choice,
24
+ availability,
25
+ isPending,
26
+ errorMessage,
27
+ onTypeChange,
28
+ onCancel,
29
+ onSubmit
30
+ }: ImportWorkspaceStepProps) {
31
+ return (
32
+ <WorkspaceAgentStep
33
+ title={`Import ${workspaceDisplayName(choice.workspace)}`}
34
+ selectedType={choice.selectedType}
35
+ detectedTypes={choice.workspace.types}
36
+ availability={availability}
37
+ isPending={isPending}
38
+ errorMessage={errorMessage}
39
+ secondaryAction={
40
+ <Button variant="secondary" onClick={onCancel} disabled={isPending}>
41
+ Cancel
42
+ </Button>
43
+ }
44
+ primaryLabel="Add workspace"
45
+ pendingLabel="Adding…"
46
+ onTypeChange={onTypeChange}
47
+ onSubmit={onSubmit}
48
+ />
49
+ )
50
+ }
51
+
52
+ type ImportWorkspaceDialogProps = Omit<ImportWorkspaceStepProps, 'onCancel'> & {
53
+ onReset: () => void
54
+ }
55
+
56
+ export function ImportWorkspaceDialog({
57
+ choice,
58
+ availability,
59
+ isPending,
60
+ errorMessage,
61
+ onTypeChange,
62
+ onSubmit,
63
+ onReset
64
+ }: ImportWorkspaceDialogProps) {
65
+ const [open, setOpen] = useState(true)
66
+
67
+ function handleOpenChange(nextOpen: boolean) {
68
+ if (!nextOpen && isPending) return
69
+ setOpen(nextOpen)
70
+ }
71
+
72
+ function handleOpenChangeComplete(nextOpen: boolean) {
73
+ if (!nextOpen) onReset()
74
+ }
75
+
76
+ return (
77
+ <Dialog
78
+ open={open}
79
+ onOpenChange={handleOpenChange}
80
+ onOpenChangeComplete={handleOpenChangeComplete}
81
+ >
82
+ <WorkspaceDialogContent closeDisabled={isPending}>
83
+ <ImportWorkspaceStep
84
+ choice={choice}
85
+ availability={availability}
86
+ isPending={isPending}
87
+ errorMessage={errorMessage}
88
+ onTypeChange={onTypeChange}
89
+ onCancel={() => setOpen(false)}
90
+ onSubmit={onSubmit}
91
+ />
92
+ </WorkspaceDialogContent>
93
+ </Dialog>
94
+ )
95
+ }
@@ -0,0 +1,230 @@
1
+ import { type ReactNode, useEffect } from 'react'
2
+
3
+ import { IconCircleCheckFilled } from '@tabler/icons-react'
4
+
5
+ import { Button } from '@/client/components/ui/button'
6
+ import { DialogDescription, DialogTitle } from '@/client/components/ui/dialog'
7
+ import { Tooltip, TooltipContent, TooltipTrigger } from '@/client/components/ui/tooltip'
8
+ import {
9
+ workspaceProviderIcon,
10
+ workspaceTypeLabel
11
+ } from '@/client/features/home/workspace-presentation'
12
+ import { cn } from '@/client/lib/cn'
13
+ import { WORKSPACE_TYPE_ORDER } from '@/lib/workspace-types'
14
+ import type { HarnessAvailability, WorkspaceType } from '@/lib/types'
15
+
16
+ const WORKSPACE_AGENT_DESCRIPTION = 'Choose which agent moi will use to build your workspace'
17
+ const OPENCLAW_LOCKED_DESCRIPTION =
18
+ 'Initialize OpenClaw in the folder\nmanually, then import it to moi'
19
+
20
+ const workspaceAgentDescription: Record<WorkspaceType, string> = {
21
+ 'claude-code': 'By Anthropic',
22
+ codex: 'By OpenAI',
23
+ openclaw: 'Open-source'
24
+ }
25
+
26
+ export type WorkspaceAgentOption = {
27
+ type: WorkspaceType
28
+ description: string
29
+ disabled: boolean
30
+ disabledReason?: string
31
+ }
32
+
33
+ type WorkspaceAgentOptionsInput = {
34
+ availability?: Partial<Record<WorkspaceType, HarnessAvailability>>
35
+ detectedTypes?: WorkspaceType[]
36
+ }
37
+
38
+ export function getWorkspaceAgentOptions({
39
+ availability,
40
+ detectedTypes = []
41
+ }: WorkspaceAgentOptionsInput): WorkspaceAgentOption[] {
42
+ return WORKSPACE_TYPE_ORDER.map(type => {
43
+ const state = availability?.[type]
44
+ const unavailableReason = state?.available === false ? state.reason : undefined
45
+ const openClawReason =
46
+ type === 'openclaw' && !detectedTypes.includes(type) ? OPENCLAW_LOCKED_DESCRIPTION : undefined
47
+ const disabledReason = unavailableReason ?? openClawReason
48
+
49
+ return {
50
+ type,
51
+ description: workspaceAgentDescription[type],
52
+ disabled: Boolean(disabledReason),
53
+ ...(disabledReason ? { disabledReason } : {})
54
+ }
55
+ })
56
+ }
57
+
58
+ export function resolveWorkspaceAgentSelection(
59
+ options: WorkspaceAgentOption[],
60
+ selectedType: WorkspaceType
61
+ ): WorkspaceType | undefined {
62
+ const selected = options.find(option => option.type === selectedType)
63
+ if (selected && !selected.disabled) return selected.type
64
+ return options.find(option => !option.disabled)?.type
65
+ }
66
+
67
+ type WorkspaceAgentStepProps = {
68
+ title: string
69
+ selectedType: WorkspaceType
70
+ detectedTypes?: WorkspaceType[]
71
+ availability?: Partial<Record<WorkspaceType, HarnessAvailability>>
72
+ isPending: boolean
73
+ errorMessage?: string
74
+ secondaryAction: ReactNode
75
+ primaryLabel: string
76
+ pendingLabel?: string
77
+ onTypeChange: (type: WorkspaceType) => void
78
+ onSubmit: () => void
79
+ }
80
+
81
+ export function WorkspaceAgentStep({
82
+ title,
83
+ selectedType,
84
+ detectedTypes,
85
+ availability,
86
+ isPending,
87
+ errorMessage,
88
+ secondaryAction,
89
+ primaryLabel,
90
+ pendingLabel,
91
+ onTypeChange,
92
+ onSubmit
93
+ }: WorkspaceAgentStepProps) {
94
+ const options = getWorkspaceAgentOptions({ availability, detectedTypes })
95
+ const selectableType = resolveWorkspaceAgentSelection(options, selectedType)
96
+ const selectedUnavailable = selectableType !== selectedType
97
+
98
+ useEffect(() => {
99
+ if (selectableType && selectedUnavailable) onTypeChange(selectableType)
100
+ }, [onTypeChange, selectableType, selectedUnavailable])
101
+
102
+ return (
103
+ <div className="flex flex-col gap-5">
104
+ <div className="flex flex-col gap-0.5 pr-8">
105
+ <DialogTitle>{title}</DialogTitle>
106
+ <DialogDescription>{WORKSPACE_AGENT_DESCRIPTION}</DialogDescription>
107
+ </div>
108
+
109
+ <WorkspaceAgentSelector
110
+ options={options}
111
+ selectedType={selectedUnavailable ? undefined : selectedType}
112
+ onTypeChange={onTypeChange}
113
+ />
114
+
115
+ {errorMessage && (
116
+ <p role="alert" className="text-xs text-destructive">
117
+ {errorMessage}
118
+ </p>
119
+ )}
120
+
121
+ <div className="flex items-center justify-end gap-2">
122
+ {secondaryAction}
123
+ <Button onClick={onSubmit} disabled={isPending || selectedUnavailable}>
124
+ {isPending && pendingLabel ? pendingLabel : primaryLabel}
125
+ </Button>
126
+ </div>
127
+ </div>
128
+ )
129
+ }
130
+
131
+ type WorkspaceAgentSelectorProps = {
132
+ options: WorkspaceAgentOption[]
133
+ selectedType?: WorkspaceType
134
+ onTypeChange: (type: WorkspaceType) => void
135
+ }
136
+
137
+ function WorkspaceAgentSelector({
138
+ options,
139
+ selectedType,
140
+ onTypeChange
141
+ }: WorkspaceAgentSelectorProps) {
142
+ return (
143
+ <div
144
+ role="group"
145
+ aria-label="Agent"
146
+ className={cn('grid gap-2', options.length > 2 ? 'grid-cols-3' : 'grid-cols-2')}
147
+ >
148
+ {options.map(option => (
149
+ <WorkspaceAgentOptionButton
150
+ key={option.type}
151
+ option={option}
152
+ selected={selectedType === option.type}
153
+ onSelect={onTypeChange}
154
+ />
155
+ ))}
156
+ </div>
157
+ )
158
+ }
159
+
160
+ type WorkspaceAgentOptionButtonProps = {
161
+ option: WorkspaceAgentOption
162
+ selected: boolean
163
+ onSelect: (type: WorkspaceType) => void
164
+ }
165
+
166
+ function WorkspaceAgentOptionButton({
167
+ option,
168
+ selected,
169
+ onSelect
170
+ }: WorkspaceAgentOptionButtonProps) {
171
+ const showDisabledTooltip = Boolean(option.disabledReason)
172
+ const button = (
173
+ <button
174
+ type="button"
175
+ disabled={option.disabled && !showDisabledTooltip}
176
+ aria-disabled={option.disabled || undefined}
177
+ aria-pressed={selected}
178
+ onClick={event => {
179
+ if (option.disabled) {
180
+ event.preventDefault()
181
+ return
182
+ }
183
+ onSelect(option.type)
184
+ }}
185
+ className={cn(
186
+ 'relative flex w-full flex-col items-start justify-between gap-6 rounded-lg bg-card p-4 text-left ring-1 ring-border transition-opacity outline-none focus-visible:ring-3 focus-visible:ring-ring/50',
187
+ !selected && 'opacity-70',
188
+ !selected && !option.disabled && 'cursor-pointer hover:opacity-100',
189
+ option.disabled && 'cursor-not-allowed'
190
+ )}
191
+ >
192
+ <span className="relative inline-flex">
193
+ <WorkspaceAgentIcon type={option.type} />
194
+ {selected && (
195
+ <IconCircleCheckFilled
196
+ size={16}
197
+ stroke={1.75}
198
+ aria-hidden="true"
199
+ className="absolute -top-1.5 -right-1.5"
200
+ />
201
+ )}
202
+ </span>
203
+ <span className="flex min-w-0 flex-col gap-0.5">
204
+ <span className="text-sm font-medium text-foreground">
205
+ {workspaceTypeLabel[option.type]}
206
+ </span>
207
+ <span className="text-xs leading-4 text-muted-foreground">{option.description}</span>
208
+ </span>
209
+ </button>
210
+ )
211
+
212
+ if (!showDisabledTooltip) return button
213
+
214
+ return (
215
+ <Tooltip>
216
+ <TooltipTrigger render={button} />
217
+ <TooltipContent className="max-w-64 text-center whitespace-pre-line">
218
+ {option.disabledReason}
219
+ </TooltipContent>
220
+ </Tooltip>
221
+ )
222
+ }
223
+
224
+ type WorkspaceAgentIconProps = {
225
+ type: WorkspaceType
226
+ }
227
+
228
+ function WorkspaceAgentIcon({ type }: WorkspaceAgentIconProps) {
229
+ return <img src={workspaceProviderIcon[type]} alt="" className="size-8 shrink-0" />
230
+ }
@@ -0,0 +1,35 @@
1
+ import type { ReactNode } from 'react'
2
+
3
+ import { IconX } from '@tabler/icons-react'
4
+
5
+ import { Button } from '@/client/components/ui/button'
6
+ import { DialogClose, DialogContent } from '@/client/components/ui/dialog'
7
+
8
+ type WorkspaceDialogContentProps = {
9
+ children: ReactNode
10
+ closeDisabled?: boolean
11
+ }
12
+
13
+ export function WorkspaceDialogContent({
14
+ children,
15
+ closeDisabled = false
16
+ }: WorkspaceDialogContentProps) {
17
+ return (
18
+ <DialogContent className="w-[calc(100%-2rem)] max-w-md p-6">
19
+ <DialogClose
20
+ render={
21
+ <Button
22
+ variant="ghost"
23
+ size="icon-sm"
24
+ aria-label="Close"
25
+ className="absolute top-4 right-4"
26
+ disabled={closeDisabled}
27
+ >
28
+ <IconX stroke={1.75} />
29
+ </Button>
30
+ }
31
+ />
32
+ {children}
33
+ </DialogContent>
34
+ )
35
+ }
@@ -0,0 +1,61 @@
1
+ import { useState } from 'react'
2
+
3
+ import { useImportWorkspace } from '../api'
4
+ import { WORKSPACE_TYPE_ORDER } from '@/lib/workspace-types'
5
+ import type { DiscoveredWorkspace, WorkspaceEntry, WorkspaceType } from '@/lib/types'
6
+
7
+ export function workspaceImportDefaultType(workspace: DiscoveredWorkspace): WorkspaceType {
8
+ return workspace.types[0] ?? WORKSPACE_TYPE_ORDER[0]
9
+ }
10
+
11
+ type UseWorkspaceImportProps = {
12
+ onSuccess: (entry: WorkspaceEntry) => void
13
+ }
14
+
15
+ export type WorkspaceImportChoice = {
16
+ workspace: DiscoveredWorkspace
17
+ selectedType: WorkspaceType
18
+ }
19
+
20
+ export function useWorkspaceImport({ onSuccess }: UseWorkspaceImportProps) {
21
+ const mutation = useImportWorkspace()
22
+ const [choice, setChoice] = useState<WorkspaceImportChoice | null>(null)
23
+
24
+ function startImport(workspace: DiscoveredWorkspace) {
25
+ mutation.reset()
26
+ setChoice({
27
+ workspace,
28
+ selectedType: workspaceImportDefaultType(workspace)
29
+ })
30
+ }
31
+
32
+ function selectType(type: WorkspaceType) {
33
+ setChoice(current => (current ? { ...current, selectedType: type } : current))
34
+ }
35
+
36
+ function submit() {
37
+ if (!choice || mutation.isPending) return
38
+ mutation.mutate(
39
+ {
40
+ path: choice.workspace.path,
41
+ type: choice.selectedType
42
+ },
43
+ { onSuccess }
44
+ )
45
+ }
46
+
47
+ function reset() {
48
+ setChoice(null)
49
+ mutation.reset()
50
+ }
51
+
52
+ return {
53
+ choice,
54
+ isPending: mutation.isPending,
55
+ error: mutation.error,
56
+ startImport,
57
+ selectType,
58
+ submit,
59
+ reset
60
+ }
61
+ }
@@ -0,0 +1,89 @@
1
+ import type { ReactNode } from 'react'
2
+
3
+ import { IconPlugConnected } from '@tabler/icons-react'
4
+
5
+ import { Button } from '@/client/components/ui/button'
6
+ import {
7
+ McpServerCard,
8
+ McpServerCardSkeleton,
9
+ McpServerGrid,
10
+ sortMcpServers
11
+ } from '@/client/features/connectors/McpServerCards'
12
+ import { useWorkspaceMcp } from '@/client/features/connectors/api'
13
+ import { useWorkspaceLayoutCtx } from '@/client/features/workspace/WorkspaceLayoutContext'
14
+
15
+ import { SettingsPage } from './SettingsLayout'
16
+
17
+ const CONNECTOR_SKELETONS = Array.from({ length: 4 }, (_, index) => index)
18
+
19
+ type ConnectorsContentProps = {
20
+ connectors: ReturnType<typeof useWorkspaceMcp>
21
+ }
22
+
23
+ function ConnectorsContent({ connectors }: ConnectorsContentProps) {
24
+ if (connectors.isPending) {
25
+ return (
26
+ <div role="status" aria-label="Loading connectors">
27
+ <McpServerGrid>
28
+ {CONNECTOR_SKELETONS.map(index => (
29
+ <McpServerCardSkeleton key={index} />
30
+ ))}
31
+ </McpServerGrid>
32
+ </div>
33
+ )
34
+ }
35
+
36
+ if (connectors.isError) {
37
+ return (
38
+ <ConnectorsState>
39
+ <p className="text-sm text-muted-foreground">Could not load connectors.</p>
40
+ <Button variant="outline" size="sm" onClick={() => connectors.refetch()}>
41
+ Retry
42
+ </Button>
43
+ </ConnectorsState>
44
+ )
45
+ }
46
+
47
+ if (connectors.data.length === 0) {
48
+ return (
49
+ <ConnectorsState>
50
+ <IconPlugConnected size={24} stroke={1.5} className="text-muted-foreground" />
51
+ <p className="text-sm text-foreground">No connectors configured.</p>
52
+ </ConnectorsState>
53
+ )
54
+ }
55
+
56
+ return (
57
+ <McpServerGrid>
58
+ {sortMcpServers(connectors.data).map(connector => (
59
+ <McpServerCard key={connector.name} server={connector} />
60
+ ))}
61
+ </McpServerGrid>
62
+ )
63
+ }
64
+
65
+ type ConnectorsStateProps = {
66
+ children: ReactNode
67
+ }
68
+
69
+ function ConnectorsState({ children }: ConnectorsStateProps) {
70
+ 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">
72
+ {children}
73
+ </div>
74
+ )
75
+ }
76
+
77
+ export function ConnectorsSettings() {
78
+ const { workspaceId } = useWorkspaceLayoutCtx()
79
+ const connectors = useWorkspaceMcp(workspaceId, true)
80
+
81
+ return (
82
+ <SettingsPage
83
+ title="Connectors"
84
+ description="Connectors available to the agent in this workspace."
85
+ >
86
+ <ConnectorsContent connectors={connectors} />
87
+ </SettingsPage>
88
+ )
89
+ }
@@ -9,8 +9,8 @@ type SettingsPageProps = {
9
9
  export function SettingsPage({ title, description, children }: SettingsPageProps) {
10
10
  return (
11
11
  <div className="flex flex-col gap-6">
12
- <header className="flex flex-col gap-1">
13
- <h2 className="text-xl font-semibold tracking-tight">{title}</h2>
12
+ <header className="flex flex-col gap-0.5">
13
+ <h2 className="text-lg font-medium tracking-tight">{title}</h2>
14
14
  {description && <p className="text-sm text-muted-foreground">{description}</p>}
15
15
  </header>
16
16
  {children}
@@ -1,18 +1,20 @@
1
1
  import { useState } from 'react'
2
2
 
3
- import { IconKey, IconSettings, IconX } from '@tabler/icons-react'
3
+ import { IconKey, IconPlugConnected, IconSettings, IconX } from '@tabler/icons-react'
4
4
 
5
5
  import { Button } from '@/client/components/ui/button'
6
6
  import { Dialog, DialogClose, DialogContent, DialogTitle } from '@/client/components/ui/dialog'
7
7
  import { Tooltip, TooltipContent, TooltipTrigger } from '@/client/components/ui/tooltip'
8
8
 
9
+ import { ConnectorsSettings } from './ConnectorsSettings'
9
10
  import { EnvironmentSettings } from './EnvironmentSettings'
10
11
  import { GeneralSettings } from './GeneralSettings'
11
12
 
12
- type SettingsNav = 'general' | 'environment'
13
+ type SettingsNav = 'general' | 'connectors' | 'environment'
13
14
 
14
15
  const NAV: { id: SettingsNav; label: string; icon: typeof IconSettings }[] = [
15
16
  { id: 'general', label: 'General', icon: IconSettings },
17
+ { id: 'connectors', label: 'Connectors', icon: IconPlugConnected },
16
18
  { id: 'environment', label: 'Environment', icon: IconKey }
17
19
  ]
18
20
 
@@ -22,7 +24,7 @@ export function WorkspaceSettings() {
22
24
 
23
25
  return (
24
26
  <>
25
- <Tooltip delay={50}>
27
+ <Tooltip>
26
28
  <TooltipTrigger
27
29
  render={
28
30
  <Button
@@ -78,7 +80,9 @@ export function WorkspaceSettings() {
78
80
  }
79
81
  />
80
82
  <div className="px-8 py-7">
81
- {page === 'general' ? <GeneralSettings /> : <EnvironmentSettings />}
83
+ {page === 'general' && <GeneralSettings />}
84
+ {page === 'connectors' && <ConnectorsSettings />}
85
+ {page === 'environment' && <EnvironmentSettings />}
82
86
  </div>
83
87
  </div>
84
88
  </DialogContent>
@@ -1,14 +1,21 @@
1
1
  import { type FormEvent, type KeyboardEvent, useEffect, useRef, useState } from 'react'
2
2
 
3
- import { IconArrowUp, IconLoader2 } from '@tabler/icons-react'
3
+ import { IconLoader2 } from '@tabler/icons-react'
4
4
 
5
5
  import { Button } from '@/client/components/ui/button'
6
- import { Composer, ComposerFooter, ComposerTextarea } from '@/client/components/shared/Composer'
6
+ import {
7
+ canSubmitComposerAction,
8
+ Composer,
9
+ ComposerFooter,
10
+ ComposerSubmitButton,
11
+ ComposerTextarea
12
+ } from '@/client/components/shared/Composer'
7
13
  import { ModelPicker } from '@/client/features/chat/ModelPicker'
8
14
  import type { ViewBuilder } from '@/lib/types'
9
15
 
10
16
  type ViewBuilderTabProps = {
11
17
  builder: ViewBuilder
18
+ unavailableReason: string | null | undefined
12
19
  onSave: (requirements: string) => Promise<unknown>
13
20
  onSubmit: (requirements: string) => Promise<unknown>
14
21
  onOpenChat: () => void
@@ -17,6 +24,7 @@ type ViewBuilderTabProps = {
17
24
 
18
25
  export function ViewBuilderTab({
19
26
  builder,
27
+ unavailableReason,
20
28
  onSave,
21
29
  onSubmit,
22
30
  onOpenChat,
@@ -28,6 +36,8 @@ export function ViewBuilderTab({
28
36
  const composerRef = useRef<HTMLTextAreaElement>(null)
29
37
  const onSaveRef = useRef(onSave)
30
38
  onSaveRef.current = onSave
39
+ const hasRequirements = requirements.trim().length > 0
40
+ const canSubmit = canSubmitComposerAction(hasRequirements, submitting, unavailableReason)
31
41
 
32
42
  useEffect(() => {
33
43
  if (builder.status !== 'draft' || requirements === builder.input.requirements) return
@@ -44,7 +54,7 @@ export function ViewBuilderTab({
44
54
 
45
55
  const submit = async (event: FormEvent) => {
46
56
  event.preventDefault()
47
- if (!requirements.trim() || submitting) return
57
+ if (!canSubmit) return
48
58
  setSubmitting(true)
49
59
  try {
50
60
  await onSubmit(requirements)
@@ -88,18 +98,12 @@ export function ViewBuilderTab({
88
98
  />
89
99
  <ComposerFooter>
90
100
  <ModelPicker scope="workspace" />
91
- <Button
92
- type="submit"
93
- size="icon"
94
- disabled={!requirements.trim() || submitting}
95
- aria-label="Build view"
96
- >
97
- {submitting ? (
98
- <IconLoader2 stroke={1.5} className="animate-spin" />
99
- ) : (
100
- <IconArrowUp stroke={1.5} />
101
- )}
102
- </Button>
101
+ <ComposerSubmitButton
102
+ label="Build view"
103
+ hasContent={hasRequirements}
104
+ loading={submitting}
105
+ unavailableReason={unavailableReason}
106
+ />
103
107
  </ComposerFooter>
104
108
  </Composer>
105
109
  {saveError && (
@@ -54,7 +54,7 @@ export function useViewBuilderActions() {
54
54
  stream
55
55
  })
56
56
  } catch (error) {
57
- liveStore.getState().setProcessing(workspaceId, builder.sessionId, false)
57
+ liveStore.getState().setActivity(workspaceId, builder.sessionId, 'idle')
58
58
  liveStore
59
59
  .getState()
60
60
  .setError(
@@ -23,10 +23,9 @@ type WorkspaceLayoutContextValue = {
23
23
  // Custom workspace icon (base64 data URL), or null to use the provider icon.
24
24
  icon: string | null
25
25
  cwd: string | null
26
- // The agent backend (claude-code / openclaw …). Exposed here so
27
- // components like McpMenu read it from the shared layout query instead of
28
- // spawning their own observer (a second observer that remounts would trigger
29
- // `refetchOnMount` and clobber an in-flight optimistic layout update).
26
+ // The agent backend (claude-code / openclaw …). Exposed here so descendants
27
+ // can reuse the shared layout query instead of spawning another observer
28
+ // that could refetch on mount and clobber an optimistic layout update.
30
29
  provider: WorkspaceType | null
31
30
  // The workspace's registry id (the route param), so descendants can key
32
31
  // their own queries (e.g. the model picker) without prop-drilling.