create-openclaw-bot 4.0.1 → 4.0.4

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Tuan Minh Hole (Kent)
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/README.md CHANGED
@@ -2,28 +2,45 @@
2
2
 
3
3
  # 🦞 OpenClaw Setup
4
4
 
5
- **Create your own free AI Bot on Telegram or Zalo in minutes.**
5
+ <p align="center">
6
+ <a href="https://github.com/tuanminhhole/openclaw-setup/releases"><img src="https://img.shields.io/badge/RELEASE-v4.0.1-0EA5E9?style=for-the-badge" alt="Version 4.0.1" /></a>
7
+ <a href="https://github.com/tuanminhhole/openclaw-setup?tab=MIT-1-ov-file"><img src="https://img.shields.io/badge/LICENSE-MIT-success?style=for-the-badge" alt="MIT License" /></a>
8
+ <a href="https://www.npmjs.com/package/create-openclaw-bot"><img src="https://img.shields.io/npm/v/create-openclaw-bot?style=for-the-badge&label=CLI&color=2563EB&logo=npm&logoColor=white" alt="NPM Version" /></a>
9
+ <a href="https://www.npmjs.com/package/create-openclaw-bot"><img src="https://img.shields.io/npm/dm/create-openclaw-bot?style=for-the-badge&color=22c55e" alt="NPM Downloads" /></a>
10
+ <a href="https://github.com/tuanminhhole/openclaw-setup/stargazers"><img src="https://img.shields.io/github/stars/tuanminhhole/openclaw-setup?style=for-the-badge&color=eab308&logo=github&logoColor=white" alt="GitHub Stars" /></a>
11
+ </p>
6
12
 
