moi-computer 0.3.0-next.2 → 0.3.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 (125) hide show
  1. package/README.md +1 -1
  2. package/client/AGENTS.md +2 -2
  3. package/client/api/http.ts +1 -1
  4. package/client/api/workspace-keys.ts +1 -0
  5. package/client/app/AppRouter.tsx +14 -5
  6. package/client/app/routes/HomeRoute.tsx +1 -1
  7. package/client/app/routes/WorkspaceRoute.tsx +8 -2
  8. package/client/app/shell/SidebarLayout.tsx +10 -5
  9. package/client/assets/openai.svg +3 -0
  10. package/client/components/shared/BottomPanel.tsx +2 -2
  11. package/client/components/ui/button.tsx +3 -2
  12. package/client/components/ui/input.tsx +1 -1
  13. package/client/features/applets/AppletMount.tsx +44 -0
  14. package/client/features/applets/WidgetShell.tsx +4 -1
  15. package/client/features/applets/applet-cache.ts +8 -0
  16. package/client/features/applets/applet-styles.ts +61 -0
  17. package/client/features/chat/ChatComposer.tsx +2 -2
  18. package/client/features/chat/ChatPanel.tsx +8 -25
  19. package/client/features/chat/ChatPopup.tsx +3 -3
  20. package/client/features/chat/{ThreadSelector.tsx → ChatSelector.tsx} +4 -4
  21. package/client/features/chat/TurnView.tsx +8 -9
  22. package/client/features/chat/api.ts +1 -1
  23. package/client/features/chat/chat-send.ts +57 -0
  24. package/client/features/chat/tool-group/ToolCallGroup.tsx +2 -1
  25. package/client/features/chat/tool-group/format.ts +117 -0
  26. package/client/features/chat/useChat.ts +10 -34
  27. package/client/features/connectors/McpMenu.tsx +4 -21
  28. package/client/features/dev/DevRoutes.tsx +18 -0
  29. package/client/features/dev/HarnessDebugPage.tsx +468 -0
  30. package/client/{components/playground → features/dev}/PlaygroundPage.tsx +1 -1
  31. package/client/features/home/CreateWorkspaceDialog.tsx +64 -158
  32. package/client/features/home/CreateWorkspaceDialogSteps.tsx +234 -0
  33. package/client/features/home/HomeLogo.tsx +344 -0
  34. package/client/features/home/HomePage.tsx +15 -21
  35. package/client/features/home/WorkspacePreview.tsx +12 -5
  36. package/client/features/home/api.ts +11 -3
  37. package/client/features/home/workspace-presentation.tsx +4 -4
  38. package/client/features/settings/GeneralSettings.tsx +3 -3
  39. package/client/features/settings/IconPicker.tsx +4 -3
  40. package/client/features/settings/icon-picker-options.ts +0 -131
  41. package/client/features/views/ViewBuilderTab.tsx +153 -0
  42. package/client/features/views/api.ts +124 -0
  43. package/client/features/views/useViewBuilderActions.ts +72 -0
  44. package/client/features/widgets/WidgetGrid.tsx +36 -20
  45. package/client/features/widgets/Widgets.tsx +140 -90
  46. package/client/features/workspace/WorkspaceLayoutContext.tsx +3 -9
  47. package/client/features/workspace/WorkspaceScreen.tsx +179 -40
  48. package/client/features/workspace/WorkspaceTabs.tsx +4 -4
  49. package/client/index.css +0 -35
  50. package/client/index.html +1 -1
  51. package/client/lib/app-icon-registry.ts +145 -0
  52. package/client/runtime/useWorkspaceEvents.ts +3 -1
  53. package/client/theme.css +1 -1
  54. package/dist/chunk-4vf1t6v1.js +10 -0
  55. package/dist/chunk-4z52b2av.css +1 -0
  56. package/dist/chunk-6c8cwpzc.js +1 -0
  57. package/dist/chunk-b4b276wx.js +15 -0
  58. package/dist/{chunk-c4j722at.js → chunk-cs8vbert.js} +2 -2
  59. package/dist/chunk-fjksw6xf.js +1 -0
  60. package/dist/chunk-kxmvv1ax.js +48 -0
  61. package/dist/{chunk-p68fnz3q.js → chunk-vkvb3hjm.js} +1 -1
  62. package/dist/chunk-y82s1jxm.js +61 -0
  63. package/dist/chunk-zpxrb1ce.js +2 -0
  64. package/dist/index.html +2 -2
  65. package/dist/openai-h13pza4b.svg +3 -0
  66. package/lib/format.ts +2 -2
  67. package/lib/types.ts +38 -2
  68. package/lib/view-builder-meta.ts +35 -0
  69. package/lib/workspace-layout.ts +14 -0
  70. package/package.json +2 -1
  71. package/server/AGENTS.md +3 -3
  72. package/server/api.ts +165 -51
  73. package/server/applets.ts +1 -1
  74. package/server/bundle-queue.ts +19 -0
  75. package/server/bundler/applet-css.ts +50 -0
  76. package/server/{build-applet.ts → bundler/build-applet.ts} +36 -26
  77. package/server/cli.ts +79 -2
  78. package/server/control.ts +106 -8
  79. package/server/env-apply.ts +2 -2
  80. package/server/harness/README.md +228 -0
  81. package/server/harness/claude-code/NOTES.md +578 -0
  82. package/{lib/claude-adapter.ts → server/harness/claude-code/adapter.ts} +67 -5
  83. package/server/harness/claude-code/index.ts +124 -0
  84. package/server/{mcp.ts → harness/claude-code/mcp.ts} +1 -1
  85. package/server/{cc-session.ts → harness/claude-code/session.ts} +42 -14
  86. package/server/harness/claude-code/sessions.ts +42 -0
  87. package/server/harness/codex/NOTES.md +326 -0
  88. package/server/harness/codex/adapter.ts +414 -0
  89. package/server/harness/codex/client.ts +343 -0
  90. package/server/harness/codex/index.ts +68 -0
  91. package/server/harness/codex/probe.ts +186 -0
  92. package/server/harness/codex/session.ts +617 -0
  93. package/server/harness/debug.ts +57 -0
  94. package/server/harness/openclaw/NOTES.md +316 -0
  95. package/server/{openclaw-adapter.ts → harness/openclaw/adapter.ts} +2 -2
  96. package/server/harness/openclaw/index.ts +93 -0
  97. package/server/{openclaw-session.ts → harness/openclaw/session.ts} +44 -9
  98. package/server/{openclaw-strip.ts → harness/openclaw/strip.ts} +3 -1
  99. package/server/harness/registry.ts +36 -0
  100. package/server/harness/types.ts +87 -0
  101. package/server/layout.ts +6 -12
  102. package/server/moi-scaffold.ts +1 -1
  103. package/server/registry.ts +14 -52
  104. package/server/state.ts +5 -38
  105. package/server/status.ts +7 -46
  106. package/server/vendor.ts +1 -1
  107. package/server/view-builders.ts +428 -0
  108. package/server/views.ts +0 -0
  109. package/server/web.ts +18 -40
  110. package/server/workspace-init.ts +6 -6
  111. package/workspace/.claude/skills/moi-workspace/DESIGN.md +1 -0
  112. package/workspace/.claude/skills/moi-workspace/SKILL.md +28 -7
  113. package/client/assets/hermes-nous.png +0 -0
  114. package/client/hooks/useScrollFade.ts +0 -38
  115. package/dist/chunk-23cgr1tz.css +0 -1
  116. package/dist/chunk-3hy3qy6d.js +0 -10
  117. package/dist/chunk-dyfaffyz.js +0 -119
  118. package/dist/chunk-kpe40hm8.js +0 -1
  119. package/dist/chunk-ty6dvda0.js +0 -1
  120. package/dist/hermes-nous-pznd63x9.png +0 -0
  121. /package/client/{components/playground → features/dev}/PixelPainter.tsx +0 -0
  122. /package/client/{components/playground → features/dev}/ToolCallsPage.tsx +0 -0
  123. /package/server/{agent.ts → harness/claude-code/models.ts} +0 -0
  124. /package/server/{openclaw.ts → harness/openclaw/discovery.ts} +0 -0
  125. /package/server/{openclaw-gateway.ts → harness/openclaw/gateway.ts} +0 -0
