@aiyiran/myclaw 1.0.94 → 1.0.96

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/build-manifest.js CHANGED
@@ -21,11 +21,12 @@ const SKILLS_DIR = path.join(__dirname, 'skills');
21
21
 
22
22
  // 默认 config patches(硬编码,不从目录扫描)
23
23
  const DEFAULT_CONFIG = {
24
- strategy: 'overwrite',
24
+ strategy: 'on',
25
25
  patches: {
26
26
  'session.reset.mode': 'idle',
27
27
  'session.reset.idleMinutes': 90720,
28
28
  'tools.exec.ask': 'off',
29
+ 'gateway.auth.token': 'aiyiran',
29
30
  },
30
31
  };
31
32
 
@@ -90,7 +91,7 @@ function buildManifest() {
90
91
  const config = existing.config || DEFAULT_CONFIG;
91
92
 
92
93
  const manifest = {
93
- _doc: 'MyClaw 注入清单 (auto-generated)。strategy: auto | overwrite | off',
94
+ _doc: 'MyClaw 注入清单 (auto-generated)。strategy: auto | on | off',
94
95
  _generated: new Date().toISOString(),
95
96
  agents,
96
97
  skills,
@@ -108,7 +109,7 @@ function buildManifest() {
108
109
  for (const s of skills) {
109
110
  console.log(' • ' + s.name + ' [' + s.strategy + ']');
110
111
  }
111
- console.log(' 配置: ' + Object.keys(config.patches || {}).length + ' 项 [' + (config.strategy || 'overwrite') + ']');
112
+ console.log(' 配置: ' + Object.keys(config.patches || {}).length + ' 项 [' + (config.strategy || 'on') + ']');
112
113
  }
113
114
 
114
115
  buildManifest();
package/index.js CHANGED
@@ -544,7 +544,7 @@ function runPatch() {
544
544
  const { loadManifest } = require('./patch-agent');
545
545
  const manifest = loadManifest();
546
546
  if (manifest && manifest.config && manifest.config.patches) {
547
- const configStrategy = manifest.config.strategy || 'overwrite';
547
+ const configStrategy = manifest.config.strategy || 'on';
548
548
  if (configStrategy !== 'off') {
549
549
  // 将 dot-notation patch 展开为嵌套对象
550
550
  const patches = manifest.config.patches;
@@ -729,50 +729,35 @@ function runUpdate() {
729
729
  // ============================================================================
730
730
 
731
731
  function runList() {
732
- const fs = require('fs');
733
- const path = require('path');
734
- const os = require('os');
735
732
  const { loadManifest } = require('./patch-agent');
736
733
  const bar = '----------------------------------------';
737
734
 
738
735
  console.log('');
739
- console.log('[' + colors.blue + 'MyClaw' + colors.nc + '] ' + colors.blue + '注入资源管理' + colors.nc);
736
+ console.log('[' + colors.blue + 'MyClaw' + colors.nc + '] ' + colors.blue + '注入资源列表 (Patch Manifest)' + colors.nc);
740
737
  console.log(bar);
741
738
 
742
739
  const manifest = loadManifest();
743
740
  if (!manifest) {
744
741
  console.log('');
745
742
  console.log('[' + colors.yellow + '提示' + colors.nc + '] patch-manifest.json 不存在');
746
- console.log(' 运行 ' + colors.yellow + 'myclaw patch' + colors.nc + ' 将自动生成');
743
+ console.log(' 运行发布脚本或 ' + colors.yellow + 'myclaw patch' + colors.nc + ' 将自动生成');
747
744
  console.log('');
748
745
  return;
749
746
  }
750
747
 
751
- const openclawDir = path.join(os.homedir(), '.openclaw');
752
- const configPath = path.join(openclawDir, 'openclaw.json');
753
- let registeredIds = new Set();
754
- try {
755
- const cfg = JSON.parse(fs.readFileSync(configPath, 'utf8'));
756
- if (cfg.agents && Array.isArray(cfg.agents.list)) {
757
- for (const a of cfg.agents.list) {
758
- if (a && a.id) registeredIds.add(a.id);
759
- }
760
- }
761
- } catch {}
748
+ function formatStrategy(strat) {
749
+ if (strat === 'auto') return colors.green + '[auto]' + colors.nc;
750
+ if (strat === 'on') return colors.yellow + '[on]' + colors.nc;
751
+ if (strat === 'off') return colors.red + '[off]' + colors.nc;
752
+ return '[' + strat + ']';
753
+ }
762
754
 
763
755
  // === Agents ===
764
756
  console.log('');
765
757
  console.log(' ' + colors.blue + '🤖 智能体 (Agents)' + colors.nc);
766
758
  if (manifest.agents && manifest.agents.length > 0) {
767
759
  for (const a of manifest.agents) {
768
- const wsPath = path.join(openclawDir, a.workspace || ('workspace-' + a.id));
769
- const wsExists = fs.existsSync(wsPath);
770
- const registered = registeredIds.has(a.id);
771
- const status = wsExists && registered ? colors.green + '✔ 已安装' + colors.nc
772
- : wsExists ? colors.yellow + '⚠ 文件存在未注册' + colors.nc
773
- : colors.red + '✗ 未安装' + colors.nc;
774
- const strat = a.strategy === 'off' ? colors.red + a.strategy + colors.nc : a.strategy;
775
- console.log(' ' + padRight(a.id, 20) + status + ' [' + strat + ']');
760
+ console.log(' ' + padRight(a.id, 25) + formatStrategy(a.strategy));
776
761
  }
777
762
  } else {
778
763
  console.log(' (无)');
@@ -782,12 +767,8 @@ function runList() {
782
767
  console.log('');
783
768
  console.log(' ' + colors.blue + '🧩 技能 (Skills)' + colors.nc);
784
769
  if (manifest.skills && manifest.skills.length > 0) {
785
- const skillsDir = path.join(openclawDir, 'skills');
786
770
  for (const s of manifest.skills) {
787
- const installed = fs.existsSync(path.join(skillsDir, s.name));
788
- const status = installed ? colors.green + '✔ 已安装' + colors.nc : colors.red + '✗ 未安装' + colors.nc;
789
- const strat = s.strategy === 'off' ? colors.red + s.strategy + colors.nc : s.strategy;
790
- console.log(' ' + padRight(s.name, 20) + status + ' [' + strat + ']');
771
+ console.log(' ' + padRight(s.name, 25) + formatStrategy(s.strategy));
791
772
  }
792
773
  } else {
793
774
  console.log(' (无)');
@@ -797,11 +778,10 @@ function runList() {
797
778
  console.log('');
798
779
  console.log(' ' + colors.blue + '⚙️ 配置 (Config Patches)' + colors.nc);
799
780
  if (manifest.config && manifest.config.patches) {
800
- const strat = manifest.config.strategy || 'overwrite';
801
- const stratDisplay = strat === 'off' ? colors.red + strat + colors.nc : strat;
802
- console.log(' 策略: [' + stratDisplay + ']');
781
+ const strat = manifest.config.strategy || 'on';
782
+ console.log(' 策略: ' + formatStrategy(strat));
803
783
  for (const [key, value] of Object.entries(manifest.config.patches)) {
804
- console.log(' ' + padRight(key, 30) + '→ ' + JSON.stringify(value));
784
+ console.log(' ' + padRight(key, 25) + '→ ' + JSON.stringify(value));
805
785
  }
806
786
  } else {
807
787
  console.log(' (无)');
@@ -810,8 +790,8 @@ function runList() {
810
790
  console.log('');
811
791
  console.log(bar);
812
792
  console.log('策略说明: ' + colors.green + 'auto' + colors.nc + '=不存在才注入 '
813
- + colors.yellow + 'overwrite' + colors.nc + '=覆盖 '
814
- + colors.red + 'off' + colors.nc + '=关闭');
793
+ + colors.yellow + 'on' + colors.nc + '=始终覆盖更新 '
794
+ + colors.red + 'off' + colors.nc + '=关闭不注入');
815
795
  console.log('');
816
796
  }
817
797
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aiyiran/myclaw",
3
- "version": "1.0.94",
3
+ "version": "1.0.96",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "bin": {
package/patch-agent.js CHANGED
@@ -7,7 +7,7 @@
7
7
  * 1. 读取 patch-manifest.json 中的 agents 列表
8
8
  * 2. 根据 strategy 决定行为:
9
9
  * - auto: 目标 workspace 不存在时才注入(默认)
10
- * - overwrite: 始终覆盖更新 workspace 文件
10
+ * - on: 始终覆盖更新 workspace 文件
11
11
  * - off: 跳过,不注入
12
12
  * 3. 将 workspace 复制到 ~/.openclaw/ 下
13
13
  * 4. 在 openclaw.json 的 agents.list 中注册
@@ -1,11 +1,11 @@
1
1
  {
2
- "_doc": "MyClaw 注入清单 (auto-generated)。strategy: auto | overwrite | off",
3
- "_generated": "2026-04-01T12:07:00.088Z",
2
+ "_doc": "MyClaw 注入清单 (auto-generated)。strategy: auto | on | off",
3
+ "_generated": "2026-04-01T13:01:02.413Z",
4
4
  "agents": [
5
5
  {
6
6
  "id": "danci",
7
7
  "workspace": "workspace-danci",
8
- "strategy": "auto",
8
+ "strategy": "on",
9
9
  "description": "danci"
10
10
  }
11
11
  ],
@@ -17,11 +17,12 @@
17
17
  }
18
18
  ],
19
19
  "config": {
20
- "strategy": "overwrite",
20
+ "strategy": "on",
21
21
  "patches": {
22
22
  "session.reset.mode": "idle",
23
23
  "session.reset.idleMinutes": 90720,
24
- "tools.exec.ask": "off"
24
+ "tools.exec.ask": "off",
25
+ "gateway.auth.token": "aiyiran"
25
26
  }
26
27
  }
27
28
  }