moi-computer 0.0.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 (106) hide show
  1. package/LICENSE +95 -0
  2. package/README.md +71 -0
  3. package/bin/moi.mjs +25 -0
  4. package/bunfig.toml +3 -0
  5. package/client/CLAUDE.md +12 -0
  6. package/client/api/workspaces.ts +158 -0
  7. package/client/assets/claude.svg +3 -0
  8. package/client/assets/favicon.png +0 -0
  9. package/client/assets/hermes-nous.png +0 -0
  10. package/client/assets/mcp/.gitkeep +0 -0
  11. package/client/assets/mcp/atlassian.png +0 -0
  12. package/client/assets/mcp/discord.png +0 -0
  13. package/client/assets/mcp/figma.png +0 -0
  14. package/client/assets/mcp/github.png +0 -0
  15. package/client/assets/mcp/gitlab.png +0 -0
  16. package/client/assets/mcp/granola.png +0 -0
  17. package/client/assets/mcp/hubspot.png +0 -0
  18. package/client/assets/mcp/linear.png +0 -0
  19. package/client/assets/mcp/neon.png +0 -0
  20. package/client/assets/mcp/notion.png +0 -0
  21. package/client/assets/mcp/sentry.png +0 -0
  22. package/client/assets/mcp/slack.png +0 -0
  23. package/client/assets/mcp/stripe.png +0 -0
  24. package/client/assets/mcp/supabase.png +0 -0
  25. package/client/assets/mcp/vercel.png +0 -0
  26. package/client/assets/moi-logo.svg +11 -0
  27. package/client/assets/openclaw.svg +22 -0
  28. package/client/components/App.tsx +35 -0
  29. package/client/components/BottomPanel.tsx +33 -0
  30. package/client/components/ChatInput.tsx +62 -0
  31. package/client/components/ChatPanel.tsx +206 -0
  32. package/client/components/ChatPopup.tsx +60 -0
  33. package/client/components/CustomizePanel.tsx +117 -0
  34. package/client/components/HiddenPanel.tsx +79 -0
  35. package/client/components/HomePage.tsx +17 -0
  36. package/client/components/MarkdownContent.tsx +41 -0
  37. package/client/components/ThreadSelector.tsx +88 -0
  38. package/client/components/TurnView.tsx +618 -0
  39. package/client/components/WidgetErrorBoundary.tsx +46 -0
  40. package/client/components/WidgetFrame.tsx +66 -0
  41. package/client/components/WidgetGrid.tsx +113 -0
  42. package/client/components/WidgetShell.tsx +44 -0
  43. package/client/components/Widgets.tsx +132 -0
  44. package/client/components/WorkspacePreview.tsx +48 -0
  45. package/client/components/WorkspacesPage.tsx +237 -0
  46. package/client/components/layout/SidebarLayout.tsx +260 -0
  47. package/client/components/playground/LedLogo.tsx +181 -0
  48. package/client/components/playground/PixelPainter.tsx +105 -0
  49. package/client/components/playground/PlaygroundPage.tsx +71 -0
  50. package/client/components/routes/workspace/[id].tsx +282 -0
  51. package/client/components/ui/button.tsx +48 -0
  52. package/client/components/ui/dropdown-menu.tsx +257 -0
  53. package/client/components/ui/input.tsx +21 -0
  54. package/client/components/ui/popover.tsx +79 -0
  55. package/client/components/ui/textarea.tsx +18 -0
  56. package/client/externalize-react.ts +29 -0
  57. package/client/hooks/useChat.ts +88 -0
  58. package/client/hooks/useFitsSidebar.ts +34 -0
  59. package/client/hooks/useGridReconcile.ts +73 -0
  60. package/client/hooks/useMeiEvents.ts +66 -0
  61. package/client/hooks/useScrollFade.ts +38 -0
  62. package/client/hooks/useWidget.ts +72 -0
  63. package/client/hooks/useWidgetList.ts +30 -0
  64. package/client/hooks/useWorkspaceTheme.ts +76 -0
  65. package/client/index.css +182 -0
  66. package/client/index.html +43 -0
  67. package/client/index.tsx +19 -0
  68. package/client/lib/WorkspaceContext.tsx +24 -0
  69. package/client/lib/WorkspaceLayoutContext.tsx +92 -0
  70. package/client/lib/cn.ts +6 -0
  71. package/client/lib/grid-pack.ts +35 -0
  72. package/client/lib/group-turns.ts +44 -0
  73. package/client/lib/mcp-icons.ts +53 -0
  74. package/client/lib/ws.ts +129 -0
  75. package/client/main.tsx +23 -0
  76. package/client/store/chat.tsx +162 -0
  77. package/client/store/ui.ts +21 -0
  78. package/client/theme.css +66 -0
  79. package/lib/claude-adapter.ts +602 -0
  80. package/lib/format.ts +212 -0
  81. package/lib/themes.ts +89 -0
  82. package/lib/types.ts +144 -0
  83. package/package.json +117 -0
  84. package/server/CLAUDE.md +6 -0
  85. package/server/agent.ts +132 -0
  86. package/server/build-widget.ts +343 -0
  87. package/server/cli.ts +632 -0
  88. package/server/constants.ts +3 -0
  89. package/server/control.ts +98 -0
  90. package/server/functions-worker.ts +89 -0
  91. package/server/functions.ts +171 -0
  92. package/server/layout.ts +83 -0
  93. package/server/openclaw-adapter.ts +242 -0
  94. package/server/openclaw-gateway.ts +255 -0
  95. package/server/openclaw-session.ts +485 -0
  96. package/server/openclaw-strip.ts +134 -0
  97. package/server/openclaw.ts +206 -0
  98. package/server/registry.ts +150 -0
  99. package/server/skills-template.ts +21 -0
  100. package/server/state.ts +87 -0
  101. package/server/theme.ts +55 -0
  102. package/server/web.ts +321 -0
  103. package/server/widgets.ts +254 -0
  104. package/tsconfig.json +21 -0
  105. package/workspace/.claude/skills/widgets/DESIGN.md +630 -0
  106. package/workspace/.claude/skills/widgets/SKILL.md +176 -0