@@ -9,27 +9,122 @@ import { findFreePosition } from '@/client/features/widgets/grid'
9
9
  import type { GridItem } from '@/client/features/widgets/grid'
10
10
  import { WidgetShell } from '@/client/features/applets/WidgetShell'
11
11
  import { Button } from '@/client/components/ui/button'
12
+ import { Skeleton } from '@/client/components/ui/skeleton'
13
+ import { cn } from '@/client/lib/cn'
12
14
  import type { WidgetInfo } from '@/lib/types'
13
15
 
14
16
  import { HiddenPanel } from './HiddenPanel'
15
- import { WidgetGrid } from './WidgetGrid'
17
+ import { WidgetGrid, WidgetGridLayout } from './WidgetGrid'
16
18
 
17
19
  function renderItem(id: string) {
18
20
  return <WidgetShell name={id} />
19
21
  }
20
22
 
23
+ const EMPTY_WIDGET_ITEMS: GridItem[] = Array.from({ length: 10 }, (_, index) => ({
24
+ id: `empty-widget-${index}`,
25
+ w: 2,
26
+ h: 1
27
+ }))
28
+
29
+ function renderEmptyWidget() {
30
+ return (
31
+ <Skeleton className="size-full animate-none rounded-2xl [corner-shape:superellipse(1.2)]" />
32
+ )
33
+ }
34
+
21
35
  type NoWidgetsCreatedProps = {
22
36
  onCreateWidget: () => void
23
37
  }
