@aiyiran/myclaw 1.0.131 → 1.0.133

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/launch.js CHANGED
@@ -53,6 +53,17 @@ function stepUpdate() {
53
53
  ).trim();
54
54
  execSync('npm install -g ' + tarball, { stdio: 'pipe', timeout: 60000 });
55
55
  console.log(' ' + C.g + '[OK]' + C.nc + ' 已升级到 v' + latestVersion);
56
+
57
+ // 磁盘上的代码已更新,但当前进程内存中仍为旧版
58
+ // 需要用新版代码重新执行 launch 流程
59
+ if (!process.env.MYCLAW_RELAUNCHED) {
60
+ console.log(' 重新加载新版代码...');
61
+ process.env.MYCLAW_RELAUNCHED = '1';
62
+ try {
63
+ execSync('myclaw launch', { stdio: 'inherit' });
64
+ } catch {}
65
+ process.exit(0);
66
+ }
56
67
  }
57
68
  } catch (err) {
58
69
  console.log(' ' + C.y + '[跳过]' + C.nc + ' 更新失败 (非致命)');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aiyiran/myclaw",
3
- "version": "1.0.131",
3
+ "version": "1.0.133",
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-03T11:44:37.316Z",
3
+ "_generated": "2026-04-03T15:13:11.323Z",
4
4
  "agents": [
5
5
  {
6
6
  "id": "danci",
@@ -11,7 +11,7 @@
11
11
  {
12
12
  "id": "kakaxi",
13
13
  "workspace": "workspace-kakaxi",
14
- "strategy": "on",
14
+ "strategy": "delete",
15
15
  "description": "kakaxi"
16
16
  }
17
17
  ],
package/wsl2.js CHANGED
@@ -80,45 +80,66 @@ function launchElevatedPS(script) {
80
80
  }
81
81
 
82
82
  function makeAskLocalOrCDN(prompt, destVar, cdnUrl, desc, fileName) {
83
+ const callerDir = process.cwd().replace(/\\/g, '\\\\');
84
+ const cdnFilename = cdnUrl.split('/').pop();
83
85
  return `
84
- Write-Host ''
85
- Write-Host ' +---------------------------------------------+'
86
- Write-Host ' | ${desc} '
87
- Write-Host ' | '
88
- Write-Host ' | [1] 拖拽文件到此窗口 + 回车 '
89
- Write-Host ' | [2] 输入U盘盘符 (如 F) + 回车 -> 自动搜索 '
90
- Write-Host ' | [3] 直接回车 -> 从网络下载 '
91
- Write-Host ' +---------------------------------------------+'
92
- Write-Host ''
93
- $userInput = Read-Host ' 请输入路径/盘符/回车'
94
- $userInput = $userInput.Trim().Trim('"')
95
- $resolved = ''
96
-
97
- if ($userInput) {
98
- if ($userInput -match '^[a-zA-Z]$') {
99
- $drive = $userInput.ToUpper()
100
- $drivePath = $drive + ':'
101
- Write-Host " 正在搜索 $drivePath 中的 ${fileName}..."
102
- $found = Get-ChildItem -Path $drivePath -Filter '${fileName}' -Recurse -ErrorAction SilentlyContinue | Select-Object -First 1
103
- if ($found) {
104
- Write-Host " 找到: $($found.FullName)"
105
- $resolved = $found.FullName
106
- } else {
107
- Write-Host " 未在 $drivePath 中找到 ${fileName}"
108
- }
109
- } elseif (Test-Path $userInput -PathType Leaf) {
110
- $resolved = $userInput
111
- } elseif (Test-Path $userInput -PathType Container) {
112
- Write-Host " 正在搜索 $userInput 中的 ${fileName}..."
113
- $found = Get-ChildItem -Path $userInput -Filter '${fileName}' -Recurse -ErrorAction SilentlyContinue | Select-Object -First 1
114
- if ($found) {
115
- Write-Host " 找到: $($found.FullName)"
116
- $resolved = $found.FullName
86
+ $callerDir = "${callerDir}"
87
+
88
+ $autoLocal1 = Join-Path $callerDir "${cdnFilename}"
89
+ $autoLocal2 = Join-Path $callerDir "${fileName}"
90
+
91
+ $autoFound = ""
92
+
93
+ if (Test-Path $autoLocal1 -PathType Leaf) {
94
+ $autoFound = $autoLocal1
95
+ } elseif (Test-Path $autoLocal2 -PathType Leaf) {
96
+ $autoFound = $autoLocal2
97
+ }
98
+
99
+ if ($autoFound) {
100
+ Write-Host ""
101
+ Write-Host " [自动检测] 发现本地文件并跳过询问: $autoFound"
102
+ $resolved = $autoFound
103
+ } else {
104
+ Write-Host ''
105
+ Write-Host ' +---------------------------------------------+'
106
+ Write-Host ' | ${desc} '
107
+ Write-Host ' | '
108
+ Write-Host ' | [1] 拖拽文件到此窗口 + 回车 '
109
+ Write-Host ' | [2] 输入U盘盘符 (如 F) + 回车 -> 自动搜索 '
110
+ Write-Host ' | [3] 直接回车 -> 从网络下载 '
111
+ Write-Host ' +---------------------------------------------+'
112
+ Write-Host ''
113
+ $userInput = Read-Host ' 请输入路径/盘符/回车'
114
+ $userInput = $userInput.Trim().Trim('"')
115
+ $resolved = ''
116
+
117
+ if ($userInput) {
118
+ if ($userInput -match '^[a-zA-Z]$') {
119
+ $drive = $userInput.ToUpper()
120
+ $drivePath = $drive + ':'
121
+ Write-Host " 正在搜索 $drivePath 中的 ${fileName}..."
122
+ $found = Get-ChildItem -Path $drivePath -Filter '${fileName}' -Recurse -ErrorAction SilentlyContinue | Select-Object -First 1
123
+ if ($found) {
124
+ Write-Host " 找到: $($found.FullName)"
125
+ $resolved = $found.FullName
126
+ } else {
127
+ Write-Host " 未在 $drivePath 中找到 ${fileName}"
128
+ }
129
+ } elseif (Test-Path $userInput -PathType Leaf) {
130
+ $resolved = $userInput
131
+ } elseif (Test-Path $userInput -PathType Container) {
132
+ Write-Host " 正在搜索 $userInput 中的 ${fileName}..."
133
+ $found = Get-ChildItem -Path $userInput -Filter '${fileName}' -Recurse -ErrorAction SilentlyContinue | Select-Object -First 1
134
+ if ($found) {
135
+ Write-Host " 找到: $($found.FullName)"
136
+ $resolved = $found.FullName
137
+ } else {
138
+ Write-Host " 未在该目录中找到 ${fileName}"
139
+ }
117
140
  } else {
118
- Write-Host " 未在该目录中找到 ${fileName}"
141
+ Write-Host " [警告] 路径不存在: $userInput"
119
142
  }
120
- } else {
121
- Write-Host " [警告] 路径不存在: $userInput"
122
143
  }
123
144
  }
124
145
 
@@ -341,7 +362,7 @@ Write-Host ''
341
362
 
342
363
  Write-Host '[3/4] 导入 Linux 环境 (可能需要几分钟)...'
343
364
  Write-Host ' 清理旧版本...'
344
- try { wsl --unregister $distroName 2>$null } catch {}
365
+ try { wsl --unregister $distroName 2>&1 | Out-Null } catch {}
345
366
  Write-Host ' [OK]'
346
367
 
347
368
  try {