@aiyiran/myclaw 1.0.119 → 1.0.121

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/index.js CHANGED
@@ -383,14 +383,14 @@ function runWsl2() {
383
383
  wsl2.run();
384
384
  }
385
385
 
386
- function runLaunch() {
386
+ async function runLaunch() {
387
387
  const launch = require('./launch');
388
- launch.run();
388
+ await launch.run();
389
389
  }
390
390
 
391
- function runStart() {
391
+ async function runStart() {
392
392
  const start = require('./start');
393
- start.run();
393
+ await start.run();
394
394
  }
395
395
 
396
396
  // ============================================================================
@@ -445,7 +445,8 @@ function runBat() {
445
445
  const lnkPath = path.join(desktopPath, ver + '_OpenClaw_' + mm + '-' + dd + '_' + hh + '-' + mi + '-' + ss + '.lnk');
446
446
 
447
447
  // === 智能启动器 bat 内容 ===
448
- // Gateway 在独立窗口运行,本窗口负责升级 + 刷新图标后自动退出
448
+ // 首次启动: myclaw start 会阻塞在当前窗口(Gateway 运行期间不退出)
449
+ // 非首次启动: myclaw start 跑完后 pause 防止闪退
449
450
  const batContent = `@echo off
450
451
  chcp 65001 >nul 2>&1
451
452
  title OpenClaw
@@ -455,7 +456,9 @@ echo OpenClaw
455
456
  echo ============================================
456
457
  echo.
457
458
  myclaw start
458
- timeout /t 2 >nul
459
+ echo.
460
+ echo 按任意键关闭此窗口...
461
+ pause >nul
459
462
  `;
460
463
 
461
464
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aiyiran/myclaw",
3
- "version": "1.0.119",
3
+ "version": "1.0.121",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "bin": {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "_doc": "MyClaw 注入清单 (auto-generated)。strategy: auto | on | off | delete",
3
- "_generated": "2026-04-02T14:44:32.731Z",
3
+ "_generated": "2026-04-02T14:53:32.081Z",
4
4
  "agents": [
5
5
  {
6
6
  "id": "danci",
package/start.js CHANGED
@@ -90,19 +90,36 @@ function startWindows() {
90
90
  console.log('');
91
91
 
92
92
  if (!gatewayRunning) {
93
- // Gateway 未运行: 在新窗口启动(launch 内部会再 patch 一次,幂等无害)
94
- console.log('[launch] 在新窗口启动 Gateway...');
93
+ // ============================================================
94
+ // 首次启动: 在当前窗口直接 launch,不开新窗口,不刷图标
95
+ // ============================================================
96
+ console.log('[launch] 在当前窗口启动 Gateway...');
97
+
98
+ // Step 4: 先打开浏览器(延迟几秒后 Gateway 就绑了)
99
+ console.log('');
100
+ console.log('[4/4] 打开浏览器 (Gateway 启动后自动连接)...');
101
+ try { execSync('myclaw open', { stdio: 'inherit', timeout: 10000 }); } catch {}
102
+
103
+ console.log('');
104
+ console.log(BAR);
105
+ console.log(' Gateway 正在当前窗口启动...');
106
+ console.log(' 关闭此窗口 = 停止服务');
107
+ console.log(BAR);
108
+ console.log('');
109
+
110
+ // 直接在当前窗口执行 launch(阻塞,关窗口 = 停服务)
95
111
  try {
96
- execSync('start "OpenClaw Gateway" wsl -d OpenClaw -- myclaw launch', {
112
+ execSync('wsl -d OpenClaw -- myclaw launch', {
97
113
  stdio: 'inherit',
98
- shell: true,
99
114
  });
100
- console.log(' ' + C.g + '[OK]' + C.nc);
101
- } catch (err) {
102
- console.error(' ' + C.r + '[失败]' + C.nc + ' ' + err.message);
103
- }
115
+ } catch {}
116
+
104
117
  } else {
105
- // Gateway 已在运行,重启使 patch 生效
118
+ // ============================================================
119
+ // 非首次启动: Gateway 已在运行
120
+ // ============================================================
121
+
122
+ // 重启使 patch 生效
106
123
  console.log('[restart] 重启 Gateway 使插件生效...');
107
124
  try {
108
125
  execSync('wsl -d OpenClaw -- openclaw gateway restart', { stdio: 'pipe', timeout: 15000 });
@@ -110,15 +127,13 @@ function startWindows() {
110
127
  } catch {
111
128
  console.log(' ' + C.y + '[跳过]' + C.nc + ' 重启失败,手动 myclaw restart');
112
129
  }
113
- }
114
130
 
115
- // Step 4: 打开浏览器
116
- console.log('');
117
- console.log('[4/4] 打开浏览器...');
118
- try { execSync('myclaw open', { stdio: 'inherit', timeout: 10000 }); } catch {}
131
+ // Step 4: 打开浏览器
132
+ console.log('');
133
+ console.log('[4/4] 打开浏览器...');
134
+ try { execSync('myclaw open', { stdio: 'inherit', timeout: 10000 }); } catch {}
119
135
 
120
- if (gatewayRunning) {
121
- // Gateway 已有,附带打开 WSL 终端
136
+ // 打开 WSL 终端
122
137
  console.log('');
123
138
  console.log('[terminal] 打开 WSL 终端...');
124
139
  try {
@@ -127,19 +142,15 @@ function startWindows() {
127
142
  shell: true,
128
143
  });
129
144
  } catch {}
130
- }
131
145
 
132
- // 静默刷新桌面图标
133
- try { execSync('myclaw bat', { stdio: 'pipe', timeout: 10000 }); } catch {}
146
+ // 刷新桌面图标(仅非首次才做)
147
+ try { execSync('myclaw bat', { stdio: 'pipe', timeout: 10000 }); } catch {}
134
148
 
135
- console.log('');
136
- console.log(BAR);
137
- if (gatewayRunning) {
149
+ console.log('');
150
+ console.log(BAR);
138
151
  console.log(' OpenClaw 正在运行,浏览器已打开。');
139
- } else {
140
- console.log(' Gateway 正在新窗口中启动...');
152
+ console.log(BAR);
141
153
  }
142
- console.log(BAR);
143
154
  }
144
155
 
145
156
  // ============================================================================