24
38
 
25
39
  function NoWidgetsCreated({ onCreateWidget }: NoWidgetsCreatedProps) {
26
40
  return (
27
- <div className="flex min-h-0 flex-1 flex-col items-center justify-center gap-3">
28
- <p className="text-sm text-muted-foreground">No widgets created yet</p>
29
- <Button type="button" variant="secondary" size="sm" onClick={onCreateWidget}>
30
- <IconPlus data-icon="inline-start" stroke={1.75} />
31
- Create widget
32
- </Button>
41
+ <div className="relative min-h-0 flex-1 pt-7">
42
+ <div aria-hidden="true">
43
+ <WidgetGridLayout items={EMPTY_WIDGET_ITEMS} renderItem={renderEmptyWidget} />
44
+ </div>
45
+
46
+ <div className="absolute inset-0 z-1 flex items-center justify-center p-6">
47
+ <div className="flex h-full w-full max-w-(--column-w) flex-col items-center justify-center gap-4 bg-radial from-background from-50% to-transparent to-75% text-center">
48
+ <div className="flex flex-col gap-1.5">
49
+ <h2 className="font-medium">A little empty here</h2>
50
+ <p className="mx-auto max-w-sm text-sm text-muted-foreground">
51
+ Widgets are small apps that can read data, perform tasks, and show a compact view of
52
+ the information that matters.
53
+ </p>
54
+ </div>
55
+ <Button type="button" variant="secondary" size="sm" onClick={onCreateWidget}>
56
+ <IconPlus data-icon="inline-start" stroke={1.5} />
57
+ Create widget
58
+ </Button>
59
+ </div>
60
+ </div>
61
+ </div>
62
+ )
63
+ }
64
+
65
+ type WidgetActionsProps = {
66
+ editing: boolean
67
+ onCreateWidget: () => void
68
+ onEditingChange: (editing: boolean) => void
69
+ }
70
+
71
+ function WidgetActions({ editing, onCreateWidget, onEditingChange }: WidgetActionsProps) {
72
+ return (
73
+ <div className="mx-auto mb-4 flex w-full max-w-(--column-w) shrink-0 items-center justify-end gap-2">
74
+ {editing && (
75
+ <Button
76
+ type="button"
77
+ variant="ghost"
78
+ size="sm"
79
+ className="mr-auto"
80
+ onClick={onCreateWidget}
81
+ >
82
+ <IconPlus data-icon="inline-start" stroke={1.75} />
83
+ New widget
84
+ </Button>
85
+ )}
86
+ <AnimatePresence mode="popLayout" initial={false}>
87
+ {editing ? (
88
+ <motion.div
89
+ key="done"
90
+ variants={{
91
+ from: { opacity: 0, scale: 0.8, filter: 'blur(4px)' },
92
+ to: { opacity: 1, scale: 1, filter: 'blur(0px)' }
93
+ }}
94
+ initial="from"
95
+ animate="to"
96
+ exit="from"
97
+ transition={{ type: 'spring', duration: 0.3, bounce: 0 }}
98
+ >
99
+ <Button type="button" size="sm" onClick={() => onEditingChange(false)}>
100
+ Done
101
+ </Button>
102
+ </motion.div>
103
+ ) : (
104
+ <motion.div
105
+ key="actions"
106
+ className="flex items-center gap-1"
107
+ variants={{
108
+ from: { opacity: 0, scale: 0.8, filter: 'blur(4px)' },
109
+ to: { opacity: 1, scale: 1, filter: 'blur(0px)' }
110
+ }}
111
+ initial="from"
112
+ animate="to"
113
+ exit="from"
114
+ transition={{ type: 'spring', duration: 0.3, bounce: 0 }}
115
+ >
116
+ <Button
117
+ type="button"
118
+ variant="ghost"
119
+ size="sm"
120
+ className="text-muted-foreground group-hover/widgets:opacity-100 [@media(hover:hover)]:opacity-0"
121
+ onClick={() => onEditingChange(true)}
122
+ >
123
+ Edit widgets
124
+ </Button>
125
+ </motion.div>
126
+ )}
127
+ </AnimatePresence>
33
128
  </div>
34
129
  )
35
130
  }
