moi-computer 0.0.3 → 0.1.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 (214) hide show
  1. package/bunfig.toml +4 -0
  2. package/client/api/workspaces.ts +277 -6
  3. package/client/assets/mcp/agentation.png +0 -0
  4. package/client/assets/mcp/airtable.png +0 -0
  5. package/client/assets/mcp/apollo.png +0 -0
  6. package/client/assets/mcp/asana.png +0 -0
  7. package/client/assets/mcp/box.png +0 -0
  8. package/client/assets/mcp/chrome.svg +33 -0
  9. package/client/assets/mcp/clickup.png +0 -0
  10. package/client/assets/mcp/cloudflare.png +0 -0
  11. package/client/assets/mcp/context7.png +0 -0
  12. package/client/assets/mcp/datadog.png +0 -0
  13. package/client/assets/mcp/dropbox.png +0 -0
  14. package/client/assets/mcp/elevenlabs.png +0 -0
  15. package/client/assets/mcp/exa.png +0 -0
  16. package/client/assets/mcp/firecrawl.png +0 -0
  17. package/client/assets/mcp/gmail.png +0 -0
  18. package/client/assets/mcp/googlecalendar.png +0 -0
  19. package/client/assets/mcp/googledrive.png +0 -0
  20. package/client/assets/mcp/grafana.png +0 -0
  21. package/client/assets/mcp/huggingface.png +0 -0
  22. package/client/assets/mcp/intercom.png +0 -0
  23. package/client/assets/mcp/monday.png +0 -0
  24. package/client/assets/mcp/mongodb.png +0 -0
  25. package/client/assets/mcp/paper.png +0 -0
  26. package/client/assets/mcp/paypal.png +0 -0
  27. package/client/assets/mcp/perplexity.png +0 -0
  28. package/client/assets/mcp/postgresql.png +0 -0
  29. package/client/assets/mcp/posthog.png +0 -0
  30. package/client/assets/mcp/puppeteer.png +0 -0
  31. package/client/assets/mcp/railway.png +0 -0
  32. package/client/assets/mcp/redis.png +0 -0
  33. package/client/assets/mcp/salesforce.png +0 -0
  34. package/client/assets/mcp/shopify.png +0 -0
  35. package/client/assets/mcp/snowflake.png +0 -0
  36. package/client/assets/mcp/telegram.png +0 -0
  37. package/client/assets/mcp/twilio.png +0 -0
  38. package/client/assets/mcp/zapier.png +0 -0
  39. package/client/components/App.tsx +7 -1
  40. package/client/components/ChatInput.tsx +194 -13
  41. package/client/components/ChatPanel.tsx +116 -47
  42. package/client/components/ChatPopup.tsx +1 -1
  43. package/client/components/IconMcp.tsx +21 -0
  44. package/client/components/McpMenu.tsx +125 -0
  45. package/client/components/ModelPicker.tsx +147 -0
  46. package/client/components/Scratchpad.tsx +775 -0
  47. package/client/components/ShimmerText.tsx +20 -0
  48. package/client/components/ThreadSelector.tsx +2 -2
  49. package/client/components/TurnView.tsx +111 -531
  50. package/client/components/WidgetShell.tsx +1 -1
  51. package/client/components/WorkspacesPage.tsx +12 -4
  52. package/client/components/layout/SidebarLayout.tsx +18 -9
  53. package/client/components/playground/ToolCallsPage.tsx +81 -0
  54. package/client/components/routes/workspace/[id].tsx +534 -141
  55. package/client/components/routes/workspace/create.tsx +155 -0
  56. package/client/components/settings/IconPicker.tsx +590 -0
  57. package/client/components/settings/SettingsPages.tsx +307 -0
  58. package/client/components/settings/WorkspaceSettings.tsx +92 -0
  59. package/client/components/tool-group/CodeBlock.tsx +41 -0
  60. package/client/components/tool-group/Collapse.tsx +28 -0
  61. package/client/components/tool-group/ReadImagePreview.tsx +46 -0
  62. package/client/components/tool-group/SubagentCard.tsx +135 -0
  63. package/client/components/tool-group/TimelineRow.tsx +147 -0
  64. package/client/components/tool-group/ToolCallGroup.tsx +231 -0
  65. package/client/components/tool-group/ToolOutput.tsx +139 -0
  66. package/client/components/tool-group/detect.ts +93 -0
  67. package/client/components/tool-group/fixtures.ts +315 -0
  68. package/client/components/tool-group/format.ts +211 -0
  69. package/client/components/tool-group/index.ts +9 -0
  70. package/client/components/ui/dialog.tsx +58 -0
  71. package/client/components/ui/hover-card.tsx +44 -0
  72. package/client/components/ui/switch.tsx +23 -0
  73. package/client/components/ui/tooltip.tsx +54 -0
  74. package/client/externalize-react.ts +6 -0
  75. package/client/hooks/useApplet.ts +117 -0
  76. package/client/hooks/useChat.ts +162 -62
  77. package/client/hooks/useMeiEvents.ts +9 -2
  78. package/client/hooks/useStickToBottom.ts +86 -0
  79. package/client/hooks/useWorkspaceTheme.ts +8 -2
  80. package/client/index.css +48 -2
  81. package/client/index.html +9 -5
  82. package/client/index.tsx +29 -2
  83. package/client/lib/WorkspaceContext.tsx +5 -8
  84. package/client/lib/WorkspaceLayoutContext.tsx +30 -10
  85. package/client/lib/applet-cache.ts +54 -0
  86. package/client/lib/connection.ts +237 -0
  87. package/client/lib/flags.ts +10 -0
  88. package/client/lib/mcp-icons.ts +142 -10
  89. package/client/lib/preview-turn.ts +37 -0
  90. package/client/lib/render-icon.ts +173 -0
  91. package/client/lib/scratch-executor.ts +20 -0
  92. package/client/lib/uploads.ts +18 -0
  93. package/client/main.tsx +5 -0
  94. package/client/store/live.ts +282 -0
  95. package/client/structured-clone-shim.ts +14 -0
  96. package/client/theme.css +2 -2
  97. package/client/vendor/emojibase/en/data.json +1 -0
  98. package/client/vendor/emojibase/en/messages.json +1 -0
  99. package/client/vendor/react/development/_impl/react-dom-client.js +15871 -0
  100. package/client/vendor/react/development/_impl/react-dom.js +223 -0
  101. package/client/vendor/react/development/_impl/react-jsx-dev-runtime.js +256 -0
  102. package/client/vendor/react/development/_impl/react-jsx-runtime.js +260 -0
  103. package/client/vendor/react/development/_impl/react.js +863 -0
  104. package/client/vendor/react/development/react-dom-client.js +6 -0
  105. package/client/vendor/react/development/react-dom.js +17 -0
  106. package/client/vendor/react/development/react-jsx-dev-runtime.js +5 -0
  107. package/client/vendor/react/development/react-jsx-runtime.js +6 -0
  108. package/client/vendor/react/development/react.js +47 -0
  109. package/client/vendor/react/production/_impl/react-dom-client.js +10361 -0
  110. package/client/vendor/react/production/_impl/react-dom.js +184 -0
  111. package/client/vendor/react/production/_impl/react-jsx-dev-runtime.js +37 -0
  112. package/client/vendor/react/production/_impl/react-jsx-runtime.js +60 -0
  113. package/client/vendor/react/production/_impl/react.js +428 -0
  114. package/client/vendor/react/production/react-dom-client.js +6 -0
  115. package/client/vendor/react/production/react-dom.js +17 -0
  116. package/client/vendor/react/production/react-jsx-dev-runtime.js +5 -0
  117. package/client/vendor/react/production/react-jsx-runtime.js +6 -0
  118. package/client/vendor/react/production/react.js +47 -0
  119. package/dist/agentation-4s0nn45p.png +0 -0
  120. package/dist/airtable-hsa66v6q.png +0 -0
  121. package/dist/apollo-2ed5dy2d.png +0 -0
  122. package/dist/asana-tvgtwbx2.png +0 -0
  123. package/dist/box-w3n36t5g.png +0 -0
  124. package/dist/chrome-tspm94rw.svg +33 -0
  125. package/dist/chunk-kc6e9nd4.css +1 -0
  126. package/dist/chunk-yf3p7qg7.js +673 -0
  127. package/dist/clickup-qqrqqvqb.png +0 -0
  128. package/dist/cloudflare-j9p931v6.png +0 -0
  129. package/dist/context7-8ht0xjfy.png +0 -0
  130. package/dist/datadog-70ne3yzt.png +0 -0
  131. package/dist/dropbox-4m5s9mgr.png +0 -0
  132. package/dist/elevenlabs-2nzzej1t.png +0 -0
  133. package/dist/exa-qqj3vr0x.png +0 -0
  134. package/dist/firecrawl-w2t8nehx.png +0 -0
  135. package/dist/gmail-sg6a5v3x.png +0 -0
  136. package/dist/googlecalendar-nqhh2v7r.png +0 -0
  137. package/dist/googledrive-6s8xyab7.png +0 -0
  138. package/dist/grafana-1yfsnwr6.png +0 -0
  139. package/dist/huggingface-kxzaxj83.png +0 -0
  140. package/dist/index.html +10 -6
  141. package/dist/intercom-td763jt8.png +0 -0
  142. package/dist/monday-jdbs4wwf.png +0 -0
  143. package/dist/mongodb-emzxvhd5.png +0 -0
  144. package/dist/paper-zbt34fab.png +0 -0
  145. package/dist/paypal-kwwf7xsc.png +0 -0
  146. package/dist/perplexity-4y63rxvj.png +0 -0
  147. package/dist/postgresql-qsspbsr1.png +0 -0
  148. package/dist/posthog-sphppc4w.png +0 -0
  149. package/dist/puppeteer-2xjt1a9b.png +0 -0
  150. package/dist/railway-834de8d2.png +0 -0
  151. package/dist/redis-spm6w2m1.png +0 -0
  152. package/dist/salesforce-1mk56v4z.png +0 -0
  153. package/dist/shopify-90dadaav.png +0 -0
  154. package/dist/snowflake-hfpykpgy.png +0 -0
  155. package/dist/telegram-v6tjyrs7.png +0 -0
  156. package/dist/twilio-dpyjdwpj.png +0 -0
  157. package/dist/zapier-p67qfch0.png +0 -0
  158. package/lib/attachment-note.ts +48 -0
  159. package/lib/claude-adapter.ts +219 -29
  160. package/lib/format.ts +32 -0
  161. package/lib/types.ts +314 -6
  162. package/package.json +10 -5
  163. package/server/CLAUDE.md +3 -0
  164. package/server/agent.ts +25 -118
  165. package/server/api.ts +593 -0
  166. package/server/applets.ts +396 -0
  167. package/server/build-applet.ts +580 -0
  168. package/server/cc-session.ts +611 -0
  169. package/server/cli-colors.ts +17 -0
  170. package/server/cli-ui.ts +52 -0
  171. package/server/cli.ts +964 -72
  172. package/server/control.ts +166 -19
  173. package/server/debug.ts +10 -0
  174. package/server/events.ts +24 -0
  175. package/server/functions-worker.ts +18 -2
  176. package/server/functions.ts +59 -12
  177. package/server/icon.ts +13 -0
  178. package/server/layout.ts +25 -3
  179. package/server/mcp.ts +125 -0
  180. package/server/moi-scaffold.ts +85 -0
  181. package/server/openclaw-session.ts +41 -10
  182. package/server/openclaw.ts +22 -0
  183. package/server/preview.ts +70 -0
  184. package/server/registry.ts +32 -2
  185. package/server/scratchpad-executor.ts +380 -0
  186. package/server/scratchpad-relay.ts +45 -0
  187. package/server/scratchpad.ts +171 -0
  188. package/server/skill-version.ts +146 -0
  189. package/server/skills-template.ts +6 -1
  190. package/server/state.ts +22 -36
  191. package/server/static.ts +23 -0
  192. package/server/status.ts +94 -0
  193. package/server/thread-config.ts +125 -0
  194. package/server/uploads.ts +0 -0
  195. package/server/vendor.ts +63 -0
  196. package/server/views.ts +0 -0
  197. package/server/web.ts +108 -253
  198. package/server/widgets.ts +52 -142
  199. package/server/workspace-config.ts +37 -0
  200. package/server/workspace-env.ts +407 -0
  201. package/server/workspace-init.ts +66 -0
  202. package/workspace/.claude/skills/moi-workspace/DESIGN.md +109 -0
  203. package/workspace/.claude/skills/moi-workspace/SCRATCHPAD.md +57 -0
  204. package/workspace/.claude/skills/moi-workspace/SKILL.md +252 -0
  205. package/workspace/.claude/skills/moi-workspace/VIEW-DESIGN.md +22 -0
  206. package/client/hooks/useWidget.ts +0 -72
  207. package/client/hooks/useWidgetList.ts +0 -30
  208. package/client/lib/ws.ts +0 -129
  209. package/client/store/chat.tsx +0 -162
  210. package/dist/chunk-4615fa69.js +0 -67
  211. package/dist/chunk-582xmy05.css +0 -1
  212. package/server/build-widget.ts +0 -343
  213. package/workspace/.claude/skills/widgets/DESIGN.md +0 -630
  214. package/workspace/.claude/skills/widgets/SKILL.md +0 -176
