yymaxapi 1.0.15 → 1.0.17

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/bin/yymaxapi.js CHANGED
@@ -93,8 +93,16 @@ const DEFAULT_CLAUDE_MODELS = [
93
93
  "name": "Claude Opus 4.6"
94
94
  },
95
95
  {
96
- "id": "claude-sonnet-4-5",
97
- "name": "Claude Sonnet 4.5"
96
+ "id": "claude-opus-4-6-Thinking",
97
+ "name": "Claude Opus 4.6 Thinking"
98
+ },
99
+ {
100
+ "id": "claude-sonnet-4-6",
101
+ "name": "Claude Sonnet 4.6"
102
+ },
103
+ {
104
+ "id": "claude-sonnet-4-6-Thinking",
105
+ "name": "Claude Sonnet 4.6 Thinking"
98
106
  },
99
107
  {
100
108
  "id": "claude-haiku-4-5",
@@ -587,6 +595,24 @@ function getWslHome() {
587
595
  return _wslHomeCache;
588
596
  }
589
597
 
598
+ // 获取 WSL 内 openclaw CLI 的完整路径(缓存)
599
+ let _wslCliBinaryCache = undefined;
600
+
601
+ function getWslCliBinary() {
602
+ if (_wslCliBinaryCache !== undefined) return _wslCliBinaryCache;
603
+ for (const name of ['openclaw', 'clawdbot', 'moltbot']) {
604
+ try {
605
+ const result = execFileSync('wsl', ['bash', '-c', `which ${name} 2>/dev/null`], { encoding: 'utf8', timeout: 5000 }).trim();
606
+ if (result && result.startsWith('/')) {
607
+ _wslCliBinaryCache = result;
608
+ return _wslCliBinaryCache;
609
+ }
610
+ } catch {}
611
+ }
612
+ _wslCliBinaryCache = null;
613
+ return null;
614
+ }
615
+
590
616
  function detectGatewayEnv(port = 18789) {
591
617
  if (_gwEnvCache !== null) return _gwEnvCache;
592
618
  if (process.platform !== 'win32' || !isWslAvailable()) {
@@ -2489,12 +2515,15 @@ async function restartGateway() {
2489
2515
  // 如果 Gateway 在 WSL 里,优先用 wsl -- 重启
2490
2516
  if (gwEnv === 'wsl') {
2491
2517
  console.log(chalk.gray(' [检测] Gateway 运行在 WSL 中'));
2518
+ const wslCli = getWslCliBinary();
2492
2519
  return new Promise((resolve) => {
2493
- const wslCmds = [
2494
- 'wsl -- bash -lc "openclaw gateway restart"',
2495
- 'wsl -- bash -lc "clawdbot gateway restart"',
2496
- 'wsl -- bash -lc "moltbot gateway restart"',
2497
- ];
2520
+ const wslCmds = wslCli
2521
+ ? [`wsl -- bash -c "${wslCli} gateway restart"`]
2522
+ : [
2523
+ 'wsl -- bash -lc "openclaw gateway restart"',
2524
+ 'wsl -- bash -lc "clawdbot gateway restart"',
2525
+ 'wsl -- bash -lc "moltbot gateway restart"',
2526
+ ];
2498
2527
  let tried = 0;
2499
2528
  const tryNext = () => {
2500
2529
  if (tried >= wslCmds.length) {
@@ -2670,8 +2699,14 @@ function testGatewayViaAgent(model) {
2670
2699
 
2671
2700
  if (gwEnv === 'wsl') {
2672
2701
  // Gateway 在 WSL 中,agent 也要在 WSL 中执行
2673
- const agentCmd = `openclaw agent --session-id ${sessionId} --message "请回复你的模型名称" --json --timeout 120 2>/dev/null || clawdbot agent --session-id ${sessionId} --message "请回复你的模型名称" --json --timeout 120 2>/dev/null || moltbot agent --session-id ${sessionId} --message "请回复你的模型名称" --json --timeout 120`;
2674
- cmd = `wsl -- bash -lc '${agentCmd.replace(/'/g, "'\\''")}'`;
2702
+ const wslCli = getWslCliBinary();
2703
+ if (wslCli) {
2704
+ const agentCmd = `${wslCli} agent --session-id ${sessionId} --message "请回复你的模型名称" --json --timeout 120`;
2705
+ cmd = `wsl -- bash -c '${agentCmd.replace(/'/g, "'\\''")}'`;
2706
+ } else {
2707
+ const agentCmd = `openclaw agent --session-id ${sessionId} --message "请回复你的模型名称" --json --timeout 120 2>/dev/null || clawdbot agent --session-id ${sessionId} --message "请回复你的模型名称" --json --timeout 120 2>/dev/null || moltbot agent --session-id ${sessionId} --message "请回复你的模型名称" --json --timeout 120`;
2708
+ cmd = `wsl -- bash -lc '${agentCmd.replace(/'/g, "'\\''")}'`;
2709
+ }
2675
2710
  execOpts = { timeout: 120000 };
2676
2711
  } else {
2677
2712
  const { cliBinary, nodeMajor } = getCliMeta();
@@ -2816,7 +2851,7 @@ function testClaudeApi(baseUrl, apiKey, model) {
2816
2851
  const protocol = urlObj.protocol === 'https:' ? https : http;
2817
2852
 
2818
2853
  const postData = JSON.stringify({
2819
- model: model || 'claude-sonnet-4-5',
2854
+ model: model || 'claude-sonnet-4-6',
2820
2855
  max_tokens: 150,
2821
2856
  messages: [{ role: 'user', content: '你是哪个模型?请用一句话回答你的模型名称和版本。' }]
2822
2857
  });
@@ -25,7 +25,9 @@
25
25
  "models": {
26
26
  "claude": [
27
27
  { "id": "claude-opus-4-6", "name": "Claude Opus 4.6" },
28
- { "id": "claude-sonnet-4-5", "name": "Claude Sonnet 4.5" },
28
+ { "id": "claude-opus-4-6-Thinking", "name": "Claude Opus 4.6 Thinking" },
29
+ { "id": "claude-sonnet-4-6", "name": "Claude Sonnet 4.6" },
30
+ { "id": "claude-sonnet-4-6-Thinking", "name": "Claude Sonnet 4.6 Thinking" },
29
31
  { "id": "claude-haiku-4-5", "name": "Claude Haiku 4.5" }
30
32
  ],
31
33
  "codex": [
@@ -87,6 +89,6 @@ npx yymaxapi@latest
87
89
 
88
90
  **注意事项:**
89
91
  - `base_url` 不要加 `/v1`,平台会自动拼接 `/v1/messages`
90
- - 可用模型:`claude-opus-4-6`、`claude-sonnet-4-5`、`claude-haiku-4-5`
92
+ - 可用模型:`claude-opus-4-6`、`claude-opus-4-6-Thinking`、`claude-sonnet-4-6`、`claude-sonnet-4-6-Thinking`、`claude-haiku-4-5`
91
93
  - 已验证环境:腾讯云 OpenCloudOS,OpenClaw `2026.2.3-1`
92
94
  - 参考文档:https://cloud.tencent.com/developer/article/2624003
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "yymaxapi",
3
- "version": "1.0.15",
3
+ "version": "1.0.17",
4
4
  "description": "跨平台 OpenClaw/Clawdbot 配置管理工具 - 管理中转地址、模型切换、API Keys、测速优化",
5
5
  "main": "bin/yymaxapi.js",
6
6
  "bin": {