create-openclaw-bot 5.4.0 → 5.4.2
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/CHANGELOG.md +177 -157
- package/CHANGELOG.vi.md +175 -155
- package/README.md +321 -321
- package/README.vi.md +321 -321
- package/cli.js +17 -19
- package/package.json +1 -1
- package/setup.js +16 -5
- package/openclaw_correct_structure.md +0 -203
package/cli.js
CHANGED
|
@@ -44,24 +44,22 @@ const {
|
|
|
44
44
|
buildToolsDoc,
|
|
45
45
|
buildRelayDoc,
|
|
46
46
|
} = _require('./setup/shared/scaffold-gen.js');
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
* @returns {{name:string, content:string}|null}
|
|
64
|
-
*/
|
|
47
|
+
|
|
48
|
+
let dataExport = _require('./setup/data/index.js');
|
|
49
|
+
if (!dataExport.CHANNELS) dataExport = globalThis.__openclawData || {};
|
|
50
|
+
|
|
51
|
+
const {
|
|
52
|
+
PROVIDERS: _PROVIDERS,
|
|
53
|
+
SKILLS: _SKILLS,
|
|
54
|
+
CHANNELS: _CHANNELS,
|
|
55
|
+
OLLAMA_MODELS,
|
|
56
|
+
} = dataExport;
|
|
57
|
+
|
|
58
|
+
const {
|
|
59
|
+
buildChromeDebugBat,
|
|
60
|
+
buildChromeDebugSh,
|
|
61
|
+
} = _require('./setup/shared/runtime-gen.js');
|
|
62
|
+
|
|
65
63
|
function buildCLIUninstallScript({ os, projectDir, botName = 'openclaw', isDocker = false }) {
|
|
66
64
|
const absWin = projectDir.replace(/\//g, '\\');
|
|
67
65
|
const absUnix = projectDir.replace(/\\/g, '/');
|
|
@@ -1824,7 +1822,7 @@ async function main() {
|
|
|
1824
1822
|
// ── start-bot.bat / start-bot.sh — one-click restart scripts ─────────────
|
|
1825
1823
|
// Generated for native deployments only (docker has docker compose up)
|
|
1826
1824
|
if (deployMode !== 'docker') {
|
|
1827
|
-
const { generateStartBotBat, generateStartBotSh } = _require('
|
|
1825
|
+
const { generateStartBotBat, generateStartBotSh } = _require('./setup/generators/gateway-start-gen.js');
|
|
1828
1826
|
|
|
1829
1827
|
// Windows: start-bot.bat
|
|
1830
1828
|
const startBotBatPath = path.join(projectDir, 'start-bot.bat');
|
package/package.json
CHANGED
package/setup.js
CHANGED
|
@@ -1863,7 +1863,7 @@
|
|
|
1863
1863
|
emitBrowserInstall = true,
|
|
1864
1864
|
} = options;
|
|
1865
1865
|
|
|
1866
|
-
const browserAptExtra = hasBrowser ? '
|
|
1866
|
+
const browserAptExtra = hasBrowser ? ' xvfb' : '';
|
|
1867
1867
|
const browserInstallLines = hasBrowser && emitBrowserInstall
|
|
1868
1868
|
? [
|
|
1869
1869
|
'',
|
|
@@ -1879,8 +1879,18 @@
|
|
|
1879
1879
|
? `\n# Install skills (ClawHub)\n${allSkills.map((skill) => `RUN openclaw skills install ${skill} || echo "Warning: Failed to install ${skill} due to rate limits."`).join('\n')}\n`
|
|
1880
1880
|
: '';
|
|
1881
1881
|
const patchLine = `RUN node -e "const fs=require('fs');const path=require('path');const dir='/usr/local/lib/node_modules/openclaw/dist';const from='\\t\\t\\t\\t\\tonAgentRunStart: (runId) => {';const to='\\t\\t\\t\\t\\ttimeoutOverrideSeconds: Math.max(1, Math.ceil(timeoutMs / 1e3)),\\n\\t\\t\\t\\t\\tonAgentRunStart: (runId) => {';const files=fs.readdirSync(dir).filter(n=>/\\.js$/.test(n));let patched=0;for(const file of files){const p=path.join(dir,file);let s='';try{s=fs.readFileSync(p,'utf8');}catch{continue;}if(s.includes(to)||!s.includes(from))continue;s=s.replace(from,to);fs.writeFileSync(p,s);patched++;}if(!patched){process.exit(0);}"`;
|
|
1882
|
+
|
|
1883
|
+
// Dynamic runtime configuration injection for container internal IPs
|
|
1884
|
+
const setupInternalIpScript = `const fs=require('fs'),os=require('os'),p='/root/.openclaw/openclaw.json';if(fs.existsSync(p)){const c=JSON.parse(fs.readFileSync(p,'utf8'));const a=new Set(['http://localhost:18791','http://127.0.0.1:18791','http://0.0.0.0:18791']);for(const entries of Object.values(os.networkInterfaces()||{})){for(const entry of entries||[]){if(!entry||entry.internal||entry.family!=='IPv4'||!entry.address)continue;a.add('http://' + entry.address + ':18791');}}c.tools=Object.assign({},c.tools,{profile:'full',exec:{host:'gateway',security:'full',ask:'off'}});c.gateway=Object.assign({},c.gateway,{port:18791,bind:'custom',customBindHost:'0.0.0.0',controlUi:Object.assign({},c.gateway?.controlUi,{allowedOrigins:Array.from(a).filter(Boolean)})});fs.writeFileSync(p,JSON.stringify(c,null,2));}`;
|
|
1885
|
+
const setupInternalIpB64 = encodeBase64Utf8(setupInternalIpScript);
|
|
1886
|
+
|
|
1882
1887
|
const runtimeParts = runtimeCommandParts.filter(Boolean);
|
|
1883
|
-
runtimeParts.
|
|
1888
|
+
runtimeParts.unshift(`node -e "eval(Buffer.from('${setupInternalIpB64}','base64').toString())" &&`);
|
|
1889
|
+
if (hasBrowser) {
|
|
1890
|
+
runtimeParts.push('(Xvfb :99 -screen 0 1280x720x24 > /dev/null 2>&1 &) && export DISPLAY=:99 && openclaw gateway run');
|
|
1891
|
+
} else {
|
|
1892
|
+
runtimeParts.push('openclaw gateway run');
|
|
1893
|
+
}
|
|
1884
1894
|
const dockerfile = `FROM node:22-slim
|
|
1885
1895
|
|
|
1886
1896
|
RUN apt-get update && apt-get install -y git curl${browserAptExtra} && rm -rf /var/lib/apt/lists/*
|
|
@@ -2147,7 +2157,8 @@
|
|
|
2147
2157
|
if (p) allPlugins.push(p.package);
|
|
2148
2158
|
});
|
|
2149
2159
|
if (isMultiBot && state.channel === 'telegram') allPlugins.push(relayPluginSpec);
|
|
2150
|
-
const
|
|
2160
|
+
const uniquePlugins = [...new Set(allPlugins)];
|
|
2161
|
+
const pluginCmd = uniquePlugins.length > 0 ? uniquePlugins.map(function(pkg) { return 'call npm exec -- openclaw plugins install ' + pkg + ' || goto :fail'; }).join('\r\n') : '';
|
|
2151
2162
|
const nativeSkillInstallCmds = nativeSkillConfigs.map((skill) => `call openclaw skills install ${skill.slug} || echo Warning: Failed to install skill ${skill.slug}`);
|
|
2152
2163
|
|
|
2153
2164
|
Object.assign(globalThis, {
|
|
@@ -5250,7 +5261,7 @@
|
|
|
5250
5261
|
const dockerGen = globalThis.__openclawDockerGen;
|
|
5251
5262
|
const relayPluginInstallCmd = isMultiBot ? `${buildRelayPluginInstallCommand('openclaw')} && ` : '';
|
|
5252
5263
|
const pluginInstallCmd = allPlugins.length > 0
|
|
5253
|
-
? `openclaw plugins install ${
|
|
5264
|
+
? `${allPlugins.map((p) => `openclaw plugins install ${p} 2>/dev/null || true`).join(' && ')} && ${relayPluginInstallCmd}`
|
|
5254
5265
|
: relayPluginInstallCmd;
|
|
5255
5266
|
const dockerArtifacts = dockerGen.buildDockerArtifacts({
|
|
5256
5267
|
openClawNpmSpec: 'openclaw@2026.4.5',
|
|
@@ -6008,7 +6019,7 @@
|
|
|
6008
6019
|
// ========== Zalo Personal Login Guide (post-setup) ==========
|
|
6009
6020
|
function generateZaloOnboardGuide() {
|
|
6010
6021
|
const lang = document.getElementById('cfg-language')?.value || 'vi';
|
|
6011
|
-
setOutput('out-zalo-onboard-cmd', `docker compose exec -it ai-bot openclaw channels login --channel zalouser --
|
|
6022
|
+
setOutput('out-zalo-onboard-cmd', `docker compose exec -it ai-bot openclaw channels login --channel zalouser --verbose`);
|
|
6012
6023
|
|
|
6013
6024
|
if (lang === 'vi') {
|
|
6014
6025
|
setOutput('out-zalo-onboard-guide', `┌─────────────────────────────────────────────────────┐
|
|
@@ -1,203 +0,0 @@
|
|
|
1
|
-
# OpenClaw - Kien truc thu muc va secrets hien tai
|
|
2
|
-
|
|
3
|
-
Tai lieu nay mo ta dung behavior code hien tai cua wizard sau khi da dong bo lai native/docker va logic `.env`.
|
|
4
|
-
|
|
5
|
-
## Pham vi ho tro hien tai
|
|
6
|
-
|
|
7
|
-
- Native: `win`, `macos`, `linux-desktop`, `vps`
|
|
8
|
-
- Docker: cung mot cau truc file cho moi OS, chi khac launcher script tai ve
|
|
9
|
-
- Channel ho tro:
|
|
10
|
-
- `telegram`
|
|
11
|
-
- `zalo-bot`
|
|
12
|
-
- `zalo-personal`
|
|
13
|
-
- Multi-bot: chi ap dung cho `telegram`
|
|
14
|
-
- Combo `telegram + zalo-*`: hien khong duoc wizard UI mo ra
|
|
15
|
-
|
|
16
|
-
## Nguyen tac chung
|
|
17
|
-
|
|
18
|
-
- `OPENCLAW_HOME = {projectDir}/.openclaw`
|
|
19
|
-
- `OPENCLAW_STATE_DIR = {projectDir}/.openclaw`
|
|
20
|
-
- `DATA_DIR = {projectDir}/.9router`
|
|
21
|
-
- `agents.list[].agentDir` la duong dan relative theo `OPENCLAW_HOME`
|
|
22
|
-
- `agents.list[].workspace` cung la duong dan relative theo `OPENCLAW_HOME`
|
|
23
|
-
- Workspace luon dung format `workspace-{slug}`, ke ca single bot
|
|
24
|
-
|
|
25
|
-
## Secrets va .env
|
|
26
|
-
|
|
27
|
-
### Native
|
|
28
|
-
|
|
29
|
-
Native setup hien tai tao `{projectDir}/.env` va cac script native deu load file nay truoc khi chay `openclaw gateway run`.
|
|
30
|
-
|
|
31
|
-
`.env` trong native dung de luu:
|
|
32
|
-
|
|
33
|
-
- API key cua direct provider, vd `OPENAI_API_KEY`, `GEMINI_API_KEY`, ...
|
|
34
|
-
- channel token khi can:
|
|
35
|
-
- `TELEGRAM_BOT_TOKEN`
|
|
36
|
-
- `TELEGRAM_BOT_TOKEN_1..N` cho telegram multi-bot
|
|
37
|
-
- `ZALO_BOT_TOKEN` cho `zalo-bot`
|
|
38
|
-
- `TELEGRAM_GROUP_ID` neu user nhap group id
|
|
39
|
-
- env vars cua skills da chon
|
|
40
|
-
|
|
41
|
-
Luu y:
|
|
42
|
-
|
|
43
|
-
- `9router` khong can AI API key trong `.env`
|
|
44
|
-
- nhung neu channel la `telegram` hoac `zalo-bot` thi `.env` van co token channel
|
|
45
|
-
- `zalo-personal` khong dung bot token; login bang `openclaw channels login --channel zalouser --verbose`
|
|
46
|
-
|
|
47
|
-
### Docker
|
|
48
|
-
|
|
49
|
-
Docker setup hien tai tao ca hai file:
|
|
50
|
-
|
|
51
|
-
- `{projectDir}/.env`
|
|
52
|
-
- `{projectDir}/docker/openclaw/.env`
|
|
53
|
-
|
|
54
|
-
Trong do:
|
|
55
|
-
|
|
56
|
-
- root `.env` la ban ghi secrets tai project root de user de theo doi/chinh sua
|
|
57
|
-
- `docker/openclaw/.env` la file duoc `docker compose` nap vao container
|
|
58
|
-
|
|
59
|
-
## Provider auth
|
|
60
|
-
|
|
61
|
-
- Direct provider va provider local van co `.openclaw/auth-profiles.json`
|
|
62
|
-
- Per-agent `auth-profiles.json` duoc tao trong `.openclaw/agents/{slug}/agent/` khi khong dung `9router`
|
|
63
|
-
- Khi dung `9router`, khong tao root/per-agent `auth-profiles.json`
|
|
64
|
-
- Khi dung `9router`, provider endpoint duoc khai bao trong `.openclaw/openclaw.json -> models.providers.9router`
|
|
65
|
-
|
|
66
|
-
## Cau truc chuan theo case
|
|
67
|
-
|
|
68
|
-
### Case 1: Single bot
|
|
69
|
-
|
|
70
|
-
Ap dung cho:
|
|
71
|
-
|
|
72
|
-
- `telegram` single bot
|
|
73
|
-
- `zalo-bot`
|
|
74
|
-
- `zalo-personal`
|
|
75
|
-
|
|
76
|
-
```text
|
|
77
|
-
{projectDir}/
|
|
78
|
-
|-- .env # native secrets; docker cung co ban root nay
|
|
79
|
-
|-- .openclaw/
|
|
80
|
-
| |-- openclaw.json
|
|
81
|
-
| |-- exec-approvals.json
|
|
82
|
-
| |-- auth-profiles.json # chi khi khong dung 9router
|
|
83
|
-
| |-- agents/
|
|
84
|
-
| | |-- {slug}.yaml
|
|
85
|
-
| | `-- {slug}/agent/
|
|
86
|
-
| | `-- auth-profiles.json # chi khi khong dung 9router
|
|
87
|
-
| `-- workspace-{slug}/
|
|
88
|
-
| |-- IDENTITY.md
|
|
89
|
-
| |-- SOUL.md
|
|
90
|
-
| |-- AGENTS.md
|
|
91
|
-
| |-- USER.md
|
|
92
|
-
| |-- TOOLS.md
|
|
93
|
-
| |-- MEMORY.md
|
|
94
|
-
| |-- browser-tool.js # neu bat browser
|
|
95
|
-
| `-- BROWSER.md # neu bat browser
|
|
96
|
-
|-- .9router/
|
|
97
|
-
| `-- 9router-smart-route-sync.js # chi khi provider = 9router
|
|
98
|
-
|-- start-bot.bat / start-bot.sh # chi native
|
|
99
|
-
|-- start-chrome-debug.bat/sh # neu bat browser va native
|
|
100
|
-
|-- uninstall-openclaw-*.bat/sh
|
|
101
|
-
`-- docker/
|
|
102
|
-
`-- openclaw/
|
|
103
|
-
|-- Dockerfile # chi docker mode
|
|
104
|
-
|-- docker-compose.yml # chi docker mode
|
|
105
|
-
`-- .env # chi docker mode
|
|
106
|
-
```
|
|
107
|
-
|
|
108
|
-
### Case 2: Telegram multi-bot
|
|
109
|
-
|
|
110
|
-
```text
|
|
111
|
-
{projectDir}/
|
|
112
|
-
|-- .env
|
|
113
|
-
|-- .openclaw/
|
|
114
|
-
| |-- openclaw.json
|
|
115
|
-
| |-- exec-approvals.json
|
|
116
|
-
| |-- auth-profiles.json # chi khi khong dung 9router
|
|
117
|
-
| |-- agents/
|
|
118
|
-
| | |-- {bot1}.yaml
|
|
119
|
-
| | |-- {bot2}.yaml
|
|
120
|
-
| | |-- {bot1}/agent/auth-profiles.json # chi khi khong dung 9router
|
|
121
|
-
| | `-- {bot2}/agent/auth-profiles.json # chi khi khong dung 9router
|
|
122
|
-
| |-- workspace-{bot1}/
|
|
123
|
-
| | |-- IDENTITY.md
|
|
124
|
-
| | |-- SOUL.md
|
|
125
|
-
| | |-- AGENTS.md
|
|
126
|
-
| | |-- USER.md
|
|
127
|
-
| | |-- TOOLS.md
|
|
128
|
-
| | |-- MEMORY.md
|
|
129
|
-
| | |-- browser-tool.js # neu bat browser
|
|
130
|
-
| | `-- BROWSER.md # neu bat browser
|
|
131
|
-
| `-- workspace-{bot2}/
|
|
132
|
-
| |-- IDENTITY.md
|
|
133
|
-
| |-- SOUL.md
|
|
134
|
-
| |-- AGENTS.md
|
|
135
|
-
| |-- USER.md
|
|
136
|
-
| |-- TOOLS.md
|
|
137
|
-
| |-- MEMORY.md
|
|
138
|
-
| |-- browser-tool.js # neu bat browser
|
|
139
|
-
| `-- BROWSER.md # neu bat browser
|
|
140
|
-
|-- TELEGRAM-POST-INSTALL.md
|
|
141
|
-
|-- .9router/
|
|
142
|
-
| `-- 9router-smart-route-sync.js # chi khi provider = 9router
|
|
143
|
-
|-- start-bot.bat / start-bot.sh # chi native
|
|
144
|
-
|-- uninstall-openclaw-*.bat/sh
|
|
145
|
-
`-- docker/
|
|
146
|
-
`-- openclaw/
|
|
147
|
-
|-- Dockerfile # chi docker mode
|
|
148
|
-
|-- docker-compose.yml # chi docker mode
|
|
149
|
-
`-- .env # chi docker mode
|
|
150
|
-
```
|
|
151
|
-
|
|
152
|
-
Ghi chu multi-bot:
|
|
153
|
-
|
|
154
|
-
- `openclaw.json` co `channels.telegram.accounts` cho tung bot
|
|
155
|
-
- moi workspace co `AGENTS.md` mo ta handoff/routing
|
|
156
|
-
- wizard hien khong tao file rieng `TEAM.md` hay `RELAY.md`
|
|
157
|
-
- noi dung team coordination da duoc nhap vao `AGENTS.md`
|
|
158
|
-
- noi dung security da duoc nhap vao `AGENTS.md`
|
|
159
|
-
- noi dung relay da duoc nhap vao `TOOLS.md`
|
|
160
|
-
|
|
161
|
-
## Hanh vi theo channel
|
|
162
|
-
|
|
163
|
-
### Telegram single
|
|
164
|
-
|
|
165
|
-
- co `TELEGRAM_BOT_TOKEN` trong `.env`
|
|
166
|
-
- native script load `.env` roi chay gateway
|
|
167
|
-
- docker dung `docker/openclaw/.env`
|
|
168
|
-
|
|
169
|
-
### Telegram multi-bot
|
|
170
|
-
|
|
171
|
-
- co `TELEGRAM_BOT_TOKEN_1..N` va co the co `TELEGRAM_GROUP_ID` trong `.env`
|
|
172
|
-
- `openclaw.json` van co `channels.telegram.accounts` cho tung bot
|
|
173
|
-
- relay plugin `openclaw-telegram-multibot-relay` duoc bat
|
|
174
|
-
|
|
175
|
-
### Zalo Bot API
|
|
176
|
-
|
|
177
|
-
- co `ZALO_BOT_TOKEN` trong `.env`
|
|
178
|
-
- code hien cung de san `ZALO_APP_ID` va `ZALO_APP_SECRET` placeholder
|
|
179
|
-
- native va docker deu can secrets nay
|
|
180
|
-
|
|
181
|
-
### Zalo Personal
|
|
182
|
-
|
|
183
|
-
- khong co bot token trong `.env`
|
|
184
|
-
- native: script tu dong mo flow login `zalouser`
|
|
185
|
-
- docker: user chay lenh login sau khi container da len
|
|
186
|
-
|
|
187
|
-
## Danh sach file khong nen tao
|
|
188
|
-
|
|
189
|
-
- khong tao `agents/` o project root
|
|
190
|
-
- khong tao `.openclaw/workspace` chung kieu cu
|
|
191
|
-
- khong tao `models.json` trong agent dir khi dung `9router`
|
|
192
|
-
- khong tao Docker artifacts trong native mode
|
|
193
|
-
- khong tao root/per-agent `auth-profiles.json` khi dung `9router`
|
|
194
|
-
- khong tao file rieng `TEAM.md` / `RELAY.md` trong wizard hien tai
|
|
195
|
-
|
|
196
|
-
## Ket luan thuc te hien tai
|
|
197
|
-
|
|
198
|
-
Sau khi chinh code:
|
|
199
|
-
|
|
200
|
-
- logic tao thu muc `.openclaw`, `workspace-{slug}`, `auth-profiles.json` da dong bo hon giua native va docker
|
|
201
|
-
- native va docker deu co `.env` de ghi nhan secrets theo provider/channel
|
|
202
|
-
- 4 OS native deu load project `.env` truoc khi start gateway
|
|
203
|
-
- tai lieu nay mo ta code thuc te hien tai, khong mo ta combo modes dang tam ngung trong UI
|