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.
Files changed (62) hide show
  1. package/README.md +124 -58
  2. package/client/app/shell/SidebarLayout.tsx +114 -69
  3. package/client/assets/floppy-disk.webp +0 -0
  4. package/client/assets.d.ts +5 -0
  5. package/client/components/ui/button.tsx +2 -1
  6. package/client/features/chat/ChatEmptyState.tsx +70 -34
  7. package/client/features/chat/ChatPanel.tsx +8 -1
  8. package/client/features/chat/chat-store.ts +4 -0
  9. package/client/features/chat/tool-group/format/claude.ts +2 -1
  10. package/client/features/chat/tool-group/format/codex.ts +2 -1
  11. package/client/features/chat/tool-group/format/hermes.ts +2 -1
  12. package/client/features/chat/tool-group/format/mcp.ts +7 -3
  13. package/client/features/chat/tool-group/format/openclaw.ts +6 -2
  14. package/client/features/chat/tool-group/format/shell.ts +162 -0
  15. package/client/features/dev/DevIndexPage.tsx +5 -0
  16. package/client/features/dev/DevRoutes.tsx +2 -0
  17. package/client/features/dev/TextureLabPage.tsx +149 -0
  18. package/client/features/home/HomePage.tsx +5 -5
  19. package/client/features/home/workspace-setup/CreateWorkspaceDialog.tsx +3 -3
  20. package/client/features/home/workspace-setup/DemoDialog.tsx +239 -0
  21. package/client/features/home/workspace-setup/WorkspaceAgentStep.tsx +22 -5
  22. package/client/features/settings/GeneralSettings.tsx +27 -23
  23. package/client/features/update/Update.tsx +78 -0
  24. package/client/features/update/api.ts +35 -0
  25. package/client/features/widgets/WidgetFrame.tsx +1 -0
  26. package/client/features/workspace/WorkspaceScreen.tsx +15 -0
  27. package/client/index.css +2 -2
  28. package/client/runtime/workspace-theme.ts +12 -4
  29. package/client/theme.css +26 -22
  30. package/dist/{chunk-zbt8emsw.js → chunk-0set7tmf.js} +2 -2
  31. package/dist/chunk-4057kxht.css +1 -0
  32. package/dist/{chunk-zcyvyebg.js → chunk-5t06zksf.js} +2 -2
  33. package/dist/{chunk-zbeq02yc.js → chunk-97eg9mjn.js} +1 -1
  34. package/dist/chunk-b5c62p8h.js +1 -0
  35. package/dist/chunk-dfe7qnrp.js +1 -0
  36. package/dist/{chunk-b959mdkj.js → chunk-efdyz6xp.js} +1 -1
  37. package/dist/chunk-f6xmz3tn.js +83 -0
  38. package/dist/chunk-h2kj1ysj.js +1 -0
  39. package/dist/{chunk-zfz3b4xg.js → chunk-ht1f95h9.js} +2 -2
  40. package/dist/chunk-qtc5a8qa.js +10 -0
  41. package/dist/floppy-disk-wmjs0n85.webp +0 -0
  42. package/dist/index.html +1 -1
  43. package/lib/ids.ts +27 -0
  44. package/lib/themes.ts +12 -12
  45. package/lib/types.ts +11 -2
  46. package/lib/update.ts +2 -0
  47. package/package.json +2 -1
  48. package/server/api.ts +47 -1
  49. package/server/app-config.ts +2 -2
  50. package/server/bundler/build-applet.ts +2 -3
  51. package/server/cli.ts +30 -7
  52. package/server/constants.ts +4 -2
  53. package/server/registry.ts +37 -2
  54. package/server/update.ts +293 -5
  55. package/server/web.ts +1 -1
  56. package/client/features/home/workspace-setup/InstallMoiDialog.tsx +0 -245
  57. package/dist/chunk-87q78504.js +0 -1
  58. package/dist/chunk-8s41nd3g.js +0 -1
  59. package/dist/chunk-cagtq45k.js +0 -1
  60. package/dist/chunk-ek6zde7t.js +0 -10
  61. package/dist/chunk-n8tq2494.js +0 -82
  62. package/dist/chunk-v82nefjq.css +0 -1
