create-openclaw-bot 5.5.0 → 5.6.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 (39) hide show
  1. package/README.md +18 -17
  2. package/README.vi.md +18 -17
  3. package/{cli.js → dist/cli.js} +295 -224
  4. package/dist/setup/shared/install-gen.js +485 -0
  5. package/{setup/shared/scaffold-gen.js → dist/setup/shared/workspace-gen.js} +247 -25
  6. package/{setup.js → dist/setup.js} +771 -1158
  7. package/package.json +10 -7
  8. package/.github/workflows/check-openclaw-update.yml +0 -106
  9. package/CHANGELOG.md +0 -602
  10. package/CHANGELOG.vi.md +0 -588
  11. package/docs/SETUP.md +0 -532
  12. package/docs/SETUP.vi.md +0 -439
  13. package/docs/ai-providers.md +0 -144
  14. package/docs/ai-providers.vi.md +0 -144
  15. package/docs/browser-automation-guide.md +0 -207
  16. package/docs/faq.md +0 -63
  17. package/docs/faq.vi.md +0 -63
  18. package/docs/hardware-guide.md +0 -55
  19. package/docs/hardware-guide.vi.md +0 -55
  20. package/docs/install-docker.md +0 -161
  21. package/docs/install-docker.vi.md +0 -161
  22. package/docs/install-native.md +0 -96
  23. package/docs/install-native.vi.md +0 -96
  24. package/docs/preview.png +0 -0
  25. package/docs/skills-plugins-guide.md +0 -126
  26. package/index.html +0 -589
  27. package/old_v510.js +0 -0
  28. package/setup/shared/runtime-gen.js +0 -710
  29. package/style.css +0 -1653
  30. package/upgrade.ps1 +0 -90
  31. package/upgrade.sh +0 -93
  32. /package/{setup → dist/setup}/data/channels.js +0 -0
  33. /package/{setup → dist/setup}/data/header.js +0 -0
  34. /package/{setup → dist/setup}/data/index.js +0 -0
  35. /package/{setup → dist/setup}/data/plugins.js +0 -0
  36. /package/{setup → dist/setup}/data/providers.js +0 -0
  37. /package/{setup → dist/setup}/data/skills.js +0 -0
  38. /package/{setup → dist/setup}/shared/common-gen.js +0 -0
  39. /package/{setup → dist/setup}/shared/docker-gen.js +0 -0
