@aiyiran/myclaw 1.1.192 → 1.1.193

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.
Files changed (55) hide show
  1. package/assets/myclaw-artifacts.js +1 -1
  2. package/delete_agents.js +1 -3
  3. package/gateway.js +4 -20
  4. package/index.js +2 -10
  5. package/injects/inject-minimax.js +22 -2
  6. package/package.json +1 -1
  7. package/patches/patch.js +7 -15
  8. package/server/sync_workspace.py +1 -8
  9. package//345/234/260/344/270/213/345/237/216/345/244/247/345/206/222/351/231/251/1.html +1756 -0
  10. package//345/234/260/344/270/213/345/237/216/345/244/247/345/206/222/351/231/251/__demo__.html +1756 -0
  11. package//345/234/260/344/270/213/345/237/216/345/244/247/345/206/222/351/231/251/__student-view__.html +77 -0
  12. package//345/234/260/344/270/213/345/237/216/345/244/247/345/206/222/351/231/251/__student__.json +60 -0
  13. package//345/234/260/344/270/213/345/237/216/345/244/247/345/206/222/351/231/251/__teacher-view__.html +52 -0
  14. package//345/234/260/344/270/213/345/237/216/345/244/247/345/206/222/351/231/251/__teacher__.json +45 -0
  15. package//345/234/260/344/270/213/345/237/216/345/244/247/345/206/222/351/231/251/index.html +150 -0
  16. package//346/210/221/347/232/204/345/217/254/345/224/244/345/233/276/351/211/264/357/274/232/346/215/242/344/270/273/351/242/230/346/215/242/345/215/241/346/261/240/__demo__.html +1531 -0
  17. package//346/210/221/347/232/204/345/217/254/345/224/244/345/233/276/351/211/264/357/274/232/346/215/242/344/270/273/351/242/230/346/215/242/345/215/241/346/261/240/__student-view__.html +77 -0
  18. package//346/210/221/347/232/204/345/217/254/345/224/244/345/233/276/351/211/264/357/274/232/346/215/242/344/270/273/351/242/230/346/215/242/345/215/241/346/261/240/__student__.json +60 -0
  19. package//346/210/221/347/232/204/345/217/254/345/224/244/345/233/276/351/211/264/357/274/232/346/215/242/344/270/273/351/242/230/346/215/242/345/215/241/346/261/240/__teacher-view__.html +52 -0
  20. package//346/210/221/347/232/204/345/217/254/345/224/244/345/233/276/351/211/264/357/274/232/346/215/242/344/270/273/351/242/230/346/215/242/345/215/241/346/261/240/__teacher__.json +45 -0
  21. package//346/210/221/347/232/204/345/217/254/345/224/244/345/233/276/351/211/264/357/274/232/346/215/242/344/270/273/351/242/230/346/215/242/345/215/241/346/261/240/index.html +150 -0
  22. package//347/264/257/345/220/220/350/241/200/345/220/216/347/232/204/346/200/273/347/273/223.md +196 -0
  23. package//350/223/235/346/230/237/345/276/256/344/277/241/347/237/255/350/247/206/351/242/221/345/210/206/346/236/220/1.jpg +0 -0
  24. package//350/223/235/346/230/237/345/276/256/344/277/241/347/237/255/350/247/206/351/242/221/345/210/206/346/236/220/2.jpg +0 -0
  25. package//350/223/235/346/230/237/345/276/256/344/277/241/347/237/255/350/247/206/351/242/221/345/210/206/346/236/220/3.jpg +0 -0
  26. package//350/223/235/346/230/237/345/276/256/344/277/241/347/237/255/350/247/206/351/242/221/345/210/206/346/236/220/4.jpg +0 -0
  27. package//350/223/235/346/230/237/345/276/256/344/277/241/347/237/255/350/247/206/351/242/221/345/210/206/346/236/220/AI/344/270/215/347/224/250/347/234/213/347/232/204/345/216/237/345/247/213/346/217/220/347/244/272/350/257/215/344/272/272/347/261/273/347/234/213/__/351/200/211/351/242/230/345/274/225/346/223/216__.html +589 -0
  28. package//350/223/235/346/230/237/345/276/256/344/277/241/347/237/255/350/247/206/351/242/221/345/210/206/346/236/220/AI/344/270/215/347/224/250/347/234/213/347/232/204/345/216/237/345/247/213/346/217/220/347/244/272/350/257/215/344/272/272/347/261/273/347/234/213//345/216/237/345/247/213/346/217/220/347/244/272/350/257/215.md +125 -0
  29. package//350/223/235/346/230/237/345/276/256/344/277/241/347/237/255/350/247/206/351/242/221/345/210/206/346/236/220/AI/344/270/215/347/224/250/347/234/213/347/232/204/345/216/237/345/247/213/346/217/220/347/244/272/350/257/215/344/272/272/347/261/273/347/234/213//350/200/201/350/202/226/347/210/206/346/254/276/351/200/211/351/242/230/345/274/225/346/223/216.md +179 -0
  30. package//350/223/235/346/230/237/345/276/256/344/277/241/347/237/255/350/247/206/351/242/221/345/210/206/346/236/220/AI/344/270/215/347/224/250/347/234/213/347/232/204/345/216/237/345/247/213/346/217/220/347/244/272/350/257/215/344/272/272/347/261/273/347/234/213//350/200/201/350/202/226/351/207/221/345/217/245/345/272/223v1.md +594 -0
  31. package//350/223/235/346/230/237/345/276/256/344/277/241/347/237/255/350/247/206/351/242/221/345/210/206/346/236/220/__demo__.html +588 -0
  32. package//350/223/235/346/230/237/345/276/256/344/277/241/347/237/255/350/247/206/351/242/221/345/210/206/346/236/220/__student-view__.html +77 -0
  33. package//350/223/235/346/230/237/345/276/256/344/277/241/347/237/255/350/247/206/351/242/221/345/210/206/346/236/220/__student__.json +54 -0
  34. package//350/223/235/346/230/237/345/276/256/344/277/241/347/237/255/350/247/206/351/242/221/345/210/206/346/236/220/__teacher-view__.html +52 -0
  35. package//350/223/235/346/230/237/345/276/256/344/277/241/347/237/255/350/247/206/351/242/221/345/210/206/346/236/220/__teacher__.json +46 -0
  36. package//350/223/235/346/230/237/345/276/256/344/277/241/347/237/255/350/247/206/351/242/221/345/210/206/346/236/220/index.html +148 -0
  37. package//350/223/235/346/230/237/345/276/256/344/277/241/347/237/255/350/247/206/351/242/221/345/210/206/346/236/220//344/270/211/344/270/252/350/247/206/351/242/221/345/216/237/345/247/213/345/206/205/345/256/271/1-/344/273/200/344/271/210/346/230/257/344/274/230/347/247/200/347/232/204/345/255/251/345/255/220+/350/223/235/346/230/237/344/277/261/344/271/220/351/203/250/345/210/233/345/212/236+/347/210/266/346/257/215/345/244/251/350/201/214/357/274/210/351/200/220/345/255/227/347/250/277/357/274/211.md +48 -0
  38. package//350/223/235/346/230/237/345/276/256/344/277/241/347/237/255/350/247/206/351/242/221/345/210/206/346/236/220//344/270/211/344/270/252/350/247/206/351/242/221/345/216/237/345/247/213/345/206/205/345/256/271/2-/350/277/207/347/250/213/345/206/231/344/275/234/350/257/276/347/250/213/345/210/206/344/272/253/357/274/210/351/200/220/345/255/227/347/250/277/357/274/211.md +27 -0
  39. package//350/223/235/346/230/237/345/276/256/344/277/241/347/237/255/350/247/206/351/242/221/345/210/206/346/236/220//344/270/211/344/270/252/350/247/206/351/242/221/345/216/237/345/247/213/345/206/205/345/256/271/3-/350/202/262/345/204/277/345/273/272/350/256/256/357/274/232/345/242/236/351/207/217/344/277/241/346/201/257+/346/214/207/345/274/225vs/345/216/237/345/210/231+/345/210/206/344/272/253/347/224/237/346/264/273/347/273/206/350/212/202/357/274/210/351/200/220/345/255/227/347/250/277/357/274/211.md +204 -0
  40. package//350/223/235/346/230/237/345/276/256/344/277/241/347/237/255/350/247/206/351/242/221/345/210/206/346/236/220//344/270/211/344/270/252/350/247/206/351/242/221/345/216/237/345/247/213/345/206/205/345/256/271//346/213/206/345/210/206/345/211/215/345/275/225/351/237/263/346/226/207/346/234/254.md +267 -0
  41. package//350/223/235/346/230/237/345/276/256/344/277/241/347/237/255/350/247/206/351/242/221/345/210/206/346/236/220//350/264/242/345/212/241/345/210/206/346/236/220.html +411 -0
  42. package//350/264/246/345/215/225/345/210/206/346/236/220/345/212/251/346/211/213/__demo__.html +411 -0
  43. package//350/264/246/345/215/225/345/210/206/346/236/220/345/212/251/346/211/213/__student-view__.html +77 -0
  44. package//350/264/246/345/215/225/345/210/206/346/236/220/345/212/251/346/211/213/__student__.json +54 -0
  45. package//350/264/246/345/215/225/345/210/206/346/236/220/345/212/251/346/211/213/__teacher-view__.html +52 -0
  46. package//350/264/246/345/215/225/345/210/206/346/236/220/345/212/251/346/211/213/__teacher__.json +50 -0
  47. package//350/264/246/345/215/225/345/210/206/346/236/220/345/212/251/346/211/213/index.html +148 -0
  48. package//351/200/203/345/207/272/350/277/267/345/256/253/357/274/232/346/210/221/346/235/245/345/256/232/350/247/204/345/210/231/__demo__.html +842 -0
  49. package//351/200/203/345/207/272/350/277/267/345/256/253/357/274/232/346/210/221/346/235/245/345/256/232/350/247/204/345/210/231/__student-view__.html +77 -0
  50. package//351/200/203/345/207/272/350/277/267/345/256/253/357/274/232/346/210/221/346/235/245/345/256/232/350/247/204/345/210/231/__student__.json +60 -0
  51. package//351/200/203/345/207/272/350/277/267/345/256/253/357/274/232/346/210/221/346/235/245/345/256/232/350/247/204/345/210/231/__teacher-view__.html +52 -0
  52. package//351/200/203/345/207/272/350/277/267/345/256/253/357/274/232/346/210/221/346/235/245/345/256/232/350/247/204/345/210/231/__teacher__.json +45 -0
  53. package//351/200/203/345/207/272/350/277/267/345/256/253/357/274/232/346/210/221/346/235/245/345/256/232/350/247/204/345/210/231/index.html +150 -0
  54. package/fix-longxia.js +0 -133
  55. package/scripts/inject_polyfill.sh +0 -33
