@vibeapi/api-helper 0.0.92 → 0.0.94

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,548 @@
1
+ {
2
+ "schema": 1,
3
+ "revision": "2026-10-14T09:43:10Z-3",
4
+ "min_client_version": "",
5
+ "upgrade_message": "",
6
+ "defaults": {
7
+ "language": "zh-CN",
8
+ "permission_mode": "full_auto"
9
+ },
10
+ "profiles": [
11
+ {
12
+ "id": "claude-opus-medium",
13
+ "name": "Claude Opus 5.5 · Medium",
14
+ "tool": "claude",
15
+ "model": "claude-opus-5-5",
16
+ "thinking": "medium",
17
+ "permission_mode": "full_auto",
18
+ "default": true
19
+ },
20
+ {
21
+ "id": "codex-gpt-6-astra",
22
+ "name": "Codex · GPT-6 Astra",
23
+ "tool": "codex",
24
+ "model": "gpt-6-astra",
25
+ "permission_mode": "full_auto",
26
+ "default": false
27
+ },
28
+ {
29
+ "id": "grok-4-7",
30
+ "name": "Grok 4.7",
31
+ "tool": "grok",
32
+ "model": "grok-4.7",
33
+ "permission_mode": "full_auto",
34
+ "default": false
35
+ },
36
+ {
37
+ "id": "gemini-3-8-flash",
38
+ "name": "Gemini 3.8 Flash",
39
+ "tool": "gemini",
40
+ "model": "gemini-3.8-flash",
41
+ "permission_mode": "full_auto",
42
+ "default": false
43
+ }
44
+ ],
45
+ "models": {
46
+ "claude": [
47
+ {
48
+ "id": "claude-opus-5-5",
49
+ "name": "Claude Opus 5.5",
50
+ "description": "100 万上下文 | 长时 Agent 编程 | 知识工作",
51
+ "group": "",
52
+ "group_name": "",
53
+ "recommended": true,
54
+ "hidden": false,
55
+ "context_window": 1000000
56
+ },
57
+ {
58
+ "id": "claude-sonnet-5-5",
59
+ "name": "Claude Sonnet 5.5",
60
+ "description": "100 万上下文 | Agent 编程 | 速度与成本均衡",
61
+ "group": "",
62
+ "group_name": "",
63
+ "recommended": false,
64
+ "hidden": false,
65
+ "context_window": 1000000
66
+ },
67
+ {
68
+ "id": "claude-fable-5-1",
69
+ "name": "Claude Fable 5.1",
70
+ "description": "100 万上下文 | 长时 Agent 与多步研究",
71
+ "group": "",
72
+ "group_name": "",
73
+ "recommended": false,
74
+ "hidden": false,
75
+ "context_window": 1000000
76
+ },
77
+ {
78
+ "id": "claude-fable-5",
79
+ "name": "Claude Fable 5",
80
+ "description": "100 万上下文 | 高强度推理 | 长时 Agent",
81
+ "group": "",
82
+ "group_name": "",
83
+ "recommended": false,
84
+ "hidden": false,
85
+ "context_window": 1000000
86
+ },
87
+ {
88
+ "id": "claude-opus-5",
89
+ "name": "Claude Opus 5",
90
+ "description": "100 万上下文 | Agent 编程",
91
+ "group": "",
92
+ "group_name": "",
93
+ "recommended": false,
94
+ "hidden": false,
95
+ "context_window": 1000000
96
+ },
97
+ {
98
+ "id": "claude-sonnet-5",
99
+ "name": "Claude Sonnet 5",
100
+ "description": "100 万上下文 | Agent 编程 | 工具调用",
101
+ "group": "",
102
+ "group_name": "",
103
+ "recommended": false,
104
+ "hidden": false,
105
+ "context_window": 1000000
106
+ },
107
+ {
108
+ "id": "claude-opus-4-8",
109
+ "name": "Claude Opus 4.8",
110
+ "description": "100 万上下文 | 推理 | 编程",
111
+ "group": "",
112
+ "group_name": "",
113
+ "recommended": false,
114
+ "hidden": false,
115
+ "context_window": 1000000
116
+ },
117
+ {
118
+ "id": "claude-opus-4-7",
119
+ "name": "Claude Opus 4.7",
120
+ "description": "100 万上下文 | 推理 | 编程",
121
+ "group": "",
122
+ "group_name": "",
123
+ "recommended": false,
124
+ "hidden": false,
125
+ "context_window": 1000000
126
+ },
127
+ {
128
+ "id": "claude-opus-4-6",
129
+ "name": "Claude Opus 4.6",
130
+ "description": "20 万上下文(部分分组无 1M)| 推理 | 编程",
131
+ "group": "",
132
+ "group_name": "",
133
+ "recommended": false,
134
+ "hidden": false,
135
+ "context_window": 200000
136
+ },
137
+ {
138
+ "id": "claude-sonnet-4-6",
139
+ "name": "Claude Sonnet 4.6",
140
+ "description": "20 万上下文(部分分组无 1M)| Agent 编程",
141
+ "group": "",
142
+ "group_name": "",
143
+ "recommended": false,
144
+ "hidden": false,
145
+ "context_window": 200000
146
+ },
147
+ {
148
+ "id": "deepseek-v4-pro",
149
+ "name": "DeepSeek V4 Pro",
150
+ "description": "100 万上下文 | 跨文件重构",
151
+ "group": "",
152
+ "group_name": "",
153
+ "recommended": false,
154
+ "hidden": false,
155
+ "context_window": 1000000
156
+ },
157
+ {
158
+ "id": "deepseek-v4.1-flash",
159
+ "name": "DeepSeek V4.1 Flash",
160
+ "description": "100 万上下文 | 高速档",
161
+ "group": "",
162
+ "group_name": "",
163
+ "recommended": false,
164
+ "hidden": false,
165
+ "context_window": 1000000
166
+ },
167
+ {
168
+ "id": "deepseek-v4-flash",
169
+ "name": "DeepSeek V4 Flash",
170
+ "description": "100 万上下文 | 高速档",
171
+ "group": "",
172
+ "group_name": "",
173
+ "recommended": false,
174
+ "hidden": true,
175
+ "context_window": 1000000
176
+ },
177
+ {
178
+ "id": "glm-5.3",
179
+ "name": "GLM 5.3",
180
+ "description": "105 万上下文 | 代码 Agent",
181
+ "group": "",
182
+ "group_name": "",
183
+ "recommended": false,
184
+ "hidden": false,
185
+ "context_window": 1048576
186
+ },
187
+ {
188
+ "id": "glm-5.3-flash",
189
+ "name": "GLM 5.3 Flash",
190
+ "description": "105 万上下文 | 高速档",
191
+ "group": "",
192
+ "group_name": "",
193
+ "recommended": false,
194
+ "hidden": false,
195
+ "context_window": 1048576
196
+ },
197
+ {
198
+ "id": "glm-5.2",
199
+ "name": "GLM 5.2",
200
+ "description": "100 万上下文 | 编程",
201
+ "group": "",
202
+ "group_name": "",
203
+ "recommended": false,
204
+ "hidden": true,
205
+ "context_window": 1000000
206
+ },
207
+ {
208
+ "id": "kimi-k3",
209
+ "name": "Kimi K3",
210
+ "description": "105 万上下文 | 前端编码",
211
+ "group": "",
212
+ "group_name": "",
213
+ "recommended": false,
214
+ "hidden": false,
215
+ "context_window": 1048576
216
+ },
217
+ {
218
+ "id": "qwen3.8-max",
219
+ "name": "Qwen 3.8 Max",
220
+ "description": "100 万上下文 | 视觉理解",
221
+ "group": "",
222
+ "group_name": "",
223
+ "recommended": false,
224
+ "hidden": false,
225
+ "context_window": 1000000
226
+ },
227
+ {
228
+ "id": "qwen3.8-flash",
229
+ "name": "Qwen 3.8 Flash",
230
+ "description": "100 万上下文 | 高速档",
231
+ "group": "",
232
+ "group_name": "",
233
+ "recommended": false,
234
+ "hidden": false,
235
+ "context_window": 1000000
236
+ },
237
+ {
238
+ "id": "qwen3.7-max",
239
+ "name": "Qwen 3.7 Max",
240
+ "description": "100 万上下文 | 推理 | 编程",
241
+ "group": "",
242
+ "group_name": "",
243
+ "recommended": false,
244
+ "hidden": true,
245
+ "context_window": 1000000
246
+ },
247
+ {
248
+ "id": "qwen3.7-plus",
249
+ "name": "Qwen 3.7 Plus",
250
+ "description": "100 万上下文 | 均衡档",
251
+ "group": "",
252
+ "group_name": "",
253
+ "recommended": false,
254
+ "hidden": true,
255
+ "context_window": 1000000
256
+ },
257
+ {
258
+ "id": "MiniMax-M3",
259
+ "name": "MiniMax M3",
260
+ "description": "100 万上下文 | Agent 工作流",
261
+ "group": "",
262
+ "group_name": "",
263
+ "recommended": false,
264
+ "hidden": false,
265
+ "context_window": 1000000
266
+ }
267
+ ],
268
+ "codex": [
269
+ {
270
+ "id": "gpt-6-astra",
271
+ "name": "GPT-6 Astra",
272
+ "description": "105 万上下文 | 12.8 万输出 | 思考强度至 max | 计算机操作 / 编码 / 科学基准接近饱和",
273
+ "group": "",
274
+ "group_name": "",
275
+ "recommended": true,
276
+ "hidden": false,
277
+ "context_window": 1050000,
278
+ "max_output_tokens": 128000
279
+ },
280
+ {
281
+ "id": "gpt-6.1-sol",
282
+ "name": "GPT-6.1 Sol",
283
+ "description": "105 万上下文 | 12.8 万输出 | 文字与图像输入 | 工具调用、联网搜索、结构化输出 | 工具调用使用 Responses API",
284
+ "group": "",
285
+ "group_name": "",
286
+ "recommended": false,
287
+ "hidden": false,
288
+ "context_window": 1050000,
289
+ "max_output_tokens": 128000
290
+ },
291
+ {
292
+ "id": "gpt-6-sol",
293
+ "name": "GPT-6 Sol",
294
+ "description": "105 万上下文 | 12.8 万输出 | 复杂编程与 Agent 工作流",
295
+ "group": "",
296
+ "group_name": "",
297
+ "recommended": false,
298
+ "hidden": false,
299
+ "context_window": 1050000,
300
+ "max_output_tokens": 128000
301
+ },
302
+ {
303
+ "id": "gpt-5.6-sol",
304
+ "name": "GPT-5.6 Sol",
305
+ "description": "105 万上下文 | 12.8 万输出 | 前沿档",
306
+ "group": "",
307
+ "group_name": "",
308
+ "recommended": false,
309
+ "hidden": false,
310
+ "context_window": 1050000,
311
+ "max_output_tokens": 128000
312
+ },
313
+ {
314
+ "id": "gpt-5.6-terra",
315
+ "name": "GPT-5.6 Terra",
316
+ "description": "105 万上下文 | 12.8 万输出 | 均衡生产档",
317
+ "group": "",
318
+ "group_name": "",
319
+ "recommended": false,
320
+ "hidden": false,
321
+ "context_window": 1050000,
322
+ "max_output_tokens": 128000
323
+ },
324
+ {
325
+ "id": "gpt-5.6-luna",
326
+ "name": "GPT-5.6 Luna",
327
+ "description": "105 万上下文 | 12.8 万输出 | 大批量低成本档",
328
+ "group": "",
329
+ "group_name": "",
330
+ "recommended": false,
331
+ "hidden": false,
332
+ "context_window": 1050000,
333
+ "max_output_tokens": 128000
334
+ },
335
+ {
336
+ "id": "deepseek-v4-pro",
337
+ "name": "DeepSeek V4 Pro",
338
+ "description": "100 万上下文 | 跨文件重构",
339
+ "group": "",
340
+ "group_name": "",
341
+ "recommended": false,
342
+ "hidden": false,
343
+ "context_window": 1000000
344
+ },
345
+ {
346
+ "id": "deepseek-v4.1-flash",
347
+ "name": "DeepSeek V4.1 Flash",
348
+ "description": "100 万上下文 | 高速档",
349
+ "group": "",
350
+ "group_name": "",
351
+ "recommended": false,
352
+ "hidden": false,
353
+ "context_window": 1000000
354
+ },
355
+ {
356
+ "id": "deepseek-v4-flash",
357
+ "name": "DeepSeek V4 Flash",
358
+ "description": "100 万上下文 | 高速档",
359
+ "group": "",
360
+ "group_name": "",
361
+ "recommended": false,
362
+ "hidden": true,
363
+ "context_window": 1000000
364
+ },
365
+ {
366
+ "id": "glm-5.3",
367
+ "name": "GLM 5.3",
368
+ "description": "105 万上下文 | 代码 Agent",
369
+ "group": "",
370
+ "group_name": "",
371
+ "recommended": false,
372
+ "hidden": false,
373
+ "context_window": 1048576
374
+ },
375
+ {
376
+ "id": "glm-5.3-flash",
377
+ "name": "GLM 5.3 Flash",
378
+ "description": "105 万上下文 | 高速档",
379
+ "group": "",
380
+ "group_name": "",
381
+ "recommended": false,
382
+ "hidden": false,
383
+ "context_window": 1048576
384
+ },
385
+ {
386
+ "id": "glm-5.2",
387
+ "name": "GLM 5.2",
388
+ "description": "100 万上下文 | 编程",
389
+ "group": "",
390
+ "group_name": "",
391
+ "recommended": false,
392
+ "hidden": true,
393
+ "context_window": 1000000
394
+ },
395
+ {
396
+ "id": "kimi-k3",
397
+ "name": "Kimi K3",
398
+ "description": "105 万上下文 | 前端编码",
399
+ "group": "",
400
+ "group_name": "",
401
+ "recommended": false,
402
+ "hidden": false,
403
+ "context_window": 1048576
404
+ },
405
+ {
406
+ "id": "qwen3.8-max",
407
+ "name": "Qwen 3.8 Max",
408
+ "description": "100 万上下文 | 视觉理解",
409
+ "group": "",
410
+ "group_name": "",
411
+ "recommended": false,
412
+ "hidden": false,
413
+ "context_window": 1000000
414
+ },
415
+ {
416
+ "id": "qwen3.8-flash",
417
+ "name": "Qwen 3.8 Flash",
418
+ "description": "100 万上下文 | 高速档",
419
+ "group": "",
420
+ "group_name": "",
421
+ "recommended": false,
422
+ "hidden": false,
423
+ "context_window": 1000000
424
+ },
425
+ {
426
+ "id": "qwen3.7-max",
427
+ "name": "Qwen 3.7 Max",
428
+ "description": "100 万上下文 | 推理 | 编程",
429
+ "group": "",
430
+ "group_name": "",
431
+ "recommended": false,
432
+ "hidden": true,
433
+ "context_window": 1000000
434
+ },
435
+ {
436
+ "id": "qwen3.7-plus",
437
+ "name": "Qwen 3.7 Plus",
438
+ "description": "100 万上下文 | 均衡档",
439
+ "group": "",
440
+ "group_name": "",
441
+ "recommended": false,
442
+ "hidden": true,
443
+ "context_window": 1000000
444
+ },
445
+ {
446
+ "id": "MiniMax-M3",
447
+ "name": "MiniMax M3",
448
+ "description": "100 万上下文 | Agent 工作流",
449
+ "group": "",
450
+ "group_name": "",
451
+ "recommended": false,
452
+ "hidden": false,
453
+ "context_window": 1000000
454
+ },
455
+ {
456
+ "id": "grok-4.7",
457
+ "name": "Grok 4.7",
458
+ "description": "50 万上下文 | 长时 Agent | 编码",
459
+ "group": "",
460
+ "group_name": "",
461
+ "recommended": false,
462
+ "hidden": false,
463
+ "context_window": 500000
464
+ }
465
+ ],
466
+ "gemini": [
467
+ {
468
+ "id": "gemini-4-argon",
469
+ "name": "Gemini 4 Argon",
470
+ "description": "105 万上下文 | 旗舰推理 | 编码与 Agent",
471
+ "group": "",
472
+ "group_name": "",
473
+ "recommended": false,
474
+ "hidden": false,
475
+ "context_window": 1048576
476
+ },
477
+ {
478
+ "id": "gemini-3.8-flash",
479
+ "name": "Gemini 3.8 Flash",
480
+ "description": "推理与编码 | HLE-Verified 54.9% | 长文档工作流",
481
+ "group": "",
482
+ "group_name": "",
483
+ "recommended": true,
484
+ "hidden": false,
485
+ "context_window": 1048576,
486
+ "max_output_tokens": 65536
487
+ },
488
+ {
489
+ "id": "gemini-3.1-pro",
490
+ "name": "Gemini 3.1 Pro",
491
+ "description": "约 100 万上下文 | 深度推理 | 密集长文档",
492
+ "group": "",
493
+ "group_name": "",
494
+ "recommended": false,
495
+ "hidden": false,
496
+ "context_window": 1000000
497
+ },
498
+ {
499
+ "id": "gemini-3.7-flash",
500
+ "name": "Gemini 3.7 Flash",
501
+ "description": "Agent 主力 | 软件工程 | 网页开发",
502
+ "group": "",
503
+ "group_name": "",
504
+ "recommended": false,
505
+ "hidden": false,
506
+ "context_window": 1000000
507
+ }
508
+ ],
509
+ "grok": [
510
+ {
511
+ "id": "grok-4.7",
512
+ "name": "Grok 4.7",
513
+ "description": "50 万上下文 | 长时 Agent | 编码与视觉项目",
514
+ "group": "",
515
+ "group_name": "",
516
+ "recommended": true,
517
+ "hidden": false,
518
+ "context_window": 500000
519
+ },
520
+ {
521
+ "id": "grok-4.6",
522
+ "name": "Grok 4.6",
523
+ "description": "50 万上下文 | 思考强度四档 | 编码与 Agent",
524
+ "group": "",
525
+ "group_name": "",
526
+ "recommended": false,
527
+ "hidden": false,
528
+ "context_window": 500000
529
+ }
530
+ ]
531
+ },
532
+ "tools": {
533
+ "claude": {
534
+ "min_version": "2.1.291"
535
+ },
536
+ "codex": {
537
+ "min_version": ""
538
+ },
539
+ "gemini": {
540
+ "min_version": ""
541
+ },
542
+ "grok": {
543
+ "min_version": ""
544
+ }
545
+ },
546
+ "features": {},
547
+ "announcements": []
548
+ }
@@ -1 +1 @@
1
- import t from"chalk";import o from"ora";import{spawnSync as s}from"child_process";import{readFileSync as e}from"fs";import{connect as a}from"net";import{join as r}from"path";import{configManager as n}from"../lib/config.js";import{toolManager as c}from"../lib/tool-manager.js";import{i18n as i}from"../lib/i18n.js";import{validateApiKey as l}from"../lib/api-validator.js";import{getAdapter as d}from"../lib/tools/registry.js";import{findInstalls as u,installLabel as p}from"../lib/tools/tool-installs.js";import{detectManagedOverrides as m}from"../lib/tools/claude-managed.js";import{codexAuthProblem as _}from"../lib/tools/codex.js";import{claudeAccountLoginPresent as g}from"../lib/tools/claude-code.js";import{toolHome as f}from"../lib/tools/types.js";import{gatewayAddresses as h,probeGatewayAddress as y}from"../lib/gateway-addresses.js";const w=["HTTPS_PROXY","https_proxy","HTTP_PROXY","http_proxy","ALL_PROXY","all_proxy"];function j(t,o,s=3e3){return new Promise(e=>{const r=a({host:t,port:o}),n=t=>{r.destroy(),e(t)};r.setTimeout(s,()=>n(!1)),r.once("connect",()=>n(!0)),r.once("error",()=>n(!1))})}export async function doctorCommand(a={}){const x=o(i.t("doctor.checking")).start(),$=[],k=Number(process.versions.node.split(".")[0]);$.push({name:"Node.js",status:k>=20?"pass":"fail",message:`v${process.versions.node}`}),x.text=i.t("doctor.check_proxy"),$.push(await async function(){const t=i.t("doctor.proxy"),o=new Map;for(const t of w){const s=process.env[t]?.trim();s&&!o.has(s)&&o.set(s,t)}if(0===o.size)return{name:t,status:"pass",message:i.t("doctor.proxy_none")};const s=[];for(const[t,e]of o){let o;try{o=new URL(t.includes("://")?t:`http://${t}`)}catch{s.push(`${e}=${t}`);continue}const a=Number(o.port)||("https:"===o.protocol?443:o.protocol.startsWith("socks")?1080:80);await j(o.hostname,a)||s.push(`${e}=${t}`)}return 0===s.length?{name:t,status:"pass",message:[...o.keys()].join(", ")}:{name:t,status:"fail",message:i.t("doctor.proxy_dead",{proxies:s.join(", ")})}}()),x.text=i.t("doctor.check_api_key_network");const T=n.getApiKey(),b=i.t("doctor.api_key_network");if(T){const t=await l(T);t.valid?$.push({name:b,status:"pass"}):"invalid_api_key"===t.error?$.push({name:b,status:"fail",message:i.t("doctor.api_key_invalid")}):($.push({name:b,status:"fail",message:`${i.t("doctor.network_error")}: ${t.message??t.error}`}),x.text=i.t("doctor.check_other_addresses"),$.push(await async function(){const t=i.t("doctor.other_addresses"),o=n.getBaseUrl(),s=h().filter(t=>t.url!==o),e=n.getApiKey(),a=await Promise.all(s.map(t=>y(t.url,{apiKey:e}))),r=s.filter((t,o)=>a[o].ok).map(t=>t.url);return 0===r.length?{name:t,status:"fail",message:i.t("doctor.other_addresses_none")}:{name:t,status:"warn",message:i.t("doctor.other_addresses_found",{urls:r.join(", ")})}}()))}else $.push({name:b,status:"fail",message:i.t("doctor.api_key_missing")});x.text=i.t("doctor.check_tools");const A=c.getInstalledTools();$.push({name:i.t("doctor.installed_tools"),status:A.length>0?"pass":"warn",message:A.length>0?A.map(t=>d(t)?.displayName??t).join(", "):i.t("doctor.no_tools_installed")}),$.push(...function(){const t=[];for(const o of c.getInstalledTools()){const s=d(o);if(!s?.installSpec)continue;const e=u(s.installSpec);if(0===e.length)continue;const a=[],r=c.outdatedVersion(o);r&&a.push(i.t("doctor.tool_outdated",{min:r.min})),e.length>1&&a.push(i.t("doctor.tool_duplicates",{others:e.slice(1).map(p).join("、")})),t.push({name:s.displayName,status:a.length>0?"warn":"pass",message:[p(e[0]),...a,...a.length>0?[i.t("doctor.run_upgrade",{tool:o})]:[]].join("\n ")})}return t}());const v=function(){if(!c.isToolInstalled("claude-code"))return null;const t=i.t("doctor.claude_config"),o=m();if(o.length>0){const s=o.map(t=>`${t.source}: ${t.keys.join(", ")}`).join("; ");return{name:t,status:"fail",message:i.t("doctor.claude_managed",{detail:s})}}let s={};try{s=JSON.parse(e(r(f(),".claude","settings.json"),"utf-8")).env??{}}catch{}const a=n.getApiKeyForTool("claude-code");return s.ANTHROPIC_AUTH_TOKEN&&s.ANTHROPIC_BASE_URL?s.ANTHROPIC_BASE_URL!==n.getBaseUrl()||a&&s.ANTHROPIC_AUTH_TOKEN!==a?{name:t,status:"warn",message:i.t("doctor.claude_config_changed")}:{name:t,status:"pass"}:{name:t,status:"warn",message:i.t("doctor.claude_not_configured")}}();v&&$.push(v),A.includes("claude-code")&&g()&&$.push({name:i.t("doctor.claude_login"),status:"pass",message:i.t("tools.claude_code.account_login_overridden")});const N=A.includes("codex")?_():null;A.includes("codex")&&$.push({name:i.t("doctor.codex_auth"),status:N?"fail":"pass",message:N?i.t(`doctor.codex_${N}`):void 0}),"win32"===process.platform&&A.includes("claude-code")&&!process.env.CLAUDE_CODE_GIT_BASH_PATH&&$.push({name:"Git for Windows",status:c.isGitInstalled()?"pass":"warn",message:c.isGitInstalled()?void 0:i.t("tools.claude_code.no_git_bash")}),a.deep&&A.includes("claude-code")&&(x.text=i.t("doctor.check_claude_request"),$.push(function(){const t=i.t("doctor.claude_request"),o=u(d("claude-code").installSpec)[0];if(!o)return{name:t,status:"warn",message:i.t("doctor.claude_request_skipped")};const e={encoding:"utf-8",timeout:12e4,windowsHide:!0,stdio:["ignore","pipe","pipe"]},a=["-p","Reply with the single word OK."],r=/\.cmd$/i.test(o.path)?s(`"${o.path}" ${a.map(t=>`"${t}"`).join(" ")}`,{...e,shell:!0}):s(o.path,a,e),n=`${r.stdout??""}`.trim();if(0===r.status&&n)return{name:t,status:"pass",message:n.slice(0,80)};const c=(`${r.stderr??""}`.trim()||n||r.error?.message||`exit ${r.status}`).slice(0,300);return{name:t,status:"fail",message:i.t("doctor.claude_request_failed",{reason:c})}}())),x.stop(),console.log("\n"+t.bold(i.t("doctor.results_title"))+"\n");const O={pass:t.green("√"),warn:t.yellow("!"),fail:t.red("×")};for(const o of $)console.log(`${O[o.status]} ${o.name}`),o.message&&console.log(t.gray(` ${o.message}`));$.every(t=>"pass"===t.status)&&console.log("\n"+t.green.bold(i.t("doctor.all_good"))),!a.deep&&A.includes("claude-code")&&console.log(t.gray("\n"+i.t("doctor.deep_hint"))),$.some(t=>"fail"===t.status)&&(process.exitCode=1)}
1
+ import{refreshClientConfig as t}from"../lib/client-config-sync.js";import o from"chalk";import e from"ora";import{spawnSync as s}from"child_process";import{readFileSync as a}from"fs";import{connect as r}from"net";import{join as n}from"path";import{configManager as c}from"../lib/config.js";import{toolManager as i}from"../lib/tool-manager.js";import{i18n as l}from"../lib/i18n.js";import{validateApiKey as d}from"../lib/api-validator.js";import{getAdapter as u}from"../lib/tools/registry.js";import{findInstalls as p,installLabel as m}from"../lib/tools/tool-installs.js";import{detectManagedOverrides as _}from"../lib/tools/claude-managed.js";import{codexAuthProblem as g}from"../lib/tools/codex.js";import{claudeAccountLoginPresent as f}from"../lib/tools/claude-code.js";import{toolHome as h}from"../lib/tools/types.js";import{gatewayAddresses as y,probeGatewayAddress as w}from"../lib/gateway-addresses.js";const j=["HTTPS_PROXY","https_proxy","HTTP_PROXY","http_proxy","ALL_PROXY","all_proxy"];function x(t,o,e=3e3){return new Promise(s=>{const a=r({host:t,port:o}),n=t=>{a.destroy(),s(t)};a.setTimeout(e,()=>n(!1)),a.once("connect",()=>n(!0)),a.once("error",()=>n(!1))})}export async function doctorCommand(r={}){const $=e(l.t("doctor.checking")).start(),k=[],b=Number(process.versions.node.split(".")[0]);k.push({name:"Node.js",status:b>=20?"pass":"fail",message:`v${process.versions.node}`}),$.text=l.t("doctor.check_proxy"),k.push(await async function(){const t=l.t("doctor.proxy"),o=new Map;for(const t of j){const e=process.env[t]?.trim();e&&!o.has(e)&&o.set(e,t)}if(0===o.size)return{name:t,status:"pass",message:l.t("doctor.proxy_none")};const e=[];for(const[t,s]of o){let o;try{o=new URL(t.includes("://")?t:`http://${t}`)}catch{e.push(`${s}=${t}`);continue}const a=Number(o.port)||("https:"===o.protocol?443:o.protocol.startsWith("socks")?1080:80);await x(o.hostname,a)||e.push(`${s}=${t}`)}return 0===e.length?{name:t,status:"pass",message:[...o.keys()].join(", ")}:{name:t,status:"fail",message:l.t("doctor.proxy_dead",{proxies:e.join(", ")})}}()),$.text=l.t("doctor.check_api_key_network");const T=c.getApiKey(),v=l.t("doctor.api_key_network");if(T){const t=await d(T);t.valid?k.push({name:v,status:"pass"}):"invalid_api_key"===t.error?k.push({name:v,status:"fail",message:l.t("doctor.api_key_invalid")}):(k.push({name:v,status:"fail",message:`${l.t("doctor.network_error")}: ${t.message??t.error}`}),$.text=l.t("doctor.check_other_addresses"),k.push(await async function(){const t=l.t("doctor.other_addresses"),o=c.getBaseUrl(),e=y().filter(t=>t.url!==o),s=c.getApiKey(),a=await Promise.all(e.map(t=>w(t.url,{apiKey:s}))),r=e.filter((t,o)=>a[o].ok).map(t=>t.url);return 0===r.length?{name:t,status:"fail",message:l.t("doctor.other_addresses_none")}:{name:t,status:"warn",message:l.t("doctor.other_addresses_found",{urls:r.join(", ")})}}()))}else k.push({name:v,status:"fail",message:l.t("doctor.api_key_missing")});$.text=l.t("doctor.check_client_config");const A=await t();k.push({name:l.t("doctor.client_config"),status:"cloud"===A.source||"cache"===A.source&&!A.problem?"pass":"warn",message:[A.source?l.t(`refresh.source.${A.source}`):l.t("refresh.source.none"),A.revision?l.t("doctor.client_config_revision",{revision:A.revision}):"",A.problem??""].filter(Boolean).join(" · ")}),$.text=l.t("doctor.check_tools");const N=i.getInstalledTools();k.push({name:l.t("doctor.installed_tools"),status:N.length>0?"pass":"warn",message:N.length>0?N.map(t=>u(t)?.displayName??t).join(", "):l.t("doctor.no_tools_installed")}),k.push(...function(){const t=[];for(const o of i.getInstalledTools()){const e=u(o);if(!e?.installSpec)continue;const s=p(e.installSpec);if(0===s.length)continue;const a=[],r=i.outdatedVersion(o);r&&a.push(l.t("doctor.tool_outdated",{min:r.min})),s.length>1&&a.push(l.t("doctor.tool_duplicates",{others:s.slice(1).map(m).join("、")})),t.push({name:e.displayName,status:a.length>0?"warn":"pass",message:[m(s[0]),...a,...a.length>0?[l.t("doctor.run_upgrade",{tool:o})]:[]].join("\n ")})}return t}());const O=function(){if(!i.isToolInstalled("claude-code"))return null;const t=l.t("doctor.claude_config"),o=_();if(o.length>0){const e=o.map(t=>`${t.source}: ${t.keys.join(", ")}`).join("; ");return{name:t,status:"fail",message:l.t("doctor.claude_managed",{detail:e})}}let e={};try{e=JSON.parse(a(n(h(),".claude","settings.json"),"utf-8")).env??{}}catch{}const s=c.getApiKeyForTool("claude-code");return e.ANTHROPIC_AUTH_TOKEN&&e.ANTHROPIC_BASE_URL?e.ANTHROPIC_BASE_URL!==c.getBaseUrl()||s&&e.ANTHROPIC_AUTH_TOKEN!==s?{name:t,status:"warn",message:l.t("doctor.claude_config_changed")}:{name:t,status:"pass"}:{name:t,status:"warn",message:l.t("doctor.claude_not_configured")}}();O&&k.push(O),N.includes("claude-code")&&f()&&k.push({name:l.t("doctor.claude_login"),status:"pass",message:l.t("tools.claude_code.account_login_overridden")});const P=N.includes("codex")?g():null;N.includes("codex")&&k.push({name:l.t("doctor.codex_auth"),status:P?"fail":"pass",message:P?l.t(`doctor.codex_${P}`):void 0}),"win32"===process.platform&&N.includes("claude-code")&&!process.env.CLAUDE_CODE_GIT_BASH_PATH&&k.push({name:"Git for Windows",status:i.isGitInstalled()?"pass":"warn",message:i.isGitInstalled()?void 0:l.t("tools.claude_code.no_git_bash")}),r.deep&&N.includes("claude-code")&&($.text=l.t("doctor.check_claude_request"),k.push(function(){const t=l.t("doctor.claude_request"),o=p(u("claude-code").installSpec)[0];if(!o)return{name:t,status:"warn",message:l.t("doctor.claude_request_skipped")};const e={encoding:"utf-8",timeout:12e4,windowsHide:!0,stdio:["ignore","pipe","pipe"]},a=["-p","Reply with the single word OK."],r=/\.cmd$/i.test(o.path)?s(`"${o.path}" ${a.map(t=>`"${t}"`).join(" ")}`,{...e,shell:!0}):s(o.path,a,e),n=`${r.stdout??""}`.trim();if(0===r.status&&n)return{name:t,status:"pass",message:n.slice(0,80)};const c=(`${r.stderr??""}`.trim()||n||r.error?.message||`exit ${r.status}`).slice(0,300);return{name:t,status:"fail",message:l.t("doctor.claude_request_failed",{reason:c})}}())),$.stop(),console.log("\n"+o.bold(l.t("doctor.results_title"))+"\n");const H={pass:o.green("√"),warn:o.yellow("!"),fail:o.red("×")};for(const t of k)console.log(`${H[t.status]} ${t.name}`),t.message&&console.log(o.gray(` ${t.message}`));k.every(t=>"pass"===t.status)&&console.log("\n"+o.green.bold(l.t("doctor.all_good"))),!r.deep&&N.includes("claude-code")&&console.log(o.gray("\n"+l.t("doctor.deep_hint"))),k.some(t=>"fail"===t.status)&&(process.exitCode=1)}
@@ -7,3 +7,4 @@ export { logsCommand } from './logs.js';
7
7
  export { completionCommand } from './completion.js';
