@aiyiran/myclaw 1.0.136 → 1.0.137

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.
@@ -0,0 +1,27 @@
1
+ #!/usr/bin/env node
2
+ const { readConfig, writeConfig } = require('./find-config');
3
+ const { config, configPath } = readConfig();
4
+ console.log('config:', configPath);
5
+
6
+ if (!config.models) config.models = {};
7
+ if (!config.models.providers) config.models.providers = {};
8
+ config.models.providers.openai = {
9
+ baseUrl: 'https://api.vveai.com/v1',
10
+ api: 'openai-completions',
11
+ apiKey: 'sk-PXPUzqllWKJy2oj011Df510242264219Ba21093e3d2b2335',
12
+ models: [{ id: 'nano-banana-2-0.5k', name: 'Nano Banana 2', input: ['text'] }]
13
+ };
14
+ delete config.models.providers.vveai;
15
+
16
+ if (!config.agents) config.agents = {};
17
+ if (!config.agents.defaults) config.agents.defaults = {};
18
+ config.agents.defaults.imageGenerationModel = { primary: 'openai/nano-banana-2-0.5k' };
19
+ if (!config.agents.defaults.models) config.agents.defaults.models = {};
20
+ delete config.agents.defaults.models['vveai/nano-banana-2-0.5k'];
21
+ config.agents.defaults.models['openai/nano-banana-2-0.5k'] = {};
22
+
23
+ writeConfig(config, configPath);
24
+ const v = readConfig();
25
+ console.log('imageGenModel:', JSON.stringify(v.config.agents.defaults.imageGenerationModel));
26
+ console.log('openai baseUrl:', v.config.models.providers.openai.baseUrl);
27
+ console.log('done');
package/index.js CHANGED
@@ -984,6 +984,9 @@ function showHelp() {
984
984
  console.log(' patch 注入 MyClaw UI + 技能 + 智能体 + 配置');
985
985
  console.log(' unpatch 回滚 UI 注入(恢复原版)');
986
986
  console.log(' minimax 注入 MiniMax 模型配置 (可选: --key sk-xxx)');
987
+ console.log(' image 注入图像生成模型配置 (基于 vveai)');
988
+ console.log(' token 设置 Gateway Token 为 aiyiran');
989
+ console.log(' plus 增强功能 (子命令: search)');
987
990
  console.log(' restart 重启 OpenClaw Gateway');
988
991
  console.log(' help 显示帮助信息');
989
992
  console.log('');
@@ -1060,6 +1063,33 @@ if (!command || command === 'help' || command === '--help' || command === '-h')
1060
1063
  console.log('🔄 正在重启 Gateway 使配置生效...');
1061
1064
  console.log('');
1062
1065
  runRestart();
1066
+ } else if (command === 'image') {
1067
+ const image = require('./inject-image');
1068
+ image.run(args.slice(1));
1069
+ console.log('🔄 正在重启 Gateway 使配置生效...');
1070
+ console.log('');
1071
+ runRestart();
1072
+ } else if (command === 'token') {
1073
+ const token = require('./inject-token');
1074
+ token.run(args.slice(1));
1075
+ console.log('🔄 正在重启 Gateway 使配置生效...');
1076
+ console.log('');
1077
+ runRestart();
1078
+ } else if (command === 'plus') {
1079
+ const subCmd = args[1];
1080
+ if (subCmd === 'search') {
1081
+ const search = require('./inject-search');
1082
+ search.run(args.slice(2));
1083
+ console.log('🔄 正在重启 Gateway 使配置生效...');
1084
+ console.log('');
1085
+ runRestart();
1086
+ } else {
1087
+ console.log('用法: myclaw plus <子命令>');
1088
+ console.log('');
1089
+ console.log('子命令:');
1090
+ console.log(' search 注入 Tavily 搜索插件配置');
1091
+ process.exit(1);
1092
+ }
1063
1093
  } else {
1064
1094
  console.error('[' + colors.red + '错误' + colors.nc + '] 未知命令: ' + command);
1065
1095
  showHelp();
@@ -0,0 +1,67 @@
1
+ #!/usr/bin/env node
2
+
3
+ /**
4
+ * inject-image.js
5
+ *
6
+ * 单独注入图像生成的配置 (使用 openai provider + 自定义 baseUrl 指向 vveaiAPI)。
7
+ * 这样就可以通过 `myclaw image` 直接覆盖图像模型。
8
+ */
9
+
10
+ const { readConfig, writeConfig } = require('./find-config');
11
+
12
+ function run(cliArgs) {
13
+ let configPath;
14
+ try {
15
+ ({ configPath } = readConfig());
16
+ } catch (err) {
17
+ console.error('❌ ' + err.message);
18
+ process.exit(1);
19
+ }
20
+
21
+ console.log('📍 找到配置: ' + configPath);
22
+ console.log('📝 注入 Image 模型配置...');
23
+
24
+ const { config } = readConfig();
25
+
26
+ if (!config.models) config.models = {};
27
+ if (!config.models.providers) config.models.providers = {};
28
+
29
+ // 注入 openai provider
30
+ config.models.providers.openai = {
31
+ baseUrl: "https://api.vveai.com/v1",
32
+ api: "openai-completions",
33
+ apiKey: "sk-PXPUzqllWKJy2oj011Df510242264219Ba21093e3d2b2335",
34
+ models: [
35
+ {
36
+ id: "nano-banana-2-0.5k",
37
+ name: "Nano Banana 2",
38
+ input: ["text"]
39
+ }
40
+ ]
41
+ };
42
+
43
+ if (!config.agents) config.agents = {};
44
+ if (!config.agents.defaults) config.agents.defaults = {};
45
+
46
+ // 覆盖图像生成模型
47
+ config.agents.defaults.imageGenerationModel = {
48
+ primary: "openai/nano-banana-2-0.5k"
49
+ };
50
+
51
+ if (!config.agents.defaults.models) config.agents.defaults.models = {};
52
+ config.agents.defaults.models["openai/nano-banana-2-0.5k"] = {};
53
+
54
+ writeConfig(config, configPath);
55
+
56
+ // 验证写入
57
+ const verify = readConfig();
58
+ const writtenProviderUrl = verify.config.models?.providers?.openai?.baseUrl || '???';
59
+ const writtenImageDefault = verify.config.agents?.defaults?.imageGenerationModel?.primary || '???';
60
+
61
+ console.log('✅ 图像配置已注入');
62
+ console.log(' [验证] openai baseUrl: ' + writtenProviderUrl);
63
+ console.log(' [验证] image primary: ' + writtenImageDefault);
64
+ console.log('');
65
+ }
66
+
67
+ module.exports = { run };
package/inject-minimax.js CHANGED
@@ -3,11 +3,12 @@
3
3
  /**
4
4
  * inject-minimax.js
5
5
  *
6
- * openclaw.json 中的模型配置清空,注入为唯一的 MiniMax 模型。
6
+ * 增量注入 MiniMax 模型配置到 openclaw.json,不影响已有的其他 provider。
7
+ * 图片模型由 inject-image.js 单独管理,本脚本不再覆盖。
7
8
  *
8
9
  * 流程:
9
- * 1. 先执行 openclaw onboard(设置 API Key,会覆盖 JSON
10
- * 2. 再写入我们的 JSON 配置(覆盖回来)
10
+ * 1. 先执行 openclaw onboard(设置 API Key)
11
+ * 2. 增量写入 minimax provider + 白名单 + 默认聊天模型
11
12
  *
12
13
  * 入口: myclaw minimax [--key sk-xxx]
13
14
  */
@@ -84,56 +85,57 @@ function run(cliArgs) {
84
85
  // 重新读取(onboard 可能已改过)
85
86
  const { config } = readConfig();
86
87
 
87
- config.auth = {
88
- profiles: {
89
- "minimax:cn": {
90
- provider: "minimax",
91
- mode: "api_key"
92
- }
93
- }
88
+ // auth profile: 增量合并,不覆盖已有 profile
89
+ if (!config.auth) config.auth = {};
90
+ if (!config.auth.profiles) config.auth.profiles = {};
91
+ config.auth.profiles["minimax:cn"] = {
92
+ provider: "minimax",
93
+ mode: "api_key"
94
94
  };
95
95
 
96
- config.models = {
97
- mode: "merge",
98
- providers: {
99
- minimax: {
100
- baseUrl: "https://api.minimaxi.com/anthropic",
101
- api: "anthropic-messages",
102
- authHeader: true,
103
- models: [
104
- {
105
- id: "MiniMax-M2.7-highspeed",
106
- name: "MiniMax M2.7 Highspeed",
107
- reasoning: true,
108
- input: ["text"],
109
- cost: {
110
- input: 0.3,
111
- output: 1.2,
112
- cacheRead: 0.06,
113
- cacheWrite: 0.375
114
- },
115
- contextWindow: 204800,
116
- maxTokens: 131072
117
- }
118
- ]
96
+ // models provider: 只设置 minimax,保留其他 provider(如 openai/vveai 图片)
97
+ if (!config.models) config.models = {};
98
+ if (!config.models.mode) config.models.mode = "merge";
99
+ if (!config.models.providers) config.models.providers = {};
100
+
101
+ config.models.providers.minimax = {
102
+ baseUrl: "https://api.minimaxi.com/anthropic",
103
+ api: "anthropic-messages",
104
+ authHeader: true,
105
+ models: [
106
+ {
107
+ id: "MiniMax-M2.7-highspeed",
108
+ name: "MiniMax M2.7 Highspeed",
109
+ reasoning: true,
110
+ input: ["text"],
111
+ cost: {
112
+ input: 0.3,
113
+ output: 1.2,
114
+ cacheRead: 0.06,
115
+ cacheWrite: 0.375
116
+ },
117
+ contextWindow: 204800,
118
+ maxTokens: 131072
119
119
  }
120
- }
120
+ ]
121
121
  };
122
122
 
123
123
  if (!config.agents) config.agents = {};
124
124
  if (!config.agents.defaults) config.agents.defaults = {};
125
125
 
126
+ // 默认聊天模型
126
127
  config.agents.defaults.model = {
127
128
  primary: "minimax/MiniMax-M2.7-highspeed"
128
129
  };
129
130
 
131
+ // 图片模型: 覆盖注入(myclaw image 和 myclaw minimax 互相覆盖)
130
132
  config.agents.defaults.imageGenerationModel = {
131
133
  primary: "minimax/image-01"
132
134
  };
133
135
 
134
- config.agents.defaults.models = {
135
- "minimax/MiniMax-M2.7-highspeed": {}
136
- };
136
+ // 白名单: 增量添加,不覆盖已有模型
137
+ if (!config.agents.defaults.models) config.agents.defaults.models = {};
138
+ config.agents.defaults.models["minimax/MiniMax-M2.7-highspeed"] = {};
137
139
 
138
140
  writeConfig(config, configPath);
139
141
 
@@ -0,0 +1,51 @@
1
+ #!/usr/bin/env node
2
+
3
+ /**
4
+ * inject-search.js
5
+ *
6
+ * 增量注入 Tavily 搜索插件配置到 openclaw.json。
7
+ *
8
+ * 入口: myclaw plus search
9
+ */
10
+
11
+ const { readConfig, writeConfig } = require('./find-config');
12
+
13
+ function run(cliArgs) {
14
+ let configPath;
15
+ try {
16
+ ({ configPath } = readConfig());
17
+ } catch (err) {
18
+ console.error('❌ ' + err.message);
19
+ process.exit(1);
20
+ }
21
+
22
+ console.log('📍 找到配置: ' + configPath);
23
+ console.log('📝 注入 Tavily 搜索配置...');
24
+
25
+ const { config } = readConfig();
26
+
27
+ // 增量注入 plugins.entries.tavily
28
+ if (!config.plugins) config.plugins = {};
29
+ if (!config.plugins.entries) config.plugins.entries = {};
30
+
31
+ config.plugins.entries.tavily = {
32
+ enabled: true,
33
+ config: {
34
+ webSearch: {
35
+ apiKey: "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,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"
36
+ }
37
+ }
38
+ };
39
+
40
+ writeConfig(config, configPath);
41
+
42
+ // 验证
43
+ const verify = readConfig();
44
+ const tavilyEnabled = verify.config.plugins?.entries?.tavily?.enabled;
45
+
46
+ console.log('✅ Tavily 搜索已注入');
47
+ console.log(' [验证] enabled: ' + tavilyEnabled);
48
+ console.log('');
49
+ }
50
+
51
+ module.exports = { run };
@@ -0,0 +1,37 @@
1
+ #!/usr/bin/env node
2
+
3
+ /**
4
+ * inject-token.js
5
+ *
6
+ * 将 gateway.auth.token 设置为 "aiyiran"。
7
+ *
8
+ * 入口: myclaw token
9
+ */
10
+
11
+ const { readConfig, writeConfig } = require('./find-config');
12
+
13
+ function run(cliArgs) {
14
+ let configPath;
15
+ try {
16
+ ({ configPath } = readConfig());
17
+ } catch (err) {
18
+ console.error('❌ ' + err.message);
19
+ process.exit(1);
20
+ }
21
+
22
+ console.log('📍 找到配置: ' + configPath);
23
+
24
+ const { config } = readConfig();
25
+
26
+ if (!config.gateway) config.gateway = {};
27
+ if (!config.gateway.auth) config.gateway.auth = {};
28
+
29
+ config.gateway.auth.token = "aiyiran";
30
+
31
+ writeConfig(config, configPath);
32
+
33
+ console.log('✅ Token 已设置为 "aiyiran"');
34
+ console.log('');
35
+ }
36
+
37
+ module.exports = { run };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aiyiran/myclaw",
3
- "version": "1.0.136",
3
+ "version": "1.0.137",
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-07T07:39:37.379Z",
3
+ "_generated": "2026-04-07T15:18:27.708Z",
4
4
  "agents": [
5
5
  {
6
6
  "id": "danci",
@@ -29,7 +29,6 @@
29
29
  "session.reset.idleMinutes": 90720,
30
30
  "tools.exec.ask": "off",
31
31
  "tools.exec.security": "full",
32
- "gateway.auth.token": "123",
33
32
  "update.checkOnStart": false
34
33
  }
35
34
  }
@@ -91,56 +91,57 @@ console.log('📝 [Step 2] 注入 MiniMax 模型配置...');
91
91
 
92
92
  const config = JSON.parse(fs.readFileSync(targetPath, 'utf8'));
93
93
 
94
- config.auth = {
95
- profiles: {
96
- "minimax:cn": {
97
- provider: "minimax",
98
- mode: "api_key"
99
- }
100
- }
94
+ // auth profile: 增量合并
95
+ if (!config.auth) config.auth = {};
96
+ if (!config.auth.profiles) config.auth.profiles = {};
97
+ config.auth.profiles["minimax:cn"] = {
98
+ provider: "minimax",
99
+ mode: "api_key"
101
100
  };
102
101
 
103
- config.models = {
104
- mode: "merge",
105
- providers: {
106
- minimax: {
107
- baseUrl: "https://api.minimaxi.com/anthropic",
108
- api: "anthropic-messages",
109
- authHeader: true,
110
- models: [
111
- {
112
- id: "MiniMax-M2.7-highspeed",
113
- name: "MiniMax M2.7 Highspeed",
114
- reasoning: true,
115
- input: ["text"],
116
- cost: {
117
- input: 0.3,
118
- output: 1.2,
119
- cacheRead: 0.06,
120
- cacheWrite: 0.375
121
- },
122
- contextWindow: 204800,
123
- maxTokens: 131072
124
- }
125
- ]
102
+ // models provider: 只设置 minimax,保留其他 provider
103
+ if (!config.models) config.models = {};
104
+ if (!config.models.mode) config.models.mode = "merge";
105
+ if (!config.models.providers) config.models.providers = {};
106
+
107
+ config.models.providers.minimax = {
108
+ baseUrl: "https://api.minimaxi.com/anthropic",
109
+ api: "anthropic-messages",
110
+ authHeader: true,
111
+ models: [
112
+ {
113
+ id: "MiniMax-M2.7-highspeed",
114
+ name: "MiniMax M2.7 Highspeed",
115
+ reasoning: true,
116
+ input: ["text"],
117
+ cost: {
118
+ input: 0.3,
119
+ output: 1.2,
120
+ cacheRead: 0.06,
121
+ cacheWrite: 0.375
122
+ },
123
+ contextWindow: 204800,
124
+ maxTokens: 131072
126
125
  }
127
- }
126
+ ]
128
127
  };
129
128
 
130
129
  if (!config.agents) config.agents = {};
131
130
  if (!config.agents.defaults) config.agents.defaults = {};
132
131
 
132
+ // 默认聊天模型
133
133
  config.agents.defaults.model = {
134
134
  primary: "minimax/MiniMax-M2.7-highspeed"
135
135
  };
136
136
 
137
+ // 图片模型: 覆盖注入(myclaw image 和 myclaw minimax 互相覆盖)
137
138
  config.agents.defaults.imageGenerationModel = {
138
139
  primary: "minimax/image-01"
139
140
  };
140
141
 
141
- config.agents.defaults.models = {
142
- "minimax/MiniMax-M2.7-highspeed": {}
143
- };
142
+ // 白名单: 增量添加
143
+ if (!config.agents.defaults.models) config.agents.defaults.models = {};
144
+ config.agents.defaults.models["minimax/MiniMax-M2.7-highspeed"] = {};
144
145
 
145
146
  fs.writeFileSync(targetPath, JSON.stringify(config, null, 2) + '\n', 'utf8');
146
147