@@ -759,7 +759,7 @@
759
759
  var assetExt = (asset.path || '').split('.').pop().toLowerCase();
760
760
  var isCSV = assetExt === 'csv';
761
761
  var isPDF = assetExt === 'pdf';
762
- var CODE_EXTS = ['ts', 'tsx', 'py', 'sh', 'bash', 'go', 'java', 'c', 'cpp', 'h', 'rs', 'rb', 'php', 'swift', 'kt', 'vue'];
762
+ var CODE_EXTS = ['ts', 'tsx', 'py', 'sh', 'bash', 'go', 'java', 'c', 'cpp', 'h', 'rs', 'rb', 'php', 'swift', 'kt', 'vue', 'log'];
763
763
  var isCode = CODE_EXTS.indexOf(assetExt) !== -1;
764
764
  var OFFICE_EXTS = ['ppt', 'pptx', 'doc', 'docx', 'xls', 'xlsx'];
765
765
  var isOffice = OFFICE_EXTS.indexOf(assetExt) !== -1;
package/delete_agents.js CHANGED
@@ -27,9 +27,7 @@ const { spawnSync, execSync } = require('child_process');
27
27
  // ─────────────────────────────────────────────
28
28
 
29
29
  function getOpenclawDir() {
30
- // Windows 上 '/' 会被解释成当前盘符根目录(如 E:\root\.openclaw),
31
- // 不是真正的文件系统根,因此 /root/.openclaw 判断只在非 Windows 上有意义。
32
- if (process.platform !== 'win32' && fs.existsSync('/root/.openclaw')) {
30
+ if (process.platform === 'win32' || fs.existsSync('/root/.openclaw')) {
33
31
  return '/root/.openclaw';
34
32
  }
35
33
  return path.join(os.homedir(), '.openclaw');
package/gateway.js CHANGED
@@ -16,13 +16,6 @@ const { execSync } = require('child_process');
16
16
  const PORT = 18789;
17
17
  const isWin = process.platform === 'win32';
18
18
 
19
- // 跨平台同步等待:用 Atomics.wait 阻塞当前线程,不 spawn 子进程、不碰 shell。
20
- // 早期用 `timeout /t N /nobreak >nul`,但 Windows 的 timeout.exe 要求 stdin 是真正的
21
- // 控制台句柄,被 Node 的 execSync 调用(stdin 非控制台)时必定报错退出,反而会误伤调用方。
22
- function sleepSync(seconds) {
23
- Atomics.wait(new Int32Array(new SharedArrayBuffer(4)), 0, 0, Math.round(seconds * 1000));
24
- }
25
-
26
19
  // ANSI 颜色
27
20
  const colors = {
28
21
  green: '\x1b[32m',
@@ -45,7 +38,7 @@ function stop() {
45
38
  }
46
39
 
47
40
  // 等 2 秒让优雅关闭执行
48
- sleepSync(2);
41
+ execSync(isWin ? 'timeout /t 2 /nobreak >nul' : 'sleep 2', { stdio: 'ignore' });
49
42
 
50
43
  // Step 2: 检查残留进程并强杀
51
44
  console.log('[停止] Step 2 — 清理残留进程...');
@@ -108,9 +101,6 @@ function stop() {
108
101
  let portFree = false;
109
102
 
110
103
  for (let i = 0; i < MAX_WAIT; i++) {
111
- // 端口探测:命令成功(exit 0)=端口仍被监听;命令抛错(非零/无匹配)=端口已释放。
112
- // 注意:sleep 必须放在 try/catch 之外,否则等待命令一旦失败会被误判成“端口已释放”。
113
- let stillListening = false;
114
104
  try {
115
105
  if (isWin) {
116
106
  execSync('netstat -ano | findstr :' + PORT + ' | findstr LISTENING', {
@@ -119,18 +109,12 @@ function stop() {
119
109
  } else {
120
110
  execSync('lsof -i :' + PORT + ' -t 2>/dev/null', { stdio: 'pipe', timeout: 2000 });
121
111
  }
122
- stillListening = true;
112
+ process.stdout.write('[等待] 端口 ' + PORT + ' 释放中... (' + (i + 1) + '/' + MAX_WAIT + 's)\r');
113
+ execSync(isWin ? 'timeout /t 1 /nobreak >nul' : 'sleep 1', { stdio: 'ignore' });
123
114
  } catch {
124
- // 未查到监听 = 端口已释放
125
- }
126
-
127
- if (!stillListening) {
128
115
  portFree = true;
129
116
  break;
130
117
  }
131
-
132
- process.stdout.write('[等待] 端口 ' + PORT + ' 释放中... (' + (i + 1) + '/' + MAX_WAIT + 's)\r');
133
- sleepSync(1);
134
118
  }
135
119
 
136
120
  if (portFree) {
@@ -159,7 +143,7 @@ function start() {
159
143
  }
160
144
 
161
145
  // 等待启动完成
162
- sleepSync(3);
146
+ execSync(isWin ? 'timeout /t 3 /nobreak >nul' : 'sleep 3', { stdio: 'ignore' });
163
147
 
164
148
  // 注册 LaunchAgent(仅 macOS,Docker/Linux 无 systemd 跳过)
165
149
  if (process.platform === 'darwin') {
package/index.js CHANGED
@@ -462,11 +462,6 @@ function runFix() {
462
462
  fix.run();
463
463
  }
464
464
 
465
- function runFixLongxia() {
466
- const fixLongxia = require('./fix-longxia');
467
- fixLongxia.run();
468
- }
469
-
470
465
  // ============================================================================
471
466
  // WSL2 安装 (独立模块)
472
467
  // ============================================================================
@@ -1429,8 +1424,8 @@ function runUpdate() {
1429
1424
  if (attempt < maxRetries) {
1430
1425
  console.log('');
1431
1426
  console.log('[' + colors.yellow + '重试' + colors.nc + '] 8 秒后重试 (' + attempt + '/' + maxRetries + ')...');
1432
- // Atomics.wait 同步阻塞 8 秒,跨平台且不依赖 timeout.exe(后者被 execSync 调用时会立即报错)
1433
- Atomics.wait(new Int32Array(new SharedArrayBuffer(4)), 0, 0, 8000);
1427
+ const waitCmd = require('os').platform() === 'win32' ? 'timeout /t 8 >nul' : 'sleep 8';
1428
+ try { execSync(waitCmd, { stdio: 'ignore' }); } catch { }
1434
1429
  } else {
1435
1430
  console.log('');
1436
1431
  console.log('[' + colors.red + '错误' + colors.nc + '] 升级失败: ' + err.message);
@@ -2594,7 +2589,6 @@ function showHelp() {
2594
2589
  console.log(' list-agents 列出所有 Agent(--json 输出机器可读)');
2595
2590
  console.log(' trash-paths <p1> <p2> 将路径移入回收站(跨平台)');
2596
2591
  console.log(' fix 兜底修复(自动补装 WSL + Chrome,仅限 Windows)');
2597
- console.log(' fix-longxia 🦞 修复小龙虾(注入 ES2023 Array Polyfill 到首页)');
2598
2592
  console.log(' wsl2 WSL2 一键安装/修复 (仅限 Windows, 可选: --cli, --remote)');
2599
2593
  console.log(' safe 开启虚拟机屏蔽 (禁止自动挂载 Windows 盘符)');
2600
2594
  console.log(' bat 在桌面生成一键启动脚本 (仅限 Windows)');
@@ -2719,8 +2713,6 @@ if (!command) {
2719
2713
  runTrashPaths();
2720
2714
  } else if (command === 'fix') {
2721
2715
  runFix();
2722
- } else if (command === 'fix-longxia' || command === '修复小龙虾') {
2723
- runFixLongxia();
2724
2716
  } else if (command === 'wsl2') {
2725
2717
  runWsl2();
2726
2718
  } else if (command === 'safe') {
@@ -30,7 +30,7 @@ const PROVIDER_ID = "minimax";
30
30
  const DEFAULT_MODEL = "minimax/MiniMax-M2.7-highspeed";
31
31
 
32
32
  // ── zai (智谱 GLM) 配置:仅 --beta 模式下附带注入 ──
33
- const DEFAULT_ZAI_KEY = "a7ae7806dea8406bb85eea5d859c00ad.pVnBuagTz6942JHp";
33
+ const DEFAULT_ZAI_KEY = "d353aa76b4ac415b89feb867de6ea870.blKBNpJW0L8dyrH6";
34
34
  const ZAI_BETA_MODELS = [
35
35
  {
36
36
  id: "glm-5.2",
@@ -49,6 +49,24 @@ const ZAI_BETA_MODELS = [
49
49
  cost: { input: 1.2, output: 4, cacheRead: 0.24, cacheWrite: 0 },
50
50
  contextWindow: 202800,
51
51
  maxTokens: 131100
52
+ },
53
+ {
54
+ id: "glm-5",
55
+ name: "GLM-5",
56
+ reasoning: true,
57
+ input: ["text"],
58
+ cost: { input: 1.2, output: 4, cacheRead: 0.24, cacheWrite: 0 },
59
+ contextWindow: 202800,
60
+ maxTokens: 131100
61
+ },
62
+ {
63
+ id: "glm-4.7",
64
+ name: "GLM-4.7",
65
+ reasoning: true,
66
+ input: ["text"],
67
+ cost: { input: 1.2, output: 4, cacheRead: 0.24, cacheWrite: 0 },
68
+ contextWindow: 202800,
69
+ maxTokens: 131100
52
70
  }
53
71
  ];
54
72
 
@@ -188,6 +206,8 @@ function run(cliArgs) {
188
206
  };
189
207
  config.agents.defaults.models["zai/glm-5.2"] = {};
190
208
  config.agents.defaults.models["zai/glm-5-turbo"] = {};
209
+ config.agents.defaults.models["zai/glm-5"] = {};
210
+ config.agents.defaults.models["zai/glm-4.7"] = {};
191
211
  }
192
212
 
193
213
  // ── Step 3:--default 设默认模型 ──
@@ -346,7 +366,7 @@ CREATE TABLE IF NOT EXISTS auth_profile_state (
346
366
  console.log('');
347
367
  console.log('✅ MiniMax 注入完成');
348
368
  console.log(' 默认模型: ' + (setDefault ? DEFAULT_MODEL : '(未修改)'));
349
- console.log(' 备选模型: minimax/MiniMax-M2.7-highspeed' + (betaMode ? ' + zai/glm-5.2 + zai/glm-5-turbo' : ''));
369
+ console.log(' 备选模型: minimax/MiniMax-M2.7-highspeed' + (betaMode ? ' + zai/glm-5.2 + zai/glm-5-turbo + zai/glm-5 + zai/glm-4.7' : ''));
350
370
  console.log(' Agent: ' + okCount + ' 个写入,' + skipCount + ' 个跳过');
351
371
  if (betaMode) console.log(' 其他 provider 已清除 (保留 minimax + zai)');
352
372
  else if (onlyMode) console.log(' 其他 provider 已清除');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aiyiran/myclaw",
3
- "version": "1.1.192",
3
+ "version": "1.1.193",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "bin": {
package/patches/patch.js CHANGED
@@ -38,14 +38,6 @@ const BACKUP_SUFFIX = '.myclaw-backup';
38
38
  function findControlUiDir() {
39
39
  const candidates = [];
40
40
 
41
- const isWin = process.platform === 'win32';
42
- // 用 stdio 抑制 stderr,避免在 Windows cmd 上写 `2>/dev/null`
43
- // (cmd 会把 /dev/null 当成路径 \dev\null,重定向失败并中断命令执行)
44
- const runQuiet = (cmd) => {
45
- const { execSync } = require('child_process');
46
- return execSync(cmd, { encoding: 'utf8', stdio: ['pipe', 'pipe', 'ignore'] }).trim();
47
- };
48
-
49
41
  // 1. 通过 require.resolve 查找
50
42
  const globalPaths = [
51
43
  '/usr/lib/node_modules',
@@ -54,10 +46,9 @@ function findControlUiDir() {
54
46
 
55
47
  // 加上当前 npm prefix
56
48
  try {
57
- const prefix = runQuiet('npm config get prefix');
49
+ const { execSync } = require('child_process');
50
+ const prefix = execSync('npm config get prefix 2>/dev/null', { encoding: 'utf8' }).trim();
58
51
  if (prefix) {
59
- // Windows: 全局包在 <prefix>\node_modules;Unix: 在 <prefix>/lib/node_modules
60
- globalPaths.push(path.join(prefix, 'node_modules'));
61
52
  globalPaths.push(path.join(prefix, 'lib', 'node_modules'));
62
53
  }
63
54
  } catch {}
@@ -71,7 +62,8 @@ function findControlUiDir() {
71
62
  }
72
63
  // 也尝试通过命令动态获取(如果 pnpm 在 PATH 里)
73
64
  try {
74
- const pnpmRoot = runQuiet('pnpm root -g');
65
+ const { execSync } = require('child_process');
66
+ const pnpmRoot = execSync('pnpm root -g 2>/dev/null', { encoding: 'utf8' }).trim();
75
67
  if (pnpmRoot) globalPaths.push(pnpmRoot);
76
68
  } catch {}
77
69
 
@@ -79,10 +71,10 @@ function findControlUiDir() {
79
71
  candidates.push(path.join(globalPath, 'openclaw', 'dist', 'control-ui'));
80
72
  }
81
73
 
82
- // 2. 通过 which/where openclaw 推断
74
+ // 2. 通过 which openclaw 推断
83
75
  try {
84
- // Windows 没有 which,用 where;可能返回多行(.ps1/.cmd),取第一行
85
- const bin = runQuiet(isWin ? 'where openclaw' : 'which openclaw').split(/\r?\n/)[0].trim();
76
+ const { execSync } = require('child_process');
77
+ const bin = execSync('which openclaw 2>/dev/null', { encoding: 'utf8' }).trim();
86
78
  if (bin) {
87
79
  const real = fs.realpathSync(bin);
88
80
  // openclaw.mjs → 包根目录
@@ -15,11 +15,6 @@ from http.server import HTTPServer, BaseHTTPRequestHandler
15
15
  from urllib.parse import urlparse, parse_qs, unquote
16
16
  from qiniu import Auth, put_file_v2, put_data, CdnManager, BucketManager
17
17
 
18
- # Windows 控制台默认用 GBK,print emoji(如 ✅)会抛 UnicodeEncodeError,强制标准流走 UTF-8
19
- if hasattr(sys.stdout, 'reconfigure'):
20
- sys.stdout.reconfigure(encoding='utf-8')
21
- sys.stderr.reconfigure(encoding='utf-8')
22
-
23
18
  # 确保同目录的共享模块可导入
24
19
  sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
25
20
  from artifacts_schema import ARTIFACTS_FILENAME, create_empty_artifacts, now_iso as _now_iso
@@ -27,9 +22,7 @@ import debug_record
27
22
 
28
23
  # 跨平台获取 openclaw 目录
29
24
  def get_openclaw_path():
30
- # Windows 上 '/' 会被解释成当前盘符根目录(如 E:\root\.openclaw),
31
- # 不是真正的文件系统根,因此 /root/.openclaw 判断只在非 Windows 上有意义。
32
- if platform.system() != 'Windows' and os.path.exists('/root/.openclaw'):
25
+ if platform.system() == 'Windows' or os.path.exists('/root/.openclaw'):
33
26
  return '/root/.openclaw'
34
27
  return os.path.expanduser('~/.openclaw')
35
28