8
8
  export { benchCommand } from './bench.js';
9
9
  export { updateCommand } from './update.js';
10
+ export { refreshCommand } from './refresh.js';
@@ -1 +1 @@
1
- export{langCommand}from"./lang.js";export{authCommand}from"./auth.js";export{doctorCommand}from"./doctor.js";export{configCommand}from"./config.js";export{statusCommand}from"./status.js";export{logsCommand}from"./logs.js";export{completionCommand}from"./completion.js";export{benchCommand}from"./bench.js";export{updateCommand}from"./update.js";
1
+ export{langCommand}from"./lang.js";export{authCommand}from"./auth.js";export{doctorCommand}from"./doctor.js";export{configCommand}from"./config.js";export{statusCommand}from"./status.js";export{logsCommand}from"./logs.js";export{completionCommand}from"./completion.js";export{benchCommand}from"./bench.js";export{updateCommand}from"./update.js";export{refreshCommand}from"./refresh.js";
@@ -0,0 +1,5 @@
1
+ /**
2
+ * `vibecli refresh`:马上按网关当前的客户端配置和 Key 现在能用的模型重写各工具的菜单,不等
3
+ * 每小时一次的自动同步。Key 换了分组(之前用不了的模型现在能用了)、网关上新或下架后用。
4
+ */
5
+ export declare function refreshCommand(): Promise<void>;
@@ -0,0 +1 @@
1
+ import e from"chalk";import{refreshClientConfig as o}from"../lib/client-config-sync.js";import{i18n as r}from"../lib/i18n.js";import{runModelRefresh as s}from"../lib/model-refresh.js";export async function refreshCommand(){const t=await o({force:!0}),l=t.source?r.t(`refresh.source.${t.source}`):r.t("refresh.source.none");console.log(e.gray(r.t("refresh.config",{source:l,revision:t.revision||"-"}))+(t.problem?e.yellow(` ${r.t("refresh.problem",{problem:t.problem})}`):"")),0===(await s(["refresh"],{force:!0,output:e=>console.log(e)})).length&&console.log(e.green(r.t("refresh.up_to_date")))}
@@ -1,3 +1,4 @@
1
+ import { type GatewayClientModel } from './client-config.js';
1
2
  export interface ValidateApiKeyResult {
2
3
  valid: boolean;
3
4
  error?: 'network_error' | 'invalid_api_key' | 'unknown_error';
@@ -65,21 +66,12 @@ export declare function fetchKeyGroupInfo(apiKey: string, options?: {
65
66
  timeoutMs?: number;
66
67
  fetchFn?: typeof fetch;
67
68
  }): Promise<KeyGroupInfo | null>;
68
- /** One model row of the gateway's client config (`/api/platform/vibecode/config` → `models.<tool>[]`). */
69
- export interface GatewayClientModel {
70
- id: string;
71
- name?: string;
72
- description?: string;
73
- contextWindow?: number;
74
- autoCompactTokens?: number;
75
- /** Taken off by the gateway: not listed, and keeps the built-in entry of the same id out too. */
76
- hidden?: boolean;
77
- }
69
+ export type { GatewayClientModel } from './client-config.js';
78
70
  /**
79
- * 拉取网关下发给编码客户端的模型清单(公开接口,无需鉴权):每个工具的模型、名称、说明、
80
- * 上下文窗口与压缩阈值,站长改了即时生效。老网关没有这个接口,任何失败都返回 null,
81
- * 调用方回退到 models.json 里的内置清单。隐藏的模型只留 id 和 `hidden` 标记:不列出,
82
- * 也挡住内置清单里的同名条目。
71
+ * 网关下发给编码客户端的模型清单(`/api/platform/vibecode/config` → `models`),经
72
+ * client-config-sync.ts 校验、缓存、保底后,再按本机的版本门槛与灰度过滤(看不到的行变成
73
+ * `hidden`,同名内置条目也一并挡住)。网关没有这份配置或拉取失败时用上次缓存 / 随包快照;
74
+ * 都没有时返回 null,调用方用 models.json 里的内置清单。
83
75
  */
84
76
  export declare function fetchClientModelConfig(options?: {
85
77
  timeoutMs?: number;
@@ -89,4 +81,3 @@ export declare function fetchClientModelConfig(options?: {
89
81
  * 验证 API Key 的有效性和网络连通性,遇到网络错误时按指数退避重试
90
82
  */
91
83
  export declare function validateApiKey(apiKey: string, options?: ValidateOptions): Promise<ValidateApiKeyResult>;
92
- export {};