moi-computer 0.9.1-next.4 → 0.10.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 +124 -58
- package/client/app/shell/SidebarLayout.tsx +114 -69
- package/client/assets/floppy-disk.webp +0 -0
- package/client/assets.d.ts +5 -0
- package/client/components/ui/button.tsx +2 -1
- package/client/features/chat/ChatEmptyState.tsx +70 -34
- package/client/features/chat/ChatPanel.tsx +8 -1
- package/client/features/chat/chat-store.ts +4 -0
- package/client/features/chat/tool-group/format/claude.ts +2 -1
- package/client/features/chat/tool-group/format/codex.ts +2 -1
- package/client/features/chat/tool-group/format/hermes.ts +2 -1
- package/client/features/chat/tool-group/format/mcp.ts +7 -3
- package/client/features/chat/tool-group/format/openclaw.ts +6 -2
- package/client/features/chat/tool-group/format/shell.ts +162 -0
- package/client/features/dev/DevIndexPage.tsx +5 -0
- package/client/features/dev/DevRoutes.tsx +2 -0
- package/client/features/dev/TextureLabPage.tsx +149 -0
- package/client/features/home/HomePage.tsx +5 -5
- package/client/features/home/workspace-setup/CreateWorkspaceDialog.tsx +3 -3
- package/client/features/home/workspace-setup/DemoDialog.tsx +239 -0
- package/client/features/home/workspace-setup/WorkspaceAgentStep.tsx +22 -5
- package/client/features/settings/GeneralSettings.tsx +27 -23
- package/client/features/update/Update.tsx +78 -0
- package/client/features/update/api.ts +35 -0
- package/client/features/widgets/WidgetFrame.tsx +1 -0
- package/client/features/workspace/WorkspaceScreen.tsx +15 -0
- package/client/index.css +2 -2
- package/client/runtime/workspace-theme.ts +12 -4
- package/client/theme.css +26 -22
- package/dist/{chunk-zbt8emsw.js → chunk-0set7tmf.js} +2 -2
- package/dist/chunk-4057kxht.css +1 -0
- package/dist/{chunk-zcyvyebg.js → chunk-5t06zksf.js} +2 -2
- package/dist/{chunk-zbeq02yc.js → chunk-97eg9mjn.js} +1 -1
- package/dist/chunk-b5c62p8h.js +1 -0
- package/dist/chunk-dfe7qnrp.js +1 -0
- package/dist/{chunk-b959mdkj.js → chunk-efdyz6xp.js} +1 -1
- package/dist/chunk-f6xmz3tn.js +83 -0
- package/dist/chunk-h2kj1ysj.js +1 -0
- package/dist/{chunk-zfz3b4xg.js → chunk-ht1f95h9.js} +2 -2
- package/dist/chunk-qtc5a8qa.js +10 -0
- package/dist/floppy-disk-wmjs0n85.webp +0 -0
- package/dist/index.html +1 -1
- package/lib/ids.ts +27 -0
- package/lib/themes.ts +12 -12
- package/lib/types.ts +11 -2
- package/lib/update.ts +2 -0
- package/package.json +2 -1
- package/server/api.ts +47 -1
- package/server/app-config.ts +2 -2
- package/server/bundler/build-applet.ts +2 -3
- package/server/cli.ts +30 -7
- package/server/constants.ts +4 -2
- package/server/registry.ts +37 -2
- package/server/update.ts +293 -5
- package/server/web.ts +1 -1
- package/client/features/home/workspace-setup/InstallMoiDialog.tsx +0 -245
- package/dist/chunk-87q78504.js +0 -1
- package/dist/chunk-8s41nd3g.js +0 -1
- package/dist/chunk-cagtq45k.js +0 -1
- package/dist/chunk-ek6zde7t.js +0 -10
- package/dist/chunk-n8tq2494.js +0 -82
- package/dist/chunk-v82nefjq.css +0 -1
package/server/update.ts
CHANGED
|
@@ -1,12 +1,17 @@
|
|
|
1
|
-
// `moi update` mechanics
|
|
2
|
-
//
|
|
3
|
-
// update through it
|
|
4
|
-
//
|
|
1
|
+
// Shared `moi update` mechanics for the CLI and the local web UI: check the npm
|
|
2
|
+
// registry, find the package manager that owns the current global install, and
|
|
3
|
+
// update through it so no second shadowing install appears. Checks may run in
|
|
4
|
+
// the background; installing always requires an explicit user action.
|
|
5
5
|
import { realpathSync } from 'node:fs'
|
|
6
6
|
|
|
7
|
-
import {
|
|
7
|
+
import type { SessionActivity, UpdateResult, UpdateStatus } from '@/lib/types'
|
|
8
|
+
|
|
9
|
+
import { analyzeInstall } from './service'
|
|
10
|
+
import type { InstallAnalysis } from './service'
|
|
11
|
+
import { PACKAGE_ROOT, VERSION, isPrerelease } from './version'
|
|
8
12
|
|
|
9
13
|
export const PACKAGE_NAME = 'moi-computer'
|
|
14
|
+
export const UPDATE_RESTART_EXIT_CODE = 75
|
|
10
15
|
|
|
11
16
|
// Test seam: point at a local mock registry (`MOI_NPM_REGISTRY`).
|
|
12
17
|
function registryBase(): string {
|
|
@@ -139,3 +144,286 @@ export async function installedBinVersion(bin: string): Promise<string | null> {
|
|
|
139
144
|
return null
|
|
140
145
|
}
|
|
141
146
|
}
|
|
147
|
+
|
|
148
|
+
type ServerProcess = {
|
|
149
|
+
exited: Promise<number>
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
// A service manager already respawns failed exits. Foreground launchers use
|
|
153
|
+
// the same exit code to replace their server child with the updated install.
|
|
154
|
+
export async function superviseServerUpdates(
|
|
155
|
+
child: ServerProcess,
|
|
156
|
+
respawn: () => ServerProcess
|
|
157
|
+
): Promise<number> {
|
|
158
|
+
let exitCode = await child.exited
|
|
159
|
+
while (exitCode === UPDATE_RESTART_EXIT_CODE) {
|
|
160
|
+
child = respawn()
|
|
161
|
+
exitCode = await child.exited
|
|
162
|
+
}
|
|
163
|
+
return exitCode
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
type UpdateOptions = {
|
|
167
|
+
runningVersion?: string
|
|
168
|
+
analysis?: InstallAnalysis
|
|
169
|
+
fetchLatest?: () => Promise<string>
|
|
170
|
+
detectManager?: () => Promise<PackageManager | null>
|
|
171
|
+
runManager?: (argv: string[]) => Promise<number>
|
|
172
|
+
readInstalledVersion?: (bin: string) => Promise<string | null>
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
// Both of these describe where this process was installed from, which cannot
|
|
176
|
+
// change while it runs — and `detectPackageManager` may spawn `npm root -g`, a
|
|
177
|
+
// whole Node process. Probe each once and reuse the answer for every later
|
|
178
|
+
// check; the promise (not the value) is memoized so concurrent callers share
|
|
179
|
+
// the one probe. `null` is a real answer here — an install nobody owns stays
|
|
180
|
+
// unowned — so it is cached like any other.
|
|
181
|
+
let installAnalysis: InstallAnalysis | null = null
|
|
182
|
+
let managerProbe: Promise<PackageManager | null> | null = null
|
|
183
|
+
|
|
184
|
+
export function ownInstall(): InstallAnalysis {
|
|
185
|
+
return (installAnalysis ??= analyzeInstall())
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
export function owningManager(): Promise<PackageManager | null> {
|
|
189
|
+
return (managerProbe ??= detectPackageManager())
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
type AvailableUpdate = {
|
|
193
|
+
version: string
|
|
194
|
+
packageManager: PackageManager
|
|
195
|
+
bin: string
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
export function hasRunningAgentSessions(sessions: { activity: SessionActivity }[]): boolean {
|
|
199
|
+
return sessions.some(session => session.activity === 'running')
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
async function findAvailableUpdate(options: UpdateOptions): Promise<AvailableUpdate | null> {
|
|
203
|
+
const runningVersion = options.runningVersion ?? VERSION
|
|
204
|
+
const analysis = options.analysis ?? ownInstall()
|
|
205
|
+
if (analysis.kind !== 'global' || isPrerelease(runningVersion)) return null
|
|
206
|
+
const version = await (options.fetchLatest ?? fetchLatestVersion)()
|
|
207
|
+
if (!isNewer(version, runningVersion)) return null
|
|
208
|
+
const packageManager = await (options.detectManager ?? owningManager)()
|
|
209
|
+
return packageManager ? { version, packageManager, bin: analysis.bin } : null
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
// Background checks stay quiet: every failure reads to the UI as "nothing to
|
|
213
|
+
// install". The cache still needs to tell the two apart — an unreachable
|
|
214
|
+
// registry should be retried in minutes, a successful "you are current" in
|
|
215
|
+
// hours — so the outcome carries `ok` alongside the status the UI sees.
|
|
216
|
+
type CheckOutcome = { ok: boolean; status: UpdateStatus }
|
|
217
|
+
|
|
218
|
+
async function checkForUpdate(options: UpdateOptions): Promise<CheckOutcome> {
|
|
219
|
+
const runningVersion = options.runningVersion ?? VERSION
|
|
220
|
+
try {
|
|
221
|
+
const update = await findAvailableUpdate(options)
|
|
222
|
+
return { ok: true, status: { runningVersion, availableVersion: update?.version ?? null } }
|
|
223
|
+
} catch {
|
|
224
|
+
return { ok: false, status: { runningVersion, availableVersion: null } }
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
// One uncached check. The cached path below is what the API serves.
|
|
229
|
+
export async function getUpdateStatus(options: UpdateOptions = {}): Promise<UpdateStatus> {
|
|
230
|
+
return (await checkForUpdate(options)).status
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
// ---- cached status ----------------------------------------------------------
|
|
234
|
+
|
|
235
|
+
// There is deliberately no background timer. The check runs when a client asks
|
|
236
|
+
// and the cached answer has aged out, which means: a closed app makes no
|
|
237
|
+
// network calls at all, the cost stays flat no matter how many tabs or reloads
|
|
238
|
+
// there are, and a machine waking from sleep does exactly one check on the next
|
|
239
|
+
// poll instead of firing into a network stack that is not up yet.
|
|
240
|
+
export type UpdateTimings = {
|
|
241
|
+
// Nothing is checked this early into the process — one grace window per
|
|
242
|
+
// server boot, not per tab, so a burst of reloads cannot compound it.
|
|
243
|
+
bootGraceMs: number
|
|
244
|
+
// How long a successful answer is served before it is refreshed.
|
|
245
|
+
cacheTtlMs: number
|
|
246
|
+
// How long a *failed* check is remembered. Without this the client's poll
|
|
247
|
+
// interval becomes the retry interval and an offline machine hammers the
|
|
248
|
+
// registry all day.
|
|
249
|
+
failureBackoffMs: number
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
export const UPDATE_BOOT_GRACE_MS = 60_000
|
|
253
|
+
export const UPDATE_CACHE_TTL_MS = 60 * 60 * 1000
|
|
254
|
+
export const UPDATE_FAILURE_BACKOFF_MS = 5 * 60 * 1000
|
|
255
|
+
|
|
256
|
+
// Test seams (`MOI_UPDATE_*_MS`): the e2e drives real HTTP against a spawned
|
|
257
|
+
// server, so it needs these compressed to milliseconds.
|
|
258
|
+
function envMs(name: string, fallback: number): number {
|
|
259
|
+
const raw = Number(process.env[name])
|
|
260
|
+
return Number.isFinite(raw) && raw >= 0 ? raw : fallback
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
function defaultTimings(): UpdateTimings {
|
|
264
|
+
return {
|
|
265
|
+
bootGraceMs: envMs('MOI_UPDATE_BOOT_GRACE_MS', UPDATE_BOOT_GRACE_MS),
|
|
266
|
+
cacheTtlMs: envMs('MOI_UPDATE_CACHE_TTL_MS', UPDATE_CACHE_TTL_MS),
|
|
267
|
+
failureBackoffMs: envMs('MOI_UPDATE_FAILURE_BACKOFF_MS', UPDATE_FAILURE_BACKOFF_MS)
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
type StatusCache = {
|
|
272
|
+
status: UpdateStatus
|
|
273
|
+
attemptedAt: number
|
|
274
|
+
ok: boolean
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
type CachedStatusOptions = UpdateOptions & {
|
|
278
|
+
now?: () => number
|
|
279
|
+
uptimeMs?: () => number
|
|
280
|
+
timings?: Partial<UpdateTimings>
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
let statusCache: StatusCache | null = null
|
|
284
|
+
let statusInFlight: Promise<UpdateStatus> | null = null
|
|
285
|
+
|
|
286
|
+
// Wall-clock deltas only ever widen an interval here. A clock that jumped
|
|
287
|
+
// backwards (an NTP correction after sleep is the usual cause) would otherwise
|
|
288
|
+
// read as "checked in the future" and pin the cache forever, so treat it as
|
|
289
|
+
// infinitely old: the cost of being wrong is one extra check.
|
|
290
|
+
function elapsed(since: number, now: number): number {
|
|
291
|
+
return now >= since ? now - since : Number.POSITIVE_INFINITY
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
function needsRefresh(
|
|
295
|
+
cache: StatusCache | null,
|
|
296
|
+
now: number,
|
|
297
|
+
uptime: number,
|
|
298
|
+
timings: UpdateTimings
|
|
299
|
+
): boolean {
|
|
300
|
+
if (uptime < timings.bootGraceMs) return false
|
|
301
|
+
if (!cache) return true
|
|
302
|
+
const age = elapsed(cache.attemptedAt, now)
|
|
303
|
+
return age >= (cache.ok ? timings.cacheTtlMs : timings.failureBackoffMs)
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
// What `GET /api/update` serves: the cached answer, refreshed lazily. Callers
|
|
307
|
+
// that arrive together share one refresh, so N tabs crossing the TTL boundary
|
|
308
|
+
// at the same moment produce one registry request, not N.
|
|
309
|
+
export async function getCachedUpdateStatus(
|
|
310
|
+
options: CachedStatusOptions = {}
|
|
311
|
+
): Promise<UpdateStatus> {
|
|
312
|
+
const now = (options.now ?? Date.now)()
|
|
313
|
+
const uptime = (options.uptimeMs ?? defaultUptimeMs)()
|
|
314
|
+
const timings = { ...defaultTimings(), ...options.timings }
|
|
315
|
+
|
|
316
|
+
if (!needsRefresh(statusCache, now, uptime, timings)) {
|
|
317
|
+
return (
|
|
318
|
+
statusCache?.status ?? {
|
|
319
|
+
runningVersion: options.runningVersion ?? VERSION,
|
|
320
|
+
availableVersion: null
|
|
321
|
+
}
|
|
322
|
+
)
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
statusInFlight ??= checkForUpdate(options)
|
|
326
|
+
.then(outcome => {
|
|
327
|
+
statusCache = { status: outcome.status, attemptedAt: now, ok: outcome.ok }
|
|
328
|
+
return outcome.status
|
|
329
|
+
})
|
|
330
|
+
.finally(() => {
|
|
331
|
+
statusInFlight = null
|
|
332
|
+
})
|
|
333
|
+
return statusInFlight
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
function defaultUptimeMs(): number {
|
|
337
|
+
return process.uptime() * 1000
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
async function performUpdate(options: UpdateOptions): Promise<UpdateResult | null> {
|
|
341
|
+
const update = await findAvailableUpdate(options)
|
|
342
|
+
if (!update) return null
|
|
343
|
+
|
|
344
|
+
const argv = updateArgv(update.packageManager, update.version)
|
|
345
|
+
const exitCode = await (options.runManager ?? runPackageManager)(argv)
|
|
346
|
+
if (exitCode !== 0) {
|
|
347
|
+
throw new Error(
|
|
348
|
+
`${update.packageManager} exited with code ${exitCode}. Run \`moi update\` in a terminal for details.`
|
|
349
|
+
)
|
|
350
|
+
}
|
|
351
|
+
const installedVersion = await (options.readInstalledVersion ?? installedBinVersion)(update.bin)
|
|
352
|
+
if (installedVersion !== update.version) {
|
|
353
|
+
const detail = installedVersion
|
|
354
|
+
? `The moi command reports v${installedVersion} instead of v${update.version}.`
|
|
355
|
+
: 'Could not verify the updated moi command.'
|
|
356
|
+
throw new Error(`${detail} Run \`moi update\` in a terminal for details.`)
|
|
357
|
+
}
|
|
358
|
+
return { installedVersion }
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
// Multiple open browser tabs share one install. They also share this promise,
|
|
362
|
+
// so two clicks never launch two global package-manager processes. A successful
|
|
363
|
+
// result stays cached for the few milliseconds until the server restarts.
|
|
364
|
+
//
|
|
365
|
+
// This guards this process only. A `moi update` run in a terminal while the UI
|
|
366
|
+
// installs is still two package managers writing one global tree; that needs a
|
|
367
|
+
// lock file both entry points take, which is not here yet.
|
|
368
|
+
let installInFlight: Promise<UpdateResult | null> | null = null
|
|
369
|
+
|
|
370
|
+
// Lets the API answer a second click with "already in progress" instead of
|
|
371
|
+
// silently reporting someone else's install as its own. Stays true once an
|
|
372
|
+
// install succeeds — the restart it scheduled has not landed yet, and
|
|
373
|
+
// `restartPendingForUpdate` tells those two states apart.
|
|
374
|
+
export function updateInProgress(): boolean {
|
|
375
|
+
return installInFlight !== null
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
export function installUpdate(options: UpdateOptions = {}): Promise<UpdateResult | null> {
|
|
379
|
+
installInFlight ??= performUpdate(options).then(
|
|
380
|
+
result => {
|
|
381
|
+
if (!result) installInFlight = null
|
|
382
|
+
// The install just invalidated whatever the cache says is available.
|
|
383
|
+
else statusCache = null
|
|
384
|
+
return result
|
|
385
|
+
},
|
|
386
|
+
error => {
|
|
387
|
+
installInFlight = null
|
|
388
|
+
throw error
|
|
389
|
+
}
|
|
390
|
+
)
|
|
391
|
+
return installInFlight
|
|
392
|
+
}
|
|
393
|
+
|
|
394
|
+
// ---- restart ----------------------------------------------------------------
|
|
395
|
+
|
|
396
|
+
// Long enough for the HTTP response that triggered it to be flushed to the
|
|
397
|
+
// browser that clicked — it is that response the client waits on before it
|
|
398
|
+
// starts polling for the restarted server.
|
|
399
|
+
export const UPDATE_RESTART_DELAY_MS = 500
|
|
400
|
+
|
|
401
|
+
let restartScheduled = false
|
|
402
|
+
|
|
403
|
+
export function restartPendingForUpdate(): boolean {
|
|
404
|
+
return restartScheduled
|
|
405
|
+
}
|
|
406
|
+
|
|
407
|
+
// Hand the process back to whoever supervises it: the foreground CLI
|
|
408
|
+
// (`superviseServerUpdates`) and service managers alike bring it back on a
|
|
409
|
+
// non-zero exit, and 75 is the code they agree means "updated, come back".
|
|
410
|
+
// Latched, so concurrent callers schedule one SIGTERM rather than one each.
|
|
411
|
+
export function scheduleRestartForUpdate(delayMs = UPDATE_RESTART_DELAY_MS): boolean {
|
|
412
|
+
if (restartScheduled) return false
|
|
413
|
+
restartScheduled = true
|
|
414
|
+
const timer = setTimeout(() => {
|
|
415
|
+
process.exitCode = UPDATE_RESTART_EXIT_CODE
|
|
416
|
+
process.kill(process.pid, 'SIGTERM')
|
|
417
|
+
}, delayMs)
|
|
418
|
+
timer.unref()
|
|
419
|
+
return true
|
|
420
|
+
}
|
|
421
|
+
|
|
422
|
+
export function __resetUpdateStateForTests(): void {
|
|
423
|
+
installInFlight = null
|
|
424
|
+
statusCache = null
|
|
425
|
+
statusInFlight = null
|
|
426
|
+
installAnalysis = null
|
|
427
|
+
managerProbe = null
|
|
428
|
+
restartScheduled = false
|
|
429
|
+
}
|
package/server/web.ts
CHANGED
|
@@ -1,245 +0,0 @@
|
|
|
1
|
-
import { type ReactElement, useEffect, useState } from 'react'
|
|
2
|
-
|
|
3
|
-
import {
|
|
4
|
-
IconArrowUpRight,
|
|
5
|
-
IconCheck,
|
|
6
|
-
IconCopy,
|
|
7
|
-
IconFolders,
|
|
8
|
-
IconTerminal2,
|
|
9
|
-
IconX
|
|
10
|
-
} from '@tabler/icons-react'
|
|
11
|
-
|
|
12
|
-
import claudeIcon from '@/client/assets/claude.svg'
|
|
13
|
-
import hermesIcon from '@/client/assets/hermes.png'
|
|
14
|
-
import openaiIcon from '@/client/assets/openai.svg'
|
|
15
|
-
import openclawIcon from '@/client/assets/openclaw.svg'
|
|
16
|
-
import { Button } from '@/client/components/ui/button'
|
|
17
|
-
import {
|
|
18
|
-
Dialog,
|
|
19
|
-
DialogClose,
|
|
20
|
-
DialogContent,
|
|
21
|
-
DialogDescription,
|
|
22
|
-
DialogTitle,
|
|
23
|
-
DialogTrigger
|
|
24
|
-
} from '@/client/components/ui/dialog'
|
|
25
|
-
import { useAppConfig } from '@/client/api/app-config'
|
|
26
|
-
|
|
27
|
-
// The canonical setup prompt from moi.computer — pasted into any agent, it
|
|
28
|
-
// fetches INSTALL.md and walks itself through the install.
|
|
29
|
-
const AGENT_COMMAND =
|
|
30
|
-
'Set up the moi workspace for this project. Fetch https://moi.computer/INSTALL.md, and follow the steps.'
|
|
31
|
-
|
|
32
|
-
type InstallMoiDialogProps = {
|
|
33
|
-
// Trigger-owned (uncontrolled) or controlled via open/onOpenChange — the
|
|
34
|
-
// create-workspace buttons use the former, programmatic opens the latter.
|
|
35
|
-
trigger?: ReactElement
|
|
36
|
-
open?: boolean
|
|
37
|
-
onOpenChange?: (open: boolean) => void
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
// Shown in the cloud demo wherever a workspace would be created: the demo is
|
|
41
|
-
// limited to its built-in workspaces, and the way out is installing moi.
|
|
42
|
-
export function InstallMoiDialog({ trigger, open, onOpenChange }: InstallMoiDialogProps) {
|
|
43
|
-
return (
|
|
44
|
-
<Dialog open={open} onOpenChange={onOpenChange}>
|
|
45
|
-
{trigger && <DialogTrigger render={trigger} />}
|
|
46
|
-
<InstallMoiDialogContent />
|
|
47
|
-
</Dialog>
|
|
48
|
-
)
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
// Hero artwork: a floppy disk cropped by the band, on a soft gradient. The
|
|
52
|
-
// gradient's raw colors are a deliberate owner-approved exception to the
|
|
53
|
-
// semantic-token rule — this block is an illustration (constant across
|
|
54
|
-
// themes), not a UI surface.
|
|
55
|
-
function FloppyHero() {
|
|
56
|
-
return (
|
|
57
|
-
<div className="relative h-44 overflow-hidden rounded-lg bg-[#e6dcc4] bg-[image:radial-gradient(75%_110%_at_0%_0%,#e0742f_0%,rgba(224,116,47,0)_48%),radial-gradient(110%_160%_at_100%_0%,#16352a_0%,rgba(22,53,42,0)_60%),radial-gradient(70%_90%_at_90%_100%,#8fb492_0%,rgba(143,180,146,0)_55%),radial-gradient(60%_80%_at_8%_100%,#dcc294_0%,rgba(220,194,148,0)_52%)]">
|
|
58
|
-
<FloppyDisk className="absolute top-9 left-1/2 w-52 -translate-x-1/2 -rotate-6 drop-shadow-xl" />
|
|
59
|
-
{/* film grain, keeps the flat gradients from banding */}
|
|
60
|
-
<svg
|
|
61
|
-
className="absolute inset-0 size-full opacity-30 mix-blend-soft-light"
|
|
62
|
-
aria-hidden="true"
|
|
63
|
-
>
|
|
64
|
-
<filter id="floppy-grain">
|
|
65
|
-
<feTurbulence
|
|
66
|
-
type="fractalNoise"
|
|
67
|
-
baseFrequency="0.8"
|
|
68
|
-
numOctaves="2"
|
|
69
|
-
stitchTiles="stitch"
|
|
70
|
-
/>
|
|
71
|
-
</filter>
|
|
72
|
-
<rect width="100%" height="100%" filter="url(#floppy-grain)" />
|
|
73
|
-
</svg>
|
|
74
|
-
</div>
|
|
75
|
-
)
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
type FloppyDiskProps = {
|
|
79
|
-
className?: string
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
// Front view of a 3.5" floppy: shutter with window, insert arrow, label
|
|
83
|
-
// area, write-protect holes. Drawn inline so it stays crisp and asset-free.
|
|
84
|
-
function FloppyDisk({ className }: FloppyDiskProps) {
|
|
85
|
-
return (
|
|
86
|
-
<svg viewBox="0 0 200 200" aria-hidden="true" className={className}>
|
|
87
|
-
<defs>
|
|
88
|
-
<linearGradient id="floppy-shutter" x1="0" y1="0" x2="0" y2="1">
|
|
89
|
-
<stop offset="0" stopColor="#e3e3e1" />
|
|
90
|
-
<stop offset="0.5" stopColor="#c8c8c6" />
|
|
91
|
-
<stop offset="1" stopColor="#aeaeac" />
|
|
92
|
-
</linearGradient>
|
|
93
|
-
</defs>
|
|
94
|
-
{/* body with clipped top-right corner */}
|
|
95
|
-
<path
|
|
96
|
-
d="M14 2h146l26 26v160a10 10 0 0 1-10 10H14A10 10 0 0 1 4 188V12A10 10 0 0 1 14 2Z"
|
|
97
|
-
fill="#1a1b1d"
|
|
98
|
-
/>
|
|
99
|
-
<path
|
|
100
|
-
d="M14 2h146l26 26v160a10 10 0 0 1-10 10H14A10 10 0 0 1 4 188V12A10 10 0 0 1 14 2Z"
|
|
101
|
-
fill="none"
|
|
102
|
-
stroke="#ffffff"
|
|
103
|
-
strokeOpacity="0.08"
|
|
104
|
-
strokeWidth="1.5"
|
|
105
|
-
/>
|
|
106
|
-
{/* shutter */}
|
|
107
|
-
<path d="M64 2h96v66a6 6 0 0 1-6 6H70a6 6 0 0 1-6-6V2Z" fill="url(#floppy-shutter)" />
|
|
108
|
-
<rect x="116" y="12" width="28" height="52" rx="3" fill="#191a1c" />
|
|
109
|
-
{/* insert arrow */}
|
|
110
|
-
<path d="M26 30 34 16l8 14h-5v14h-6V30Z" fill="#0e0f10" />
|
|
111
|
-
{/* label area */}
|
|
112
|
-
<rect
|
|
113
|
-
x="22"
|
|
114
|
-
y="92"
|
|
115
|
-
width="156"
|
|
116
|
-
height="106"
|
|
117
|
-
rx="8"
|
|
118
|
-
fill="#202124"
|
|
119
|
-
stroke="#ffffff"
|
|
120
|
-
strokeOpacity="0.05"
|
|
121
|
-
/>
|
|
122
|
-
{/* write-protect holes */}
|
|
123
|
-
<rect x="14" y="168" width="13" height="13" rx="2" fill="#0c0d0e" />
|
|
124
|
-
<rect x="172" y="168" width="13" height="13" rx="2" fill="#0c0d0e" />
|
|
125
|
-
<rect x="175" y="171" width="7" height="7" rx="1" fill="#e6e6e4" />
|
|
126
|
-
</svg>
|
|
127
|
-
)
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
function useCopyCommand() {
|
|
131
|
-
const [copied, setCopied] = useState(false)
|
|
132
|
-
|
|
133
|
-
useEffect(() => {
|
|
134
|
-
if (!copied) return
|
|
135
|
-
const t = setTimeout(() => setCopied(false), 1500)
|
|
136
|
-
return () => clearTimeout(t)
|
|
137
|
-
}, [copied])
|
|
138
|
-
|
|
139
|
-
const copy = () => {
|
|
140
|
-
navigator.clipboard
|
|
141
|
-
?.writeText(AGENT_COMMAND)
|
|
142
|
-
.then(() => setCopied(true))
|
|
143
|
-
.catch(() => {})
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
return { copied, copy }
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
function InstallMoiDialogContent() {
|
|
150
|
-
const { demoInstallUrl } = useAppConfig()
|
|
151
|
-
const { copied, copy } = useCopyCommand()
|
|
152
|
-
|
|
153
|
-
return (
|
|
154
|
-
<DialogContent className="w-[calc(100%-2rem)] max-w-md">
|
|
155
|
-
<div className="p-2">
|
|
156
|
-
<FloppyHero />
|
|
157
|
-
</div>
|
|
158
|
-
<DialogClose
|
|
159
|
-
render={
|
|
160
|
-
<Button
|
|
161
|
-
variant="ghost"
|
|
162
|
-
size="icon-sm"
|
|
163
|
-
aria-label="Close"
|
|
164
|
-
className="absolute top-4 right-4 text-white hover:bg-white/20 hover:text-white"
|
|
165
|
-
>
|
|
166
|
-
<IconX stroke={1.75} />
|
|
167
|
-
</Button>
|
|
168
|
-
}
|
|
169
|
-
/>
|
|
170
|
-
|
|
171
|
-
<div className="flex flex-col gap-5 p-6 pt-3">
|
|
172
|
-
<div className="flex flex-col gap-0.5">
|
|
173
|
-
<DialogTitle>Use moi with your projects</DialogTitle>
|
|
174
|
-
<DialogDescription>
|
|
175
|
-
This demo comes with sample workspaces. Connect moi to your agent to unlock all
|
|
176
|
-
features.
|
|
177
|
-
</DialogDescription>
|
|
178
|
-
</div>
|
|
179
|
-
|
|
180
|
-
<ul className="flex flex-col gap-3">
|
|
181
|
-
<li className="flex items-center gap-3">
|
|
182
|
-
<span className="flex size-10 shrink-0 items-center justify-center rounded-lg bg-muted">
|
|
183
|
-
<IconFolders size={20} stroke={1.5} />
|
|
184
|
-
</span>
|
|
185
|
-
<span className="text-sm text-foreground">
|
|
186
|
-
Connect your own data and import existing projects
|
|
187
|
-
</span>
|
|
188
|
-
</li>
|
|
189
|
-
<li className="flex items-center gap-3">
|
|
190
|
-
<span className="flex size-10 shrink-0 items-center justify-center rounded-lg bg-muted">
|
|
191
|
-
<IconTerminal2 size={20} stroke={1.5} />
|
|
192
|
-
</span>
|
|
193
|
-
<span className="flex flex-wrap items-center gap-x-1 gap-y-0.5 text-sm text-foreground">
|
|
194
|
-
<span>Works with</span>
|
|
195
|
-
<span className="inline-flex items-center gap-1 font-medium">
|
|
196
|
-
<img src={claudeIcon} alt="" className="size-4 object-contain" />
|
|
197
|
-
Claude Code,
|
|
198
|
-
</span>
|
|
199
|
-
<span className="inline-flex items-center gap-1 font-medium">
|
|
200
|
-
<img src={openaiIcon} alt="" className="size-4 object-contain" />
|
|
201
|
-
Codex,
|
|
202
|
-
</span>
|
|
203
|
-
<span className="inline-flex items-center gap-1 font-medium">
|
|
204
|
-
<img src={hermesIcon} alt="" className="size-4 object-contain" />
|
|
205
|
-
Hermes,
|
|
206
|
-
</span>
|
|
207
|
-
<span className="inline-flex items-center gap-1 font-medium">
|
|
208
|
-
<img src={openclawIcon} alt="" className="size-4 object-contain" />
|
|
209
|
-
OpenClaw,
|
|
210
|
-
</span>
|
|
211
|
-
<span>and more.</span>
|
|
212
|
-
</span>
|
|
213
|
-
</li>
|
|
214
|
-
</ul>
|
|
215
|
-
|
|
216
|
-
<div className="flex flex-col gap-2">
|
|
217
|
-
<p className="text-sm text-muted-foreground">Paste this prompt into your agent:</p>
|
|
218
|
-
<div className="rounded-lg bg-muted p-3">
|
|
219
|
-
<code className="block font-mono text-sm leading-relaxed text-foreground">
|
|
220
|
-
{AGENT_COMMAND}
|
|
221
|
-
</code>
|
|
222
|
-
<div className="mt-5 flex flex-wrap items-center gap-2">
|
|
223
|
-
<Button type="button" onClick={copy}>
|
|
224
|
-
{copied ? (
|
|
225
|
-
<IconCheck data-icon="inline-start" stroke={1.5} />
|
|
226
|
-
) : (
|
|
227
|
-
<IconCopy data-icon="inline-start" stroke={1.5} />
|
|
228
|
-
)}
|
|
229
|
-
{copied ? 'Copied' : 'Copy installation prompt'}
|
|
230
|
-
</Button>
|
|
231
|
-
<Button
|
|
232
|
-
variant="secondary"
|
|
233
|
-
nativeButton={false}
|
|
234
|
-
render={<a href={demoInstallUrl} target="_blank" rel="noreferrer" />}
|
|
235
|
-
>
|
|
236
|
-
Learn more
|
|
237
|
-
<IconArrowUpRight data-icon="inline-end" stroke={1.5} />
|
|
238
|
-
</Button>
|
|
239
|
-
</div>
|
|
240
|
-
</div>
|
|
241
|
-
</div>
|
|
242
|
-
</div>
|
|
243
|
-
</DialogContent>
|
|
244
|
-
)
|
|
245
|
-
}
|
package/dist/chunk-87q78504.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{Vc as r}from"/chunk-zbeq02yc.js";if(typeof globalThis.structuredClone==="function")globalThis.structuredClone=globalThis.structuredClone.bind(globalThis);async function o(a){let[{mount:t}]=await Promise.all([import("/chunk-n8tq2494.js"),import("/chunk-cagtq45k.js").then((e)=>e.loadAppConfig())]);t(a)}globalThis.__init=o;
|
package/dist/chunk-8s41nd3g.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a}from"/chunk-pcnahct1.js";import"/chunk-zbeq02yc.js";export{a as sanitizeSvg};
|
package/dist/chunk-cagtq45k.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{Mc as a,Nc as b}from"/chunk-zbt8emsw.js";import"/chunk-zfz3b4xg.js";import"/chunk-zbeq02yc.js";export{b as useAppConfig,a as loadAppConfig};
|