package/docs/SETUP.md DELETED
@@ -1,532 +0,0 @@
1
- # 🦞 OpenClaw — Technical Setup Guide
2
-
3
- > **This file is for AI Agents (Antigravity) to read and execute automatically.**
4
- > The user has already created a `.env` file with their API key and Bot token. The AI must **NEVER** ask for or receive credentials through chat.
5
-
6
- [English](#-security-rules--mandatory) · [Tiếng Việt](SETUP.vi.md)
7
-
8
- ---
9
-
10
- ## 🔐 Security Rules — MANDATORY
11
-
12
- > **The AI Agent MUST follow ALL rules below. Any violation = STOP immediately.**
13
-
14
- ### System files & directories
15
-
16
- - ❌ **DO NOT** read, copy, or access any file outside the project folder
17
- - ❌ **DO NOT** scan or list system directories: `Documents`, `Desktop`, `Downloads`, `AppData`, `%USERPROFILE%`
18
- - ❌ **DO NOT** access the registry, system32, or Program Files
19
- - ❌ **DO NOT** install system software, drivers, or services outside Docker
20
- - ❌ **DO NOT** modify system environment variables
21
- - ✅ **ONLY** work within the user-specified project folder
22
-
23
- ### API keys & credentials
24
-
25
- - ❌ **NEVER** display API keys, tokens, or passwords in chat
26
- - ❌ **DO NOT** write API keys directly into source code or scripts
27
- - ❌ **DO NOT** commit credential files to Git
28
- - ✅ **ALWAYS** store credentials in a separate `.env` file
29
- - ✅ **ALWAYS** add `.env` to `.gitignore`
30
- - ✅ **ALWAYS** use environment variables (`${VAR}`) instead of hardcoding
31
-
32
- ### Crypto wallets & digital assets
33
-
34
- - ❌ **ABSOLUTELY DO NOT** access, read, or scan crypto wallet directories:
35
- - Metamask, Trust Wallet, Phantom, Exodus, Electrum
36
- - Files: `wallet.dat`, `keystore/`, seed phrases, private keys
37
- - Browser extensions containing crypto wallets
38
- - ❌ **DO NOT** scan the clipboard (may contain seed phrases)
39
- - ❌ **DO NOT** access browser profiles, cookies, or saved passwords
40
- - ❌ **DO NOT** install unknown npm packages (only `openclaw` and its official plugins)
41
-
42
- ### Docker isolation
43
-
44
- - ✅ Only mount the **required** directories (config + workspace)
45
- - ❌ **DO NOT** mount entire drives (`C:/` or `D:/`)
46
- - ❌ **DO NOT** run containers with `--privileged`
47
- - ✅ Limit exposed ports (only `18789`)
48
-
49
- ---
50
-
51
- ## 📂 Directory Structure After Setup
52
-
53
- ```
54
- <PROJECT_DIR>/
55
- ├── .openclaw/ ← Main config (DO NOT commit)
56
- │ ├── openclaw.json ← Gateway, agent, channel config
57
- │ ├── auth-profiles.json ← API key profile
58
- │ ├── credentials/
59
- │ │ └── gemini ← Gemini API key
60
- │ ├── agents/
61
- │ │ └── <agent-name>.yaml ← Agent definition (name + model only)
62
- │ ├── workspace/ ← ⭐ Bot persona & behavior
63
- │ │ ├── IDENTITY.md ← Bot name, emoji, vibe
64
- │ │ ├── SOUL.md ← Personality, boundaries
65
- │ │ ├── AGENTS.md ← Operating rules
66
- │ │ ├── USER.md ← User preferences
67
- │ │ ├── TOOLS.md ← Tool usage guide
68
- │ │ └── MEMORY.md ← Long-term memory
69
- │ ├── skills/ ← Slash commands (optional)
70
- │ ├── identity/
71
- │ │ └── device.json ← Device keypair
72
- │ ├── memory/ ← Agent memory (SQLite)
73
- │ ├── cron/jobs.json
74
- │ └── logs/
75
- │ └── config-audit.jsonl
76
-
77
- ├── docker/openclaw/
78
- │ ├── Dockerfile
79
- │ ├── docker-compose.yml
80
- │ └── .env ← API keys (DO NOT commit)
81
-
82
- └── .gitignore
83
- ```
84
-
85
- ---
86
-
87
- ## 🔌 Supported Channels
88
-
89
- This setup supports **3 channels**. The AI Agent must detect which channel the user chose based on the `.env` file contents.
90
-
91
- | Channel | .env keys required | Plugin needed |
92
- |---------|-------------------|---------------|
93
- | **Telegram** | `GOOGLE_API_KEY` + `TELEGRAM_BOT_TOKEN` | None (built-in) |
94
- | **Zalo Bot API** | `GOOGLE_API_KEY` + `ZALO_BOT_TOKEN` | `@openclaw/zalo` |
95
- | **Zalo Personal** | `GOOGLE_API_KEY` only | `@openclaw/zalouser` |
96
-
97
- ### Channel detection logic:
98
-
99
- ```
100
- IF .env contains TELEGRAM_BOT_TOKEN → Channel = Telegram
101
- ELSE IF .env contains ZALO_BOT_TOKEN → Channel = Zalo Bot API
102
- ELSE → Channel = Zalo Personal (or ask user)
103
- ```
104
-
105
- ---
106
-
107
- ## ⚙️ Setup Steps
108
-
109
- ### Step 1: Create directories
110
-
111
- ```bash
112
- mkdir -p <PROJECT_DIR>/docker/openclaw
113
- mkdir -p <PROJECT_DIR>/.openclaw/credentials
114
- mkdir -p <PROJECT_DIR>/.openclaw/agents
115
- mkdir -p <PROJECT_DIR>/.openclaw/skills
116
- mkdir -p <PROJECT_DIR>/.openclaw/identity
117
- mkdir -p <PROJECT_DIR>/.openclaw/memory
118
- mkdir -p <PROJECT_DIR>/.openclaw/cron
119
- mkdir -p <PROJECT_DIR>/.openclaw/logs
120
- mkdir -p <PROJECT_DIR>/.openclaw/completions
121
- mkdir -p <PROJECT_DIR>/.openclaw/canvas
122
- ```
123
-
124
- ### Step 2: Create Dockerfile
125
-
126
- Create `<PROJECT_DIR>/docker/openclaw/Dockerfile`:
127
-
128
- #### Telegram (no plugins needed):
129
-
130
- ```dockerfile
131
- FROM node:22-slim
132
-
133
- RUN apt-get update && apt-get install -y git curl && rm -rf /var/lib/apt/lists/*
134
-
135
- RUN npm install -g openclaw@latest
136
-
137
- WORKDIR /root/.openclaw
138
-
139
- EXPOSE 18789
140
-
141
- CMD ["openclaw", "gateway", "run"]
142
- ```
143
-
144
- #### Zalo Bot API:
145
-
146
- ```dockerfile
147
- FROM node:22-slim
148
-
149
- RUN apt-get update && apt-get install -y git curl && rm -rf /var/lib/apt/lists/*
150
-
151
- RUN npm install -g openclaw@latest
152
-
153
- RUN openclaw plugins install @openclaw/zalo
154
-
155
- WORKDIR /root/.openclaw
156
-
157
- EXPOSE 18789
158
-
159
- CMD ["openclaw", "gateway", "run"]
160
- ```
161
-
162
- #### Zalo Personal:
163
-
164
- ```dockerfile
165
- FROM node:22-slim
166
-
167
- RUN apt-get update && apt-get install -y git curl && rm -rf /var/lib/apt/lists/*
168
-
169
- RUN npm install -g openclaw@latest
170
-
171
- RUN openclaw plugins install @openclaw/zalouser
172
-
173
- WORKDIR /root/.openclaw
174
-
175
- EXPOSE 18789
176
-
177
- CMD ["openclaw", "gateway", "run"]
178
- ```
179
-
180
- ### Step 3: Create docker-compose.yml
181
-
182
- Create `<PROJECT_DIR>/docker/openclaw/docker-compose.yml`:
183
-
184
- ```yaml
185
- services:
186
- ai-bot:
187
- build: .
188
- container_name: openclaw-bot
189
- restart: always
190
- env_file:
191
- - .env
192
- extra_hosts:
193
- - "host.docker.internal:host-gateway"
194
- volumes:
195
- - <PROJECT_DIR>/.openclaw:/root/.openclaw
196
- ports:
197
- - "18789:18789"
198
- ```
199
-
200
- > Replace `<PROJECT_DIR>` with the actual absolute path. Example: `D:/MyAIBot/.openclaw:/root/.openclaw`
201
-
202
- ### Step 4: Verify .env file (created by user)
203
-
204
- The `.env` file has already been created by the user at `<PROJECT_DIR>/docker/openclaw/.env`.
205
-
206
- **The AI Agent MUST verify:**
207
- 1. File `.env` **exists** at `<PROJECT_DIR>/docker/openclaw/.env`
208
- 2. File contains `GOOGLE_API_KEY=`
209
- 3. File contains one of: `TELEGRAM_BOT_TOKEN=` or `ZALO_BOT_TOKEN=` (or neither for Zalo Personal)
210
- 4. **DO NOT** read or display the values in chat
211
-
212
- If the file doesn't exist → **STOP** and ask the user to create it per the instructions in README.md.
213
-
214
- > **NEVER** create the `.env` for the user. **NEVER** ask for credentials in chat.
215
-
216
- ### Step 5: Create .gitignore
217
-
218
- Create `<PROJECT_DIR>/.gitignore`:
219
-
220
- ```gitignore
221
- # Credentials
222
- .openclaw/credentials/
223
- .openclaw/auth-profiles.json
224
- .openclaw/openclaw.json
225
- .openclaw/identity/
226
- docker/openclaw/.env
227
-
228
- # Runtime data
229
- .openclaw/memory/
230
- .openclaw/logs/
231
- .openclaw/completions/
232
- .openclaw/telegram/
233
- .openclaw/canvas/
234
- ```
235
-
236
- ### Step 6: Create OpenClaw configuration
237
-
238
- **AI Agent performs:**
239
-
240
- 1. Read `GOOGLE_API_KEY` (and channel token if present) from `.env` (created in Step 4)
241
- 2. Detect the channel type based on Step 4 verification
242
- 3. Generate a random gateway auth token
243
- 4. Write values into the config files below
244
- 5. **DO NOT** display any key/token in chat
245
-
246
- **Generate gateway auth token:**
247
-
248
- ```bash
249
- node -e "console.log(require('crypto').randomBytes(24).toString('hex'))"
250
- ```
251
-
252
- #### Telegram config:
253
-
254
- **Create `<PROJECT_DIR>/.openclaw/openclaw.json`:**
255
-
256
- ```json
257
- {
258
- "meta": {
259
- "lastTouchedVersion": "2026.3.27"
260
- },
261
- "agents": {
262
- "defaults": {
263
- "model": {
264
- "primary": "google/gemini-2.5-flash",
265
- "fallbacks": []
266
- },
267
- "compaction": {
268
- "mode": "safeguard"
269
- }
270
- },
271
- "list": []
272
- },
273
- "commands": {
274
- "native": "auto",
275
- "nativeSkills": "auto",
276
- "restart": true,
277
- "ownerDisplay": "raw"
278
- },
279
- "channels": {
280
- "telegram": {
281
- "enabled": true,
282
- "dmPolicy": "open",
283
- "botToken": "<BOT_TOKEN_FROM_.ENV>",
284
- "allowFrom": ["*"],
285
- "groupPolicy": "allowlist",
286
- "streaming": "partial"
287
- }
288
- },
289
- "gateway": {
290
- "port": 18789,
291
- "mode": "local",
292
- "auth": {
293
- "mode": "token",
294
- "token": "<GENERATED_GATEWAY_TOKEN>"
295
- }
296
- }
297
- }
298
- ```
299
-
300
- #### Zalo Bot API config:
301
-
302
- Replace the `channels` section with:
303
-
304
- ```json
305
- {
306
- "channels": {
307
- "zalo": {
308
- "enabled": true,
309
- "botToken": "<ZALO_BOT_TOKEN_FROM_.ENV>"
310
- }
311
- }
312
- }
313
- ```
314
-
315
- #### Zalo Personal config:
316
-
317
- Replace the `channels` section with:
318
-
319
- ```json
320
- {
321
- "channels": {
322
- "zalouser": {
323
- "enabled": true
324
- }
325
- }
326
- }
327
- ```
328
-
329
- > **Note:** Zalo Personal requires QR code login after the container starts. Check logs with `docker logs openclaw-bot` to see the QR code.
330
-
331
- ---
332
-
333
- **Create `<PROJECT_DIR>/.openclaw/auth-profiles.json`** — use `GOOGLE_API_KEY` from `.env`:
334
-
335
- ```json
336
- {
337
- "gemini": {
338
- "apiKey": "<GOOGLE_API_KEY_FROM_.ENV>"
339
- }
340
- }
341
- ```
342
-
343
- **Create `<PROJECT_DIR>/.openclaw/credentials/gemini`** — write the `GOOGLE_API_KEY` value (single line, no newline).
344
-
345
- **Create `<PROJECT_DIR>/.openclaw/cron/jobs.json`:**
346
-
347
- ```json
348
- {
349
- "version": 1,
350
- "jobs": []
351
- }
352
- ```
353
-
354
- ### Step 7: Create Agent & Workspace Files
355
-
356
- #### 7a. Agent YAML (metadata only, NO system_prompt)
357
-
358
- Create a YAML file at `.openclaw/agents/<name>.yaml`. Example — `.openclaw/agents/chat.yaml`:
359
-
360
- ```yaml
361
- name: chat
362
- description: "Personal AI assistant"
363
-
364
- model:
365
- primary: google/gemini-2.5-flash
366
- ```
367
-
368
- > **Note:** The YAML file only declares `name`, `description`, `model`. Bot personality lives in workspace files below.
369
-
370
- #### 7b. Workspace Markdown Files (⭐ Bot Identity)
371
-
372
- OpenClaw **auto-injects** all `.md` files in `.openclaw/workspace/` into the agent's context at the start of every session. This is how the bot "knows" its name, personality, and rules.
373
-
374
- | File | Purpose | Required |
375
- |------|---------|----------|
376
- | `IDENTITY.md` | Bot name, emoji, self-introduction | ✅ |
377
- | `SOUL.md` | Personality, style, boundaries | ✅ |
378
- | `AGENTS.md` | Operating rules, response format | ✅ |
379
- | `USER.md` | User preferences (language, timezone) | Recommended |
380
- | `TOOLS.md` | Tool/skill usage conventions | Recommended |
381
- | `MEMORY.md` | Long-term memory (bot auto-updates) | Optional |
382
-
383
- > **Priority order:** Per-agent files (`.openclaw/agents/<id>/`) → Global workspace files (`.openclaw/workspace/`) → Config defaults.
384
-
385
- > **System security** (no file deletion, no sensitive directory access, no API key leaks...) is **automatically enforced** by OpenClaw — no need to write it in workspace files.
386
-
387
- #### 7c. Update `openclaw.json`
388
-
389
- Add the agent to `agents.list`:
390
-
391
- ```json
392
- {
393
- "agents": {
394
- "list": [
395
- {
396
- "id": "chat",
397
- "model": {
398
- "primary": "google/gemini-2.5-flash",
399
- "fallbacks": []
400
- }
401
- }
402
- ]
403
- }
404
- }
405
- ```
406
-
407
- ### Step 8: Build & Start
408
-
409
- ```bash
410
- cd <PROJECT_DIR>/docker/openclaw
411
-
412
- docker compose build
413
-
414
- docker compose up -d
415
-
416
- docker logs -f openclaw-bot
417
- ```
418
-
419
- ### Step 9: Verify
420
-
421
- **Telegram:**
422
- 1. Open Telegram → Find your bot
423
- 2. Send any message
424
- 3. Bot replies = **Success!** 🎉
425
-
426
- **Zalo Bot API:**
427
- 1. Open Zalo → Find your bot
428
- 2. Send any message
429
- 3. Bot replies = **Success!** 🎉
430
-
431
- **Zalo Personal:**
432
- 1. Check `docker logs openclaw-bot` for QR code
433
- 2. Scan QR code with Zalo app
434
- 3. Send a message from another Zalo account
435
- 4. Bot replies = **Success!** 🎉
436
-
437
- If the bot doesn't respond:
438
-
439
- ```bash
440
- docker logs openclaw-bot --tail 50
441
- docker compose restart
442
- ```
443
-
444
- If the bot **can't create cron jobs** (error "pairing required"):
445
-
446
- ```bash
447
- docker exec -i openclaw-bot openclaw devices approve --latest
448
- ```
449
-
450
- > **Note:** Since OpenClaw v2026.3.x, the gateway requires device pairing for CLI connections. The Dockerfile auto-approves on startup, but if the error persists, run the command above once.
451
-
452
- ---
453
-
454
- ## 🛠 Bot Management
455
-
456
- ```bash
457
- docker ps # Status
458
- docker logs -f openclaw-bot # Live logs
459
- docker compose restart # Restart
460
- docker compose down # Stop
461
- docker compose build --no-cache # Update OpenClaw
462
- docker compose up -d # Start after update
463
- ```
464
-
465
- ---
466
-
467
- ## 🔧 Advanced Configuration
468
-
469
- <details>
470
- <summary><b>Restrict who can chat with the bot (Telegram)</b></summary>
471
-
472
- By default `allowFrom: ["*"]` lets **everyone** DM the bot. To restrict:
473
-
474
- 1. Chat [@userinfobot](https://t.me/userinfobot) on Telegram → Copy your user ID
475
- 2. Edit `openclaw.json`:
476
-
477
- ```json
478
- {
479
- "channels": {
480
- "telegram": {
481
- "allowFrom": ["<YOUR_TELEGRAM_USER_ID>"]
482
- }
483
- }
484
- }
485
- ```
486
- </details>
487
-
488
- <details>
489
- <summary><b>Add Ollama (local AI, offline)</b></summary>
490
-
491
- If you have Ollama running locally, add to `.env`:
492
-
493
- ```env
494
- OLLAMA_HOST=http://host.docker.internal:11434
495
- ```
496
-
497
- And add a fallback in `openclaw.json`:
498
-
499
- ```json
500
- {
501
- "agents": {
502
- "defaults": {
503
- "model": {
504
- "fallbacks": ["ollama/qwen3:8b"]
505
- }
506
- }
507
- }
508
- }
509
- ```
510
- </details>
511
-
512
- <details>
513
- <summary><b>Switch channels</b></summary>
514
-
515
- To switch from Telegram to Zalo (or vice versa):
516
-
517
- 1. Update `Dockerfile` to install the appropriate plugin
518
- 2. Update `openclaw.json` → change the `channels` section
519
- 3. Update `.env` with the new token
520
- 4. Rebuild: `docker compose build --no-cache && docker compose up -d`
521
- </details>
522
-
523
- ---
524
-
525
- ## ✅ Post-Setup Security Checklist
526
-
527
- - [ ] `.env` is **not** visible in `git status`
528
- - [ ] `.openclaw/credentials/` is **not** tracked by Git
529
- - [ ] `openclaw.json` is **not** tracked by Git
530
- - [ ] Docker does **not** mount entire drives
531
- - [ ] Gateway auth token is randomly generated
532
- - [ ] Zalo Personal: using a **secondary** account (if applicable)