@@ -0,0 +1,35 @@
1
+ import { useMutation, useQuery } from '@tanstack/react-query'
2
+
3
+ import { requestJson } from '@/client/api/http'
4
+ import type { UpdateResult, UpdateStatus } from '@/lib/types'
5
+
6
+ export const updateKey = ['update'] as const
7
+
8
+ // The server decides how often the npm registry is actually consulted and
9
+ // serves a cached answer in between, so polling here is a local memory read.
10
+ // Keep it frequent enough that a tab left open all day stays current — and note
11
+ // React Query pauses intervals while the tab is hidden, so a background window
12
+ // costs nothing and catches up on focus instead.
13
+ const UPDATE_POLL_INTERVAL_MS = 5 * 60 * 1000
14
+ const RESTART_POLL_INTERVAL_MS = 1000
15
+
16
+ export function useUpdateStatus(restarting: boolean) {
17
+ return useQuery<UpdateStatus>({
18
+ queryKey: updateKey,
19
+ queryFn: () => requestJson('/api/update'),
20
+ staleTime: UPDATE_POLL_INTERVAL_MS,
21
+ refetchInterval: restarting ? RESTART_POLL_INTERVAL_MS : UPDATE_POLL_INTERVAL_MS,
22
+ // A tab that sat in the background for days is stale by definition; give it
23
+ // a fresh answer the moment someone looks at it.
24
+ refetchOnWindowFocus: true,
25
+ // While the server is restarting every request fails until it is back. The
26
+ // poll interval is the retry.
27
+ retry: false
28
+ })
29
+ }
30
+
31
+ export function useUpdate() {
32
+ return useMutation<UpdateResult, Error>({
33
+ mutationFn: () => requestJson('/api/update', { method: 'POST' }, 'Could not update moi')
34
+ })
35
+ }
@@ -39,6 +39,7 @@ export function WidgetFrame({ editing, hidden, onRemove, children }: WidgetFrame
39
39
  // Stable hook for widget thumbnails: the capture clone overrides this
40
40
  // element's chrome (radius/shadow/stroke) so thumbnails come out square.
41
41
  data-widget-chrome
42
+ data-vivid
42
43
  style={getWorkspaceThemeStyle(theme, 'widget')}
43
44
  className={cn(
44
45
  'absolute inset-0 overflow-hidden rounded-2xl text-foreground [corner-shape:superellipse(1.2)]',
@@ -16,6 +16,7 @@ import { DrawingLayer } from '@/client/features/drawings/DrawingLayer'
16
16
  import { DrawingToolbar } from '@/client/features/drawings/DrawingToolbar'
17
17
  import { useChatAnnotation } from '@/client/features/drawings/useChatAnnotation'
18
18
  import { ChatPanel } from '@/client/features/chat/ChatPanel'
19
+ import type { ChatWelcomeDestination } from '@/client/features/chat/ChatEmptyState'
19
20
  import { ChatPopup } from '@/client/features/chat/ChatPopup'
20
21
  import { CustomizePanel } from '@/client/features/workspace/CustomizePanel'
21
22
  import { useAppletEvent } from '@/client/features/applets/applet-runtime'
@@ -392,6 +393,17 @@ export function WorkspaceScreen({ widgets, views, builders }: WorkspaceScreenPro
392
393
  }
393
394
  }
394
395
 
396
+ const navigateFromWelcome = (destination: ChatWelcomeDestination) => {
397
+ if (destination === 'views') {
398
+ const firstView = views[0]
399
+ if (firstView) openTab(viewTabId(firstView.id))
400
+ else void builderActions.create().then(builder => openTab(viewBuilderTabId(builder.id)))
401
+ } else {
402
+ openTab(destination)
403
+ }
404
+ setFloatingChatOpen(false)
405
+ }
406
+
395
407
  // Focus requests from applet bridges arrive here already validated — the
396
408
  // applet runtime narrows the untrusted tab id and params shape at the trust
397
409
  // boundary (applet-runtime.ts). A well-formed id for a missing view just
@@ -571,6 +583,7 @@ export function WorkspaceScreen({ widgets, views, builders }: WorkspaceScreenPro
571
583
  composerAvailability={composerAvailability}
572
584
  send={send}
573
585
  stop={stop}
586
+ onNavigateFromWelcome={navigateFromWelcome}
574
587
  onClose={() => setMode('fullscreen')}
575
588
  annotation={annotation.docked}
576
589
  builderDraft={builderChatDraft}
@@ -591,6 +604,7 @@ export function WorkspaceScreen({ widgets, views, builders }: WorkspaceScreenPro
591
604
  composerAvailability={composerAvailability}
592
605
  send={send}
593
606
  stop={stop}
607
+ onNavigateFromWelcome={navigateFromWelcome}
594
608
  />
595
609
  )
596
610
  const workspacePanel = (
@@ -746,6 +760,7 @@ export function WorkspaceScreen({ widgets, views, builders }: WorkspaceScreenPro
746
760
  composerAvailability={composerAvailability}
747
761
  send={send}
748
762
  stop={stop}
763
+ onNavigateFromWelcome={navigateFromWelcome}
749
764
  onClose={onClose}
750
765
  annotation={annotation.popup}
751
766
  builderDraft={builderChatDraft}
package/client/index.css CHANGED
@@ -12,7 +12,7 @@
12
12
  @plugin '@tailwindcss/typography';
13
13
 
14
14
  @custom-variant dark (&:is(.dark *));
15
- @custom-variant dark-or-widget (&:is(.dark *, [data-widget-chrome] *));
15
+ @custom-variant dark-or-vivid (&:is(.dark *, [data-vivid], [data-vivid] *));
16
16
 
17
17
  :root {
18
18
  --cursor-pencil:
@@ -39,7 +39,7 @@
39
39
  --radius: 0.625rem;
40
40
  --default-sans: ui-sans-serif, system-ui, sans-serif;
41
41
  --sans: var(--default-sans);
42
- --default-mono: ui-monospace, monospace;
42
+ --default-mono: 'Geist Mono', ui-monospace, monospace;
43
43
  --mono: var(--default-mono);
44
44
 
45
45
  /* Workspace page layout — single source of truth for the widget/chat panel.
@@ -46,9 +46,12 @@ function themeColorProperty(token: ThemeColorToken): `--${string}` {
46
46
  export function getWorkspaceThemeFontStyle(theme: WorkspaceLayout['theme']): WorkspaceThemeStyle {
47
47
  const style: WorkspaceThemeStyle = {}
48
48
  const resolved = resolveWorkspaceTheme(theme)
49
- const font = FONT_THEMES[resolved.font] ?? FONT_THEMES[DEFAULT_WORKSPACE_THEME.font]
49
+
50
+ const font =
51
+ resolved.font === DEFAULT_WORKSPACE_THEME.font ? undefined : FONT_THEMES[resolved.font]
52
+
50
53
  for (const [token, property] of WORKSPACE_FONT_PROPERTIES) {
51
- style[property] = font[token]
54
+ style[property] = font?.[token]
52
55
  }
53
56
  return style
54
57
  }
@@ -59,9 +62,11 @@ export function getWorkspaceThemeColorStyle(
59
62
  ): WorkspaceThemeStyle {
60
63
  const style: WorkspaceThemeStyle = {}
61
64
  const resolved = resolveWorkspaceTheme(theme)
65
+
62
66
  const color = COLOR_THEMES[resolved.color] ?? COLOR_THEMES[DEFAULT_WORKSPACE_THEME.color]
63
67
  const primary = color.primary ?? (colorMode === 'widget' ? DEFAULT_PRIMARY_COLOR : undefined)
64
68
  const colors = primary ? deriveThemeColors(primary, colorMode) : undefined
69
+
65
70
  for (const [token, property] of WORKSPACE_COLOR_PROPERTIES) {
66
71
  style[property] = colors?.[token]
67
72
  }
@@ -71,8 +76,11 @@ export function getWorkspaceThemeColorStyle(
71
76
  export function getWorkspaceThemeRadiusStyle(theme: WorkspaceLayout['theme']): WorkspaceThemeStyle {
72
77
  const style: WorkspaceThemeStyle = {}
73
78
  const resolved = resolveWorkspaceTheme(theme)
74
- const radius = RADIUS_THEMES[resolved.radius] ?? RADIUS_THEMES[DEFAULT_WORKSPACE_THEME.radius]
75
- style[WORKSPACE_RADIUS_PROPERTY] = radius.radius
79
+
80
+ const radius =
81
+ resolved.radius === DEFAULT_WORKSPACE_THEME.radius ? undefined : RADIUS_THEMES[resolved.radius]
82
+
83
+ style[WORKSPACE_RADIUS_PROPERTY] = radius?.radius
76
84
  return style
77
85
  }
78
86
 
package/client/theme.css CHANGED
@@ -88,40 +88,44 @@
88
88
  * opaque semantic base underneath them. */
89
89
 
90
90
  @utility texture-checker {
91
- background-image: repeating-conic-gradient(
92
- transparent 0 25%,
93
- color-mix(in oklch, var(--primary) 2%, var(--foreground) 4%) 0 50%
94
- );
91
+ --texture-checker-fill: color-mix(in oklch, var(--primary) 2%, var(--foreground) 4%);
92
+
93
+ background-image: repeating-conic-gradient(transparent 0 25%, var(--texture-checker-fill) 0 50%);
95
94
  background-position: 50% 50%;
96
95
  background-repeat: repeat;
97
96
  background-size: 32px 32px;
97
+
98
+ @variant dark-or-vivid {
99
+ --texture-checker-fill: color-mix(in oklch, currentColor 8%, transparent);
100
+ }
98
101
  }
99
102
 
100
103
  @utility texture-checker-* {
101
- background-image: repeating-conic-gradient(
102
- transparent 0 25%,
103
- color-mix(in oklch, var(--primary) 2%, var(--foreground) 4%) 0 50%
104
- );
104
+ --texture-checker-fill: color-mix(in oklch, var(--primary) 2%, var(--foreground) 4%);
105
+
106
+ background-image: repeating-conic-gradient(transparent 0 25%, var(--texture-checker-fill) 0 50%);
105
107
  background-position: 50% 50%;
106
108
  background-repeat: repeat;
107
109
  background-size: calc(--value(number) * var(--spacing)) calc(--value(number) * var(--spacing));
110
+
111
+ @variant dark-or-vivid {
112
+ --texture-checker-fill: color-mix(in oklch, currentColor 8%, transparent);
113
+ }
108
114
  }
109
115
 
110
116
  @utility texture-grid {
117
+ --texture-grid-line: color-mix(in oklch, var(--primary) 3%, var(--foreground) 3%);
118
+
111
119
  background-image:
112
- linear-gradient(
113
- to right,
114
- color-mix(in oklch, var(--primary) 3%, var(--foreground) 3%) 1px,
115
- transparent 1px
116
- ),
117
- linear-gradient(
118
- to bottom,
119
- color-mix(in oklch, var(--primary) 3%, var(--foreground) 3%) 1px,
120
- transparent 1px
121
- );
120
+ linear-gradient(to right, var(--texture-grid-line) 1px, transparent 1px),
121
+ linear-gradient(to bottom, var(--texture-grid-line) 1px, transparent 1px);
122
122
  background-position: 50% 50%;
123
123
  background-repeat: repeat;
124
124
  background-size: 24px 24px;
125
+
126
+ @variant dark-or-vivid {
127
+ --texture-grid-line: color-mix(in oklch, currentColor 10%, transparent);
128
+ }
125
129
  }
126
130
 
127
131
  @utility texture-noise {
@@ -131,7 +135,7 @@
131
135
  background-repeat: repeat;
132
136
  background-size: 160px 160px;
133
137
 
134
- @variant dark-or-widget {
138
+ @variant dark-or-vivid {
135
139
  background-image: url('data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 1 1%22 width=%22160%22 height=%22160%22 color=%22white%22%3E%3Cdefs%3E%3Cfilter id=%22noise%22 x=%220%22 y=%220%22 width=%221%22 height=%221%22 filterUnits=%22userSpaceOnUse%22%3E%3CfeTurbulence type=%22fractalNoise%22 baseFrequency=%22128%22 numOctaves=%2210%22 result=%22turbulence%22/%3E%3CfeColorMatrix in=%22turbulence%22 type=%22luminanceToAlpha%22 result=%22alpha%22/%3E%3CfeComponentTransfer in=%22alpha%22 result=%22threshold%22%3E%3CfeFuncA type=%22linear%22 slope=%223.2%22 intercept=%22-1.44%22/%3E%3C/feComponentTransfer%3E%3CfeFlood flood-color=%22currentColor%22 flood-opacity=%220.1%22 result=%22color%22/%3E%3CfeComposite in=%22color%22 in2=%22threshold%22 operator=%22in%22/%3E%3C/filter%3E%3C/defs%3E%3Crect width=%221%22 height=%221%22 filter=%22url(%23noise)%22/%3E%3C/svg%3E');
136
140
  }
137
141
  }
@@ -147,7 +151,7 @@
147
151
  background-repeat: no-repeat;
148
152
  background-size: cover;
149
153
 
150
- @variant dark-or-widget {
154
+ @variant dark-or-vivid {
151
155
  background-image: linear-gradient(
152
156
  to bottom,
153
157
  transparent 25%,
@@ -160,14 +164,14 @@
160
164
  @utility texture-inset-shadow {
161
165
  box-shadow: inset 0 0 32px 24px color-mix(in oklch, var(--primary) 4%, transparent);
162
166
 
163
- @variant dark-or-widget {
167
+ @variant dark-or-vivid {
164
168
  box-shadow: inset 0 0 32px 24px color-mix(in oklch, var(--primary) 10%, transparent);
165
169
  }
166
170
 
167
171
  @media (width < 48rem) {
168
172
  box-shadow: inset 0 0 16px 16px color-mix(in oklch, var(--primary) 4%, transparent);
169
173
 
170
- @variant dark-or-widget {
174
+ @variant dark-or-vivid {
171
175
  box-shadow: inset 0 0 16px 16px color-mix(in oklch, var(--primary) 10%, transparent);
172
176
  }
173
177
  }
@@ -1,2 +1,2 @@
1
- import{Oc as w,Qc as s}from"/chunk-zfz3b4xg.js";import{Sc as q}from"/chunk-zbeq02yc.js";var R=q(w(),1);async function i(o,t){let a=await o.text();return Error(a||t)}async function u(o,t,a="Request failed"){let n=await fetch(o,t);if(!n.ok)throw await i(n,a);return n.json()}async function T(o,t,a="Request failed"){let n=await fetch(o,t);if(!n.ok)throw await i(n,a)}function y(o,t){return{method:o,headers:{"Content-Type":"application/json"},body:t===void 0?void 0:JSON.stringify(t)}}var r={cloudDemo:!1,experiments:[],demoInstallUrl:"https://moi.computer"},d=r,e=new Set;function I(o){return e.add(o),()=>{e.delete(o)}}async function f(){try{d=await u("/api/config");for(let o of e)o()}catch{}}async function c(){await f(),s(()=>{f()})}function h(){return R.useSyncExternalStore(I,()=>d)}
2
- export{u as Jc,T as Kc,y as Lc,c as Mc,h as Nc};
1
+ import{Sc as w,Uc as s}from"/chunk-ht1f95h9.js";import{Wc as q}from"/chunk-97eg9mjn.js";var R=q(w(),1);async function i(o,t){let a=await o.text();return Error(a||t)}async function u(o,t,a="Request failed"){let n=await fetch(o,t);if(!n.ok)throw await i(n,a);return n.json()}async function T(o,t,a="Request failed"){let n=await fetch(o,t);if(!n.ok)throw await i(n,a)}function y(o,t){return{method:o,headers:{"Content-Type":"application/json"},body:t===void 0?void 0:JSON.stringify(t)}}var r={cloudDemo:!1,experiments:[],demoInstallUrl:"https://moi.computer"},d=r,e=new Set;function I(o){return e.add(o),()=>{e.delete(o)}}async function f(){try{d=await u("/api/config");for(let o of e)o()}catch{}}async function c(){await f(),s(()=>{f()})}function h(){return R.useSyncExternalStore(I,()=>d)}
2
+ export{u as Nc,T as Oc,y as Pc,c as Qc,h as Rc};