moi-computer 0.0.3 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (216) hide show
  1. package/README.md +2 -2
  2. package/bunfig.toml +4 -0
  3. package/client/api/workspaces.ts +277 -6
  4. package/client/assets/mcp/agentation.png +0 -0
  5. package/client/assets/mcp/airtable.png +0 -0
  6. package/client/assets/mcp/apollo.png +0 -0
  7. package/client/assets/mcp/asana.png +0 -0
  8. package/client/assets/mcp/box.png +0 -0
  9. package/client/assets/mcp/chrome.svg +33 -0
  10. package/client/assets/mcp/clickup.png +0 -0
  11. package/client/assets/mcp/cloudflare.png +0 -0
  12. package/client/assets/mcp/context7.png +0 -0
  13. package/client/assets/mcp/datadog.png +0 -0
  14. package/client/assets/mcp/dropbox.png +0 -0
  15. package/client/assets/mcp/elevenlabs.png +0 -0
  16. package/client/assets/mcp/exa.png +0 -0
  17. package/client/assets/mcp/firecrawl.png +0 -0
  18. package/client/assets/mcp/gmail.png +0 -0
  19. package/client/assets/mcp/googlecalendar.png +0 -0
  20. package/client/assets/mcp/googledrive.png +0 -0
  21. package/client/assets/mcp/grafana.png +0 -0
  22. package/client/assets/mcp/huggingface.png +0 -0
  23. package/client/assets/mcp/intercom.png +0 -0
  24. package/client/assets/mcp/monday.png +0 -0
  25. package/client/assets/mcp/mongodb.png +0 -0
  26. package/client/assets/mcp/paper.png +0 -0
  27. package/client/assets/mcp/paypal.png +0 -0
  28. package/client/assets/mcp/perplexity.png +0 -0
  29. package/client/assets/mcp/postgresql.png +0 -0
  30. package/client/assets/mcp/posthog.png +0 -0
  31. package/client/assets/mcp/puppeteer.png +0 -0
  32. package/client/assets/mcp/railway.png +0 -0
  33. package/client/assets/mcp/redis.png +0 -0
  34. package/client/assets/mcp/salesforce.png +0 -0
  35. package/client/assets/mcp/shopify.png +0 -0
  36. package/client/assets/mcp/snowflake.png +0 -0
  37. package/client/assets/mcp/telegram.png +0 -0
  38. package/client/assets/mcp/twilio.png +0 -0
  39. package/client/assets/mcp/zapier.png +0 -0
  40. package/client/components/App.tsx +7 -1
  41. package/client/components/ChatInput.tsx +194 -13
  42. package/client/components/ChatPanel.tsx +116 -47
  43. package/client/components/ChatPopup.tsx +1 -1
  44. package/client/components/IconMcp.tsx +21 -0
  45. package/client/components/McpMenu.tsx +125 -0
  46. package/client/components/ModelPicker.tsx +147 -0
  47. package/client/components/Scratchpad.tsx +775 -0
  48. package/client/components/ShimmerText.tsx +20 -0
  49. package/client/components/ThreadSelector.tsx +2 -2
  50. package/client/components/TurnView.tsx +111 -531
  51. package/client/components/WidgetShell.tsx +1 -1
  52. package/client/components/WorkspacesPage.tsx +12 -4
  53. package/client/components/layout/SidebarLayout.tsx +18 -9
  54. package/client/components/playground/ToolCallsPage.tsx +81 -0
  55. package/client/components/routes/workspace/[id].tsx +534 -141
  56. package/client/components/routes/workspace/create.tsx +155 -0
  57. package/client/components/settings/IconPicker.tsx +590 -0
  58. package/client/components/settings/SettingsPages.tsx +307 -0
  59. package/client/components/settings/WorkspaceSettings.tsx +92 -0
  60. package/client/components/tool-group/CodeBlock.tsx +41 -0
  61. package/client/components/tool-group/Collapse.tsx +28 -0
  62. package/client/components/tool-group/ReadImagePreview.tsx +46 -0
  63. package/client/components/tool-group/SubagentCard.tsx +135 -0
  64. package/client/components/tool-group/TimelineRow.tsx +147 -0
  65. package/client/components/tool-group/ToolCallGroup.tsx +231 -0
  66. package/client/components/tool-group/ToolOutput.tsx +139 -0
  67. package/client/components/tool-group/detect.ts +93 -0
  68. package/client/components/tool-group/fixtures.ts +315 -0
  69. package/client/components/tool-group/format.ts +211 -0
  70. package/client/components/tool-group/index.ts +9 -0
  71. package/client/components/ui/dialog.tsx +58 -0
  72. package/client/components/ui/hover-card.tsx +44 -0
  73. package/client/components/ui/switch.tsx +23 -0
  74. package/client/components/ui/tooltip.tsx +54 -0
  75. package/client/externalize-react.ts +6 -0
  76. package/client/hooks/useApplet.ts +117 -0
  77. package/client/hooks/useChat.ts +162 -62
  78. package/client/hooks/useMeiEvents.ts +9 -2
  79. package/client/hooks/useStickToBottom.ts +86 -0
  80. package/client/hooks/useWorkspaceTheme.ts +8 -2
  81. package/client/index.css +48 -2
  82. package/client/index.html +9 -5
  83. package/client/index.tsx +29 -2
  84. package/client/lib/WorkspaceContext.tsx +5 -8
  85. package/client/lib/WorkspaceLayoutContext.tsx +30 -10
  86. package/client/lib/applet-cache.ts +54 -0
  87. package/client/lib/connection.ts +237 -0
  88. package/client/lib/flags.ts +10 -0
  89. package/client/lib/mcp-icons.ts +142 -10
  90. package/client/lib/preview-turn.ts +37 -0
  91. package/client/lib/render-icon.ts +173 -0
  92. package/client/lib/scratch-executor.ts +20 -0
  93. package/client/lib/uploads.ts +18 -0
  94. package/client/main.tsx +5 -0
  95. package/client/store/live.ts +282 -0
  96. package/client/structured-clone-shim.ts +14 -0
  97. package/client/theme.css +2 -2
  98. package/client/vendor/emojibase/en/data.json +1 -0
  99. package/client/vendor/emojibase/en/messages.json +1 -0
  100. package/client/vendor/react/development/_impl/react-dom-client.js +15871 -0
  101. package/client/vendor/react/development/_impl/react-dom.js +223 -0
  102. package/client/vendor/react/development/_impl/react-jsx-dev-runtime.js +256 -0
  103. package/client/vendor/react/development/_impl/react-jsx-runtime.js +260 -0
  104. package/client/vendor/react/development/_impl/react.js +863 -0
  105. package/client/vendor/react/development/react-dom-client.js +6 -0
  106. package/client/vendor/react/development/react-dom.js +17 -0
  107. package/client/vendor/react/development/react-jsx-dev-runtime.js +5 -0
  108. package/client/vendor/react/development/react-jsx-runtime.js +6 -0
  109. package/client/vendor/react/development/react.js +47 -0
  110. package/client/vendor/react/production/_impl/react-dom-client.js +10361 -0
  111. package/client/vendor/react/production/_impl/react-dom.js +184 -0
  112. package/client/vendor/react/production/_impl/react-jsx-dev-runtime.js +37 -0
  113. package/client/vendor/react/production/_impl/react-jsx-runtime.js +60 -0
  114. package/client/vendor/react/production/_impl/react.js +428 -0
  115. package/client/vendor/react/production/react-dom-client.js +6 -0
  116. package/client/vendor/react/production/react-dom.js +17 -0
  117. package/client/vendor/react/production/react-jsx-dev-runtime.js +5 -0
  118. package/client/vendor/react/production/react-jsx-runtime.js +6 -0
  119. package/client/vendor/react/production/react.js +47 -0
  120. package/dist/agentation-4s0nn45p.png +0 -0
  121. package/dist/airtable-hsa66v6q.png +0 -0
  122. package/dist/apollo-2ed5dy2d.png +0 -0
  123. package/dist/asana-tvgtwbx2.png +0 -0
  124. package/dist/box-w3n36t5g.png +0 -0
  125. package/dist/chrome-tspm94rw.svg +33 -0
  126. package/dist/chunk-kc6e9nd4.css +1 -0
  127. package/dist/chunk-yf3p7qg7.js +673 -0
  128. package/dist/clickup-qqrqqvqb.png +0 -0
  129. package/dist/cloudflare-j9p931v6.png +0 -0
  130. package/dist/context7-8ht0xjfy.png +0 -0
  131. package/dist/datadog-70ne3yzt.png +0 -0
  132. package/dist/dropbox-4m5s9mgr.png +0 -0
  133. package/dist/elevenlabs-2nzzej1t.png +0 -0
  134. package/dist/exa-qqj3vr0x.png +0 -0
  135. package/dist/firecrawl-w2t8nehx.png +0 -0
  136. package/dist/gmail-sg6a5v3x.png +0 -0
  137. package/dist/googlecalendar-nqhh2v7r.png +0 -0
  138. package/dist/googledrive-6s8xyab7.png +0 -0
  139. package/dist/grafana-1yfsnwr6.png +0 -0
  140. package/dist/huggingface-kxzaxj83.png +0 -0
  141. package/dist/index.html +10 -6
  142. package/dist/intercom-td763jt8.png +0 -0
  143. package/dist/monday-jdbs4wwf.png +0 -0
  144. package/dist/mongodb-emzxvhd5.png +0 -0
  145. package/dist/paper-zbt34fab.png +0 -0
  146. package/dist/paypal-kwwf7xsc.png +0 -0
  147. package/dist/perplexity-4y63rxvj.png +0 -0
  148. package/dist/postgresql-qsspbsr1.png +0 -0
  149. package/dist/posthog-sphppc4w.png +0 -0
  150. package/dist/puppeteer-2xjt1a9b.png +0 -0
  151. package/dist/railway-834de8d2.png +0 -0
  152. package/dist/redis-spm6w2m1.png +0 -0
  153. package/dist/salesforce-1mk56v4z.png +0 -0
  154. package/dist/shopify-90dadaav.png +0 -0
  155. package/dist/snowflake-hfpykpgy.png +0 -0
  156. package/dist/telegram-v6tjyrs7.png +0 -0
  157. package/dist/twilio-dpyjdwpj.png +0 -0
  158. package/dist/zapier-p67qfch0.png +0 -0
  159. package/lib/attachment-note.ts +48 -0
  160. package/lib/claude-adapter.ts +219 -29
  161. package/lib/format.ts +32 -0
  162. package/lib/types.ts +314 -6
  163. package/package.json +11 -5
  164. package/server/CLAUDE.md +4 -1
  165. package/server/agent.ts +25 -118
  166. package/server/api.ts +593 -0
  167. package/server/applets.ts +396 -0
  168. package/server/build-applet.ts +580 -0
  169. package/server/cc-session.ts +611 -0
  170. package/server/cli-colors.ts +17 -0
  171. package/server/cli-ui.ts +52 -0
  172. package/server/cli.ts +965 -73
  173. package/server/constants.ts +1 -1
  174. package/server/control.ts +166 -19
  175. package/server/debug.ts +10 -0
  176. package/server/events.ts +24 -0
  177. package/server/functions-worker.ts +18 -2
  178. package/server/functions.ts +59 -12
  179. package/server/icon.ts +13 -0
  180. package/server/layout.ts +25 -3
  181. package/server/mcp.ts +125 -0
  182. package/server/moi-scaffold.ts +85 -0
  183. package/server/openclaw-session.ts +41 -10
  184. package/server/openclaw.ts +22 -0
  185. package/server/preview.ts +70 -0
  186. package/server/registry.ts +32 -2
  187. package/server/scratchpad-executor.ts +380 -0
  188. package/server/scratchpad-relay.ts +45 -0
  189. package/server/scratchpad.ts +171 -0
  190. package/server/skill-version.ts +146 -0
  191. package/server/skills-template.ts +6 -1
  192. package/server/state.ts +22 -36
  193. package/server/static.ts +23 -0
  194. package/server/status.ts +94 -0
  195. package/server/thread-config.ts +125 -0
  196. package/server/uploads.ts +0 -0
  197. package/server/vendor.ts +63 -0
  198. package/server/views.ts +0 -0
  199. package/server/web.ts +108 -253
  200. package/server/widgets.ts +52 -142
  201. package/server/workspace-config.ts +37 -0
  202. package/server/workspace-env.ts +407 -0
  203. package/server/workspace-init.ts +66 -0
  204. package/workspace/.claude/skills/moi-workspace/DESIGN.md +109 -0
  205. package/workspace/.claude/skills/moi-workspace/SCRATCHPAD.md +57 -0
  206. package/workspace/.claude/skills/moi-workspace/SKILL.md +252 -0
  207. package/workspace/.claude/skills/moi-workspace/VIEW-DESIGN.md +22 -0
  208. package/client/hooks/useWidget.ts +0 -72
  209. package/client/hooks/useWidgetList.ts +0 -30
  210. package/client/lib/ws.ts +0 -129
  211. package/client/store/chat.tsx +0 -162
  212. package/dist/chunk-4615fa69.js +0 -67
  213. package/dist/chunk-582xmy05.css +0 -1
  214. package/server/build-widget.ts +0 -343
  215. package/workspace/.claude/skills/widgets/DESIGN.md +0 -630
  216. package/workspace/.claude/skills/widgets/SKILL.md +0 -176