@@ -68,6 +163,7 @@ type WidgetsProps = {
68
163
 
69
164
  export function Widgets({ onCreateWidget, editing, onEditingChange, widgets }: WidgetsProps) {
70
165
  const { layout, setLayout } = useWorkspaceLayoutCtx()
166
+ const hasWidgets = widgets.length > 0
71
167
 
72
168
  const gridIds = new Set(layout.widgetGrid.map(g => g.i))
73
169
 
@@ -100,107 +196,61 @@ export function Widgets({ onCreateWidget, editing, onEditingChange, widgets }: W
100
196
  setLayout({ widgetGrid: [...layout.widgetGrid, { i: id, x: pos.x, y: pos.y }] })
101
197
  }
102
198
 
103
- if (widgets.length === 0) {
104
- return <NoWidgetsCreated onCreateWidget={onCreateWidget} />
105
- }
106
-
107
199
  return (
108
- // Working area: everything below the header. It scrolls, and it's the
109
- // positioning context for the bottom panel (which is anchored to this box,
110
- // not to the grid). The grid lives in a centered max-w container and grows
111
- // to its natural height.
200
+ // Shared working area below the header and positioning context for the
201
+ // bottom panel. Created-widget states scroll; the initial empty state clips
202
+ // its fixed-height skeleton grid.
112
203
  <div className="group/widgets relative min-h-0 flex-1">
113
204
  <LayoutGroup>
114
- <div className="flex h-full flex-col overflow-y-auto p-4">
115
- <div className="mx-auto mb-4 flex w-full max-w-[var(--column-w)] shrink-0 items-center justify-end gap-2">
116
- {editing && (
117
- <Button
118
- type="button"
119
- variant="ghost"
120
- size="sm"
121
- className="mr-auto"
122
- onClick={onCreateWidget}
123
- >
124
- <IconPlus data-icon="inline-start" stroke={1.75} />
125
- New widget
126
- </Button>
127
- )}
128
- <AnimatePresence mode="popLayout" initial={false}>
129
- {editing ? (
205
+ <div
206
+ className={cn(
207
+ 'relative flex h-full flex-col p-4',
208
+ hasWidgets ? 'overflow-y-auto' : 'overflow-hidden'
209
+ )}
210
+ >
211
+ {hasWidgets ? (
212
+ <>
213
+ <WidgetActions
214
+ editing={editing}
215
+ onCreateWidget={onCreateWidget}
216
+ onEditingChange={onEditingChange}
217
+ />
218
+ {visibleItems.length === 0 ? (
130
219
  <motion.div
131
- key="done"
132
- variants={{
133
- from: { opacity: 0, scale: 0.8, filter: 'blur(4px)' },
134
- to: { opacity: 1, scale: 1, filter: 'blur(0px)' }
135
- }}
136
- initial="from"
137
- animate="to"
138
- exit="from"
220
+ className="mx-auto flex min-h-0 w-full max-w-[var(--column-w)] flex-1 flex-col"
221
+ animate={{ paddingBottom: panelOpen ? panelHeight : 0 }}
139
222
  transition={{ type: 'spring', duration: 0.3, bounce: 0 }}
140
223
  >
141
- <Button type="button" size="sm" onClick={() => onEditingChange(false)}>
142
- Done
143
- </Button>
224
+ <NoWidgetsAdded />
144
225
  </motion.div>
145
226
  ) : (
227
+ // The open panel's height is reserved below the grid so every card
228
+ // can scroll clear of the panel.
146
229
  <motion.div
147
- key="actions"
148
- className="flex items-center gap-1"
149
- variants={{
150
- from: { opacity: 0, scale: 0.8, filter: 'blur(4px)' },
151
- to: { opacity: 1, scale: 1, filter: 'blur(0px)' }
152
- }}
153
- initial="from"
154
- animate="to"
155
- exit="from"
230
+ animate={{ marginBottom: panelOpen ? panelHeight : 0 }}
156
231
  transition={{ type: 'spring', duration: 0.3, bounce: 0 }}
157
232
  >
158
- <Button
159
- type="button"
160
- variant="ghost"
161
- size="sm"
162
- className="text-muted-foreground group-hover/widgets:opacity-100 [@media(hover:hover)]:opacity-0"
163
- onClick={() => onEditingChange(true)}
164
- >
165
- Edit widgets
166
- </Button>
233
+ <WidgetGrid
234
+ items={visibleItems}
235
+ editing={editing}
236
+ renderItem={renderItem}
237
+ onRemove={hide}
238
+ onLayoutChange={items =>
239
+ setLayout({
240
+ widgetGrid: items.map(i => ({ i: i.id, x: i.x ?? 0, y: i.y ?? 0 }))
241
+ })
242
+ }
243
+ />
167
244
  </motion.div>
168
245
  )}
169
- </AnimatePresence>
170
- </div>
171
- {visibleItems.length === 0 ? (
172
- <motion.div
173
- className="mx-auto flex min-h-0 w-full max-w-[var(--column-w)] flex-1 flex-col"
174
- animate={{ paddingBottom: panelOpen ? panelHeight : 0 }}
175
- transition={{ type: 'spring', duration: 0.3, bounce: 0 }}
176
- >
177
- <NoWidgetsAdded />
178
- </motion.div>
246
+ </>
179
247
  ) : (
180
- // The open panel's height is reserved below the grid so every card
181
- // can scroll clear of the panel.
182
- <motion.div
183
- className="mx-auto w-full max-w-[var(--column-w)]"
184
- animate={{ marginBottom: panelOpen ? panelHeight : 0 }}
185
- transition={{ type: 'spring', duration: 0.3, bounce: 0 }}
186
- >
187
- <WidgetGrid
188
- items={visibleItems}
189
- editing={editing}
190
- renderItem={renderItem}
191
- onRemove={hide}
192
- onLayoutChange={items =>
193
- setLayout({
194
- widgetGrid: items.map(i => ({ i: i.id, x: i.x ?? 0, y: i.y ?? 0 }))
195
- })
196
- }
197
- />
198
- </motion.div>
248
+ <NoWidgetsCreated onCreateWidget={onCreateWidget} />
199
249
  )}
200
250
  </div>
201
251
 
202
252
  <AnimatePresence>
203
- {editing && hiddenItems.length > 0 && (
253
+ {hasWidgets && editing && hiddenItems.length > 0 && (
204
254
  <HiddenPanel
205
255
  ref={panelRef}
206
256
  items={hiddenItems}
@@ -9,13 +9,7 @@ import {
9
9
  } from '@/client/features/workspace/api'
10
10
  import { workspaceKeys } from '@/client/api/workspace-keys'
11
11
  import type { WorkspaceLayout, WorkspaceType } from '@/lib/types'
12
-
13
- const DEFAULT_LAYOUT: WorkspaceLayout = {
14
- version: 1,
15
- widgetGrid: [],
16
- layoutMode: 'fullscreen',
17
- tabs: { open: ['agent'], active: 'agent' }
18
- }
12
+ import { createDefaultWorkspaceLayout } from '@/lib/workspace-layout'
19
13
 
20
14
  type WorkspaceLayoutContextValue = {
21
15
  // The persisted layout (widget grid, layout mode, theme). Falls back to an
@@ -29,7 +23,7 @@ type WorkspaceLayoutContextValue = {
29
23
  // Custom workspace icon (base64 data URL), or null to use the provider icon.
30
24
  icon: string | null
31
25
  cwd: string | null
32
- // The agent backend (claude-code / openclaw / hermes …). Exposed here so
26
+ // The agent backend (claude-code / openclaw …). Exposed here so
33
27
  // components like McpMenu read it from the shared layout query instead of
34
28
  // spawning their own observer (a second observer that remounts would trigger
35
29
  // `refetchOnMount` and clobber an in-flight optimistic layout update).
@@ -103,7 +97,7 @@ export function WorkspaceLayoutProvider({ id, children }: WorkspaceLayoutProvide
103
97
  // is already stable; the rest derive from `query.data`.
104
98
  const value = useMemo<WorkspaceLayoutContextValue>(
105
99
  () => ({
106
- layout: query.data ? stripMeta(query.data) : DEFAULT_LAYOUT,
100
+ layout: query.data ? stripMeta(query.data) : createDefaultWorkspaceLayout(),
107
101
  setLayout,
108
102
  name: query.data?.name ?? null,
109
103
  icon: query.data?.icon ?? null,