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.
- package/README.md +1 -1
- package/client/AGENTS.md +2 -2
- package/client/api/http.ts +1 -1
- package/client/api/workspace-keys.ts +1 -0
- package/client/app/AppRouter.tsx +14 -5
- package/client/app/routes/HomeRoute.tsx +1 -1
- package/client/app/routes/WorkspaceRoute.tsx +8 -2
- package/client/app/shell/SidebarLayout.tsx +10 -5
- package/client/assets/openai.svg +3 -0
- package/client/components/shared/BottomPanel.tsx +2 -2
- package/client/components/ui/button.tsx +3 -2
- package/client/components/ui/input.tsx +1 -1
- package/client/features/applets/AppletMount.tsx +44 -0
- package/client/features/applets/WidgetShell.tsx +4 -1
- package/client/features/applets/applet-cache.ts +8 -0
- package/client/features/applets/applet-styles.ts +61 -0
- package/client/features/chat/ChatComposer.tsx +2 -2
- package/client/features/chat/ChatPanel.tsx +8 -25
- package/client/features/chat/ChatPopup.tsx +3 -3
- package/client/features/chat/{ThreadSelector.tsx → ChatSelector.tsx} +4 -4
- package/client/features/chat/TurnView.tsx +8 -9
- package/client/features/chat/api.ts +1 -1
- package/client/features/chat/chat-send.ts +57 -0
- package/client/features/chat/tool-group/ToolCallGroup.tsx +2 -1
- package/client/features/chat/tool-group/format.ts +117 -0
- package/client/features/chat/useChat.ts +10 -34
- package/client/features/connectors/McpMenu.tsx +4 -21
- package/client/features/dev/DevRoutes.tsx +18 -0
- package/client/features/dev/HarnessDebugPage.tsx +468 -0
- package/client/{components/playground → features/dev}/PlaygroundPage.tsx +1 -1
- package/client/features/home/CreateWorkspaceDialog.tsx +64 -158
- package/client/features/home/CreateWorkspaceDialogSteps.tsx +234 -0
- package/client/features/home/HomeLogo.tsx +344 -0
- package/client/features/home/HomePage.tsx +15 -21
- package/client/features/home/WorkspacePreview.tsx +12 -5
- package/client/features/home/api.ts +11 -3
- package/client/features/home/workspace-presentation.tsx +4 -4
- package/client/features/settings/GeneralSettings.tsx +3 -3
- package/client/features/settings/IconPicker.tsx +4 -3
- package/client/features/settings/icon-picker-options.ts +0 -131
- package/client/features/views/ViewBuilderTab.tsx +153 -0
- package/client/features/views/api.ts +124 -0
- package/client/features/views/useViewBuilderActions.ts +72 -0
- package/client/features/widgets/WidgetGrid.tsx +36 -20
- package/client/features/widgets/Widgets.tsx +140 -90
- package/client/features/workspace/WorkspaceLayoutContext.tsx +3 -9
- package/client/features/workspace/WorkspaceScreen.tsx +179 -40
- package/client/features/workspace/WorkspaceTabs.tsx +4 -4
- package/client/index.css +0 -35
- package/client/index.html +1 -1
- package/client/lib/app-icon-registry.ts +145 -0
- package/client/runtime/useWorkspaceEvents.ts +3 -1
- package/client/theme.css +1 -1
- package/dist/chunk-4vf1t6v1.js +10 -0
- package/dist/chunk-4z52b2av.css +1 -0
- package/dist/chunk-6c8cwpzc.js +1 -0
- package/dist/chunk-b4b276wx.js +15 -0
- package/dist/{chunk-c4j722at.js → chunk-cs8vbert.js} +2 -2
- package/dist/chunk-fjksw6xf.js +1 -0
- package/dist/chunk-kxmvv1ax.js +48 -0
- package/dist/{chunk-p68fnz3q.js → chunk-vkvb3hjm.js} +1 -1
- package/dist/chunk-y82s1jxm.js +61 -0
- package/dist/chunk-zpxrb1ce.js +2 -0
- package/dist/index.html +2 -2
- package/dist/openai-h13pza4b.svg +3 -0
- package/lib/format.ts +2 -2
- package/lib/types.ts +38 -2
- package/lib/view-builder-meta.ts +35 -0
- package/lib/workspace-layout.ts +14 -0
- package/package.json +2 -1
- package/server/AGENTS.md +3 -3
- package/server/api.ts +165 -51
- package/server/applets.ts +1 -1
- package/server/bundle-queue.ts +19 -0
- package/server/bundler/applet-css.ts +50 -0
- package/server/{build-applet.ts → bundler/build-applet.ts} +36 -26
- package/server/cli.ts +79 -2
- package/server/control.ts +106 -8
- package/server/env-apply.ts +2 -2
- package/server/harness/README.md +228 -0
- package/server/harness/claude-code/NOTES.md +578 -0
- package/{lib/claude-adapter.ts → server/harness/claude-code/adapter.ts} +67 -5
- package/server/harness/claude-code/index.ts +124 -0
- package/server/{mcp.ts → harness/claude-code/mcp.ts} +1 -1
- package/server/{cc-session.ts → harness/claude-code/session.ts} +42 -14
- package/server/harness/claude-code/sessions.ts +42 -0
- package/server/harness/codex/NOTES.md +326 -0
- package/server/harness/codex/adapter.ts +414 -0
- package/server/harness/codex/client.ts +343 -0
- package/server/harness/codex/index.ts +68 -0
- package/server/harness/codex/probe.ts +186 -0
- package/server/harness/codex/session.ts +617 -0
- package/server/harness/debug.ts +57 -0
- package/server/harness/openclaw/NOTES.md +316 -0
- package/server/{openclaw-adapter.ts → harness/openclaw/adapter.ts} +2 -2
- package/server/harness/openclaw/index.ts +93 -0
- package/server/{openclaw-session.ts → harness/openclaw/session.ts} +44 -9
- package/server/{openclaw-strip.ts → harness/openclaw/strip.ts} +3 -1
- package/server/harness/registry.ts +36 -0
- package/server/harness/types.ts +87 -0
- package/server/layout.ts +6 -12
- package/server/moi-scaffold.ts +1 -1
- package/server/registry.ts +14 -52
- package/server/state.ts +5 -38
- package/server/status.ts +7 -46
- package/server/vendor.ts +1 -1
- package/server/view-builders.ts +428 -0
- package/server/views.ts +0 -0
- package/server/web.ts +18 -40
- package/server/workspace-init.ts +6 -6
- package/workspace/.claude/skills/moi-workspace/DESIGN.md +1 -0
- package/workspace/.claude/skills/moi-workspace/SKILL.md +28 -7
- package/client/assets/hermes-nous.png +0 -0
- package/client/hooks/useScrollFade.ts +0 -38
- package/dist/chunk-23cgr1tz.css +0 -1
- package/dist/chunk-3hy3qy6d.js +0 -10
- package/dist/chunk-dyfaffyz.js +0 -119
- package/dist/chunk-kpe40hm8.js +0 -1
- package/dist/chunk-ty6dvda0.js +0 -1
- package/dist/hermes-nous-pznd63x9.png +0 -0
- /package/client/{components/playground → features/dev}/PixelPainter.tsx +0 -0
- /package/client/{components/playground → features/dev}/ToolCallsPage.tsx +0 -0
- /package/server/{agent.ts → harness/claude-code/models.ts} +0 -0
- /package/server/{openclaw.ts → harness/openclaw/discovery.ts} +0 -0
- /package/server/{openclaw-gateway.ts → harness/openclaw/gateway.ts} +0 -0
|
@@ -0,0 +1,344 @@
|
|
|
1
|
+
import { useEffect, useRef } from 'react'
|
|
2
|
+
|
|
3
|
+
import { cn } from '@/client/lib/cn'
|
|
4
|
+
|
|
5
|
+
const GLYPH_ROWS = [
|
|
6
|
+
['OOOOO', 'O.O.O', 'O.O.O'],
|
|
7
|
+
['OOO', 'O.O', 'OOO'],
|
|
8
|
+
['O', 'O', 'O']
|
|
9
|
+
] as const
|
|
10
|
+
|
|
11
|
+
const CELL_SIZE = 10
|
|
12
|
+
const CELL_GAP = 3
|
|
13
|
+
const CELL_RADIUS = 2.5
|
|
14
|
+
const CELL_OPACITY: Record<string, number> = { O: 1, o: 0.5, '.': 0 }
|
|
15
|
+
|
|
16
|
+
const INTRO_DURATION = 3000
|
|
17
|
+
const INTRO_SEED = 2
|
|
18
|
+
const INTRO_SPREAD = 3
|
|
19
|
+
const FIELD_SPACING = 3
|
|
20
|
+
const REST_THRESHOLD = 1e-3
|
|
21
|
+
|
|
22
|
+
const WAVE_PARAMS = {
|
|
23
|
+
courantSquared: 0.14,
|
|
24
|
+
damping: 0.976,
|
|
25
|
+
driveAmplitude: 1.4,
|
|
26
|
+
driveFrequency: 0.027,
|
|
27
|
+
gain: 0.65,
|
|
28
|
+
fadeIn: 0.36,
|
|
29
|
+
fadeOut: 0.1
|
|
30
|
+
} as const
|
|
31
|
+
|
|
32
|
+
type Pixel = {
|
|
33
|
+
x: number
|
|
34
|
+
y: number
|
|
35
|
+
centerX: number
|
|
36
|
+
centerY: number
|
|
37
|
+
targetOpacity: number
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
type GlyphGeometry = {
|
|
41
|
+
width: number
|
|
42
|
+
height: number
|
|
43
|
+
fieldColumns: number
|
|
44
|
+
fieldRows: number
|
|
45
|
+
pixels: Pixel[]
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
function buildGlyph(rows: readonly string[]): GlyphGeometry {
|
|
49
|
+
const columns = Math.max(...rows.map(row => row.length))
|
|
50
|
+
const width = columns * CELL_SIZE + (columns - 1) * CELL_GAP
|
|
51
|
+
const height = rows.length * CELL_SIZE + (rows.length - 1) * CELL_GAP
|
|
52
|
+
const pixels: Pixel[] = []
|
|
53
|
+
|
|
54
|
+
rows.forEach((row, rowIndex) => {
|
|
55
|
+
Array.from(row).forEach((cell, columnIndex) => {
|
|
56
|
+
const targetOpacity = CELL_OPACITY[cell]
|
|
57
|
+
if (targetOpacity === undefined) return
|
|
58
|
+
|
|
59
|
+
const x = columnIndex * (CELL_SIZE + CELL_GAP)
|
|
60
|
+
const y = rowIndex * (CELL_SIZE + CELL_GAP)
|
|
61
|
+
pixels.push({
|
|
62
|
+
x,
|
|
63
|
+
y,
|
|
64
|
+
centerX: x + CELL_SIZE / 2,
|
|
65
|
+
centerY: y + CELL_SIZE / 2,
|
|
66
|
+
targetOpacity
|
|
67
|
+
})
|
|
68
|
+
})
|
|
69
|
+
})
|
|
70
|
+
|
|
71
|
+
return {
|
|
72
|
+
width,
|
|
73
|
+
height,
|
|
74
|
+
fieldColumns: Math.round(width / FIELD_SPACING) + 1,
|
|
75
|
+
fieldRows: Math.round(height / FIELD_SPACING) + 1,
|
|
76
|
+
pixels
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
const GLYPHS = GLYPH_ROWS.map(buildGlyph)
|
|
81
|
+
|
|
82
|
+
function clamp(value: number, min: number, max: number): number {
|
|
83
|
+
return value < min ? min : value > max ? max : value
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
function easeInOut(value: number): number {
|
|
87
|
+
return value < 0.5 ? 2 * value * value : 1 - (-2 * value + 2) ** 2 / 2
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
class GlyphWaveEngine {
|
|
91
|
+
private readonly rects: (SVGRectElement | null)[]
|
|
92
|
+
private readonly svg: SVGSVGElement
|
|
93
|
+
private readonly geometry: GlyphGeometry
|
|
94
|
+
private animationFrame = 0
|
|
95
|
+
private running = false
|
|
96
|
+
private intro = true
|
|
97
|
+
private introStartedAt = -1
|
|
98
|
+
private field: Float32Array
|
|
99
|
+
private previousField: Float32Array
|
|
100
|
+
private nextField: Float32Array
|
|
101
|
+
private pointerActive = false
|
|
102
|
+
private pointerX = 0
|
|
103
|
+
private pointerY = 0
|
|
104
|
+
private activation = 0
|
|
105
|
+
|
|
106
|
+
constructor(rects: (SVGRectElement | null)[], svg: SVGSVGElement, geometry: GlyphGeometry) {
|
|
107
|
+
this.rects = rects
|
|
108
|
+
this.svg = svg
|
|
109
|
+
this.geometry = geometry
|
|
110
|
+
const fieldSize = geometry.fieldColumns * geometry.fieldRows
|
|
111
|
+
this.field = new Float32Array(fieldSize)
|
|
112
|
+
this.previousField = new Float32Array(fieldSize)
|
|
113
|
+
this.nextField = new Float32Array(fieldSize)
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
start(): void {
|
|
117
|
+
this.seedImpulse()
|
|
118
|
+
this.activation = 1
|
|
119
|
+
this.resume()
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
stop(): void {
|
|
123
|
+
cancelAnimationFrame(this.animationFrame)
|
|
124
|
+
this.running = false
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
handlePointerMove = (event: PointerEvent): void => {
|
|
128
|
+
const bounds = this.svg.getBoundingClientRect()
|
|
129
|
+
if (!bounds.width || !bounds.height) return
|
|
130
|
+
|
|
131
|
+
this.pointerActive =
|
|
132
|
+
event.clientX >= bounds.left &&
|
|
133
|
+
event.clientX <= bounds.right &&
|
|
134
|
+
event.clientY >= bounds.top &&
|
|
135
|
+
event.clientY <= bounds.bottom
|
|
136
|
+
|
|
137
|
+
if (this.pointerActive) {
|
|
138
|
+
this.pointerX = ((event.clientX - bounds.left) / bounds.width) * this.geometry.width
|
|
139
|
+
this.pointerY = ((event.clientY - bounds.top) / bounds.height) * this.geometry.height
|
|
140
|
+
this.resume()
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
private seedImpulse(): void {
|
|
145
|
+
const centerColumn = Math.round(this.geometry.width / 2 / FIELD_SPACING)
|
|
146
|
+
const centerRow = Math.round(this.geometry.height / 2 / FIELD_SPACING)
|
|
147
|
+
const spread = 2 * INTRO_SPREAD * INTRO_SPREAD
|
|
148
|
+
|
|
149
|
+
for (let row = 0; row < this.geometry.fieldRows; row++) {
|
|
150
|
+
for (let column = 0; column < this.geometry.fieldColumns; column++) {
|
|
151
|
+
const distance = (column - centerColumn) ** 2 + (row - centerRow) ** 2
|
|
152
|
+
const value = INTRO_SEED * Math.exp(-distance / spread)
|
|
153
|
+
const index = row * this.geometry.fieldColumns + column
|
|
154
|
+
this.field[index] = value
|
|
155
|
+
this.previousField[index] = value
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
private resume(): void {
|
|
161
|
+
if (this.running) return
|
|
162
|
+
this.running = true
|
|
163
|
+
this.animationFrame = requestAnimationFrame(this.animate)
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
private animate = (timestamp: number): void => {
|
|
167
|
+
this.stepWave()
|
|
168
|
+
if (this.pointerActive) this.driveWave(timestamp)
|
|
169
|
+
|
|
170
|
+
if (this.intro && !this.pointerActive) {
|
|
171
|
+
if (this.introStartedAt < 0) this.introStartedAt = timestamp
|
|
172
|
+
const progress = (timestamp - this.introStartedAt) / INTRO_DURATION
|
|
173
|
+
this.activation = 1 - easeInOut(Math.min(1, progress))
|
|
174
|
+
if (progress >= 1) this.intro = false
|
|
175
|
+
} else {
|
|
176
|
+
this.intro = false
|
|
177
|
+
const target = this.pointerActive ? 1 : 0
|
|
178
|
+
const fade = this.pointerActive ? WAVE_PARAMS.fadeIn : WAVE_PARAMS.fadeOut
|
|
179
|
+
this.activation += (target - this.activation) * fade
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
const peak = this.renderWave()
|
|
183
|
+
if (
|
|
184
|
+
this.intro ||
|
|
185
|
+
this.pointerActive ||
|
|
186
|
+
this.activation > REST_THRESHOLD ||
|
|
187
|
+
peak > REST_THRESHOLD
|
|
188
|
+
) {
|
|
189
|
+
this.animationFrame = requestAnimationFrame(this.animate)
|
|
190
|
+
return
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
this.running = false
|
|
194
|
+
this.activation = 0
|
|
195
|
+
this.renderTargets()
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
private stepWave(): void {
|
|
199
|
+
const { fieldColumns, fieldRows } = this.geometry
|
|
200
|
+
|
|
201
|
+
for (let row = 1; row < fieldRows - 1; row++) {
|
|
202
|
+
for (let column = 1; column < fieldColumns - 1; column++) {
|
|
203
|
+
const index = row * fieldColumns + column
|
|
204
|
+
const laplacian =
|
|
205
|
+
this.field[index - 1] +
|
|
206
|
+
this.field[index + 1] +
|
|
207
|
+
this.field[index - fieldColumns] +
|
|
208
|
+
this.field[index + fieldColumns] -
|
|
209
|
+
4 * this.field[index]
|
|
210
|
+
this.nextField[index] =
|
|
211
|
+
(2 * this.field[index] -
|
|
212
|
+
this.previousField[index] +
|
|
213
|
+
WAVE_PARAMS.courantSquared * laplacian) *
|
|
214
|
+
WAVE_PARAMS.damping
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
const previousField = this.previousField
|
|
219
|
+
this.previousField = this.field
|
|
220
|
+
this.field = this.nextField
|
|
221
|
+
this.nextField = previousField
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
private driveWave(timestamp: number): void {
|
|
225
|
+
const column = clamp(
|
|
226
|
+
Math.round(this.pointerX / FIELD_SPACING),
|
|
227
|
+
1,
|
|
228
|
+
this.geometry.fieldColumns - 2
|
|
229
|
+
)
|
|
230
|
+
const row = clamp(Math.round(this.pointerY / FIELD_SPACING), 1, this.geometry.fieldRows - 2)
|
|
231
|
+
this.field[row * this.geometry.fieldColumns + column] =
|
|
232
|
+
WAVE_PARAMS.driveAmplitude * Math.sin(timestamp * WAVE_PARAMS.driveFrequency)
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
private sampleField(x: number, y: number): number {
|
|
236
|
+
const fieldX = clamp(x / FIELD_SPACING, 0, this.geometry.fieldColumns - 1)
|
|
237
|
+
const fieldY = clamp(y / FIELD_SPACING, 0, this.geometry.fieldRows - 1)
|
|
238
|
+
const left = Math.floor(fieldX)
|
|
239
|
+
const top = Math.floor(fieldY)
|
|
240
|
+
const right = Math.min(left + 1, this.geometry.fieldColumns - 1)
|
|
241
|
+
const bottom = Math.min(top + 1, this.geometry.fieldRows - 1)
|
|
242
|
+
const offsetX = fieldX - left
|
|
243
|
+
const offsetY = fieldY - top
|
|
244
|
+
const { fieldColumns } = this.geometry
|
|
245
|
+
const topLeft = this.field[top * fieldColumns + left]
|
|
246
|
+
const topRight = this.field[top * fieldColumns + right]
|
|
247
|
+
const bottomLeft = this.field[bottom * fieldColumns + left]
|
|
248
|
+
const bottomRight = this.field[bottom * fieldColumns + right]
|
|
249
|
+
|
|
250
|
+
return (
|
|
251
|
+
(topLeft * (1 - offsetX) + topRight * offsetX) * (1 - offsetY) +
|
|
252
|
+
(bottomLeft * (1 - offsetX) + bottomRight * offsetX) * offsetY
|
|
253
|
+
)
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
private renderWave(): number {
|
|
257
|
+
let peak = 0
|
|
258
|
+
|
|
259
|
+
this.geometry.pixels.forEach((pixel, index) => {
|
|
260
|
+
const element = this.rects[index]
|
|
261
|
+
if (!element) return
|
|
262
|
+
|
|
263
|
+
const sample = this.sampleField(pixel.centerX, pixel.centerY)
|
|
264
|
+
peak = Math.max(peak, Math.abs(sample))
|
|
265
|
+
const waveOpacity = clamp(0.5 + sample * WAVE_PARAMS.gain, 0, 1)
|
|
266
|
+
const opacity = pixel.targetOpacity * (1 - this.activation) + waveOpacity * this.activation
|
|
267
|
+
element.setAttribute('opacity', opacity.toFixed(3))
|
|
268
|
+
})
|
|
269
|
+
|
|
270
|
+
return peak
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
private renderTargets(): void {
|
|
274
|
+
this.geometry.pixels.forEach((pixel, index) => {
|
|
275
|
+
this.rects[index]?.setAttribute('opacity', String(pixel.targetOpacity))
|
|
276
|
+
})
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
type HomeLogoGlyphProps = {
|
|
281
|
+
geometry: GlyphGeometry
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
function HomeLogoGlyph({ geometry }: HomeLogoGlyphProps) {
|
|
285
|
+
const rects = useRef<(SVGRectElement | null)[]>([])
|
|
286
|
+
const svgRef = useRef<SVGSVGElement | null>(null)
|
|
287
|
+
|
|
288
|
+
useEffect(() => {
|
|
289
|
+
const svg = svgRef.current
|
|
290
|
+
if (!svg || window.matchMedia('(prefers-reduced-motion: reduce)').matches) return
|
|
291
|
+
|
|
292
|
+
const engine = new GlyphWaveEngine(rects.current, svg, geometry)
|
|
293
|
+
engine.start()
|
|
294
|
+
window.addEventListener('pointermove', engine.handlePointerMove)
|
|
295
|
+
|
|
296
|
+
return () => {
|
|
297
|
+
engine.stop()
|
|
298
|
+
window.removeEventListener('pointermove', engine.handlePointerMove)
|
|
299
|
+
}
|
|
300
|
+
}, [geometry])
|
|
301
|
+
|
|
302
|
+
return (
|
|
303
|
+
<svg
|
|
304
|
+
ref={svgRef}
|
|
305
|
+
className="h-8 w-auto"
|
|
306
|
+
viewBox={`0 0 ${geometry.width} ${geometry.height}`}
|
|
307
|
+
fill="currentColor"
|
|
308
|
+
aria-hidden="true"
|
|
309
|
+
>
|
|
310
|
+
{geometry.pixels.map((pixel, index) => (
|
|
311
|
+
<rect
|
|
312
|
+
key={`${pixel.x}-${pixel.y}`}
|
|
313
|
+
ref={element => {
|
|
314
|
+
rects.current[index] = element
|
|
315
|
+
}}
|
|
316
|
+
x={pixel.x}
|
|
317
|
+
y={pixel.y}
|
|
318
|
+
width={CELL_SIZE}
|
|
319
|
+
height={CELL_SIZE}
|
|
320
|
+
rx={CELL_RADIUS}
|
|
321
|
+
opacity={pixel.targetOpacity}
|
|
322
|
+
/>
|
|
323
|
+
))}
|
|
324
|
+
</svg>
|
|
325
|
+
)
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
type HomeLogoProps = {
|
|
329
|
+
className?: string
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
export function HomeLogo({ className }: HomeLogoProps) {
|
|
333
|
+
return (
|
|
334
|
+
<div
|
|
335
|
+
role="img"
|
|
336
|
+
aria-label="moi"
|
|
337
|
+
className={cn('flex items-center gap-2 text-accent', className)}
|
|
338
|
+
>
|
|
339
|
+
{GLYPHS.map((geometry, index) => (
|
|
340
|
+
<HomeLogoGlyph key={index} geometry={geometry} />
|
|
341
|
+
))}
|
|
342
|
+
</div>
|
|
343
|
+
)
|
|
344
|
+
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { IconChevronRight,
|
|
2
|
-
import { useLocation } from 'wouter'
|
|
1
|
+
import { IconChevronRight, IconEggCracked, IconLoader2, IconPlus } from '@tabler/icons-react'
|
|
2
|
+
import { Link, useLocation } from 'wouter'
|
|
3
3
|
|
|
4
4
|
import { useAddWorkspace, useDiscoveredWorkspaces, useWorkspaces } from './api'
|
|
5
|
+
import { HomeLogo } from './HomeLogo'
|
|
5
6
|
import { Button } from '@/client/components/ui/button'
|
|
6
|
-
import { LedLogo } from '@/client/components/shared/LedLogo'
|
|
7
7
|
import {
|
|
8
8
|
Collapsible,
|
|
9
9
|
CollapsibleContent,
|
|
@@ -59,14 +59,12 @@ export function HomePage() {
|
|
|
59
59
|
|
|
60
60
|
return (
|
|
61
61
|
<div className="mx-auto w-full max-w-3xl px-8 pt-14 pb-16">
|
|
62
|
-
<
|
|
63
|
-
<LedLogo sprite="moi-full" pixelSize={4} gap={1} />
|
|
64
|
-
</div>
|
|
62
|
+
<HomeLogo className="mb-8" />
|
|
65
63
|
|
|
66
64
|
{count > 0 ? (
|
|
67
65
|
<section className="mb-10">
|
|
68
66
|
<div className="mb-2 flex items-center justify-between gap-2">
|
|
69
|
-
<h1 className="text-sm font-medium text-foreground">My
|
|
67
|
+
<h1 className="text-sm font-medium text-foreground">My workspaces</h1>
|
|
70
68
|
<CreateWorkspaceDialog
|
|
71
69
|
trigger={
|
|
72
70
|
<Button variant="outline" size="sm">
|
|
@@ -84,17 +82,16 @@ export function HomePage() {
|
|
|
84
82
|
</div>
|
|
85
83
|
</section>
|
|
86
84
|
) : (
|
|
87
|
-
<div className="mb-10 flex flex-col items-center gap-4 px-8
|
|
88
|
-
<
|
|
85
|
+
<div className="mb-10 flex flex-col items-center gap-4 px-8 pt-6 pb-12 text-center">
|
|
86
|
+
<IconEggCracked size={32} stroke={1.5} className="text-muted-foreground" />
|
|
89
87
|
<div className="flex flex-col gap-1.5">
|
|
90
|
-
<
|
|
91
|
-
<p className="mx-auto max-w-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
add an existing folder where you’ve worked with other agents.
|
|
88
|
+
<h2 className="font-medium">Let’s start with creating your first workspace</h2>
|
|
89
|
+
<p className="mx-auto max-w-sm text-sm text-muted-foreground">
|
|
90
|
+
Workspace is a place for all the chats, widgets, and views that share the same
|
|
91
|
+
context. Create a new one or import an existing folder you’ve worked in before.
|
|
95
92
|
</p>
|
|
96
93
|
</div>
|
|
97
|
-
<CreateWorkspaceDialog trigger={<Button
|
|
94
|
+
<CreateWorkspaceDialog trigger={<Button>Create workspace</Button>} />
|
|
98
95
|
</div>
|
|
99
96
|
)}
|
|
100
97
|
|
|
@@ -153,12 +150,9 @@ function WorkspaceCard({ workspace }: WorkspaceCardProps) {
|
|
|
153
150
|
const meta = formatAddedAt(workspace.addedAt)
|
|
154
151
|
|
|
155
152
|
return (
|
|
156
|
-
<
|
|
153
|
+
<Link
|
|
157
154
|
href={`/workspace/${workspace.id}`}
|
|
158
|
-
className=
|
|
159
|
-
'group flex min-w-0 flex-col gap-4 rounded-xl border border-border bg-card p-2 hover:shadow-sm',
|
|
160
|
-
'transition-colors'
|
|
161
|
-
)}
|
|
155
|
+
className="group flex min-w-0 flex-col gap-4 rounded-xl bg-card p-2 shadow-xs transition-shadow hover:shadow-sm"
|
|
162
156
|
>
|
|
163
157
|
<WorkspacePreview workspaceId={workspace.id} />
|
|
164
158
|
<div className="flex min-w-0 flex-col px-2 pb-2">
|
|
@@ -175,7 +169,7 @@ function WorkspaceCard({ workspace }: WorkspaceCardProps) {
|
|
|
175
169
|
</div>
|
|
176
170
|
<div className="mt-2 text-xs text-muted-foreground">{meta}</div>
|
|
177
171
|
</div>
|
|
178
|
-
</
|
|
172
|
+
</Link>
|
|
179
173
|
)
|
|
180
174
|
}
|
|
181
175
|
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { IconGhost } from '@tabler/icons-react'
|
|
2
2
|
|
|
3
3
|
import { useWorkspacePreview } from './api'
|
|
4
|
+
import { cn } from '@/client/lib/cn'
|
|
4
5
|
|
|
5
6
|
type WorkspacePreviewProps = {
|
|
6
7
|
workspaceId: string
|
|
@@ -15,13 +16,19 @@ export function WorkspacePreview({ workspaceId }: WorkspacePreviewProps) {
|
|
|
15
16
|
const hasItems = items.length > 0 && rows > 0
|
|
16
17
|
const isEmpty = query.data !== undefined && !hasItems
|
|
17
18
|
|
|
19
|
+
const overflows = rows > cols
|
|
20
|
+
|
|
18
21
|
return (
|
|
19
|
-
<div
|
|
22
|
+
<div
|
|
23
|
+
className={cn(
|
|
24
|
+
'flex aspect-square w-full justify-center overflow-hidden rounded-sm bg-muted p-3',
|
|
25
|
+
overflows ? 'items-start' : 'items-center'
|
|
26
|
+
)}
|
|
27
|
+
>
|
|
20
28
|
{hasItems && (
|
|
21
29
|
<svg
|
|
22
30
|
viewBox={`0 0 ${cols} ${rows}`}
|
|
23
|
-
|
|
24
|
-
className="size-full animate-in duration-300 fade-in"
|
|
31
|
+
className="w-full shrink-0 animate-in duration-300 fade-in"
|
|
25
32
|
>
|
|
26
33
|
{items.map((item, i) => (
|
|
27
34
|
<rect
|
|
@@ -37,7 +44,7 @@ export function WorkspacePreview({ workspaceId }: WorkspacePreviewProps) {
|
|
|
37
44
|
</svg>
|
|
38
45
|
)}
|
|
39
46
|
{isEmpty && (
|
|
40
|
-
<
|
|
47
|
+
<IconGhost
|
|
41
48
|
size={20}
|
|
42
49
|
stroke={1.5}
|
|
43
50
|
className="animate-in text-muted-foreground/40 duration-300 fade-in"
|
|
@@ -47,7 +47,7 @@ export function useAddWorkspace() {
|
|
|
47
47
|
const queryClient = useQueryClient()
|
|
48
48
|
return useMutation<WorkspaceEntry, Error, DiscoveredWorkspace>({
|
|
49
49
|
mutationFn: discovered =>
|
|
50
|
-
requestJson('/api/workspaces', jsonRequest('POST', discovered), 'Failed to add
|
|
50
|
+
requestJson('/api/workspaces', jsonRequest('POST', discovered), 'Failed to add workspace'),
|
|
51
51
|
onSuccess: (entry, suggestion) => {
|
|
52
52
|
queryClient.setQueryData<WorkspaceEntry[]>(workspaceKeys.all, previous =>
|
|
53
53
|
upsertWorkspaceEntry(previous, entry)
|
|
@@ -91,7 +91,11 @@ export function useCreateWorkspace() {
|
|
|
91
91
|
const queryClient = useQueryClient()
|
|
92
92
|
return useMutation<WorkspaceEntry, Error, CreateWorkspaceInput>({
|
|
93
93
|
mutationFn: input =>
|
|
94
|
-
requestJson(
|
|
94
|
+
requestJson(
|
|
95
|
+
'/api/workspaces/create',
|
|
96
|
+
jsonRequest('POST', input),
|
|
97
|
+
'Failed to create workspace'
|
|
98
|
+
),
|
|
95
99
|
onSuccess: entry => {
|
|
96
100
|
queryClient.setQueryData<WorkspaceEntry[]>(workspaceKeys.all, previous => [
|
|
97
101
|
...(previous ?? []),
|
|
@@ -137,7 +141,11 @@ export function useRemoveWorkspace() {
|
|
|
137
141
|
const queryClient = useQueryClient()
|
|
138
142
|
return useMutation<void, Error, string>({
|
|
139
143
|
mutationFn: workspaceId =>
|
|
140
|
-
requestVoid(
|
|
144
|
+
requestVoid(
|
|
145
|
+
`/api/workspaces/${workspaceId}`,
|
|
146
|
+
{ method: 'DELETE' },
|
|
147
|
+
'Failed to remove workspace'
|
|
148
|
+
),
|
|
141
149
|
onSuccess: (_result, workspaceId) => {
|
|
142
150
|
queryClient.setQueryData<WorkspaceEntry[]>(workspaceKeys.all, previous =>
|
|
143
151
|
(previous ?? []).filter(workspace => workspace.id !== workspaceId)
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import claudeIcon from '@/client/assets/claude.svg'
|
|
2
|
-
import
|
|
2
|
+
import openaiIcon from '@/client/assets/openai.svg'
|
|
3
3
|
import openclawIcon from '@/client/assets/openclaw.svg'
|
|
4
4
|
import { cn } from '@/client/lib/cn'
|
|
5
5
|
import type { DiscoveredWorkspace, WorkspaceEntry, WorkspaceType } from '@/lib/types'
|
|
@@ -7,13 +7,13 @@ import type { DiscoveredWorkspace, WorkspaceEntry, WorkspaceType } from '@/lib/t
|
|
|
7
7
|
export const workspaceProviderIcon: Record<WorkspaceType, string> = {
|
|
8
8
|
'claude-code': claudeIcon,
|
|
9
9
|
openclaw: openclawIcon,
|
|
10
|
-
|
|
10
|
+
codex: openaiIcon
|
|
11
11
|
}
|
|
12
12
|
|
|
13
13
|
export const workspaceTypeLabel: Record<WorkspaceType, string> = {
|
|
14
|
-
'claude-code': 'Claude
|
|
14
|
+
'claude-code': 'Claude',
|
|
15
15
|
openclaw: 'OpenClaw',
|
|
16
|
-
|
|
16
|
+
codex: 'Codex'
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
type WorkspaceTypeIconProps = {
|
|
@@ -27,7 +27,7 @@ export function GeneralSettings() {
|
|
|
27
27
|
|
|
28
28
|
const remove = () => {
|
|
29
29
|
const label = name ?? cwd ?? 'this space'
|
|
30
|
-
const message = `Remove "${label}" from your
|
|
30
|
+
const message = `Remove "${label}" from your workspaces?\n\nThis only removes it from your list. The folder and its sessions stay on disk. You can add it back any time.`
|
|
31
31
|
if (!window.confirm(message)) return
|
|
32
32
|
removeWorkspace.mutate(workspaceId, { onSuccess: () => navigate('/') })
|
|
33
33
|
}
|
|
@@ -37,7 +37,7 @@ export function GeneralSettings() {
|
|
|
37
37
|
<SettingsSection>
|
|
38
38
|
<SettingsRow
|
|
39
39
|
title="Name"
|
|
40
|
-
description="Shown in the sidebar and the
|
|
40
|
+
description="Shown in the sidebar and the workspace header."
|
|
41
41
|
control={
|
|
42
42
|
<Input
|
|
43
43
|
value={draft}
|
|
@@ -65,7 +65,7 @@ export function GeneralSettings() {
|
|
|
65
65
|
<SettingsSection label="Danger zone">
|
|
66
66
|
<SettingsRow
|
|
67
67
|
title="Remove space"
|
|
68
|
-
description="Remove this space from
|
|
68
|
+
description="Remove this space from moi. Its folder and sessions stay on disk."
|
|
69
69
|
control={
|
|
70
70
|
<Button
|
|
71
71
|
type="button"
|
|
@@ -17,6 +17,7 @@ import {
|
|
|
17
17
|
import { useResetWorkspaceIcon, useSaveWorkspaceIcon } from '@/client/features/settings/api'
|
|
18
18
|
import { workspaceProviderIcon } from '@/client/features/home/workspace-presentation'
|
|
19
19
|
import { useWorkspaceLayoutCtx } from '@/client/features/workspace/WorkspaceLayoutContext'
|
|
20
|
+
import { APP_ICON_CHOICES } from '@/client/lib/app-icon-registry'
|
|
20
21
|
import { cn } from '@/client/lib/cn'
|
|
21
22
|
import {
|
|
22
23
|
GRADIENT_PRESETS,
|
|
@@ -26,7 +27,7 @@ import {
|
|
|
26
27
|
renderEmojiIcon,
|
|
27
28
|
renderGlyphIcon
|
|
28
29
|
} from '@/client/features/settings/render-icon'
|
|
29
|
-
import { EMOJI_FONT, FAVORITE_EMOJI
|
|
30
|
+
import { EMOJI_FONT, FAVORITE_EMOJI } from './icon-picker-options'
|
|
30
31
|
|
|
31
32
|
type Mode = 'emoji' | 'icon' | 'upload'
|
|
32
33
|
|
|
@@ -98,7 +99,7 @@ export function IconPicker({ icon }: IconPickerProps) {
|
|
|
98
99
|
const glyphRef = useRef<HTMLSpanElement>(null)
|
|
99
100
|
const uploadBlob = useRef<Blob | null>(null)
|
|
100
101
|
|
|
101
|
-
const selectedIcon =
|
|
102
|
+
const selectedIcon = APP_ICON_CHOICES.find(c => c.id === iconId)
|
|
102
103
|
const onGradient = bg.gradient !== null
|
|
103
104
|
const saving = savePending || resetPending
|
|
104
105
|
|
|
@@ -367,7 +368,7 @@ export function IconPicker({ icon }: IconPickerProps) {
|
|
|
367
368
|
</EmojiPicker.Root>
|
|
368
369
|
) : mode === 'icon' ? (
|
|
369
370
|
<div className="grid scrollbar-thin h-72 grid-cols-[repeat(auto-fill,minmax(2.25rem,1fr))] content-start gap-1 overflow-y-auto rounded-lg border border-border bg-background p-1.5">
|
|
370
|
-
{
|
|
371
|
+
{APP_ICON_CHOICES.map(({ id, Icon }) => (
|
|
371
372
|
<button
|
|
372
373
|
key={id}
|
|
373
374
|
type="button"
|