package/LICENSE ADDED
@@ -0,0 +1,95 @@
1
+ Copyright (c) 2026 Alexey Taktarov
2
+
3
+ Elastic License 2.0
4
+
5
+ URL: https://www.elastic.co/licensing/elastic-license
6
+
7
+ ## Acceptance
8
+
9
+ By using the software, you agree to all of the terms and conditions below.
10
+
11
+ ## Copyright License
12
+
13
+ The licensor grants you a non-exclusive, royalty-free, worldwide,
14
+ non-sublicensable, non-transferable license to use, copy, distribute, make
15
+ available, and prepare derivative works of the software, in each case subject to
16
+ the limitations and conditions below.
17
+
18
+ ## Limitations
19
+
20
+ You may not provide the software to third parties as a hosted or managed
21
+ service, where the service provides users with access to any substantial set of
22
+ the features or functionality of the software.
23
+
24
+ You may not move, change, disable, or circumvent the license key functionality
25
+ in the software, and you may not remove or obscure any functionality in the
26
+ software that is protected by the license key.
27
+
28
+ You may not alter, remove, or obscure any licensing, copyright, or other notices
29
+ of the licensor in the software. Any use of the licensor's trademarks is subject
30
+ to applicable law.
31
+
32
+ ## Patents
33
+
34
+ The licensor grants you a license, under any patent claims the licensor can
35
+ license, or becomes able to license, to make, have made, use, sell, offer for
36
+ sale, import and have imported the software, in each case subject to the
37
+ limitations and conditions in this license. This license does not cover any
38
+ patent claims that you cause to be infringed by modifications or additions to
39
+ the software. If you or your company make any written claim that the software
40
+ infringes or contributes to infringement of any patent, your patent license for
41
+ the software granted under these terms ends immediately. If your company makes
42
+ such a claim, your patent license ends immediately for work on behalf of your
43
+ company.
44
+
45
+ ## Notices
46
+
47
+ You must ensure that anyone who gets a copy of any part of the software from you
48
+ also gets a copy of these terms.
49
+
50
+ If you modify the software, you must include in any modified copies of the
51
+ software prominent notices stating that you have modified the software.
52
+
53
+ ## No Other Rights
54
+
55
+ These terms do not imply any licenses other than those expressly granted in
56
+ these terms.
57
+
58
+ ## Termination
59
+
60
+ If you use the software in violation of these terms, such use is not licensed,
61
+ and your licenses will automatically terminate. If the licensor provides you
62
+ with a notice of your violation, and you cease all violation of this license no
63
+ later than 30 days after you receive that notice, your licenses will be
64
+ reinstated retroactively. However, if you violate these terms after such
65
+ reinstatement, any additional violation of these terms will cause your licenses
66
+ to terminate automatically and permanently.
67
+
68
+ ## No Liability
69
+
70
+ As far as the law allows, the software comes as is, without any warranty or
71
+ condition, and the licensor will not be liable to you for any damages arising
72
+ out of these terms or the use or nature of the software, under any kind of legal
73
+ claim.
74
+
75
+ ## Definitions
76
+
77
+ The "licensor" is the entity offering these terms, and the "software" is the
78
+ software the licensor makes available under these terms, including any portion
79
+ of it.
80
+
81
+ "you" refers to the individual or entity agreeing to these terms.
82
+
83
+ "your company" is any legal entity, sole proprietorship, or other kind of
84
+ organization that you work for, plus all organizations that have control over,
85
+ are under the control of, or are under common control with that organization.
86
+ "control" means ownership of substantially all the assets of an entity, or the
87
+ power to direct its management and policies by vote, contract, or otherwise.
88
+ Control can be direct or indirect.
89
+
90
+ "your licenses" are all the licenses granted to you for the software under these
91
+ terms.
92
+
93
+ "use" means anything you do with the software requiring one of your licenses.
94
+
95
+ "trademark" means trademarks, service marks, and similar rights.
package/README.md ADDED
@@ -0,0 +1,71 @@
1
+ # moi
2
+
3
+ Local AI workspace powered by the Claude Agent SDK, Bun, React, and Tailwind.
4
+
5
+ > Published on npm as **`moi-computer`**; the installed command is **`moi`**.
6
+
7
+ > **Requires [Bun](https://bun.sh).** moi is Bun-only — it uses `Bun.serve`, the
8
+ > Bun bundler, and other Bun APIs. Running it under Node prints an install hint
9
+ > and exits.
10
+
11
+ ## Install
12
+
13
+ Install globally so the `moi` command is always on your PATH — the agent calls
14
+ `moi` from your workspaces, so this is the recommended setup:
15
+
16
+ ```sh
17
+ bun i -g moi-computer
18
+ moi start
19
+ ```
20
+
21
+ If you don't have Bun yet:
22
+
23
+ ```sh
24
+ curl -fsSL https://bun.sh/install | bash
25
+ ```
26
+
27
+ You can also run it once without installing:
28
+
29
+ ```sh
30
+ bunx moi-computer init [dir]
31
+ ```
32
+
33
+ `bunx` works for a single invocation but leaves no persistent `moi` command, so
34
+ it prints a reminder to install globally.
35
+
36
+ ## Usage
37
+
38
+ Initialize a workspace directory:
39
+
40
+ ```sh
41
+ moi init [dir] # scaffold .claude/skills into dir (default: .)
42
+ moi init [dir] --web # also start the server and open the browser
43
+ ```
44
+
45
+ Start the web server:
46
+
47
+ ```sh
48
+ moi start # http://localhost:3000
49
+ moi start --port=4000 # custom port
50
+ ```
51
+
52
+ Other commands:
53
+
54
+ ```sh
55
+ moi bundle [dir] # rebuild changed widgets
56
+ moi refresh # refresh widget data without rebuilding
57
+ moi theme [dir] # show or set font/color themes (--font=<key> --color=<key>)
58
+ moi status # show server status and registered workspaces
59
+ moi openclaw init # install moi skills into an OpenClaw agent workspace
60
+ ```
61
+
62
+ ## Development (from source)
63
+
64
+ ```sh
65
+ bun install
66
+ bun run dev # watch-and-restart dev server on port 3000
67
+ ```
68
+
69
+ `bun run dev` starts a supervisor that hot-reloads the frontend in place and
70
+ full-restarts the server on changes to `server/` or `lib/`. Do not run the
71
+ server with `bun --hot` — see `CLAUDE.md` for why.
package/bin/moi.mjs ADDED
@@ -0,0 +1,25 @@
1
+ #!/usr/bin/env bun
2
+ // Plain ESM launcher so Node can parse far enough to print a friendly error.
3
+ // The real CLI (server/cli.ts) is TypeScript, uses Bun-only APIs, and relies
4
+ // on the `@/` path alias — none of which Node can load. So it MUST be a
5
+ // dynamic import placed AFTER the Bun guard below: a static import would be
6
+ // hoisted and fail before the guard ever runs.
7
+ if (!process.versions.bun) {
8
+ console.error('moi requires Bun (Node is not supported).')
9
+ console.error('Install Bun: curl -fsSL https://bun.sh/install | bash')
10
+ console.error('Then run: bun i -g moi-computer')
11
+ process.exit(1)
12
+ }
13
+
14
+ // The `moi` command is meant to live on your PATH permanently: the agent
15
+ // shells out to `moi bundle`/`moi refresh` from your workspaces, which only
16
+ // works if it's installed. If `moi` doesn't resolve as a command, nudge toward
17
+ // a global install. (`Bun.which` honors a custom global bin dir and finds
18
+ // installs from any package manager, unlike checking a hardcoded path.)
19
+ if (!Bun.which('moi')) {
20
+ console.error('Note: `moi` is not installed as a command — this run is temporary.')
21
+ console.error('Install it so the command stays available (the agent calls it from your workspaces):')
22
+ console.error(' bun i -g moi-computer\n')
23
+ }
24
+
25
+ await import('../server/cli.ts')
package/bunfig.toml ADDED
@@ -0,0 +1,3 @@
1
+
2
+ [serve.static]
3
+ plugins = ["bun-plugin-tailwind", "./client/externalize-react.ts"]
@@ -0,0 +1,12 @@
1
+ React SPA connecting to the server via WebSocket (`useChat` hook).
2
+
3
+ ## Entities
4
+
5
+ - **Space** — Top-level container. Has a name and contains widgets and a chat. One space is active at a time.
6
+ - **Widget** — A configurable card inside the space's main area. Displayed in a grid. When there are no widgets, the chat fills the whole panel.
7
+ - **Chat** — The agent conversation. Contains a scrollable message list and an input. Always lives in the panel. Two modes: sidebar (a bounded pane beside the widgets, or the full panel when there are no widgets) and floating (popover). Floating only applies when there are widgets and they need the room.
8
+
9
+ ## Conventions
10
+
11
+ - UI components in `components/ui/` are shadcn built on Base UI React.
12
+ - `lib/cn.ts` is `clsx` + `tailwind-merge`.
@@ -0,0 +1,158 @@
1
+ import { useMutation, useQuery, useQueryClient } from '@tanstack/react-query'
2
+
3
+ import type {
4
+ DiscoveredWorkspace,
5
+ SessionInfo,
6
+ WidgetInfo,
7
+ WorkspaceEntry,
8
+ WorkspaceLayout,
9
+ WorkspacePreview
10
+ } from '@/lib/types'
11
+
12
+ // Layout endpoint payload: the persisted layout plus server-resolved metadata
13
+ // (`cwd`, `name`, `agentId`) merged in by the route.
14
+ export type WorkspaceLayoutResponse = WorkspaceLayout & {
15
+ cwd: string
16
+ name: string
17
+ agentId?: string
18
+ }
19
+
20
+ // Central query-key registry for the workspaces domain. Both the `/` view and
21
+ // the sidebar read from these keys, so the cache is shared.
22
+ export const workspaceKeys = {
23
+ all: ['workspaces'] as const,
24
+ discover: ['workspaces', 'discover'] as const,
25
+ preview: (id: string) => ['workspaces', 'preview', id] as const,
26
+ layout: (id: string) => ['workspaces', 'layout', id] as const,
27
+ widgets: (id: string) => ['workspaces', 'widgets', id] as const,
28
+ sessions: (id: string) => ['workspaces', 'sessions', id] as const
29
+ }
30
+
31
+ // Registered workspaces (the contents of workspaces.json).
32
+ //
33
+ // Cache-first: the list rarely changes, so `staleTime: Infinity` keeps it cached
34
+ // indefinitely (no focus/interval refetch churn) and mutations below keep it
35
+ // current. `refetchOnMount: 'always'` still fires a background refetch on every
36
+ // (re)mount — e.g. when the Sidebar remounts on collapse — while showing the
37
+ // cached data immediately, so the rows never flicker empty.
38
+ export function useWorkspaces() {
39
+ return useQuery<WorkspaceEntry[]>({
40
+ queryKey: workspaceKeys.all,
41
+ queryFn: () => fetch('/api/workspaces').then(r => r.json()),
42
+ staleTime: Infinity,
43
+ refetchOnMount: 'always'
44
+ })
45
+ }
46
+
47
+ // Per-workspace dashboard preview (widget grid thumbnail).
48
+ export function useWorkspacePreview(workspaceId: string) {
49
+ return useQuery<WorkspacePreview>({
50
+ queryKey: workspaceKeys.preview(workspaceId),
51
+ queryFn: () => fetch(`/api/workspaces/${workspaceId}/preview`).then(r => r.json()),
52
+ staleTime: 60_000
53
+ })
54
+ }
55
+
56
+ // Shared freshness policy for a workspace's resources: always considered stale
57
+ // (`staleTime: 0`) so every (re)mount and window-focus refetches in the
58
+ // background, while `gcTime` keeps the data cached when you switch to another
59
+ // workspace and back — so the panel shows instantly, then revalidates.
60
+ const WORKSPACE_RESOURCE_OPTS = {
61
+ staleTime: 0,
62
+ gcTime: 5 * 60_000,
63
+ refetchOnMount: true,
64
+ refetchOnWindowFocus: true
65
+ } as const
66
+
67
+ // Persisted layout + workspace metadata for a single workspace.
68
+ export function useWorkspaceLayout(workspaceId: string) {
69
+ return useQuery<WorkspaceLayoutResponse>({
70
+ queryKey: workspaceKeys.layout(workspaceId),
71
+ queryFn: () => fetch(`/api/workspaces/${workspaceId}/layout`).then(r => r.json()),
72
+ ...WORKSPACE_RESOURCE_OPTS
73
+ })
74
+ }
75
+
76
+ // Widgets declared in a workspace (the endpoint wraps them in `{ widgets }`).
77
+ export function useWorkspaceWidgets(workspaceId: string) {
78
+ return useQuery<WidgetInfo[]>({
79
+ queryKey: workspaceKeys.widgets(workspaceId),
80
+ queryFn: () =>
81
+ fetch(`/api/workspaces/${workspaceId}/widgets`)
82
+ .then(r => r.json())
83
+ .then((d: { widgets: WidgetInfo[] }) => d.widgets),
84
+ ...WORKSPACE_RESOURCE_OPTS
85
+ })
86
+ }
87
+
88
+ // Sessions (chat threads) available in a workspace, latest first.
89
+ export function useWorkspaceSessions(workspaceId: string) {
90
+ return useQuery<SessionInfo[]>({
91
+ queryKey: workspaceKeys.sessions(workspaceId),
92
+ queryFn: () => fetch(`/api/workspaces/${workspaceId}/sessions`).then(r => r.json()),
93
+ ...WORKSPACE_RESOURCE_OPTS
94
+ })
95
+ }
96
+
97
+ // Persist a workspace's layout (widget grid, chat mode, theme). Callers update
98
+ // the layout query cache optimistically and use this to write through to the
99
+ // server, so it's a plain fire-and-forget PUT with no extra cache work.
100
+ export function useSaveLayout(workspaceId: string) {
101
+ return useMutation<void, Error, WorkspaceLayout>({
102
+ mutationFn: async layout => {
103
+ const res = await fetch(`/api/workspaces/${workspaceId}/layout`, {
104
+ method: 'PUT',
105
+ headers: { 'Content-Type': 'application/json' },
106
+ body: JSON.stringify(layout)
107
+ })
108
+ if (!res.ok) throw new Error('Failed to save layout')
109
+ }
110
+ })
111
+ }
112
+
113
+ // CC / OpenClaw directories found on the machine but not yet registered.
114
+ export function useDiscoveredWorkspaces() {
115
+ return useQuery<DiscoveredWorkspace[]>({
116
+ queryKey: workspaceKeys.discover,
117
+ queryFn: () => fetch('/api/workspaces/discover').then(r => r.json())
118
+ })
119
+ }
120
+
121
+ // Import a discovered workspace into the registry (optimistically move it from
122
+ // the discover list into the registered list).
123
+ export function useAddWorkspace() {
124
+ const qc = useQueryClient()
125
+ return useMutation<WorkspaceEntry, Error, DiscoveredWorkspace>({
126
+ mutationFn: async discovered => {
127
+ const res = await fetch('/api/workspaces', {
128
+ method: 'POST',
129
+ headers: { 'Content-Type': 'application/json' },
130
+ body: JSON.stringify(discovered)
131
+ })
132
+ return res.json()
133
+ },
134
+ onSuccess: (entry, suggestion) => {
135
+ qc.setQueryData<WorkspaceEntry[]>(workspaceKeys.all, prev => [...(prev ?? []), entry])
136
+ qc.setQueryData<DiscoveredWorkspace[]>(workspaceKeys.discover, prev =>
137
+ (prev ?? []).filter(s => s.path !== suggestion.path)
138
+ )
139
+ }
140
+ })
141
+ }
142
+
143
+ // Remove a workspace from the registry (re-discovery may surface it again).
144
+ export function useRemoveWorkspace() {
145
+ const qc = useQueryClient()
146
+ return useMutation<void, Error, WorkspaceEntry>({
147
+ mutationFn: async entry => {
148
+ const res = await fetch(`/api/workspaces/${entry.id}`, { method: 'DELETE' })
149
+ if (!res.ok) throw new Error('Failed to remove workspace')
150
+ },
151
+ onSuccess: (_void, entry) => {
152
+ qc.setQueryData<WorkspaceEntry[]>(workspaceKeys.all, prev =>
153
+ (prev ?? []).filter(w => w.id !== entry.id)
154
+ )
155
+ qc.invalidateQueries({ queryKey: workspaceKeys.discover })
156
+ }
157
+ })
158
+ }
@@ -0,0 +1,3 @@
1
+ <svg width="248" height="248" viewBox="0 0 248 248" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <path d="M52.4285 162.873L98.7844 136.879L99.5485 134.602L98.7844 133.334H96.4921L88.7237 132.862L62.2346 132.153L39.3113 131.207L17.0249 130.026L11.4214 128.844L6.2 121.873L6.7094 118.447L11.4214 115.257L18.171 115.847L33.0711 116.911L55.485 118.447L71.6586 119.392L95.728 121.873H99.5485L100.058 120.337L98.7844 119.392L97.7656 118.447L74.5877 102.732L49.4995 86.1905L36.3823 76.62L29.3779 71.7757L25.8121 67.2858L24.2839 57.3608L30.6515 50.2716L39.3113 50.8623L41.4763 51.4531L50.2636 58.1879L68.9842 72.7209L93.4357 90.6804L97.0015 93.6343L98.4374 92.6652L98.6571 91.9801L97.0015 89.2625L83.757 65.2772L69.621 40.8192L63.2534 30.6579L61.5978 24.632C60.9565 22.1032 60.579 20.0111 60.579 17.4246L67.8381 7.49965L71.9133 6.19995L81.7193 7.49965L85.7946 11.0443L91.9074 24.9865L101.714 46.8451L116.996 76.62L121.453 85.4816L123.873 93.6343L124.764 96.1155H126.292V94.6976L127.566 77.9197L129.858 57.3608L132.15 30.8942L132.915 23.4505L136.608 14.4708L143.994 9.62643L149.725 12.344L154.437 19.0788L153.8 23.4505L150.998 41.6463L145.522 70.1215L141.957 89.2625H143.994L146.414 86.7813L156.093 74.0206L172.266 53.698L179.398 45.6635L187.803 36.802L193.152 32.5484H203.34L210.726 43.6549L207.415 55.1159L196.972 68.3492L188.312 79.5739L175.896 96.2095L168.191 109.585L168.882 110.689L170.738 110.53L198.755 104.504L213.91 101.787L231.994 98.7149L240.144 102.496L241.036 106.395L237.852 114.311L218.495 119.037L195.826 123.645L162.07 131.592L161.696 131.893L162.137 132.547L177.36 133.925L183.855 134.279H199.774L229.447 136.524L237.215 141.605L241.8 147.867L241.036 152.711L229.065 158.737L213.019 154.956L175.45 145.977L162.587 142.787H160.805V143.85L171.502 154.366L191.242 172.089L215.82 195.011L217.094 200.682L213.91 205.172L210.599 204.699L188.949 188.394L180.544 181.069L161.696 165.118H160.422V166.772L164.752 173.152L187.803 207.771L188.949 218.405L187.294 221.832L181.308 223.959L174.813 222.777L161.187 203.754L147.305 182.486L136.098 163.345L134.745 164.2L128.075 235.42L125.019 239.082L117.887 241.8L111.902 237.31L108.718 229.984L111.902 215.452L115.722 196.547L118.779 181.541L121.58 162.873L123.291 156.636L123.14 156.219L121.773 156.449L107.699 175.752L86.304 204.699L69.3663 222.777L65.291 224.431L58.2867 220.768L58.9235 214.27L62.8713 208.48L86.304 178.705L100.44 160.155L109.551 149.507L109.462 147.967L108.959 147.924L46.6977 188.512L35.6182 189.93L30.7788 185.44L31.4156 178.115L33.7079 175.752L52.4285 162.873Z" fill="#D97757"/>
3
+ </svg>
Binary file
Binary file
File without changes
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
@@ -0,0 +1,11 @@
1
+ <svg width="1052" height="697" viewBox="0 0 1052 697" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <g clip-path="url(#clip0_4902_59)">
3
+ <path d="M225.085 167.018C248.024 168.122 236.544 212.045 234.575 225.326C231.744 244.427 227.083 259.857 219.327 277.35C216.087 284.655 206.556 323.214 211.744 328.829C219.355 329.663 231.764 311.026 236.971 305.581C251.975 289.889 266.131 272.923 282.625 258.754C288.32 253.289 302.288 244.614 306.942 239.011C326.819 215.08 347.936 196.337 366.314 235.32C369.638 242.371 373.834 249.94 375.882 258.422C377.198 263.781 377.582 269.326 377.015 274.814C376.267 282.138 368.122 301.189 374.684 306.028C380.609 306.278 390.98 293.546 395.507 289.03C408.932 275.637 421.295 260.303 435.495 247.752C447.332 237.292 462.187 229.612 474.296 219.409C481.031 213.703 485.54 206.543 493.193 201.361C502.43 195.212 513.755 193.046 524.606 195.353C541.849 199.052 546.735 214.931 543.955 230.523C541.206 245.939 532.395 259.143 527.392 273.83C521.606 290.803 516.738 308.016 511.198 325.056C506.171 342.703 497.198 359.568 491.38 376.744C484.36 397.464 480.017 416.262 469.242 435.69C465.029 443.283 461.459 458.101 459.178 467.089C457.07 475.398 453.11 490.596 457.066 498.617C458.141 500.405 459.751 500.79 461.587 501.078C469.566 499.278 521.116 452.822 528.335 442.272C534.005 431.184 536.62 416.862 541.622 405.65C550.421 386.577 557.824 366.683 566.623 347.671C570.529 340.089 576.114 332.53 579.8 324.917C596.295 290.83 623.365 264.212 649.474 237.436C653.999 232.966 665.161 217.141 670.904 215.359C683.548 211.44 707.073 204.13 719.723 201.733C757.013 194.671 779.46 223.558 803.493 245.788C814.606 256.552 815.91 272.434 818.188 286.59C822.695 314.576 826.301 312.057 843.727 294.93C859.115 279.679 874.685 264.616 890.434 249.743C904.07 236.645 916.604 222.126 933.167 212.579C945.394 205.018 959.312 203.904 972.097 198.41C987.558 191.771 1001.44 195.09 1000.4 214.755C1000.04 221.436 996.136 230.395 993.032 236.554C979.524 263.31 975.979 293.419 966.611 321.58C963.629 332.135 955.302 343.789 952.35 354.015C943.594 384.373 932.481 413.525 921.38 442.903C917.081 454.267 901.59 505.689 926.664 500.846C931.213 499.964 958.277 478.404 964.296 475.08C971.595 470.353 989.646 456.184 996.791 461.389C1001.89 470.481 971.907 500.594 965.527 508.285L938.72 540.113C925.611 555.677 918.667 564.029 901.878 576.147C889.803 584.866 879.945 597.1 865.911 604.454C855.092 610.123 847.591 614.599 834.604 610.993C816.223 606.376 806.23 584.309 807.565 566.662C808.379 555.892 814.471 545.366 817.331 535.03C820.05 527.175 820.846 513.11 824.63 505.946C835.48 485.415 841.333 465.479 847.101 443.166C849.122 435.347 854.302 426.059 856.678 417.946C858.937 410.231 861.331 402.326 863.842 394.684C865.911 388.408 872.64 374.239 873.626 368.777C876.51 352.815 887.801 325.231 880.386 310.37C879.363 308.325 876.841 306.512 874.722 306.126C865.195 304.393 849.789 316.673 841.664 321.928C837.194 324.893 827.63 327.415 826.375 330.397C823.08 338.246 822.615 350.855 821.182 359.575C819.884 367.014 818.225 374.386 816.21 381.667C803.811 426.579 784.26 469.202 758.323 507.899C752.494 516.778 747.118 525.436 740.432 533.732C729.563 547.074 717.342 559.247 703.963 570.073C690.792 580.696 658.487 597.81 641.979 602.39C635.832 604.098 629.568 604.919 623.2 604.196C616.342 603.413 609.803 601.098 603.343 598.771C580.381 590.499 576.126 582.674 560.328 565.456C551.37 555.69 543.165 547.558 538.145 534.975C536.816 531.638 535.524 528.24 534.575 524.78C532.597 517.537 531.966 505.848 527.129 500.178C525.996 498.849 524.472 497.913 522.665 497.986C512.444 498.409 467.912 558.665 457.895 568.921C450.094 576.906 441.098 582.68 432.125 589.195C420.769 597.437 408.721 609.579 393.61 609.383C387.696 609.285 382.059 606.86 377.923 602.629C370.73 595.269 359.461 571.646 359.609 560.698C359.789 547.289 364.671 537.278 368.39 524.823C372.097 512.406 375.969 500.233 379.719 487.889C383.257 476.249 385.378 463.483 389.652 452.026C393.412 441.948 399.203 432.947 403.425 422.832C409.453 408.394 413.017 394.096 417.758 379.321C421.976 366.861 428.672 354.75 428.911 341.326C429.013 335.606 427.508 324.78 419.454 326.505C409.654 328.604 399.803 341.65 393.559 349.055C368.937 378.262 348.228 410.855 331.997 445.42C317.916 476.574 307.75 511.279 286.582 539.353C279.321 548.985 268.751 555.53 259.442 562.933C253.84 567.409 248.499 572.038 242.479 575.92C237.976 578.822 229.477 580.831 225.45 576.183C218.363 568.009 222.297 551.342 224.225 541.852C227.109 527.646 233.47 514.739 238.566 501.305C241.995 492.157 244.43 482.36 247.644 473.145C250.21 465.791 252.929 458.652 255.593 451.298C259.645 439.615 261.018 426.781 265.029 415.135C269.316 402.681 274.996 390.918 277.834 377.974C279.948 369.476 281.664 360.891 281.576 352.147C281.521 346.783 278.251 339.013 271.91 340.104C262.675 341.693 251.997 354.609 246.425 361.411C228.561 383.228 212.448 406.593 199.146 431.453C190.856 447.085 183.908 464.089 176.449 480.15C171.53 490.742 165.923 500.619 161.313 511.322C155.086 525.785 154.8 541.356 146.963 555.181C142.418 563.203 135.131 569.313 130.169 576.355C123.363 586.017 118.722 595.961 111.151 605.464C103.422 615.169 95.2682 622.957 86.8539 631.946C82.2684 637.365 77.2707 643.329 73.2056 649.14C66.2786 659.028 58.3946 666.682 49.6901 674.899C45.6348 677.961 39.0935 687.164 35.1791 689.423C16.9287 699.936 22.726 674.348 25.3797 666.909C30.6658 652.079 36.6467 641.663 43.1415 627.917C48.3007 616.987 50.9612 606.835 55.3061 595.74C59.4337 585.656 65.5004 575.939 69.7388 565.37C77.0699 547.087 80.6108 528.84 86.2147 510.165C88.8892 498.966 97.4449 486.597 100.252 475.802C106.892 450.269 114.114 426.316 123.709 401.732C127.946 390.876 129.101 376.566 132.374 365.147C135.05 355.815 139.495 347.175 140.113 337.603C140.373 331.118 137.832 324.329 133.564 320.473C115.182 303.868 87.4393 341.043 70.5917 344.438C69.2495 344.714 68.1113 343.483 67.1854 342.554C63.522 326.011 112.538 279.881 123.166 265.128C126.072 261.093 137.535 254.992 142.133 252.173C147.177 249.054 151.897 245.438 156.223 241.381C179.183 219.586 198.055 195.661 218.129 171.289C220.02 168.993 222.353 167.962 225.085 167.018ZM643.865 527.964C678.638 518.296 700.913 485.777 718.162 456.166C721.524 450.385 723.887 444.795 726.753 438.96C734.064 424.081 736.586 409.055 740.67 393.282C744.093 380.044 748.826 367.351 749.365 353.354C750.106 345.828 748.349 338.489 747.847 331.05C747.253 322.325 747.626 314.638 745.085 306.11C740.205 289.752 731.97 270.724 711.176 273.642C697.301 278.213 688.906 288.536 678.185 297.977C670.451 304.79 661.175 311.511 654.213 318.967C650.864 322.49 648.035 326.475 645.812 330.801C642.824 336.611 640.595 343.636 637.638 349.435C633.137 358.27 626.451 367.155 622.612 376.376C605.951 416.433 599.289 458.107 612.84 500.252C616.128 510.489 621.828 521.137 631.692 525.883C635.47 527.72 639.695 528.442 643.865 527.964Z" fill="black"/>
4
+ <path d="M1046.03 4.79971C1048.85 4.50335 1049.85 4.30925 1052.06 6.21352C1053.3 9.87265 1048.57 17.9483 1047.13 21.9265C1043.46 32.0173 1041.8 41.7541 1040.38 52.2876C1038.78 64.2073 1048.71 68.7549 1049.14 79.8242C1048.91 95.2542 1023.16 123.145 1012.46 134.379C1004.31 142.941 982.182 166.484 970.634 166.105C965.693 165.943 962.919 163.795 959.558 160.484C954.408 153.249 953.625 141.468 948.585 133.149C945.701 128.378 939.15 123.98 938.017 119.116C936.327 111.816 947.471 100.616 951.231 94.1442C953.404 90.9822 955.186 87.4762 956.76 83.9897C962.656 70.9305 962.754 58.2741 975.178 49.1869C981.778 44.3632 988.753 39.2125 995.298 34.1989C1003.39 28.0006 1010.72 20.0534 1019.53 14.7944C1027.32 10.1384 1037.26 6.96911 1046.03 4.79971Z" fill="black"/>
5
+ </g>
6
+ <defs>
7
+ <clipPath id="clip0_4902_59">
8
+ <rect width="1052" height="697" fill="white"/>
9
+ </clipPath>
10
+ </defs>
11
+ </svg>
@@ -0,0 +1,22 @@
1
+ <svg viewBox="0 0 120 120" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <defs>
3
+ <linearGradient id="lobster-gradient" x1="0%" y1="0%" x2="100%" y2="100%">
4
+ <stop offset="0%" stop-color="#ff4d4d"/>
5
+ <stop offset="100%" stop-color="#991b1b"/>
6
+ </linearGradient>
7
+ </defs>
8
+ <!-- Body -->
9
+ <path d="M60 10 C30 10 15 35 15 55 C15 75 30 95 45 100 L45 110 L55 110 L55 100 C55 100 60 102 65 100 L65 110 L75 110 L75 100 C90 95 105 75 105 55 C105 35 90 10 60 10Z" fill="url(#lobster-gradient)"/>
10
+ <!-- Left Claw -->
11
+ <path d="M20 45 C5 40 0 50 5 60 C10 70 20 65 25 55 C28 48 25 45 20 45Z" fill="url(#lobster-gradient)"/>
12
+ <!-- Right Claw -->
13
+ <path d="M100 45 C115 40 120 50 115 60 C110 70 100 65 95 55 C92 48 95 45 100 45Z" fill="url(#lobster-gradient)"/>
14
+ <!-- Antenna -->
15
+ <path d="M45 15 Q35 5 30 8" stroke="#ff4d4d" stroke-width="3" stroke-linecap="round"/>
16
+ <path d="M75 15 Q85 5 90 8" stroke="#ff4d4d" stroke-width="3" stroke-linecap="round"/>
17
+ <!-- Eyes -->
18
+ <circle cx="45" cy="35" r="6" fill="#050810"/>
19
+ <circle cx="75" cy="35" r="6" fill="#050810"/>
20
+ <circle cx="46" cy="34" r="2.5" fill="#00e5cc"/>
21
+ <circle cx="76" cy="34" r="2.5" fill="#00e5cc"/>
22
+ </svg>
@@ -0,0 +1,35 @@
1
+ import { useEffect } from 'react'
2
+
3
+ import { Route, Switch, useLocation } from 'wouter'
4
+
5
+ import { setWorkspaceSwitchHandler } from '@/client/lib/ws'
6
+
7
+ import { HomePage } from './HomePage'
8
+ import { PlaygroundPage } from './playground/PlaygroundPage'
9
+ import { WorkspaceRoute } from './routes/workspace/[id]'
10
+
11
+ // Top-level router — sets up all client-side routes
12
+ export function AppRouter() {
13
+ const [, navigate] = useLocation()
14
+
15
+ // When the server broadcasts a workspace:switch (e.g. from `moi start`),
16
+ // navigate to that workspace
17
+ useEffect(() => {
18
+ setWorkspaceSwitchHandler(id => navigate(`/workspace/${id}`))
19
+ return () => setWorkspaceSwitchHandler(null)
20
+ }, [navigate])
21
+
22
+ return (
23
+ <Switch>
24
+ <Route path="/" component={HomePage} />
25
+ <Route path="/playground" component={PlaygroundPage} />
26
+ <Route path="/workspace/:id">
27
+ {/* Key by id so switching workspaces mounts a fresh subtree — the
28
+ per-workspace chat store (and its websocket) tears down and resets
29
+ cleanly rather than leaking state across workspaces. Cached React
30
+ Query data keeps the remount instant. */}
31
+ {(params: { id: string }) => <WorkspaceRoute key={params.id} id={params.id} />}
32
+ </Route>
33
+ </Switch>
34
+ )
35
+ }
@@ -0,0 +1,33 @@
1
+ import type { ReactNode, Ref } from 'react'
2
+
3
+ import { motion } from 'motion/react'
4
+
5
+ type BottomPanelProps = {
6
+ title: string
7
+ children: ReactNode
8
+ // Forwarded to the panel element so the working area can measure its height
9
+ // and reserve matching space below the grid.
10
+ ref?: Ref<HTMLDivElement>
11
+ }
12
+
13
+ export function BottomPanel({ title, children, ref }: BottomPanelProps) {
14
+ return (
15
+ <motion.div
16
+ ref={ref}
17
+ className="absolute inset-x-6 bottom-0 z-20 flex max-h-[60vh] flex-col rounded-t-2xl bg-white p-[var(--page-pad)] shadow-[inset_0_0_0_1px_rgba(0,0,0,0.04),inset_0_2px_4px_-1px_rgba(0,0,0,0.06),inset_0_4px_16px_-4px_rgba(0,0,0,0.06)]"
18
+ variants={{
19
+ hidden: { opacity: 0, y: 40, filter: 'blur(4px)' },
20
+ visible: { opacity: 1, y: 0, filter: 'blur(0px)' }
21
+ }}
22
+ initial="hidden"
23
+ animate="visible"
24
+ exit="hidden"
25
+ transition={{ type: 'spring', duration: 0.25, bounce: 0 }}
26
+ >
27
+ <p className="text-muted-foreground mb-4 shrink-0 text-sm font-medium">{title}</p>
28
+ <div className="-my-1 flex-1 overflow-y-auto px-[var(--page-pad)] py-1 [margin-left:calc(var(--page-pad)*-1)] [margin-right:calc(var(--page-pad)*-1)]">
29
+ {children}
30
+ </div>
31
+ </motion.div>
32
+ )
33
+ }
@@ -0,0 +1,62 @@
1
+ import { useRef } from 'react'
2
+
3
+ import { IconArrowUp, IconPlayerStop } from '@tabler/icons-react'
4
+
5
+ import { Button } from './ui/button'
6
+
7
+ type ChatInputProps = {
8
+ value: string
9
+ onChange: (value: string) => void
10
+ onSend: () => void
11
+ onStop: () => void
12
+ processing: boolean
13
+ }
14
+
15
+ export function ChatInput({ value, onChange, onSend, onStop, processing }: ChatInputProps) {
16
+ const ref = useRef<HTMLTextAreaElement>(null)
17
+
18
+ return (
19
+ <form
20
+ onSubmit={e => {
21
+ e.preventDefault()
22
+ onSend()
23
+ }}
24
+ onMouseDown={e => {
25
+ if (e.target instanceof HTMLElement && e.target.closest('button')) return
26
+ e.preventDefault()
27
+ ref.current?.focus()
28
+ }}
29
+ className="shadow-xs flex w-full cursor-text flex-col gap-1 rounded-lg bg-white p-2 outline-none transition-[color,box-shadow] focus-within:shadow-sm"
30
+ >
31
+ <textarea
32
+ ref={ref}
33
+ id="chat-input"
34
+ name="message"
35
+ value={value}
36
+ onChange={e => onChange(e.target.value)}
37
+ onKeyDown={e => {
38
+ if (e.key === 'Enter' && !e.shiftKey) {
39
+ e.preventDefault()
40
+ onSend()
41
+ }
42
+ }}
43
+ placeholder="Ask anything..."
44
+ disabled={processing}
45
+ autoFocus
46
+ rows={1}
47
+ className="field-sizing-content placeholder:text-muted-foreground max-h-40 w-full resize-none bg-transparent px-2 py-1 text-sm leading-relaxed outline-none disabled:opacity-50"
48
+ />
49
+ <div className="flex justify-end">
50
+ {processing ? (
51
+ <Button type="button" size="icon" onClick={onStop} aria-label="Stop agent">
52
+ <IconPlayerStop stroke={1.5} />
53
+ </Button>
54
+ ) : (
55
+ <Button type="submit" size="icon" disabled={!value.trim()} aria-label="Send message">
56
+ <IconArrowUp stroke={1.5} />
57
+ </Button>
58
+ )}
59
+ </div>
60
+ </form>
61
+ )
62
+ }