7
- [![Version](https://img.shields.io/badge/Version-4.0.0-FF6B35?style=for-the-badge)](CHANGELOG.md)
8
- [![OpenClaw](https://img.shields.io/badge/OpenClaw-Gateway-FF6B35?style=for-the-badge&logo=npm)](https://openclaw.ai)
9
- [![Docker](https://img.shields.io/badge/Docker-Ready-2496ED?style=for-the-badge&logo=docker&logoColor=white)](https://www.docker.com/)
10
- [![Telegram](https://img.shields.io/badge/Telegram-Bot-26A5E4?style=for-the-badge&logo=telegram&logoColor=white)](https://t.me/BotFather)
11
- [![Zalo](https://img.shields.io/badge/Zalo-Bot-0068FF?style=for-the-badge)](#supported-channels)
13
+ An interactive <strong>CLI tool</strong> and <strong>Setup Wizard</strong> to deploy your own free AI Bot on Telegram or Zalo in minutes.
12
14
 
13
- <img src="https://flagcdn.com/24x18/gb.png" alt="English" width="24" height="18"> **English** · <img src="https://flagcdn.com/24x18/vn.png" alt="Tiếng Việt" width="24" height="18"> [Tiếng Việt](README.vi.md)
15
+ <a href="https://github.com/tuanminhhole/openclaw-setup">
16
+ <img src="docs/preview.png" alt="OpenClaw Setup Hero Image" width="100%" style="border-radius: 8px; margin: 16px 0; border: 1px solid #333;" />
17
+ </a>
18
+
19
+ <p style="margin-top: 16px;">
20
+ <img src="https://flagcdn.com/24x18/gb.png" alt="English" width="24" height="18" style="vertical-align: sub;"> <strong>English</strong> ·
21
+ <img src="https://flagcdn.com/24x18/vn.png" alt="Tiếng Việt" width="24" height="18" style="vertical-align: sub;"> <a href="README.vi.md">Tiếng Việt</a>
22
+ </p>
14
23
 
15
24
  </div>
16
25
 
17
26
  ---
18
27
 
28
+ ## 🆕 What's new in v4.0.1
29
+ - 🪄 **Fully Automated Setup**: Say goodbye to downloading ZIP files and manually copying configs. Everything is now fully automated with a single action.
30
+ - ⚡ **One-Command Install (`npx create-openclaw-bot`)**: Extremely convenient for VPS/SSH users — the script automatically creates the project directory, sets up the environment, and triggers `docker compose up -d` instantly.
31
+ - 🚀 **Zero-Restart Deployment**: Details like API Keys and Bot Tokens (which you input during setup) are automatically injected into `.env` before the bot boots for the first time. No restarts required!
32
+ - 🌐 **Browser Automation Setup**: Updated Windows Task Scheduler and Debug Mode scripts for smoother interaction with Web Apps.
33
+
34
+ ---
35
+
19
36
  ## ✨ Features
20
37
 
21
38
  - 🤖 **Multi-channel** — Telegram, Zalo Bot API, or Zalo Personal
22
39
  - 🧠 **Multi-provider AI** — Google Gemini, Claude, GPT-4o/Codex, OpenRouter, Ollama, 9Router
23
40
  - 🧩 **Skills** — Web Search, Browser Automation, Memory, RAG, Code Interpreter, Image Gen...
24
41
  - 🔌 **Plugins** — Voice Call, Matrix, MS Teams, Nostr
25
- - 🔀 **9Router Proxy** — No API key needed! OAuth login via dashboard
26
- - 🧙 **Setup Wizard** — Beautiful dark-themed web UI with SVG brand logos
42
+ - 🔀 **9Router Proxy** — Auto-route your bot's traffic effectively!
43
+ - 🧙 **Setup Wizard** — Beautiful interactive shell (CLI) or dark-themed Web UI
27
44
  - 🆓 **100% Free** — Google Gemini API free tier + Docker
28
45
  - 🔒 **Secure** — API keys stay on your machine, never exposed
29
46
  - ⚡ **3 minutes** — From zero to working AI bot
@@ -71,7 +88,20 @@ You need **3 things** (all free):
71
88
 
72
89
  ## 🚀 Quick Start
73
90
 
74
- ### Option A — Setup Wizard (Recommended)
91
+ ### 1️⃣ Option A — Interactive CLI (`npx`) [Recommended]
92
+
93
+ The fastest way to install OpenClaw is using the interactive NPM package.
94
+
95
+ 1. **Open your Terminal (or Command Prompt).**
96
+ 2. **Run the command:**
97
+ ```bash
98
+ npx create-openclaw-bot
99
+ ```
100
+ 3. **Follow the interactive prompts** to configure your bot, keys, and paths!
101
+
102
+ <details>
103
+ <summary><b>2️⃣ Option B — GUI Setup Wizard (Web UI)</b></summary>
104
+ <br>
75
105
 
76
106
  1. **Clone this repo:**
77
107
  ```bash
@@ -82,21 +112,11 @@ You need **3 things** (all free):
82
112
  2. **Open `index.html`** in your browser — the Setup Wizard will guide you through:
83
113
  - Choose your channel (Telegram / Zalo)
84
114
  - Configure bot name, personality, AI model
85
- - Get credential instructions
86
- - Generate all config files
115
+ - Generate all config files and `setup-openclaw.bat`
87
116
 
88
- 3. **Create your `.env` file** (as instructed by the wizard)
89
-
90
- 4. **Build & Run:**
91
- ```bash
92
- cd docker/openclaw
93
- docker compose build
94
- docker compose up -d
95
- ```
96
-
97
- 5. **Test your bot** — send a message on Telegram or Zalo! 🎉
117
+ </details>
98
118
 
99
- ### Option B — AI Agent (Antigravity)
119
+ ### 3️⃣ Option C — AI Agent (Antigravity)
100
120
 
101
121
  1. Open [Antigravity IDE](https://antigravity.dev/)
102
122
  2. Open this repo as workspace
package/README.vi.md CHANGED
@@ -2,30 +2,48 @@
2
2
 
3
3
  # 🦞 OpenClaw Setup
4
4
 
5
- **Tạo AI Bot miễn phí trên Telegram hoặc Zalo chỉ trong vài phút.**
5
+ <p align="center">
6
+ <a href="https://github.com/tuanminhhole/openclaw-setup/releases"><img src="https://img.shields.io/badge/RELEASE-v4.0.1-0EA5E9?style=for-the-badge" alt="Version 4.0.1" /></a>
7
+ <a href="https://github.com/tuanminhhole/openclaw-setup?tab=MIT-1-ov-file"><img src="https://img.shields.io/badge/LICENSE-MIT-success?style=for-the-badge" alt="MIT License" /></a>
8
+ <a href="https://www.npmjs.com/package/create-openclaw-bot"><img src="https://img.shields.io/npm/v/create-openclaw-bot?style=for-the-badge&label=CLI&color=2563EB&logo=npm&logoColor=white" alt="NPM Version" /></a>
9
+ <a href="https://www.npmjs.com/package/create-openclaw-bot"><img src="https://img.shields.io/npm/dm/create-openclaw-bot?style=for-the-badge&color=22c55e" alt="NPM Downloads" /></a>
10
+ <a href="https://github.com/tuanminhhole/openclaw-setup/stargazers"><img src="https://img.shields.io/github/stars/tuanminhhole/openclaw-setup?style=for-the-badge&color=eab308&logo=github&logoColor=white" alt="GitHub Stars" /></a>
11
+ </p>
6
12
 
7
- [![Version](https://img.shields.io/badge/Phi%C3%AAn%20b%E1%BA%A3n-4.0.0-FF6B35?style=for-the-badge)](CHANGELOG.vi.md)
8
- [![OpenClaw](https://img.shields.io/badge/OpenClaw-Gateway-FF6B35?style=for-the-badge&logo=npm)](https://openclaw.ai)
9
- [![Docker](https://img.shields.io/badge/Docker-Ready-2496ED?style=for-the-badge&logo=docker&logoColor=white)](https://www.docker.com/)
10
- [![Telegram](https://img.shields.io/badge/Telegram-Bot-26A5E4?style=for-the-badge&logo=telegram&logoColor=white)](https://t.me/BotFather)
11
- [![Zalo](https://img.shields.io/badge/Zalo-Bot-0068FF?style=for-the-badge)](#kênh-hỗ-trợ)
13
+ Một công cụ trực quan <strong>Setup Wizard (UI)</strong> & <strong>CLI</strong> để tự tay build Bot AI trên Telegram và Zalo chỉ trong vài phút.
12
14
 
13
- <img src="https://flagcdn.com/24x18/vn.png" alt="Tiếng Việt" width="24" height="18"> **Tiếng Việt** · <img src="https://flagcdn.com/24x18/gb.png" alt="English" width="24" height="18"> [English](README.md)
15
+ <a href="https://github.com/tuanminhhole/openclaw-setup">
16
+ <img src="docs/preview.png" alt="OpenClaw Setup Hero Image" width="100%" style="border-radius: 8px; margin: 16px 0; border: 1px solid #333;" />
17
+ </a>
18
+
19
+ <p style="margin-top: 16px;">
20
+ <img src="https://flagcdn.com/24x18/vn.png" alt="Tiếng Việt" width="24" height="18" style="vertical-align: sub;"> <strong>Tiếng Việt</strong> ·
21
+ <img src="https://flagcdn.com/24x18/gb.png" alt="English" width="24" height="18" style="vertical-align: sub;"> <a href="README.md">English</a>
22
+ </p>
14
23
 
15
24
  </div>
16
25
 
17
26
  ---
18
27
 
28
+ ## 🆕 Có gì mới ở bản 4.0.1
29
+ - 🪄 **Tự động hóa hoàn toàn**: Tạm biệt việc tải file ZIP và copy config thủ công! Giờ đây mọi thứ diễn ra tự động chỉ với 1 lượt click.
30
+ - ⚡ **Chỉ 1 lệnh duy nhất (`npx create-openclaw-bot`)**: Cực kỳ tiện lợi cho ae cài qua VPS/SSH — script sẽ tự động tạo thư mục, khởi tạo môi trường và tự động kích hoạt `docker compose up -d` ngay sau khi nhập xong.
31
+ - 🚀 **Zero-Restart Deployment**: API Keys và config được inject trực tiếp vào thư mục (bạn vẫn cần nhập từ Terminal, máy sẽ tự sinh vào file `.env` trước khi bot chạy lần đầu). Không cần phải restart lại container mất thời gian nữa.
32
+ - 🌐 **Browser Automation Setup**: Cập nhật tự động sinh file chạy Windows Task Scheduler và bật file thiết lập Debug mode tự động. Mở Zalo Mini app ngon lành.
33
+
34
+ ---
35
+
19
36
  ## ✨ Tính năng
20
37
 
21
38
  - 🤖 **Đa kênh** — Telegram, Zalo Bot API, hoặc Zalo Cá nhân
22
39
  - 🧠 **Đa model AI** — Google Gemini, Claude, GPT-4o, Ollama, OpenRouter, 9Router
23
40
  - 🧩 **Skills** — Web Search, Browser Automation, Memory, RAG, Code Interpreter, Image Gen...
24
41
  - 🔌 **Plugins** — Voice Call, Matrix, MS Teams, Nostr
25
- - 🔀 **9Router Proxy** — Không cần API key! Đăng nhập OAuth qua dashboard
26
- - 🧙 **Setup Wizard** — Giao diện web đẹp, cấu hình mọi thứ trong 4 bước
42
+ - 🔀 **9Router Proxy** — Hệ thống Auto-route điều phối Bot tuyệt vời.
43
+ - 🧙 **Setup Wizard** — Chạy thẳng qua Terminal CLI hoặc giao diện web Web UI 4 bước
27
44
  - 🆓 **100% Miễn phí** — Google Gemini API free tier + Docker
28
- - 🔒 **An toàn** — API key lưu trên máy bạn, không bao giờ bị lộ
45
+ - 🔒 **An toàn** — API key không bao giờ bị lộ ra ngoài
46
+ - ⚡ **Siêu tốc** — Build thành công trong 3 phút
29
47
 
30
48
  ---
31
49
 
@@ -70,7 +88,20 @@ Bạn cần **3 thứ** (miễn phí hết):
70
88
 
71
89
  ## 🚀 Bắt đầu nhanh
72
90
 
73
- ### Cách A — Setup Wizard (Khuyến nghị)
91
+ ### 1️⃣ Cách A — Cài đặt bằng Terminal CLI (`npx`) [Tốt nhất]
92
+
93
+ Dùng NPX là cách cài chuẩn nhất:
94
+
95
+ 1. **Mở Terminal (hoặc Command Prompt).**
96
+ 2. **Gõ lệnh sau:**
97
+ ```bash
98
+ npx create-openclaw-bot
99
+ ```
100
+ 3. **Làm theo các bước gợi ý trên Terminal** để đặt tên cho bot, setup tokens và nơi chứa file thư mục của bot.
101
+
102
+ <details>
103
+ <summary><b>2️⃣ Cách B — Cài đặt bằng Giao diện Setup Web (Web UI)</b></summary>
104
+ <br>
74
105
 
75
106
  1. **Clone repo:**
76
107
  ```bash
@@ -82,21 +113,12 @@ Bạn cần **3 thứ** (miễn phí hết):
82
113
  - Chọn kênh (Telegram / Zalo)
83
114
  - Chọn AI model và plugins
84
115
  - Cấu hình tên bot, tính cách
85
- - Lấy hướng dẫn tạo API key
86
- - Tự động generate tất cả config files
87
-
88
- 3. **Tạo file `.env`** (làm theo hướng dẫn trong wizard)
116
+ - Tự động generate tất cả config files về file `setup-openclaw.bat`
89
117
 
90
- 4. **Build & Chạy:**
91
- ```bash
92
- cd docker/openclaw
93
- docker compose build
94
- docker compose up -d
95
- ```
118
+ </details>
96
119
 
97
- 5. **Test bot** — gửi tin nhắn trên Telegram hoặc Zalo! 🎉
98
120
 
99
- ### Cách B — Dùng AI Agent (Antigravity)
121
+ ### 3️⃣ Cách C — Dùng AI Agent (Antigravity)
100
122
 
101
123
  1. Mở [Antigravity IDE](https://antigravity.dev/)
102
124
  2. Mở repo này làm workspace
package/cli.js CHANGED
@@ -7,10 +7,12 @@ import chalk from 'chalk';
7
7
  import { spawn } from 'child_process';
8
8
 
9
9
  const LOGO = `
10
- \\/
11
- /\\O _ O/\\
12
- // /_\\ \\\\
13
- \\// / \\ \\\\/
10
+ ████████╗██╗ ██╗ █████╗ ███╗ ██╗███╗ ███╗██╗███╗ ██╗██╗ ██╗██╗ ██╗ ██████╗ ██╗ ███████╗
11
+ ╚══██╔══╝██║ ██║██╔══██╗████╗ ██║████╗ ████║██║████╗ ██║██║ ██║██║ ██║██╔═══██╗██║ ██╔════╝
12
+ ██║ ██║ ██║███████║██╔██╗ ██║██╔████╔██║██║██╔██╗ ██║███████║███████║██║ ██║██║ █████╗
13
+ ██║ ██║ ██║██╔══██║██║╚██╗██║██║╚██╔╝██║██║██║╚██╗██║██╔══██║██╔══██║██║ ██║██║ ██╔══╝
14
+ ██║ ╚██████╔╝██║ ██║██║ ╚████║██║ ╚═╝ ██║██║██║ ╚████║██║ ██║██║ ██║╚██████╔╝███████╗███████╗
15
+ ╚═╝ ╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═══╝╚═╝ ╚═╝╚═╝╚═╝ ╚═══╝╚═╝ ╚═╝╚═╝ ╚═╝ ╚═════╝ ╚══════╝╚══════╝
14
16
  `;
15
17
 
16
18
  const CHANNELS = {
@@ -20,7 +22,7 @@ const CHANNELS = {
20
22
  };
21
23
 
22
24
  const PROVIDERS = {
23
- 'proxy': { name: '9Router Proxy (Khuyên dùng)', icon: '🔀', isProxy: true },
25
+ '9router': { name: '9Router Proxy (Khuyên dùng)', icon: '🔀', isProxy: true },
24
26
  'openai': { name: 'OpenAI (ChatGPT)', icon: '🧠', envKey: 'OPENAI_API_KEY' },
25
27
  'ollama': { name: 'Local Ollama', icon: '🏠', isLocal: true },
26
28
  'google': { name: 'Google (Gemini)', icon: '⚡', envKey: 'GEMINI_API_KEY' },
@@ -66,6 +68,7 @@ async function main() {
66
68
  });
67
69
  }
68
70
 
71
+
69
72
  // 3. Provider
70
73
  const providerKey = await select({
71
74
  message: isVi ? 'Chọn AI Provider:' : 'Select AI Provider:',
@@ -142,47 +145,152 @@ async function main() {
142
145
  }
143
146
  await fs.writeFile(path.join(projectDir, 'docker', 'openclaw', '.env'), envContent);
144
147
 
145
- const dockerfile = `FROM ghcr.io/williamskyze/openclaw:latest
146
- ${selectedSkills.includes('browser') ? 'RUN apt-get update && apt-get install -y chromium xvfb dbus socat' : '# (No browser config needed)'}`;
148
+ const patchScript = `const fs=require('fs'),p='/root/.openclaw/openclaw.json';if(fs.existsSync(p)){const c=JSON.parse(fs.readFileSync(p,'utf8'));c.tools=Object.assign({},c.tools,{profile:'full'});c.gateway=Object.assign({},c.gateway,{port:18791,bind:'custom',customBindHost:'0.0.0.0'});fs.writeFileSync(p,JSON.stringify(c,null,2));}`;
149
+ const b64Patch = Buffer.from(patchScript).toString('base64');
150
+ const dockerfile = `FROM node:22-slim
151
+
152
+ RUN apt-get update && apt-get install -y git curl${selectedSkills.includes('browser') ? ' socat' : ''} && rm -rf /var/lib/apt/lists/*
153
+
154
+ RUN npm install -g openclaw@latest
155
+ ${selectedSkills.includes('browser') ? 'RUN npm install -g agent-browser playwright && npx playwright install chromium --with-deps && ln -f -s /root/.cache/ms-playwright/chromium-*/chrome-linux*/chrome /usr/bin/google-chrome\\n' : ''}WORKDIR /root/.openclaw
156
+
157
+ EXPOSE 18791
158
+
159
+ CMD sh -c "node -e \\"eval(Buffer.from('${b64Patch}','base64').toString())\\" && ${selectedSkills.includes('browser') ? 'socat TCP-LISTEN:9222,fork,reuseaddr TCP:host.docker.internal:9222 & ' : ''}(sleep 5 && openclaw devices approve --latest 2>/dev/null || true) & openclaw gateway run"`;
160
+
147
161
  await fs.writeFile(path.join(projectDir, 'docker', 'openclaw', 'Dockerfile'), dockerfile);
148
162
 
149
- const compose = `services:
150
- openclaw:
163
+ const agentId = botName.toLowerCase().replace(/[^a-z0-9]+/g, '-').replace(/-$/, '') || 'chat';
164
+
165
+ let compose = '';
166
+ if (providerKey === '9router') {
167
+ compose = `name: oc-${agentId}
168
+ services:
169
+ ai-bot:
151
170
  build: .
171
+ container_name: openclaw-${agentId}
152
172
  restart: always
153
- env_file: .env
173
+ env_file:
174
+ - .env
175
+ depends_on:
176
+ - 9router
177
+ ${selectedSkills.includes('browser') ? ` extra_hosts:
178
+ - "host.docker.internal:host-gateway"
179
+ ` : ''} volumes:
180
+ - ../../.openclaw:/root/.openclaw
181
+
182
+ 9router:
183
+ image: node:22-slim
184
+ container_name: 9router
185
+ restart: always
186
+ entrypoint: >
187
+ /bin/sh -c "npm install -g 9router && [ ! -f /root/.9router/db.json ] && echo '{\\"combos\\":[{\\"id\\":\\"smart-route\\",\\"name\\":\\"smart-route\\",\\"alias\\":\\"smart-route\\",\\"models\\":[\\"cx/gpt-5.4\\",\\"ag/claude-opus-4-6-thinking\\",\\"cc/claude-opus-4-6\\",\\"gh/gpt-5.4\\",\\"ag/gemini-3.1-pro-high\\",\\"cc/claude-sonnet-4-6\\",\\"gh/claude-opus-4.6\\"]}]}' > /root/.9router/db.json; 9router"
188
+ environment:
189
+ - PORT=20128
190
+ - HOSTNAME=0.0.0.0
191
+ - CI=true
154
192
  volumes:
155
- - ../../.openclaw:/app/.openclaw
156
- - ../../auth-profiles.json:/app/auth-profiles.json
193
+ - 9router-data:/root/.9router
194
+ ports:
195
+ - "20128:20128"
196
+
197
+ volumes:
198
+ 9router-data:`;
199
+ } else {
200
+ compose = `name: oc-${agentId}
201
+ services:
202
+ ai-bot:
203
+ build: .
204
+ container_name: openclaw-${agentId}
205
+ restart: always
206
+ env_file: .env
157
207
  ${selectedSkills.includes('browser') ? ` extra_hosts:
158
208
  - "host.docker.internal:host-gateway"
159
- ` : ''}`;
209
+ ` : ''} volumes:
210
+ - ../../.openclaw:/root/.openclaw`;
211
+ }
212
+
160
213
  await fs.writeFile(path.join(projectDir, 'docker', 'openclaw', 'docker-compose.yml'), compose);
161
214
 
162
- await fs.writeFile(path.join(projectDir, 'auth-profiles.json'), '{}');
215
+ let authProfilesJson = {};
216
+ if (providerKey && !provider.isLocal) {
217
+ const authProviderName = providerKey === '9router' ? '9router' : 'openai'; // fallback to openai format for standard providers initially
218
+ const authProfileId = providerKey === '9router' ? '9router-proxy' : `${authProviderName}:default`;
219
+ const authKeyValue = providerKey === '9router' ? 'sk-no-key' : providerKeyVal;
220
+
221
+ authProfilesJson = {
222
+ version: 1,
223
+ profiles: {
224
+ [authProfileId]: {
225
+ provider: authProviderName,
226
+ type: 'api_key',
227
+ key: authKeyValue,
228
+ },
229
+ },
230
+ order: {
231
+ [authProviderName]: [authProfileId],
232
+ },
233
+ };
234
+
235
+ if (providerKey !== '9router' && providerKey !== 'openai' && provider.baseURL) {
236
+ authProfilesJson.profiles[authProfileId].url = provider.baseURL;
237
+ }
238
+ }
239
+
240
+ const modelsPrimary = providerKey === '9router' ? '9router/smart-route' : (providerKey === 'google' ? 'google/gemini-2.5-flash' : 'openai/gpt-4o');
241
+
242
+ await fs.ensureDir(path.join(projectDir, '.openclaw', 'agents', agentId, 'agent'));
243
+ if (Object.keys(authProfilesJson).length > 0) {
244
+ await fs.writeJson(path.join(projectDir, '.openclaw', 'auth-profiles.json'), authProfilesJson, { spaces: 2 });
245
+ await fs.writeJson(path.join(projectDir, '.openclaw', 'agents', agentId, 'agent', 'auth-profiles.json'), authProfilesJson, { spaces: 2 });
246
+ }
163
247
 
164
248
  const botConfig = {
165
- meta: { version: '1.0' },
249
+ meta: { lastTouchedVersion: '2026.3.24' },
166
250
  agents: {
167
251
  defaults: {
168
- model: { primary: providerKey === 'openai' ? 'gpt-4o' : (providerKey === 'google' ? 'google/gemini-2.5-flash' : 'smart-route'), fallbacks: [] },
169
- identity: {
170
- name: botName,
171
- description: botDesc,
172
- system_prompt: isVi ? "Bạn là một trợ lý AI hữu ích." : "You are a helpful AI assistant."
173
- },
174
- skills: selectedSkills
175
- }
252
+ model: { primary: modelsPrimary, fallbacks: [] },
253
+ compaction: { mode: 'safeguard' }
254
+ },
255
+ list: [{
256
+ id: agentId,
257
+ model: { primary: modelsPrimary, fallbacks: [] }
258
+ }]
176
259
  },
177
- channels: {}
260
+ ...(providerKey === '9router' ? {
261
+ models: {
262
+ mode: 'merge',
263
+ providers: {
264
+ '9router': {
265
+ baseUrl: 'http://9router:20128/v1',
266
+ apiKey: 'sk-no-key',
267
+ api: 'openai-completions',
268
+ models: [
269
+ { id: 'smart-route', name: 'Smart Proxy (Auto Route)', contextWindow: 200000, maxTokens: 8192 }
270
+ ]
271
+ }
272
+ }
273
+ }
274
+ } : {}),
275
+ commands: { native: 'auto', nativeSkills: 'auto', restart: true, ownerDisplay: 'raw' },
276
+ channels: {},
277
+ tools: { profile: 'full' },
278
+ gateway: {
279
+ port: 18791, mode: 'local', bind: 'custom', customBindHost: '0.0.0.0',
280
+ auth: { mode: 'token', token: 'cli-dummy-token-xyz123' }
281
+ }
178
282
  };
283
+
284
+ const identityContent = `# ${botName}\n\n${botDesc}\n\n${isVi ? 'Bạn là một trợ lý AI phân tích và tự động hóa do Kent đào tạo và cấu hình.' : 'You are an AI assistant configured by Kent.'}`;
285
+ await fs.writeFile(path.join(projectDir, '.openclaw', 'agents', agentId, 'agent', 'IDENTITY.md'), identityContent);
179
286
 
180
287
  if (channelKey === 'telegram') {
181
- botConfig.channels['telegram'] = { enabled: true };
288
+ // dmPolicy:'open' = skip pairing step entirely (standard for personal bots)
289
+ botConfig.channels['telegram'] = { enabled: true, dmPolicy: 'open', allowFrom: ['*'] };
182
290
  } else if (channelKey === 'zalo-personal') {
183
- botConfig.channels['zalo-personal'] = { enabled: true, autoReply: true };
291
+ botConfig.channels['zalo'] = { enabled: true, provider: 'client', autoReply: true };
184
292
  } else if (channelKey === 'zalo-bot') {
185
- botConfig.channels['zalo-bot'] = { enabled: true };
293
+ botConfig.channels['zalo'] = { enabled: true, provider: 'official_account' };
186
294
  }
187
295
 
188
296
  await fs.writeJson(path.join(projectDir, '.openclaw', 'openclaw.json'), botConfig, { spaces: 2 });
@@ -212,7 +320,12 @@ ${selectedSkills.includes('browser') ? ` extra_hosts:
212
320
  child.on('close', (code) => {
213
321
  if (code === 0) {
214
322
  console.log(chalk.green(`\n🎉 ${isVi ? 'Setup hoàn tất! Bot đang chạy.' : 'Setup complete! Bot is running.'}`));
215
- if (channelKey === 'zalo-personal') {
323
+
324
+ if (channelKey === 'telegram') {
325
+ console.log(chalk.cyan(`\n💬 ${isVi
326
+ ? 'Nhắn tin cho bot trên Telegram là dùng được ngay!'
327
+ : 'Just message your bot on Telegram to start chatting!'}`));
328
+ } else if (channelKey === 'zalo-personal') {
216
329
  console.log(chalk.yellow(`\n📱 ${isVi ? 'Vui lòng chạy lệnh sau để đăng nhập Zalo Personal (1 lần duy nhất):' : 'Please run this command to login to Zalo Personal (once):'}`));
217
330
  console.log(`cd ${projectDir} && docker compose exec -it openclaw bun run core:onboard`);
218
331
  }
@@ -220,6 +333,7 @@ ${selectedSkills.includes('browser') ? ` extra_hosts:
220
333
  console.log(chalk.red(`\n❌ Docker exited with code ${code}`));
221
334
  }
222
335
  });
336
+
223
337
  } else {
224
338
  console.log(chalk.cyan(`\n👉 ${isVi ? 'Tiếp theo, hãy chạy:' : 'Next, run:'}\n cd ${projectDir}/docker/openclaw\n docker compose build\n docker compose up -d`));
225
339
  }
Binary file
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "create-openclaw-bot",
3
- "version": "4.0.1",
4
- "description": "Interactive CLI for setting up OpenClaw bot autonomously",
3
+ "version": "4.0.4",
4
+ "description": "Interactive CLI installer for OpenClaw Bot",
5
5
  "main": "cli.js",
6
6
  "bin": {
7
7
  "create-openclaw-bot": "./cli.js"