openclaw-spawn 1.0.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/Dockerfile ADDED
@@ -0,0 +1,45 @@
1
+ FROM node:22-bookworm
2
+
3
+ # Install system dependencies for browser automation and VNC remote access
4
+ RUN apt-get update && apt-get install -y \
5
+ curl \
6
+ wget \
7
+ ca-certificates \
8
+ xvfb \
9
+ x11vnc \
10
+ novnc \
11
+ websockify \
12
+ && rm -rf /var/lib/apt/lists/*
13
+
14
+ # Install OpenClaw from npm
15
+ RUN npm install -g openclaw@latest
16
+
17
+ # Install Playwright and Chromium with full system dependencies as root
18
+ RUN npx playwright install chromium --with-deps
19
+
20
+ # Create node user directories first
21
+ RUN mkdir -p /home/node/.cache/ms-playwright /home/node/.openclaw /workspace
22
+
23
+ # Copy browsers to node user location
24
+ RUN cp -r /root/.cache/ms-playwright/* /home/node/.cache/ms-playwright/ 2>/dev/null || true
25
+
26
+ # Set proper ownership before switching to node user
27
+ RUN chown -R node:node /home/node/.cache /home/node/.openclaw /workspace
28
+
29
+ # Create stable symlink for OpenClaw browser.executablePath
30
+ RUN CHROMIUM_DIR=$(ls -d /home/node/.cache/ms-playwright/chromium-* 2>/dev/null | head -1) && \
31
+ if [ -n "$CHROMIUM_DIR" ]; then \
32
+ ln -sf "$CHROMIUM_DIR/chrome-linux/chrome" /home/node/openclaw-chromium && \
33
+ chown -h node:node /home/node/openclaw-chromium; \
34
+ fi
35
+
36
+ # Verify Chromium is accessible and executable
37
+ RUN su - node -c "test -x /home/node/openclaw-chromium || echo 'Warning: Chromium not found or not executable'"
38
+
39
+ USER node
40
+ ENV PLAYWRIGHT_BROWSERS_PATH=/home/node/.cache/ms-playwright
41
+ ENV HOME=/home/node
42
+ ENV DISPLAY=:99
43
+
44
+ WORKDIR /workspace
45
+ CMD ["sh", "-c", "Xvfb :99 -screen 0 1280x900x24 -ac +extension GLX +render -noreset & tail -f /dev/null"]
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Ostap Hembara
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/QUICKSTART.md ADDED
@@ -0,0 +1,46 @@
1
+ # QuickStart
2
+
3
+ ## First time setup
4
+
5
+ ```bash
6
+ git clone https://github.com/ostapagon/openclaw-spawn.git
7
+ cd openclaw-spawn
8
+ npm install -g .
9
+ openclaw-spawn init
10
+ ```
11
+
12
+ `init` handles everything automatically:
13
+ - Installs Docker if missing (macOS: brew, Linux: apt/yum, Windows: prints download link)
14
+ - Builds the base Docker image
15
+ - Runs the OpenClaw onboarding wizard (API key, model selection)
16
+ - Starts the gateway with browser support ready
17
+
18
+ ## After init
19
+
20
+ ```bash
21
+ openclaw-spawn tui # chat with your agent (browser works out of the box)
22
+ openclaw-spawn browser # open VNC tab to see/control the browser visually
23
+ openclaw-spawn dashboard # open the web control panel
24
+ ```
25
+
26
+ ## Multiple instances
27
+
28
+ ```bash
29
+ openclaw-spawn onboard # add another instance
30
+ openclaw-spawn list # see all instances
31
+ ```
32
+
33
+ ## Manual steps (if you prefer)
34
+
35
+ ```bash
36
+ openclaw-spawn build # build Docker image
37
+ openclaw-spawn onboard # create instance + run OpenClaw onboarding
38
+ openclaw-spawn gateway -d # start gateway in background (bootstraps Chrome too)
39
+ openclaw-spawn tui # start chatting
40
+ ```
41
+
42
+ ## Ports (per instance)
43
+
44
+ - **+0**: Gateway / dashboard
45
+ - **+11**: Chrome CDP
46
+ - **+20**: noVNC browser view
package/README.md ADDED
@@ -0,0 +1,237 @@
1
+ # OpenClaw Swarm
2
+
3
+ Docker orchestrator for running multiple [OpenClaw](https://openclaw.ai) instances with browser automation support.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ npm install -g openclaw-spawn
9
+ ```
10
+
11
+ Or link locally for development:
12
+ ```bash
13
+ git clone https://github.com/yourusername/openclaw-spawn.git
14
+ cd openclaw-spawn
15
+ npm install
16
+ npm link
17
+ ```
18
+
19
+ f451c93c-534a-4c84-8822- โ”‚ d8b295 โ”‚ operat โ”‚ 140.82. โ”‚ just โ”‚ โ”‚
20
+ โ”‚ c039b6c52bd1
21
+
22
+ ## Quick Start
23
+
24
+ 1. **Build the Docker base image** (first time only):
25
+ ```bash
26
+ openclaw-spawn build
27
+ ```
28
+
29
+ 2. **Run any OpenClaw command** - it will prompt you to select or create an instance:
30
+ ```bash
31
+ openclaw-spawn onboard
32
+ ```
33
+
34
+ 3. **Select "Add new instance"** and name it (e.g., `worker1`)
35
+
36
+ 4. **Configure OpenClaw** using the native wizard that appears
37
+
38
+ 5. **Start the gateway**:
39
+ ```bash
40
+ openclaw-spawn gateway
41
+ ```
42
+
43
+ 6. **Access the dashboard** at `http://localhost:18789`
44
+
45
+ ## Usage
46
+
47
+ ### OpenClaw Commands
48
+
49
+ Any OpenClaw command automatically shows an instance selector:
50
+
51
+ ```bash
52
+ openclaw-spawn onboard # Run onboarding wizard
53
+ openclaw-spawn gateway # Start gateway
54
+ openclaw-spawn tui # Open TUI
55
+ openclaw-spawn channels status # Check channels
56
+ openclaw-spawn devices list # List devices
57
+ openclaw-spawn devices approve <ID> # Approve a device (pairing)
58
+ openclaw-spawn dashboard # Open dashboard
59
+ ```
60
+
61
+ **Device pairing (first-time dashboard):** When you open the dashboard URL you'll see "pairing required". Run `openclaw-spawn devices list`, copy the REQUEST_ID, then `openclaw-spawn devices approve <REQUEST_ID>`. Refresh the browser.
62
+
63
+ ### Management Commands
64
+
65
+ ```bash
66
+ openclaw-spawn list # List all instances
67
+ openclaw-spawn remove worker1 # Remove an instance
68
+ openclaw-spawn stop worker1 # Stop an instance
69
+ openclaw-spawn start worker1 # Start an instance
70
+ openclaw-spawn logs worker1 -f # Follow logs
71
+ openclaw-spawn build # Build Docker image
72
+ openclaw-spawn cleanup # Remove all containers and reset
73
+ ```
74
+
75
+ ## How It Works
76
+
77
+ ```
78
+ โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
79
+ โ”‚ openclaw-spawn (npm CLI) โ”‚
80
+ โ”‚ - Manages instance metadata โ”‚
81
+ โ”‚ - Shows interactive selector โ”‚
82
+ โ”‚ - Routes commands to containers โ”‚
83
+ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
84
+ โ”‚
85
+ โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
86
+ โ”‚ โ”‚
87
+ โ”Œโ”€โ”€โ”€โ–ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
88
+ โ”‚ worker1 โ”‚ โ”‚ worker2 โ”‚
89
+ โ”‚ Container โ”‚ โ”‚ Container โ”‚
90
+ โ”‚ โ”‚ โ”‚ โ”‚
91
+ โ”‚ OpenClaw โ”‚ โ”‚ OpenClaw โ”‚
92
+ โ”‚ + Chromium โ”‚ โ”‚ + Chromium โ”‚
93
+ โ”‚ โ”‚ โ”‚ โ”‚
94
+ โ”‚ Port 18789 โ”‚ โ”‚ Port 19001 โ”‚
95
+ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
96
+ ```
97
+
98
+ - Each instance runs in its own Docker container
99
+ - Containers have OpenClaw installed from npm
100
+ - Chromium included for browser automation
101
+ - Isolated configuration and workspace per instance
102
+ - Data stored in `~/.openclaw-spawn/instances/`
103
+
104
+ **Port mapping:** Internal port matches external: each instance is assigned a host port (oc-1 โ†’ 18789, oc-2 โ†’ 19009, โ€ฆ). We map `host_port:host_port` and set OpenClawโ€™s `gateway.port` to that port so the URL OpenClaw prints is correct. `openclaw-spawn dashboard` also prints the correct URL with token after the command.
105
+
106
+ **Starting fresh:** To remove all containers and metadata, run `openclaw-spawn cleanup` or `./cleanup.sh`.
107
+
108
+
109
+ ## Features
110
+
111
+ - **Simple UX** - Just run commands, select or create instances
112
+ - **Native OpenClaw** - Uses official OpenClaw wizards and tools
113
+ - **Browser support** - Chromium included for automation
114
+ - **Multi-instance** - Run many OpenClaw instances in parallel
115
+ - **Isolated** - Each instance has separate config and workspace
116
+ - **No Docker knowledge needed** - CLI abstracts all Docker commands
117
+
118
+ ## Example Workflow
119
+
120
+ ```bash
121
+ # Create and configure first instance
122
+ $ openclaw-spawn onboard
123
+ ? Select instance: โž• Add new instance
124
+ ? Enter instance name: email-bot
125
+ # ... OpenClaw wizard runs ...
126
+
127
+ # Start gateway on that instance
128
+ $ openclaw-spawn gateway
129
+ ? Select instance: ๐ŸŸข email-bot (port 18789, running)
130
+ โœ“ Starting gateway...
131
+
132
+ # Create another instance
133
+ $ openclaw-spawn onboard
134
+ ? Select instance: โž• Add new instance
135
+ ? Enter instance name: scraper
136
+
137
+ # List all instances
138
+ $ openclaw-spawn list
139
+ ๐Ÿ“‹ OpenClaw Instances:
140
+
141
+ ๐ŸŸข email-bot
142
+ Port: 18789
143
+ Status: running
144
+ Container: openclaw-email-bot
145
+
146
+ ๐ŸŸข scraper
147
+ Port: 19001
148
+ Status: running
149
+ Container: openclaw-scraper
150
+ ```
151
+
152
+ ## Data Storage
153
+
154
+ - **Metadata:** `~/.openclaw-spawn/instances.json`
155
+ - **Instance data:** `~/.openclaw-spawn/instances/<name>/`
156
+ - `.openclaw/` - OpenClaw configuration
157
+ - `workspace/` - Instance workspace files
158
+
159
+ ## Requirements
160
+
161
+ - Docker Desktop
162
+ - Node.js 18+
163
+ - macOS, Linux, or Windows with WSL2
164
+
165
+ ## Troubleshooting
166
+
167
+ ### "Pairing required" when opening the dashboard
168
+ OpenClaw requires device pairing for security. When you first open the dashboard, you'll see "disconnected (1008): pairing required".
169
+
170
+ **Steps to approve your browser:**
171
+
172
+ 1. **List pending devices:**
173
+ ```bash
174
+ openclaw-spawn devices list
175
+ ```
176
+ You'll see output like:
177
+ ```
178
+ REQUEST_ID | STATUS | AGENT | DEVICE NAME
179
+ abc123 | Pending | main | Chrome on Mac
180
+ ```
181
+
182
+ 2. **Approve the device:**
183
+ ```bash
184
+ openclaw-spawn devices approve abc123
185
+ ```
186
+ (Use the REQUEST_ID from the first column)
187
+
188
+ 3. **Refresh the dashboard** - it should now connect successfully!
189
+
190
+ **Note:** You only need to do this once per browser/device. The approval persists.
191
+
192
+ ### Docker not running
193
+ ```
194
+ โœ— Docker is not running. Please start Docker Desktop.
195
+ ```
196
+ โ†’ Start Docker Desktop and try again
197
+
198
+ ### Build fails
199
+ ```bash
200
+ # Clean and rebuild
201
+ docker rmi openclaw-spawn-base:latest
202
+ openclaw-spawn build
203
+ ```
204
+
205
+ ### Instance won't start
206
+ ```bash
207
+ # Check logs
208
+ openclaw-spawn logs instance-name
209
+
210
+ # Remove and recreate
211
+ openclaw-spawn remove instance-name
212
+ openclaw-spawn onboard # Create new one
213
+ ```
214
+
215
+ ## Development
216
+
217
+ ```bash
218
+ # Clone and setup
219
+ git clone https://github.com/yourusername/openclaw-spawn.git
220
+ cd openclaw-spawn
221
+ npm install
222
+ npm link
223
+
224
+ # Make changes to src/
225
+ # Test with: openclaw-spawn <command>
226
+
227
+ # Unlink when done
228
+ npm unlink -g openclaw-spawn
229
+ ```
230
+
231
+ ## License
232
+
233
+ MIT
234
+
235
+ ## Credits
236
+
237
+ Built for [OpenClaw](https://openclaw.ai) by the community.
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env node
2
+
3
+ import { cli } from '../src/cli.js';
4
+
5
+ cli(process.argv.slice(2));
package/cleanup.sh ADDED
@@ -0,0 +1,30 @@
1
+ #!/bin/bash
2
+
3
+ # Cleanup script - removes all openclaw-spawn containers and metadata
4
+ # Run this to start fresh
5
+
6
+ echo "๐Ÿงน Cleaning up OpenClaw Swarm..."
7
+
8
+ # Stop and remove all openclaw-* containers
9
+ echo "Stopping containers..."
10
+ docker ps -a --filter "name=openclaw-" --format "{{.Names}}" | xargs -r docker stop 2>/dev/null
11
+ echo "Removing containers..."
12
+ docker ps -a --filter "name=openclaw-" --format "{{.Names}}" | xargs -r docker rm 2>/dev/null
13
+
14
+ # Clear all instance config (keeps directory structure)
15
+ echo "Clearing instance configs..."
16
+ if [ -d ~/.openclaw-spawn/instances ]; then
17
+ find ~/.openclaw-spawn/instances -mindepth 2 -type f -delete 2>/dev/null
18
+ find ~/.openclaw-spawn/instances -mindepth 2 -type d -empty -delete 2>/dev/null
19
+ fi
20
+
21
+ # Remove metadata
22
+ echo "Clearing metadata..."
23
+ rm -f ~/.openclaw-spawn/instances.json
24
+ echo '{"instances":{},"nextPort":18789}' > ~/.openclaw-spawn/instances.json
25
+
26
+ # Uncomment to delete all instance directories entirely
27
+ # echo "Removing instance data..."
28
+ # rm -rf ~/.openclaw-spawn/instances/*
29
+
30
+ echo "โœ… Cleanup complete! Re-add instances with: openclaw-spawn onboard"
package/package.json ADDED
@@ -0,0 +1,20 @@
1
+ {
2
+ "name": "openclaw-spawn",
3
+ "version": "1.0.0",
4
+ "description": "Docker orchestrator for multiple OpenClaw instances",
5
+ "type": "module",
6
+ "bin": {
7
+ "openclaw-spawn": "./bin/openclaw-spawn.js"
8
+ },
9
+ "scripts": {
10
+ "test": "node test/test.js"
11
+ },
12
+ "keywords": ["openclaw", "docker", "orchestrator", "ai", "agent"],
13
+ "author": "",
14
+ "license": "MIT",
15
+ "dependencies": {
16
+ "inquirer": "^9.2.0",
17
+ "commander": "^11.1.0",
18
+ "chalk": "^5.3.0"
19
+ }
20
+ }