@aiyiran/myclaw 1.0.173 → 1.0.174

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/create_agent.js CHANGED
@@ -94,22 +94,35 @@ function buildBirthMessage() {
94
94
 
95
95
  /**
96
96
  * 从当前 workspace 模板目录复制默认文件,替换 agentId
97
+ * SOUL.md 使用 inject-workspaceAndSoul.js 中的学习伙伴模板
97
98
  */
98
99
  function defaultWorkspaceFiles(agentId) {
99
100
  const templateDir = path.resolve(__dirname, '..');
100
- const templateFiles = ['AGENTS.md', 'SOUL.md', 'USER.md', 'IDENTITY.md', 'HEARTBEAT.md', 'BOOTSTRAP.md'];
101
+ const templateFiles = ['AGENTS.md', 'USER.md', 'IDENTITY.md', 'HEARTBEAT.md', 'BOOTSTRAP.md'];
101
102
  const files = {};
102
103
 
104
+ // 从根 workspace 复制其他文件
103
105
  for (const fn of templateFiles) {
104
106
  const src = path.join(templateDir, fn);
105
107
  if (fs.existsSync(src)) {
106
108
  let content = fs.readFileSync(src, 'utf8');
107
- // 把模板中的 yiranclaw(或当前 workspace 名)替换为新 agentId
108
109
  content = content.replace(/yiranclaw/g, agentId);
109
110
  files[fn] = content;
110
111
  }
111
112
  }
112
113
 
114
+ // SOUL.md 使用学生学习伙伴模板
115
+ const soulModule = require('./inject-workspaceAndSoul');
116
+ // 直接读取模块里的 SOUL_CONTENT(不依赖导出,直接读源文件更可靠)
117
+ const soulSrc = path.join(__dirname, 'inject-workspaceAndSoul.js');
118
+ if (fs.existsSync(soulSrc)) {
119
+ const raw = fs.readFileSync(soulSrc, 'utf8');
120
+ const match = raw.match(/const SOUL_CONTENT = `([\s\S]*?)`;/);
121
+ if (match) {
122
+ files['SOUL.md'] = match[1];
123
+ }
124
+ }
125
+
113
126
  return files;
114
127
  }
115
128
 
package/index.js CHANGED
@@ -1042,7 +1042,8 @@ const MENU_ITEMS = [
1042
1042
  { key: 'patch', label: '修复', cmd: 'mc patch', desc: '给 AI 助手装上新技能和好看的外衣', action: runPatch },
1043
1043
  { key: 'reinstall', label: '重装', cmd: 'mc longxia', desc: '出了大问题?把 AI 助手删了重新安装', action: runReinstall },
1044
1044
  { key: 'uninstall', label: '卸载', cmd: 'mc uninstall', desc: '卸载 MyClaw,恢复 npm 源地址', action: runUninstall },
1045
- { key: 'wsl2reinstall', label: 'WSL2虚拟机重装', cmd: 'mc wsl2 --remote', desc: '强制从网络重新下载并重装 WSL2 虚拟机(仅限 Windows)', action: () => {
1045
+ { key: 'wsl2reinstall', label: 'WSL2虚拟机重装', cmd: 'mc wsl2 --remote --force-phase1', desc: '强制从网络重新下载并重装 WSL2 虚拟机(仅限 Windows)', action: () => {
1046
+ process.argv.push('--remote', '--force-phase1');
1046
1047
  const wsl2 = require('./wsl2');
1047
1048
  wsl2.run();
1048
1049
  }},
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aiyiran/myclaw",
3
- "version": "1.0.173",
3
+ "version": "1.0.174",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "bin": {
package/restrict.js CHANGED
@@ -111,7 +111,7 @@ function run() {
111
111
  if (existing.includes('[automount]')) {
112
112
  newContent = existing.replace(/\[automount\][^\[]*/, '[automount]\nenabled = false\n');
113
113
  } else {
114
- newContent = existing + (existing.endsWith('\n') ? '' : '\n') + '[automount]\nenabled = false\n';
114
+ newContent = existing + (existing.endsWith('\n') ? '' : '\n') + '[automount]\nenabled = false\n[interop]\nappendWindowsPath = false\n';
115
115
  }
116
116
 
117
117
  const script = [
package/start.js CHANGED
@@ -68,18 +68,10 @@ function startWindows() {
68
68
 
69
69
  // Step 2.5: 自动检测虚拟机屏蔽(safe)
70
70
  console.log('[safe] 虚拟机屏蔽...');
71
- try {
72
- const conf = execSync('wsl -d OpenClaw -u root -- cat /etc/wsl.conf 2>/dev/null', {
73
- encoding: 'utf8', stdio: ['pipe', 'pipe', 'pipe'],
74
- });
75
- if (conf.includes('enabled = false') || conf.includes('enabled=false')) {
76
- console.log(' ' + C.g + '[已开启]' + C.nc);
77
- } else {
78
- console.log(' ' + C.y + '[未开启,正在启用...]' + C.nc);
79
- try { execSync('myclaw safe', { stdio: 'inherit', timeout: 30000 }); } catch {}
80
- }
81
- } catch {
82
- // wsl.conf 不存在,说明还没开启
71
+ const restrict = require('./restrict');
72
+ if (restrict.isAlreadySafe()) {
73
+ console.log(' ' + C.g + '[已开启]' + C.nc);
74
+ } else {
83
75
  console.log(' ' + C.y + '[未开启,正在启用...]' + C.nc);
84
76
  try { execSync('myclaw safe', { stdio: 'inherit', timeout: 30000 }); } catch {}
85
77
  }