@@ -1,176 +0,0 @@
1
- ---
2
- name: widgets
3
- description: Build and modify user workspace. Workspace is the web UI user is chatting from and can be extended by writing custom "widgets" Use when the user asks to create, edit, or customize widgets, build custom UI panels, display data as cards, or asks what widgets are or how they work.
4
- ---
5
-
6
- # Widget development
7
-
8
- You are working inside a **moi workspace**.
9
- Widgets are React components (`.tsx` files in `.widgets/`) displayed as live cards on the browser dashboard.
10
-
11
- ## About `moi`
12
-
13
- Treat `moi` as an external command — you cannot inspect or modify its sources. Use only the documented subcommands (`moi bundle`, `moi bundle --force`, etc.).
14
-
15
- ## Managing dependencies
16
-
17
- You are allowed to add packages to `.widgets/package.json` and run `bun install` whenever it's needed (e.g. after editing `package.json`, or before bundling if `node_modules/` looks stale). **Always use `bun`** — never `npm`, `yarn`, or `pnpm`.
18
-
19
- ## First-time setup
20
-
21
- If `.widgets/` does not exist yet, create it and install dependencies:
22
-
23
- 1. Create `.widgets/package.json`:
24
-
25
- ```json
26
- {
27
- "name": "widgets",
28
- "private": true,
29
- "dependencies": {
30
- "@tabler/icons-react": "^3.40.0",
31
- "tailwindcss": "^4.0.0",
32
- "react": "^19.0.0",
33
- "react-dom": "^19.0.0"
34
- },
35
- "devDependencies": {
36
- "@types/react": "^19.0.0",
37
- "@types/react-dom": "^19.0.0"
38
- }
39
- }
40
- ```
41
-
42
- `react` and `react-dom` are stubs — at runtime they're resolved from esm.sh via the browser importmap. They're listed here only so editors pick up the correct types.
43
-
44
- 2. Run `cd .widgets && bun install`
45
-
46
- ## File structure
47
-
48
- | File | Purpose |
49
- |------|---------|
50
- | `.widgets/<name>.tsx` | Widget React component (required) |
51
- | `.widgets/<name>.server.ts` | Server-side async functions the widget can call (optional) |
52
- | `.widgets/.workspace.json` | **Auto-generated. Do NOT read, edit, or `cat` this file.** |
53
-
54
- `.widgets/.workspace.json` is owned by `moi` and rewritten on its own. Use the `moi` CLI to inspect or change anything it contains — never read or edit the file directly.
55
-
56
- ## Workflow
57
-
58
- 1. Read `.claude/skills/widgets/DESIGN.md` before creating or modifying any widget.
59
- 2. Create or edit `.widgets/<name>.tsx` (and optionally `.widgets/<name>.server.ts`).
60
- 3. Run `moi bundle` — the browser picks up changes automatically.
61
- 4. If the widget exports a new `config` with a changed `colSpan`/`rowSpan`, run `moi bundle --force`.
62
-
63
- ## Widget anatomy
64
-
65
- Every widget is a default-exported React component:
66
-
67
- ```tsx
68
- // hello.tsx
69
- import { useState } from 'react'
70
-
71
- export const config = { colSpan: 1, rowSpan: 1 } as const
72
-
73
- export default function Hello() {
74
- const [n, setN] = useState(0)
75
- return (
76
- <div className="flex flex-col w-full h-full p-4 bg-violet-600">
77
- <span className="text-xs text-foreground/70">Counter</span>
78
- <span className="text-2xl font-bold font-mono tabular-nums leading-none mt-4">{n}</span>
79
- <button
80
- onClick={() => setN(n + 1)}
81
- className="mt-auto text-xs text-foreground/70 text-left"
82
- >
83
- +1
84
- </button>
85
- </div>
86
- )
87
- }
88
- ```
89
-
90
- Key rules:
91
- - The widget root is content-only: a plain `w-full h-full` rectangle. Never apply card chrome — no `rounded-*`, `shadow-*`, outer `border`, or background that mimics a card surface — the host dashboard owns the shell, spacing, radius, border, and elevation.
92
- - Tailwind is available. Never use `style={{}}` or custom CSS.
93
- - Import only from the same folder or `package.json` deps. No `@/` path aliases.
94
- - For conditional classes, define a local `cx()` helper (widgets can't import from the project root):
95
-
96
- ```tsx
97
- function cx(...classes: (string | false | undefined | null)[]) {
98
- return classes.filter(Boolean).join(' ')
99
- }
100
- ```
101
-
102
- ## Server functions (optional)
103
-
104
- Create a `.server.ts` alongside the widget. Export named `async function`s only — no `const`, sync, or class. They run on the Bun server with full access to `process.env` and the filesystem (including files outside `.widgets/`).
105
-
106
- **Working directory:** server functions run with `cwd = <workspace root>` (the parent of `.widgets/` — same directory the agent operates in). Use plain relative paths to read workspace files:
107
-
108
- ```ts
109
- // ✓ workspace-root files: just use relative paths
110
- new Database('local.db', { readonly: true })
111
- await Bun.file('./data/notes.json').text()
112
- ```
113
-
114
- For files inside `.widgets/` itself, anchor on the file's own location:
115
-
116
- ```ts
117
- import { fileURLToPath } from 'url'
118
- import { dirname, join } from 'path'
119
-
120
- const here = dirname(fileURLToPath(import.meta.url)) // resolves to .widgets/
121
- const fixturePath = join(here, 'fixture.json')
122
- ```
123
-
124
- ```ts
125
- // hello.server.ts
126
- export async function fetchData(): Promise<{ value: number }> {
127
- // can read files, call APIs, query DBs, etc.
128
- return { value: 42 }
129
- }
130
- ```
131
-
132
- Call them from the widget exactly like normal async functions — arguments and return values are auto-serialized (supports `Date`, `Map`, `Set`, etc.).
133
-
134
- Standard data-fetching pattern for a widget with a server function:
135
-
136
- ```tsx
137
- export default function MyWidget() {
138
- const [data, setData] = useState<DataType | null>(null)
139
- const [error, setError] = useState<string | null>(null)
140
- const [loading, setLoading] = useState(true)
141
-
142
- const load = useCallback(async () => {
143
- try {
144
- const result = await fetchData()
145
- setData(result)
146
- setError(null)
147
- } catch {
148
- setError('Could not load data')
149
- } finally {
150
- setLoading(false)
151
- }
152
- }, [])
153
-
154
- useEffect(() => { load() }, [load])
155
-
156
- if (loading) return <Skeleton />
157
- if (error || !data) return <ErrorState error={error} onRetry={load} />
158
- return <Content data={data} />
159
- }
160
- ```
161
-
162
- Always handle three states: loading → skeleton, error → error state with retry, success → content.
163
-
164
- ## Commands
165
-
166
- - `moi bundle` — compile changed widgets
167
- - `moi bundle --force` — rebuild all widgets (use after changing `config`)
168
- - `moi refresh` — re-fetch widget data without rebuilding (use after you mutated data the widgets read — DB rows, files, external API records — so the displayed values catch up)
169
- - `moi theme --font=<key>` — change font theme (omit `--font` to list options)
170
- - `moi theme --color=<key>` — change color preset (omit `--color` to list options)
171
-
172
- ## Rules
173
-
174
- - Never read or modify files outside this workspace directory.
175
- - Do not start, stop, or inspect the web server — it is managed externally.
176
- - Only use `moi` commands listed above plus `bun` / `bun install` for dependencies — no `node`, `npm`, `yarn`, `pnpm`, or other server commands.