@aiyiran/myclaw 1.0.88 → 1.0.89
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/assets/openclaw.ico +0 -0
- package/index.js +10 -75
- package/lobster-icon-generator.html +24 -20
- package/package.json +1 -1
- package/start.js +155 -0
package/assets/openclaw.ico
CHANGED
|
Binary file
|
package/index.js
CHANGED
|
@@ -264,6 +264,11 @@ function runLaunch() {
|
|
|
264
264
|
launch.run();
|
|
265
265
|
}
|
|
266
266
|
|
|
267
|
+
function runStart() {
|
|
268
|
+
const start = require('./start');
|
|
269
|
+
start.run();
|
|
270
|
+
}
|
|
271
|
+
|
|
267
272
|
// ============================================================================
|
|
268
273
|
// Prepare 智能初始化
|
|
269
274
|
// ============================================================================
|
|
@@ -319,87 +324,14 @@ function runBat() {
|
|
|
319
324
|
// Gateway 在独立窗口运行,本窗口负责升级 + 刷新图标后自动退出
|
|
320
325
|
const batContent = `@echo off
|
|
321
326
|
chcp 65001 >nul 2>&1
|
|
322
|
-
title OpenClaw
|
|
327
|
+
title OpenClaw
|
|
323
328
|
echo.
|
|
324
329
|
echo ============================================
|
|
325
330
|
echo OpenClaw
|
|
326
331
|
echo ============================================
|
|
327
332
|
echo.
|
|
328
|
-
|
|
329
|
-
REM ---- Step 1: WSL ----
|
|
330
|
-
echo [1/4] WSL...
|
|
331
|
-
wsl --version >nul 2>&1
|
|
332
|
-
if not errorlevel 1 goto :wsl_ok
|
|
333
|
-
echo [!] WSL not installed
|
|
334
|
-
call myclaw wsl2
|
|
335
|
-
echo.
|
|
336
|
-
echo Please restart your computer, then double-click this icon again.
|
|
337
|
-
echo.
|
|
338
|
-
pause
|
|
339
|
-
exit /b
|
|
340
|
-
|
|
341
|
-
:wsl_ok
|
|
342
|
-
echo [OK]
|
|
343
|
-
|
|
344
|
-
REM ---- Step 2: OpenClaw distro ----
|
|
345
|
-
echo [2/4] OpenClaw Linux...
|
|
346
|
-
wsl -d OpenClaw -- echo ok >nul 2>&1
|
|
347
|
-
if not errorlevel 1 goto :distro_ok
|
|
348
|
-
echo [!] OpenClaw Linux not found
|
|
349
|
-
call myclaw wsl2
|
|
350
|
-
echo.
|
|
351
|
-
echo Done. Double-click this icon again to start.
|
|
352
|
-
echo.
|
|
353
|
-
pause
|
|
354
|
-
exit /b
|
|
355
|
-
|
|
356
|
-
:distro_ok
|
|
357
|
-
echo [OK]
|
|
358
|
-
|
|
359
|
-
REM ---- Step 3: Gateway ----
|
|
360
|
-
echo [3/4] Gateway...
|
|
361
|
-
wsl -d OpenClaw -- pgrep -f "openclaw" >nul 2>&1
|
|
362
|
-
if not errorlevel 1 goto :gateway_running
|
|
363
|
-
|
|
364
|
-
REM Gateway not running -> update, launch in new window, refresh self
|
|
365
|
-
echo Starting...
|
|
366
|
-
echo.
|
|
367
|
-
echo [update] Windows...
|
|
368
|
-
call myclaw update
|
|
369
|
-
echo.
|
|
370
|
-
echo [launch] Starting Gateway...
|
|
371
|
-
start "OpenClaw Gateway" wsl -d OpenClaw -- myclaw launch
|
|
372
|
-
echo [OK]
|
|
373
|
-
echo.
|
|
374
|
-
echo [update] Refreshing desktop icon...
|
|
375
|
-
call myclaw bat >nul 2>&1
|
|
376
|
-
echo.
|
|
377
|
-
echo ============================================
|
|
378
|
-
echo Gateway started! This window will close.
|
|
379
|
-
echo ============================================
|
|
380
|
-
timeout /t 2 >nul
|
|
381
|
-
exit /b
|
|
382
|
-
|
|
383
|
-
:gateway_running
|
|
384
|
-
echo [OK] Running
|
|
385
|
-
|
|
386
|
-
REM ---- Open browser ----
|
|
387
|
-
echo [4/4] Browser...
|
|
388
|
-
call myclaw open
|
|
389
|
-
echo [OK]
|
|
390
|
-
echo.
|
|
391
|
-
echo Opening WSL terminal...
|
|
392
|
-
start "OpenClaw Terminal" wsl -d OpenClaw --cd /root/.openclaw
|
|
393
|
-
echo.
|
|
394
|
-
echo [update] Refreshing desktop icon...
|
|
395
|
-
call myclaw bat >nul 2>&1
|
|
396
|
-
echo.
|
|
397
|
-
echo ============================================
|
|
398
|
-
echo OpenClaw is running. Browser opened.
|
|
399
|
-
echo This window will close.
|
|
400
|
-
echo ============================================
|
|
333
|
+
myclaw start
|
|
401
334
|
timeout /t 2 >nul
|
|
402
|
-
exit /b
|
|
403
335
|
`;
|
|
404
336
|
|
|
405
337
|
|
|
@@ -787,6 +719,7 @@ function showHelp() {
|
|
|
787
719
|
console.log(' rebind 微信换绑向导(清空、扫码、换Agent)');
|
|
788
720
|
console.log('');
|
|
789
721
|
console.log('命令:');
|
|
722
|
+
console.log(' start 智能启动(图标 & 命令行通用入口)');
|
|
790
723
|
console.log(' install 安装 OpenClaw 服务');
|
|
791
724
|
console.log(' status 简化版状态查看(学生友好)');
|
|
792
725
|
console.log(' new 创建新的 Agent(学生练习用)');
|
|
@@ -844,6 +777,8 @@ if (!command || command === 'help' || command === '--help' || command === '-h')
|
|
|
844
777
|
if (detectPlatform() === 'windows') {
|
|
845
778
|
runBat();
|
|
846
779
|
}
|
|
780
|
+
} else if (command === 'start') {
|
|
781
|
+
runStart();
|
|
847
782
|
} else if (command === 'open') {
|
|
848
783
|
runOpen();
|
|
849
784
|
} else if (command === 'wsl2') {
|
|
@@ -152,7 +152,7 @@
|
|
|
152
152
|
"0CC00000000CC0"
|
|
153
153
|
];
|
|
154
154
|
|
|
155
|
-
// 我们重新设计了 32x32
|
|
155
|
+
// 我们重新设计了 32x32 矩阵:保留巨镰,极大化扩充躯干宽度,并增加了一个霸气的全幅扇形尾翼,彻底填满 32x32 空间。
|
|
156
156
|
const design32 = [
|
|
157
157
|
"000000000R000000000000R000000000",
|
|
158
158
|
"00000000RRC0000000000CRR00000000",
|
|
@@ -169,23 +169,23 @@
|
|
|
169
169
|
"RBBBBRRRRRC0CBBBBBBC0CRRRRRBBBBR",
|
|
170
170
|
"RBBBBRRRRRC0CBB00BBC0CRRRRRBBBBR",
|
|
171
171
|
"RBBBBRRRRRC0CBB00BBC0CRRRRRBBBBR",
|
|
172
|
-
"
|
|
173
|
-
"
|
|
174
|
-
"
|
|
175
|
-
"
|
|
176
|
-
"
|
|
177
|
-
"
|
|
178
|
-
"
|
|
179
|
-
"
|
|
180
|
-
"
|
|
181
|
-
"
|
|
182
|
-
"
|
|
183
|
-
"
|
|
184
|
-
"
|
|
185
|
-
"
|
|
186
|
-
"
|
|
187
|
-
"
|
|
188
|
-
"
|
|
172
|
+
"RRBBBRRRRRC0CBBBBBBC0CRRRRRBBBRR",
|
|
173
|
+
"RRRBBBRRRRC0CBBBBBBC0CRRRRBBBRRR",
|
|
174
|
+
"RRRRBBRRRRC0CBBBBBBC0CRRRRBRRRRR",
|
|
175
|
+
"RRRRRRRRRRC0CCBBBBCC0CRRRRRRRRRR",
|
|
176
|
+
"RRRRRRRRRRC00CBBBBC00CRRRRRRRRRR",
|
|
177
|
+
"RRRRRRRRRRC00CBBBBC00CRRRRRRRRRR",
|
|
178
|
+
"RRRRRRRRRRCCCCCBBCCCCCRRRRRRRRRR",
|
|
179
|
+
"RRRRRRRRRCBBBBBBBBBBBBCRRRRRRRRR",
|
|
180
|
+
"RRRRRRRRCBBBBC0BB0CBBBBCRRRRRRRR",
|
|
181
|
+
"CCCCRRRCBBBBC00CC00CBBBBCRRRCCCC",
|
|
182
|
+
"BBBBBBBCCBBBC0000000CBBBCCBBBBBB",
|
|
183
|
+
"BBBBBBBBBBBBC00000000BBBBBBBBBBB",
|
|
184
|
+
"BBBBBBBBBBBBC00000000BBBBBBBBBBB",
|
|
185
|
+
"BBBBBBBBBBBBC00000000BBBBBBBBBBB",
|
|
186
|
+
"BBBBBBBBBBBBC00000000BBBBBBBBBBB",
|
|
187
|
+
"BBBBBBBBBBBBC00000000BBBBBBBBBBB",
|
|
188
|
+
"CCCCCCCCCCCCC00000000CCCCCCCCCCC"
|
|
189
189
|
];
|
|
190
190
|
|
|
191
191
|
const canvas = document.getElementById('iconCanvas');
|
|
@@ -193,8 +193,12 @@
|
|
|
193
193
|
|
|
194
194
|
// 绘制函数
|
|
195
195
|
function drawLobster() {
|
|
196
|
-
//
|
|
197
|
-
ctx.
|
|
196
|
+
// 背景渐变:从黑到蓝
|
|
197
|
+
const gradient = ctx.createLinearGradient(0, 0, 0, 256);
|
|
198
|
+
gradient.addColorStop(0, '#000000');
|
|
199
|
+
gradient.addColorStop(1, '#000088');
|
|
200
|
+
ctx.fillStyle = gradient;
|
|
201
|
+
ctx.fillRect(0, 0, 256, 256);
|
|
198
202
|
|
|
199
203
|
ctx.save();
|
|
200
204
|
// 平移到画布中心
|
package/package.json
CHANGED
package/start.js
ADDED
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* ============================================================================
|
|
5
|
+
* MyClaw Start - 智能启动(图标 & 命令行通用入口)
|
|
6
|
+
* ============================================================================
|
|
7
|
+
*
|
|
8
|
+
* 使用: myclaw start
|
|
9
|
+
*
|
|
10
|
+
* Windows 流程:
|
|
11
|
+
* 1. 检查 WSL → 未装则引导安装
|
|
12
|
+
* 2. 检查 OpenClaw 发行版 → 未装则引导安装
|
|
13
|
+
* 3. 检查 Gateway → 未启动则 update + launch(新窗口)
|
|
14
|
+
* 4. 打开浏览器
|
|
15
|
+
*
|
|
16
|
+
* Linux/Mac 流程:
|
|
17
|
+
* 等同于 myclaw launch(update + patch + gateway + open)
|
|
18
|
+
* ============================================================================
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
const { execSync } = require('child_process');
|
|
22
|
+
const os = require('os');
|
|
23
|
+
const path = require('path');
|
|
24
|
+
|
|
25
|
+
const isWindows = os.platform() === 'win32';
|
|
26
|
+
const C = isWindows
|
|
27
|
+
? { r: '', g: '', y: '', b: '', nc: '' }
|
|
28
|
+
: { r: '\x1b[31m', g: '\x1b[32m', y: '\x1b[33m', b: '\x1b[34m', nc: '\x1b[0m' };
|
|
29
|
+
|
|
30
|
+
const BAR = '============================================';
|
|
31
|
+
|
|
32
|
+
// ============================================================================
|
|
33
|
+
// Windows 启动流程
|
|
34
|
+
// ============================================================================
|
|
35
|
+
|
|
36
|
+
function startWindows() {
|
|
37
|
+
// Step 1: 检查 WSL
|
|
38
|
+
console.log('[1/4] WSL...');
|
|
39
|
+
try {
|
|
40
|
+
execSync('wsl --version', { stdio: 'pipe', timeout: 10000 });
|
|
41
|
+
console.log(' ' + C.g + '[OK]' + C.nc);
|
|
42
|
+
} catch {
|
|
43
|
+
console.log(' ' + C.r + '[未安装]' + C.nc);
|
|
44
|
+
console.log('');
|
|
45
|
+
console.log('正在启动 WSL2 安装向导...');
|
|
46
|
+
try { execSync('myclaw wsl2', { stdio: 'inherit' }); } catch {}
|
|
47
|
+
console.log('');
|
|
48
|
+
console.log('请 ' + C.y + '重启电脑' + C.nc + ' 后再次双击图标');
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
console.log('');
|
|
52
|
+
|
|
53
|
+
// Step 2: 检查 OpenClaw 发行版
|
|
54
|
+
console.log('[2/4] OpenClaw Linux...');
|
|
55
|
+
try {
|
|
56
|
+
execSync('wsl -d OpenClaw -- echo ok', { stdio: 'pipe', timeout: 15000 });
|
|
57
|
+
console.log(' ' + C.g + '[OK]' + C.nc);
|
|
58
|
+
} catch {
|
|
59
|
+
console.log(' ' + C.r + '[未安装]' + C.nc);
|
|
60
|
+
console.log('');
|
|
61
|
+
console.log('正在启动 WSL2 安装向导...');
|
|
62
|
+
try { execSync('myclaw wsl2', { stdio: 'inherit' }); } catch {}
|
|
63
|
+
console.log('');
|
|
64
|
+
console.log('完成后再次运行 ' + C.y + 'myclaw start' + C.nc);
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
console.log('');
|
|
68
|
+
|
|
69
|
+
// Step 3: 检查 Gateway
|
|
70
|
+
console.log('[3/4] Gateway...');
|
|
71
|
+
let gatewayRunning = false;
|
|
72
|
+
try {
|
|
73
|
+
execSync('wsl -d OpenClaw -- pgrep -f "openclaw"', { stdio: 'pipe', timeout: 5000 });
|
|
74
|
+
gatewayRunning = true;
|
|
75
|
+
console.log(' ' + C.g + '[已在运行]' + C.nc);
|
|
76
|
+
} catch {
|
|
77
|
+
console.log(' ' + C.y + '[未启动]' + C.nc);
|
|
78
|
+
}
|
|
79
|
+
console.log('');
|
|
80
|
+
|
|
81
|
+
if (!gatewayRunning) {
|
|
82
|
+
// Gateway 未运行: 先升级,再在新窗口启动
|
|
83
|
+
console.log('[update] 检查 MyClaw 更新...');
|
|
84
|
+
try { execSync('myclaw update', { stdio: 'inherit', timeout: 120000 }); } catch {}
|
|
85
|
+
console.log('');
|
|
86
|
+
|
|
87
|
+
console.log('[launch] 在新窗口启动 Gateway...');
|
|
88
|
+
try {
|
|
89
|
+
execSync('start "OpenClaw Gateway" wsl -d OpenClaw -- myclaw launch', {
|
|
90
|
+
stdio: 'inherit',
|
|
91
|
+
shell: true,
|
|
92
|
+
});
|
|
93
|
+
console.log(' ' + C.g + '[OK]' + C.nc);
|
|
94
|
+
} catch (err) {
|
|
95
|
+
console.error(' ' + C.r + '[失败]' + C.nc + ' ' + err.message);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
// Step 4: 打开浏览器
|
|
100
|
+
console.log('');
|
|
101
|
+
console.log('[4/4] 打开浏览器...');
|
|
102
|
+
try { execSync('myclaw open', { stdio: 'inherit', timeout: 10000 }); } catch {}
|
|
103
|
+
|
|
104
|
+
if (gatewayRunning) {
|
|
105
|
+
// Gateway 已有,附带打开 WSL 终端
|
|
106
|
+
console.log('');
|
|
107
|
+
console.log('[terminal] 打开 WSL 终端...');
|
|
108
|
+
try {
|
|
109
|
+
execSync('start "OpenClaw Terminal" wsl -d OpenClaw --cd /root/.openclaw', {
|
|
110
|
+
stdio: 'inherit',
|
|
111
|
+
shell: true,
|
|
112
|
+
});
|
|
113
|
+
} catch {}
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
// 静默刷新桌面图标
|
|
117
|
+
try { execSync('myclaw bat', { stdio: 'pipe', timeout: 10000 }); } catch {}
|
|
118
|
+
|
|
119
|
+
console.log('');
|
|
120
|
+
console.log(BAR);
|
|
121
|
+
if (gatewayRunning) {
|
|
122
|
+
console.log(' OpenClaw 正在运行,浏览器已打开。');
|
|
123
|
+
} else {
|
|
124
|
+
console.log(' Gateway 正在新窗口中启动...');
|
|
125
|
+
}
|
|
126
|
+
console.log(BAR);
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
// ============================================================================
|
|
130
|
+
// Linux/Mac 启动流程(等同于 myclaw launch)
|
|
131
|
+
// ============================================================================
|
|
132
|
+
|
|
133
|
+
function startUnix() {
|
|
134
|
+
const launch = require('./launch');
|
|
135
|
+
return launch.run();
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
// ============================================================================
|
|
139
|
+
// 主入口
|
|
140
|
+
// ============================================================================
|
|
141
|
+
|
|
142
|
+
async function run() {
|
|
143
|
+
console.log('');
|
|
144
|
+
console.log('[' + C.b + 'MyClaw' + C.nc + '] ' + C.b + '智能启动' + C.nc);
|
|
145
|
+
console.log(BAR);
|
|
146
|
+
console.log('');
|
|
147
|
+
|
|
148
|
+
if (isWindows) {
|
|
149
|
+
startWindows();
|
|
150
|
+
} else {
|
|
151
|
+
await startUnix();
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
module.exports = { run };
|