yingclaw 2.5.4 → 2.5.7

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/README.md CHANGED
@@ -61,8 +61,8 @@ claw gateway
61
61
  | Kimi / Moonshot | kimi-k2.5 | kimi-k2.5 |
62
62
  | 阿里云百炼 | qwen3-max | qwen3.5-plus |
63
63
  | MiniMax | MiniMax-M2.7 | MiniMax-M2.7-Turbo |
64
- | 智谱 GLM | glm-4.7 | glm-5-turbo |
65
- | 小米 MiMo | mimo-vl-v2.5-pro | mimo-vl-v2.5-pro |
64
+ | 智谱 GLM | GLM-4.7 | GLM-5-Turbo |
65
+ | 小米 MiMo | mimo-v2.5-pro | mimo-v2-flash |
66
66
  | 自定义接口 | 自动获取或手动输入 | — |
67
67
 
68
68
  DeepSeek 的 `[1m]` 后缀是真实 API 模型 ID,表示 100 万 token 上下文窗口([官方说明](https://api-docs.deepseek.com/zh-cn/quick_start/agent_integrations/claude_code))。
package/lib/autostart.js CHANGED
@@ -63,6 +63,35 @@ function runLaunchctl(runner, args, options = {}) {
63
63
  return result;
64
64
  }
65
65
 
66
+ function sleepSync(ms) {
67
+ Atomics.wait(new Int32Array(new SharedArrayBuffer(4)), 0, 0, ms);
68
+ }
69
+
70
+ function getLaunchAgentRuntimeStatus(runner, service) {
71
+ const result = runner('launchctl', ['print', service], { encoding: 'utf8', stdio: 'pipe' });
72
+ const output = `${result.stdout || ''}\n${result.stderr || ''}`;
73
+ return {
74
+ loaded: result.status === 0,
75
+ running: result.status === 0 && /state\s*=\s*running/i.test(output),
76
+ };
77
+ }
78
+
79
+ function waitForLaunchAgentUnload(runner, service, options = {}) {
80
+ const timeoutMs = options.timeoutMs == null ? 1500 : options.timeoutMs;
81
+ const intervalMs = options.intervalMs == null ? 100 : options.intervalMs;
82
+ const deadline = Date.now() + timeoutMs;
83
+
84
+ do {
85
+ if (!getLaunchAgentRuntimeStatus(runner, service).loaded) {
86
+ return true;
87
+ }
88
+ if (Date.now() >= deadline) {
89
+ return false;
90
+ }
91
+ sleepSync(intervalMs);
92
+ } while (true);
93
+ }
94
+
66
95
  function installGatewayAutostart(options = {}) {
67
96
  const platform = options.platform || process.platform;
68
97
  if (platform !== 'darwin') {
@@ -84,8 +113,18 @@ function installGatewayAutostart(options = {}) {
84
113
  const domain = `gui/${uid}`;
85
114
  const service = `${domain}/${GATEWAY_LAUNCH_AGENT_LABEL}`;
86
115
 
87
- runLaunchctl(runner, ['bootout', domain, GATEWAY_LAUNCH_AGENT_LABEL], { optional: true });
88
- runLaunchctl(runner, ['bootstrap', domain, file]);
116
+ const bootout = runLaunchctl(runner, ['bootout', service], { optional: true });
117
+ if (bootout.status === 0) {
118
+ waitForLaunchAgentUnload(runner, service, {
119
+ timeoutMs: options.unloadTimeoutMs,
120
+ intervalMs: options.unloadPollIntervalMs,
121
+ });
122
+ }
123
+ const bootstrap = runLaunchctl(runner, ['bootstrap', domain, file], { optional: true });
124
+ if (bootstrap.status !== 0 && !getLaunchAgentRuntimeStatus(runner, service).loaded) {
125
+ const stderr = String(bootstrap.stderr || '').trim();
126
+ throw new Error(`launchctl bootstrap ${domain} ${file} 失败${stderr ? `: ${stderr}` : ''}`);
127
+ }
89
128
  runLaunchctl(runner, ['enable', service]);
90
129
  runLaunchctl(runner, ['kickstart', '-k', service]);
91
130
 
@@ -111,12 +150,11 @@ function getGatewayAutostartStatus(options = {}) {
111
150
  }
112
151
 
113
152
  const runner = options.runner || spawnSync;
114
- const result = runner('launchctl', ['print', `gui/${uid}/${GATEWAY_LAUNCH_AGENT_LABEL}`], { encoding: 'utf8', stdio: 'pipe' });
115
- const output = `${result.stdout || ''}\n${result.stderr || ''}`;
153
+ const runtimeStatus = getLaunchAgentRuntimeStatus(runner, `gui/${uid}/${GATEWAY_LAUNCH_AGENT_LABEL}`);
116
154
  return {
117
155
  supported: true,
118
156
  installed: true,
119
- running: result.status === 0 && /state\s*=\s*running/i.test(output),
157
+ running: runtimeStatus.running,
120
158
  file,
121
159
  };
122
160
  }
package/lib/config.js CHANGED
@@ -52,6 +52,7 @@ const PROVIDERS = {
52
52
  name: 'MiniMax',
53
53
  baseUrl: 'https://api.minimaxi.com/anthropic',
54
54
  modelsUrl: 'https://api.minimaxi.com/v1/models',
55
+ fastModel: 'MiniMax-M2.7-Turbo',
55
56
  models: [
56
57
  { name: 'MiniMax M2.7(旗舰)', value: 'MiniMax-M2.7' },
57
58
  { name: 'MiniMax M2.7 Turbo(快速)', value: 'MiniMax-M2.7-Turbo' },
@@ -62,6 +63,7 @@ const PROVIDERS = {
62
63
  name: '智谱 GLM',
63
64
  baseUrl: 'https://open.bigmodel.cn/api/anthropic',
64
65
  modelsUrl: 'https://open.bigmodel.cn/api/paas/v4/models',
66
+ fastModel: 'GLM-5-Turbo',
65
67
  models: [
66
68
  { name: 'GLM-4.7(旗舰)', value: 'GLM-4.7' },
67
69
  { name: 'GLM-5.1(强力)', value: 'GLM-5.1' },
@@ -89,7 +91,27 @@ const PROVIDERS = {
89
91
  },
90
92
  };
91
93
 
94
+ const PREFERRED_MODEL_IDS = {
95
+ qwen: ['qwen3-max', 'qwen3-plus', 'qwen3.5-plus'],
96
+ minimax: ['MiniMax-M2.7', 'MiniMax-M2.7-Turbo', 'MiniMax-M2.5'],
97
+ glm: ['GLM-4.7', 'GLM-5.1', 'GLM-5-Turbo', 'GLM-4.5-Air'],
98
+ mimo: ['mimo-v2.5-pro', 'mimo-v2.5', 'mimo-v2-flash'],
99
+ };
100
+
101
+ function sortPreferredModelIds(providerKey, ids) {
102
+ const preferred = PREFERRED_MODEL_IDS[providerKey];
103
+ if (!preferred) return ids;
104
+ return [
105
+ ...preferred.filter((id) => ids.includes(id)),
106
+ ...ids.filter((id) => !preferred.includes(id)),
107
+ ];
108
+ }
109
+
92
110
  function normalizeModelIds(providerKey, ids) {
111
+ if (PREFERRED_MODEL_IDS[providerKey]) {
112
+ return sortPreferredModelIds(providerKey, ids);
113
+ }
114
+
93
115
  if (providerKey !== 'deepseek') return ids;
94
116
 
95
117
  const mapped = ids.map((id) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "yingclaw",
3
- "version": "2.5.4",
3
+ "version": "2.5.7",
4
4
  "description": "Claude Code × 国产大模型一键接入:DeepSeek、Kimi、Qwen、MiniMax、GLM、MiMo",
5
5
  "main": "index.js",
6
6
  "bin": {