@@ -0,0 +1,155 @@
1
+ import { type FormEvent, useState } from 'react'
2
+
3
+ import { IconLoader2, IconPlus } from '@tabler/icons-react'
4
+ import { useLocation } from 'wouter'
5
+
6
+ import { useCreateWorkspace, useCreateWorkspaceInfo } from '@/client/api/workspaces'
7
+ import { TypeIcon, typeLabel } from '@/client/components/WorkspacesPage'
8
+ import { PanelHeader, SidebarLayout, SidebarToggle } from '@/client/components/layout/SidebarLayout'
9
+ import { Button } from '@/client/components/ui/button'
10
+ import { Input } from '@/client/components/ui/input'
11
+ import { cn } from '@/client/lib/cn'
12
+ import type { WorkspaceType } from '@/lib/types'
13
+
14
+ // Mirrors the server's validateWorkspaceFolderName (workspace-init.ts) for
15
+ // instant feedback; the server remains the authority and re-validates.
16
+ function folderNameError(name: string): string | null {
17
+ if (!name) return null // an empty field just disables the submit, no nagging
18
+ if (name.length > 64) return 'Folder name is too long (max 64 characters)'
19
+ if (!/^[A-Za-z0-9][A-Za-z0-9._ -]*$/.test(name)) {
20
+ return 'Use letters, numbers, dots, dashes, underscores and spaces, starting with a letter or number'
21
+ }
22
+ if (name.endsWith('.') || name.endsWith(' ')) return 'Folder name cannot end with a dot or space'
23
+ return null
24
+ }
25
+
26
+ type AgentOption = {
27
+ type: WorkspaceType
28
+ hint: string
29
+ disabled?: boolean
30
+ }
31
+
32
+ // Only Claude Code workspaces can be created from scratch for now. OpenClaw
33
+ // workspaces belong to their agents — they arrive via discovery on the home
34
+ // page — and Hermes has no init path yet.
35
+ const AGENT_OPTIONS: AgentOption[] = [
36
+ { type: 'claude-code', hint: 'Powered by the Claude Agent SDK' },
37
+ { type: 'openclaw', hint: 'Import a discovered agent from Home', disabled: true },
38
+ { type: 'hermes', hint: 'Coming soon', disabled: true }
39
+ ]
40
+
41
+ // The `/workspace/create` route: name a folder, get a provisioned (skills +
42
+ // `.moi/` scaffold) and registered workspace under the server's workspaces
43
+ // root, then land in it.
44
+ export function CreateWorkspacePage() {
45
+ const [, navigate] = useLocation()
46
+ const info = useCreateWorkspaceInfo()
47
+ const createMutation = useCreateWorkspace()
48
+
49
+ const [name, setName] = useState('')
50
+ const [type, setType] = useState<WorkspaceType>('claude-code')
51
+
52
+ const trimmed = name.trim()
53
+ const nameError = folderNameError(trimmed)
54
+ const canSubmit = trimmed.length > 0 && !nameError && !createMutation.isPending
55
+ const root = info.data?.displayRoot ?? '…'
56
+
57
+ function handleSubmit(e: FormEvent) {
58
+ e.preventDefault()
59
+ if (!canSubmit) return
60
+ createMutation.mutate(
61
+ { name: trimmed, type },
62
+ { onSuccess: entry => navigate(`/workspace/${entry.id}`) }
63
+ )
64
+ }
65
+
66
+ return (
67
+ <SidebarLayout>
68
+ <PanelHeader>
69
+ <SidebarToggle />
70
+ <span className="text-sm font-medium text-foreground">New workspace</span>
71
+ </PanelHeader>
72
+ <div className="min-h-0 flex-1 overflow-y-auto">
73
+ <form onSubmit={handleSubmit} className="mx-auto w-full max-w-xl px-8 pt-14 pb-16">
74
+ <h1 className="mb-1.5 text-base font-semibold text-foreground">Create a workspace</h1>
75
+ <p className="mb-8 text-sm text-muted-foreground">
76
+ A new folder in <code className="rounded bg-muted px-1 py-0.5 font-mono text-xs">{root}</code>,
77
+ set up with moi skills and widgets, ready to chat.
78
+ </p>
79
+
80
+ <fieldset className="mb-6">
81
+ <legend className="mb-2 text-sm font-medium text-foreground">Agent</legend>
82
+ <div className="grid grid-cols-3 gap-2">
83
+ {AGENT_OPTIONS.map(option => (
84
+ <button
85
+ key={option.type}
86
+ type="button"
87
+ disabled={option.disabled}
88
+ onClick={() => setType(option.type)}
89
+ aria-pressed={type === option.type}
90
+ className={cn(
91
+ 'flex flex-col items-start gap-1.5 rounded-lg border p-3 text-left transition-colors',
92
+ type === option.type
93
+ ? 'border-ring bg-muted/50 shadow-[inset_0_0_0_1px_var(--ring)]'
94
+ : 'border-border hover:bg-muted/40',
95
+ option.disabled && 'cursor-not-allowed opacity-50 hover:bg-transparent'
96
+ )}
97
+ >
98
+ <span className="flex items-center gap-2">
99
+ <TypeIcon type={option.type} />
100
+ <span className="text-sm font-medium text-foreground">
101
+ {typeLabel[option.type]}
102
+ </span>
103
+ </span>
104
+ <span className="text-xs text-muted-foreground">{option.hint}</span>
105
+ </button>
106
+ ))}
107
+ </div>
108
+ </fieldset>
109
+
110
+ <div className="mb-2">
111
+ <label htmlFor="workspace-name" className="mb-2 block text-sm font-medium text-foreground">
112
+ Folder name
113
+ </label>
114
+ <Input
115
+ id="workspace-name"
116
+ value={name}
117
+ onChange={e => setName(e.target.value)}
118
+ placeholder="my-workspace"
119
+ autoFocus
120
+ aria-invalid={!!nameError}
121
+ autoComplete="off"
122
+ spellCheck={false}
123
+ />
124
+ </div>
125
+ {nameError ? (
126
+ <p className="mb-6 text-xs text-destructive">{nameError}</p>
127
+ ) : (
128
+ <p className="mb-6 font-mono text-xs text-muted-foreground">
129
+ {root}/{trimmed || 'my-workspace'}
130
+ </p>
131
+ )}
132
+
133
+ <div className="flex items-center gap-3">
134
+ <Button type="submit" disabled={!canSubmit}>
135
+ {createMutation.isPending ? (
136
+ <IconLoader2 stroke={1.5} className="animate-spin" />
137
+ ) : (
138
+ <IconPlus stroke={1.5} />
139
+ )}
140
+ Create workspace
141
+ </Button>
142
+ {createMutation.isPending && (
143
+ <span className="text-xs text-muted-foreground">
144
+ Setting up skills and widgets…
145
+ </span>
146
+ )}
147
+ </div>
148
+ {createMutation.isError && (
149
+ <p className="mt-3 text-xs text-destructive">{createMutation.error.message}</p>
150
+ )}
151
+ </form>
152
+ </div>
153
+ </SidebarLayout>
154
+ )
155
+ }