create-openclaw-bot 5.4.1 → 5.5.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.
@@ -0,0 +1,169 @@
1
+ // @ts-nocheck
2
+ /* eslint-disable no-undef, no-unused-vars */
3
+ /**
4
+ * @fileoverview Part of the OpenClaw Setup Wizard IIFE bundle.
5
+ * This file is concatenated (not imported) — globals are shared via setup.js IIFE scope.
6
+ * Do NOT add import/export statements. Edit, then run: node build.mjs
7
+ *
8
+ * @global {object} state - Wizard UI state
9
+ * @global {object} PROVIDERS - AI provider registry
10
+ * @global {Array} SKILLS - Available skills
11
+ * @global {Array} PLUGINS - Available plugins
12
+ * @global {object} CHANNELS - Channel definitions
13
+ * @global {boolean} isVi - Vietnamese language mode
14
+ * @global {object} provider - Current primary provider config
15
+ * @global {boolean} isMultiBot - Multi-bot mode flag
16
+ * @global {boolean} hasBrowser - Browser plugin selected
17
+ * @global {boolean} is9Router - 9Router proxy mode
18
+ * @global {string} projectDir - Output project directory path
19
+ * @global {Function} getGatewayAllowedOrigins
20
+ */
21
+ // ========== Available Skills (ClawHub registry — agent capabilities) ==========
22
+ const SKILLS = [
23
+ {
24
+ id: 'browser',
25
+ name: 'Browser Automation ⭐(Khuyên dùng)',
26
+ icon: '🌐',
27
+ descVi: 'Tự động thao tác trình duyệt (Playwright)', descEn: 'Automated browser control (Playwright)',
28
+ slug: 'browser-automation',
29
+ noteVi: 'Cần bật Chrome Debug Mode trên máy host', noteEn: 'Requires Chrome Debug Mode on host',
30
+ },
31
+ {
32
+ id: 'memory',
33
+ name: 'Long-term Memory ⭐(Khuyên dùng)',
34
+ icon: '🧠',
35
+ descVi: 'Nhớ hội thoại xuyên phiên, context dài hạn', descEn: 'Cross-session memory, long-term context',
36
+ slug: 'memory',
37
+ },
38
+ {
39
+ id: 'scheduler',
40
+ name: 'Native Cron Scheduler ⭐(Khuyên dùng)',
41
+ icon: '⏰',
42
+ descVi: 'Gọi Cron gốc trên nền tảng (không tải qua HUB)', descEn: 'Native Cron background jobs (No skill download)',
43
+ },
44
+ {
45
+ id: 'rag',
46
+ name: 'RAG / Knowledge Base',
47
+ icon: '📚',
48
+ descVi: 'Chat với tài liệu, file PDF, codebase', descEn: 'Chat with docs, PDFs, codebase',
49
+ slug: 'rag',
50
+ noteVi: 'Đặt file vào thư mục .openclaw/docs/', noteEn: 'Put files in .openclaw/docs/ folder',
51
+ },
52
+ {
53
+ id: 'image-gen',
54
+ name: 'Image Generation',
55
+ icon: '🎨',
56
+ descVi: 'Tạo ảnh bằng AI (DALL·E, Flux, Midjourney...)', descEn: 'Generate images via AI (DALL-E, Flux, Midjourney...)',
57
+ slug: 'image-gen',
58
+ noteVi: 'Dùng chung OPENAI_API_KEY (DALL-E) hoặc thêm FLUX_API_KEY', noteEn: 'Uses OPENAI_API_KEY (DALL-E) or FLUX_API_KEY',
59
+ envVars: ['# FLUX_API_KEY=<your_flux_key> # chỉ cần nếu dùng Flux'],
60
+ },
61
+ {
62
+ id: 'code-interpreter',
63
+ name: 'Code Interpreter',
64
+ icon: '💻',
65
+ descVi: 'Chạy code Python/JS trong sandbox', descEn: 'Run Python/JS code in sandbox',
66
+ slug: 'code-interpreter',
67
+ },
68
+ {
69
+ id: 'email',
70
+ name: 'Email Assistant',
71
+ icon: '📧',
72
+ descVi: 'Quản lý, soạn, tóm tắt email (Gmail, Outlook...)', descEn: 'Manage, compose, summarize emails (Gmail, Outlook...)',
73
+ slug: 'email-assistant',
74
+ noteVi: 'Cần cấu hình SMTP trong .env', noteEn: 'Requires SMTP configuration in .env',
75
+ envVars: ['SMTP_HOST=smtp.gmail.com', 'SMTP_PORT=587', 'SMTP_USER=<your_email>', 'SMTP_PASS=<your_app_password>'],
76
+ },
77
+ {
78
+ id: 'web-search',
79
+ name: 'Web Search',
80
+ icon: '🔍',
81
+ descVi: 'Tìm kiếm web thời gian thực (DuckDuckGo) — không cần API key', descEn: 'Real-time web search (DuckDuckGo) — no API key needed',
82
+ slug: 'web-search',
83
+ },
84
+ {
85
+ id: 'notion',
86
+ name: 'Notion',
87
+ icon: '📓',
88
+ descVi: 'Tạo, chỉnh sửa trang và database Notion', descEn: 'Create and edit Notion pages and databases',
89
+ slug: 'notion',
90
+ noteVi: 'Cần Notion Integration Token', noteEn: 'Requires Notion Integration Token',
91
+ envVars: ['NOTION_API_KEY=<your_notion_integration_token>'],
92
+ },
93
+ {
94
+ id: 'slack',
95
+ name: 'Slack',
96
+ icon: '🗨️',
97
+ descVi: 'Gửi tin, react, ghim tin nhắn trong Slack', descEn: 'Send messages, react, pin items in Slack',
98
+ slug: 'slack',
99
+ noteVi: 'Cần Slack Bot Token', noteEn: 'Requires Slack Bot Token',
100
+ envVars: ['SLACK_BOT_TOKEN=<your_slack_bot_token>'],
101
+ },
102
+ ];
103
+
104
+ function providerSupportsMemoryEmbeddings(providerKey) {
105
+ const provider = PROVIDERS[providerKey];
106
+ if (!provider) return false;
107
+ return !!provider.supportsEmbeddings;
108
+ }
109
+
110
+ function getSkillDisplayName(skill, providerKey, lang) {
111
+ const normalizedName = String(skill.name || '')
112
+ .replace(/\s*[⭐🌟]\s*\((Khuyên dùng|Recommended)\)\s*/gi, '')
113
+ .replace(/\s*[⭐🌟]\s*(Khuyên dùng|Recommended)\s*/gi, '')
114
+ .trim();
115
+ if (skill.id === 'memory') {
116
+ return 'Long-term Memory';
117
+ }
118
+ return normalizedName;
119
+ }
120
+
121
+ function getSkillBadge(skill, providerKey, lang) {
122
+ const isVi = lang !== 'en';
123
+ if (skill.id === 'memory' && providerSupportsMemoryEmbeddings(providerKey)) {
124
+ return {
125
+ text: isVi ? 'Khuyên dùng' : 'Recommended',
126
+ className: 'plugin-card__badge plugin-card__badge--recommended'
127
+ };
128
+ }
129
+ if (skill.id === 'browser' || skill.id === 'scheduler') {
130
+ return {
131
+ text: isVi ? 'Khuyên dùng' : 'Recommended',
132
+ className: 'plugin-card__badge plugin-card__badge--recommended'
133
+ };
134
+ }
135
+ return null;
136
+ }
137
+
138
+ function getSkillExtraNote(skill, providerKey, lang) {
139
+ const isVi = lang !== 'en';
140
+ const baseNote = isVi ? (skill.noteVi || skill.note || '') : (skill.noteEn || skill.note || '');
141
+ if (skill.id !== 'memory' || providerSupportsMemoryEmbeddings(providerKey)) {
142
+ return baseNote;
143
+ }
144
+ const providerName = PROVIDERS[providerKey]?.name || providerKey;
145
+ const memoryNote = isVi
146
+ ? `Provider hiện tại (${providerName}) chưa có đường embeddings được xác nhận trong wizard, nên memory search sẽ không được gắn khuyên dùng.`
147
+ : `The current provider (${providerName}) does not have a confirmed embeddings path in the wizard, so memory search is not marked recommended.`;
148
+ return baseNote ? `${baseNote} ${memoryNote}` : memoryNote;
149
+ }
150
+
151
+ function escapeHtml(text) {
152
+ return String(text || '')
153
+ .replace(/&/g, '&amp;')
154
+ .replace(/</g, '&lt;')
155
+ .replace(/>/g, '&gt;')
156
+ .replace(/"/g, '&quot;')
157
+ .replace(/'/g, '&#39;');
158
+ }
159
+
160
+ function getSkillTooltipContent(skill, providerKey, lang) {
161
+ const desc = lang === 'vi' ? (skill.descVi || skill.desc || '') : (skill.descEn || skill.desc || '');
162
+ const note = getSkillExtraNote(skill, providerKey, lang);
163
+ return [desc, note].filter(Boolean).join('\n\n');
164
+ }
165
+
166
+ function getPluginTooltipContent(plugin, lang) {
167
+ return lang === 'vi' ? (plugin.descVi || plugin.desc || '') : (plugin.descEn || plugin.desc || '');
168
+ }
169
+
@@ -0,0 +1,223 @@
1
+ // @ts-nocheck
2
+ (function (root) {
3
+ const OPENCLAW_NPM_SPEC = 'openclaw@2026.4.14';
4
+ const OPENCLAW_RUNTIME_PACKAGES = 'grammy @grammyjs/runner @grammyjs/transformer-throttler @buape/carbon @larksuiteoapi/node-sdk @slack/web-api';
5
+ const TELEGRAM_RELAY_PLUGIN_SPEC = 'openclaw-telegram-multibot-relay';
6
+
7
+ function buildRelayPluginInstallCommand(prefix = 'openclaw') {
8
+ return `${prefix} plugins install ${TELEGRAM_RELAY_PLUGIN_SPEC} 2>/dev/null || true`;
9
+ }
10
+
11
+ function buildRelayPluginInstallCommandWin(prefix = 'openclaw') {
12
+ return `${prefix} plugins install ${TELEGRAM_RELAY_PLUGIN_SPEC} || exit /b 0`;
13
+ }
14
+
15
+ function buildTelegramPostInstallChecklist(options = {}) {
16
+ const {
17
+ isVi = true,
18
+ bots = [],
19
+ groupId = '',
20
+ relayPluginSpec = TELEGRAM_RELAY_PLUGIN_SPEC,
21
+ includeTokenPreview = false,
22
+ } = options;
23
+ const botList = bots.map((bot, idx) => {
24
+ const name = bot?.name || `Bot ${idx + 1}`;
25
+ if (includeTokenPreview) {
26
+ return `- **${name}** — token: ${String(bot?.token || '').slice(0, 10)}...`;
27
+ }
28
+ return `- **${name}**`;
29
+ }).join('\n');
30
+
31
+ if (isVi) {
32
+ return `# Telegram Post-Install Checklist
33
+
34
+ Bot da duoc cai dat. Thuc hien cac buoc sau de hoat dong trong group.
35
+
36
+ ## Group ID
37
+ - ${groupId ? `Group ID: ${groupId}` : 'Chua nhap Group ID - bot se hoat dong o moi group.'}
38
+
39
+ ## Danh sach bot
40
+ ${botList}
41
+
42
+ ---
43
+
44
+ ## Buoc 1 -- Tat Privacy Mode tren BotFather (bat buoc, lam truoc)
45
+
46
+ Mac dinh bot chi doc tin nhan bat dau bang /. Phai tat Privacy Mode thi bot moi doc duoc tat ca tin nhan trong group.
47
+
48
+ Lam lan luot cho TUNG BOT:
49
+ 1. Mo Telegram, tim @BotFather
50
+ 2. Gui: /mybots
51
+ 3. Chon bot can sua
52
+ 4. Chon: Bot Settings
53
+ 5. Chon: Group Privacy
54
+ 6. Chon: Turn off
55
+ 7. BotFather se bao: "Privacy mode is disabled for ..."
56
+
57
+ !!! QUAN TRONG: Phai lam buoc nay TRUOC khi add bot vao group. Neu bot da o trong group roi thi phai Remove bot ra, sau do Add lai.
58
+
59
+ ## Buoc 2 -- Add bot vao group
60
+
61
+ Sau khi tat Privacy Mode cho ALL bot:
62
+ 1. Mo group Telegram cua ban
63
+ 2. Vao Settings -> Members -> Add Members
64
+ 3. Tim ten tung bot theo username (VD: @TenCuaBot) va add vao
65
+ 4. Sau khi add, vao Settings -> Administrators
66
+ 5. Promote tung bot len Admin (can quyen phan hoi, co the de mac dinh)
67
+
68
+ Lay username that cua bot: vao @BotFather -> /mybots -> chon bot -> username la chu sau @.
69
+
70
+ ## Buoc 3 -- Lay Group ID (neu chua co)
71
+
72
+ 1. Them @userinfobot vao group nhu admin
73
+ 2. Go /start hoac forward bat ky tin nhan trong group cho @userinfobot
74
+ 3. Bot tra ve Chat ID bat dau bang -100...
75
+ 4. Dat gia tri do vao TELEGRAM_GROUP_ID trong file .env
76
+
77
+ ## Buoc 4 -- Cai plugin (neu chua cai duoc tu dong)
78
+
79
+ Neu trong qua trinh setup bao loi cai plugin, sau khi bot dang chay hay chay:
80
+
81
+ openclaw plugins install ${relayPluginSpec}
82
+
83
+ ## Buoc 5 -- Test
84
+
85
+ 1. Gui tin nhan trong group, mention bot: @TenCuaBot xin chao
86
+ 2. Bot se phan hoi
87
+ 3. Neu khong phan hoi: kiem tra lai Buoc 1 (Privacy Mode) va Buoc 2 (add lai sau khi tat privacy)
88
+
89
+ ---
90
+ *Generated by OpenClaw Setup*
91
+ `;
92
+ }
93
+
94
+ return `# Telegram Post-Install Checklist
95
+
96
+ Bots are installed. Complete the steps below to activate them in a group.
97
+
98
+ ## Group ID
99
+ - ${groupId ? `Group ID: ${groupId}` : 'No Group ID - bots will respond in any group.'}
100
+
101
+ ## Bot list
102
+ ${botList}
103
+
104
+ ---
105
+
106
+ ## Step 1 -- Disable Privacy Mode on BotFather (required, do this first)
107
+
108
+ By default bots only read messages starting with /. You must disable Privacy Mode so bots can read all group messages.
109
+
110
+ Do this for EACH BOT:
111
+ 1. Open Telegram, find @BotFather
112
+ 2. Send: /mybots
113
+ 3. Select the bot
114
+ 4. Choose: Bot Settings
115
+ 5. Choose: Group Privacy
116
+ 6. Choose: Turn off
117
+ 7. BotFather confirms: "Privacy mode is disabled for ..."
118
+
119
+ !!! IMPORTANT: Do this BEFORE adding the bot to the group. If the bot is already in the group, remove it first then re-add it.
120
+
121
+ ## Step 2 -- Add bots to the group
122
+
123
+ After disabling Privacy Mode for ALL bots:
124
+ 1. Open your Telegram group
125
+ 2. Go to Settings -> Members -> Add Members
126
+ 3. Search each bot by username (e.g. @YourBotUsername) and add it
127
+ 4. Go to Settings -> Administrators
128
+ 5. Promote each bot to Admin
129
+
130
+ To get each bot's real username: open @BotFather -> /mybots -> select bot -> username after @.
131
+
132
+ ## Step 3 -- Get Group ID (if not already set)
133
+
134
+ 1. Add @userinfobot to the group as admin
135
+ 2. Send /start or forward any group message to @userinfobot
136
+ 3. It returns a Chat ID starting with -100...
137
+ 4. Set that value as TELEGRAM_GROUP_ID in your .env file
138
+
139
+ ## Step 4 -- Install plugin (if auto-install failed)
140
+
141
+ If setup reported a plugin install error, run this after the bot is running:
142
+
143
+ openclaw plugins install ${relayPluginSpec}
144
+
145
+ ## Step 5 -- Test
146
+
147
+ 1. Send a message in the group mentioning the bot: @YourBotUsername hello
148
+ 2. The bot should respond
149
+ 3. No response? Re-check Step 1 (Privacy Mode) and Step 2 (re-add bot after disabling privacy)
150
+
151
+ ---
152
+ *Generated by OpenClaw Setup*
153
+ `;
154
+ }
155
+
156
+ function buildAuthProfilesJson(options = {}) {
157
+ const {
158
+ providerKey = '',
159
+ provider = {},
160
+ apiKey = '',
161
+ isProxy = false,
162
+ isLocal = false,
163
+ localUrl = 'http://ollama:11434',
164
+ proxyKey = 'sk-no-key',
165
+ } = options;
166
+
167
+ if (isLocal) {
168
+ return {
169
+ version: 1,
170
+ profiles: {
171
+ 'ollama:default': {
172
+ provider: 'ollama',
173
+ type: 'api_key',
174
+ key: 'ollama-local',
175
+ url: localUrl,
176
+ },
177
+ },
178
+ order: { ollama: ['ollama:default'] },
179
+ };
180
+ }
181
+
182
+ const authProviderName = isProxy ? '9router' : providerKey;
183
+ const authProfileId = isProxy ? '9router-proxy' : `${authProviderName}:default`;
184
+ const authKeyValue = isProxy
185
+ ? proxyKey
186
+ : (apiKey || `<your_${(provider.envKey || 'API_KEY').toLowerCase()}>`);
187
+ const json = {
188
+ version: 1,
189
+ profiles: {
190
+ [authProfileId]: {
191
+ provider: authProviderName,
192
+ type: 'api_key',
193
+ key: authKeyValue,
194
+ },
195
+ },
196
+ order: { [authProviderName]: [authProfileId] },
197
+ };
198
+
199
+ if (!isProxy && providerKey !== 'openai' && provider.baseURL) {
200
+ json.profiles[authProfileId].url = provider.baseURL;
201
+ }
202
+ return json;
203
+ }
204
+
205
+ function buildAuthProfilesString(options = {}) {
206
+ return JSON.stringify(buildAuthProfilesJson(options), null, 2);
207
+ }
208
+
209
+ root.__openclawCommon = {
210
+ OPENCLAW_NPM_SPEC,
211
+ OPENCLAW_RUNTIME_PACKAGES,
212
+ TELEGRAM_RELAY_PLUGIN_SPEC,
213
+ buildRelayPluginInstallCommand,
214
+ buildRelayPluginInstallCommandWin,
215
+ buildTelegramPostInstallChecklist,
216
+ buildAuthProfilesJson,
217
+ buildAuthProfilesString,
218
+ };
219
+
220
+ })(typeof globalThis !== 'undefined' ? globalThis : {});
221
+ if (typeof exports !== 'undefined' && typeof globalThis !== 'undefined' && globalThis.__openclawCommon) {
222
+ Object.assign(exports, globalThis.__openclawCommon);
223
+ }