@aizoo321/cli 0.0.169 → 0.0.172

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.
@@ -24,7 +24,8 @@
24
24
  "claude-sonnet-5-5",
25
25
  "claude-haiku-5-5",
26
26
  "claude-fable-5",
27
- "claude-fable-5-1"
27
+ "claude-fable-5-1",
28
+ "claude-fable-5-2"
28
29
  ],
29
30
  "retired_default_models": {
30
31
  "opus": [
@@ -47,6 +48,7 @@
47
48
  ],
48
49
  "tier_chains": {
49
50
  "fable": [
51
+ "claude-fable-5-2",
50
52
  "claude-fable-5-1",
51
53
  "claude-fable-5",
52
54
  "claude-opus-5-5",
@@ -186,6 +188,46 @@
186
188
  "name": "Claude Sonnet 5.5",
187
189
  "recommended": false
188
190
  },
191
+ {
192
+ "capabilities": {
193
+ "contextWindowTokens": 1000000,
194
+ "functionCall": true,
195
+ "imageOutput": false,
196
+ "inputModalities": [
197
+ "text",
198
+ "image"
199
+ ],
200
+ "knowledgeCutoff": "2026-06-30",
201
+ "maxOutput": 128000,
202
+ "outputModalities": [
203
+ "text"
204
+ ],
205
+ "reasoning": true,
206
+ "reasoningEfforts": [
207
+ "low",
208
+ "medium",
209
+ "high",
210
+ "xhigh",
211
+ "max"
212
+ ],
213
+ "structuredOutput": true,
214
+ "video": false,
215
+ "vision": true
216
+ },
217
+ "context_window": 1000000,
218
+ "description": "100 万上下文 | 高难度推理 | 长时 Agent 与多步研究",
219
+ "endpoint_types": [
220
+ "anthropic",
221
+ "openai"
222
+ ],
223
+ "group": "",
224
+ "group_name": "",
225
+ "hidden": false,
226
+ "id": "claude-fable-5-2",
227
+ "max_output_tokens": 128000,
228
+ "name": "Claude Fable 5.2",
229
+ "recommended": false
230
+ },
189
231
  {
190
232
  "capabilities": {
191
233
  "contextWindowTokens": 1000000,
@@ -522,8 +564,8 @@
522
564
  "context_window": 1000000,
523
565
  "description": "100 万上下文 | 跨文件重构",
524
566
  "endpoint_types": [
525
- "anthropic",
526
- "openai"
567
+ "openai",
568
+ "anthropic"
527
569
  ],
528
570
  "group": "",
529
571
  "group_name": "",
@@ -632,8 +674,8 @@
632
674
  "context_window": 1000000,
633
675
  "description": "100 万上下文 | 高速档",
634
676
  "endpoint_types": [
635
- "anthropic",
636
- "openai"
677
+ "openai",
678
+ "anthropic"
637
679
  ],
638
680
  "group": "",
639
681
  "group_name": "",
@@ -667,8 +709,7 @@
667
709
  "context_window": 1048576,
668
710
  "description": "105 万上下文 | 代码 Agent",
669
711
  "endpoint_types": [
670
- "openai",
671
- "anthropic"
712
+ "openai"
672
713
  ],
673
714
  "group": "",
674
715
  "group_name": "",
@@ -704,8 +745,7 @@
704
745
  "context_window": 1048576,
705
746
  "description": "105 万上下文 | 高速档",
706
747
  "endpoint_types": [
707
- "openai",
708
- "anthropic"
748
+ "openai"
709
749
  ],
710
750
  "group": "",
711
751
  "group_name": "",
@@ -739,8 +779,8 @@
739
779
  "context_window": 1000000,
740
780
  "description": "100 万上下文 | 编程",
741
781
  "endpoint_types": [
742
- "anthropic",
743
- "openai"
782
+ "openai",
783
+ "anthropic"
744
784
  ],
745
785
  "group": "",
746
786
  "group_name": "",
@@ -851,7 +891,6 @@
851
891
  "context_window": 1000000,
852
892
  "description": "100 万上下文 | 视觉理解",
853
893
  "endpoint_types": [
854
- "anthropic",
855
894
  "openai"
856
895
  ],
857
896
  "group": "",
@@ -917,8 +956,8 @@
917
956
  "context_window": 1000000,
918
957
  "description": "100 万上下文 | 推理 | 编程",
919
958
  "endpoint_types": [
920
- "anthropic",
921
- "openai"
959
+ "openai",
960
+ "anthropic"
922
961
  ],
923
962
  "group": "",
924
963
  "group_name": "",
@@ -949,8 +988,8 @@
949
988
  "context_window": 1000000,
950
989
  "description": "100 万上下文 | 均衡档",
951
990
  "endpoint_types": [
952
- "anthropic",
953
- "openai"
991
+ "openai",
992
+ "anthropic"
954
993
  ],
955
994
  "group": "",
956
995
  "group_name": "",
@@ -1356,8 +1395,8 @@
1356
1395
  "context_window": 1000000,
1357
1396
  "description": "100 万上下文 | 跨文件重构",
1358
1397
  "endpoint_types": [
1359
- "anthropic",
1360
- "openai"
1398
+ "openai",
1399
+ "anthropic"
1361
1400
  ],
1362
1401
  "group": "",
1363
1402
  "group_name": "",
@@ -1466,8 +1505,8 @@
1466
1505
  "context_window": 1000000,
1467
1506
  "description": "100 万上下文 | 高速档",
1468
1507
  "endpoint_types": [
1469
- "anthropic",
1470
- "openai"
1508
+ "openai",
1509
+ "anthropic"
1471
1510
  ],
1472
1511
  "group": "",
1473
1512
  "group_name": "",
@@ -1501,8 +1540,7 @@
1501
1540
  "context_window": 1048576,
1502
1541
  "description": "105 万上下文 | 代码 Agent",
1503
1542
  "endpoint_types": [
1504
- "openai",
1505
- "anthropic"
1543
+ "openai"
1506
1544
  ],
1507
1545
  "group": "",
1508
1546
  "group_name": "",
@@ -1538,8 +1576,7 @@
1538
1576
  "context_window": 1048576,
1539
1577
  "description": "105 万上下文 | 高速档",
1540
1578
  "endpoint_types": [
1541
- "openai",
1542
- "anthropic"
1579
+ "openai"
1543
1580
  ],
1544
1581
  "group": "",
1545
1582
  "group_name": "",
@@ -1573,8 +1610,8 @@
1573
1610
  "context_window": 1000000,
1574
1611
  "description": "100 万上下文 | 编程",
1575
1612
  "endpoint_types": [
1576
- "anthropic",
1577
- "openai"
1613
+ "openai",
1614
+ "anthropic"
1578
1615
  ],
1579
1616
  "group": "",
1580
1617
  "group_name": "",
@@ -1685,7 +1722,6 @@
1685
1722
  "context_window": 1000000,
1686
1723
  "description": "100 万上下文 | 视觉理解",
1687
1724
  "endpoint_types": [
1688
- "anthropic",
1689
1725
  "openai"
1690
1726
  ],
1691
1727
  "group": "",
@@ -1751,8 +1787,8 @@
1751
1787
  "context_window": 1000000,
1752
1788
  "description": "100 万上下文 | 推理 | 编程",
1753
1789
  "endpoint_types": [
1754
- "anthropic",
1755
- "openai"
1790
+ "openai",
1791
+ "anthropic"
1756
1792
  ],
1757
1793
  "group": "",
1758
1794
  "group_name": "",
@@ -1783,8 +1819,8 @@
1783
1819
  "context_window": 1000000,
1784
1820
  "description": "100 万上下文 | 均衡档",
1785
1821
  "endpoint_types": [
1786
- "anthropic",
1787
- "openai"
1822
+ "openai",
1823
+ "anthropic"
1788
1824
  ],
1789
1825
  "group": "",
1790
1826
  "group_name": "",
@@ -2144,7 +2180,7 @@
2144
2180
  "tool": "gemini"
2145
2181
  }
2146
2182
  ],
2147
- "revision": "2026-11-03T15:29:29Z-12",
2183
+ "revision": "2026-11-10T00:13:23Z-14",
2148
2184
  "schema": 1,
2149
2185
  "tools": {
2150
2186
  "claude": {
package/dist/cli.js CHANGED
@@ -1,2 +1,2 @@
1
1
  #!/usr/bin/env node
2
- if(Number(process.versions.node.split(".")[0])<20){const{brand:e}=await import("./lib/brand.js"),r=e().productName;console.error(`无法启动 ${r}:需要 Node.js 20 或更高版本,当前是 v${process.versions.node}。\n请安装 Node.js LTS 版(国内镜像:https://registry.npmmirror.com/binary.html?path=node/ ,也可以运行 nvm install --lts),安装后重新打开终端再运行。\n${r} needs Node.js 20 or later (found v${process.versions.node}); install the LTS release and open a new terminal.`),process.exit(1)}const{Command:e}=await import("./lib/command.js"),{logger:r}=await import("./utils/logger.js"),{reportCliError:o}=await import("./lib/errors.js"),{telemetryPending:s}=await import("./lib/telemetry.js");try{await(new e).execute(process.argv.slice(2))}catch(e){r.logError("CLI",e),o(e)}s()&&process.exit();export{};
2
+ if(Number(process.versions.node.split(".")[0])<20){const{brand:e}=await import("./lib/brand.js"),r=e().productName;console.error(`无法启动 ${r}:需要 Node.js 20 或更高版本,当前是 v${process.versions.node}。\n请安装 Node.js LTS 版(国内镜像:https://registry.npmmirror.com/binary.html?path=node/ ,也可以运行 nvm install --lts),安装后重新打开终端再运行。\n${r} needs Node.js 20 or later (found v${process.versions.node}); install the LTS release and open a new terminal.`),process.exit(1)}const{Command:e}=await import("./lib/command.js"),{logger:r}=await import("./utils/logger.js"),{reportCliError:o}=await import("./lib/errors.js"),{telemetryPending:s,reportCrash:t}=await import("./lib/telemetry.js");let n=!1;const i=e=>{n&&process.exit(1),n=!0,process.exitCode=1,console.error(e instanceof Error?e.stack??e.message:e);try{r.logError("CLI crash",e)}catch{}t(e).finally(()=>process.exit(1))};process.on("uncaughtException",i),process.on("unhandledRejection",i);try{await(new e).execute(process.argv.slice(2))}catch(e){r.logError("CLI",e),o(e)}s()&&process.exit();export{};
@@ -24,7 +24,8 @@
24
24
  "claude-sonnet-5-5",
25
25
  "claude-haiku-5-5",
26
26
  "claude-fable-5",
27
- "claude-fable-5-1"
27
+ "claude-fable-5-1",
28
+ "claude-fable-5-2"
28
29
  ],
29
30
  "retired_default_models": {
30
31
  "opus": [
@@ -47,6 +48,7 @@
47
48
  ],
48
49
  "tier_chains": {
49
50
  "fable": [
51
+ "claude-fable-5-2",
50
52
  "claude-fable-5-1",
51
53
  "claude-fable-5",
52
54
  "claude-opus-5-5",
@@ -186,6 +188,46 @@
186
188
  "name": "Claude Sonnet 5.5",
187
189
  "recommended": false
188
190
  },
191
+ {
192
+ "capabilities": {
193
+ "contextWindowTokens": 1000000,
194
+ "functionCall": true,
195
+ "imageOutput": false,
196
+ "inputModalities": [
197
+ "text",
198
+ "image"
199
+ ],
200
+ "knowledgeCutoff": "2026-06-30",
201
+ "maxOutput": 128000,
202
+ "outputModalities": [
203
+ "text"
204
+ ],
205
+ "reasoning": true,
206
+ "reasoningEfforts": [
207
+ "low",
208
+ "medium",
209
+ "high",
210
+ "xhigh",
211
+ "max"
212
+ ],
213
+ "structuredOutput": true,
214
+ "video": false,
215
+ "vision": true
216
+ },
217
+ "context_window": 1000000,
218
+ "description": "100 万上下文 | 高难度推理 | 长时 Agent 与多步研究",
219
+ "endpoint_types": [
220
+ "anthropic",
221
+ "openai"
222
+ ],
223
+ "group": "",
224
+ "group_name": "",
225
+ "hidden": false,
226
+ "id": "claude-fable-5-2",
227
+ "max_output_tokens": 128000,
228
+ "name": "Claude Fable 5.2",
229
+ "recommended": false
230
+ },
189
231
  {
190
232
  "capabilities": {
191
233
  "contextWindowTokens": 1000000,
@@ -522,8 +564,8 @@
522
564
  "context_window": 1000000,
523
565
  "description": "100 万上下文 | 跨文件重构",
524
566
  "endpoint_types": [
525
- "anthropic",
526
- "openai"
567
+ "openai",
568
+ "anthropic"
527
569
  ],
528
570
  "group": "",
529
571
  "group_name": "",
@@ -632,8 +674,8 @@
632
674
  "context_window": 1000000,
633
675
  "description": "100 万上下文 | 高速档",
634
676
  "endpoint_types": [
635
- "anthropic",
636
- "openai"
677
+ "openai",
678
+ "anthropic"
637
679
  ],
638
680
  "group": "",
639
681
  "group_name": "",
@@ -667,8 +709,7 @@
667
709
  "context_window": 1048576,
668
710
  "description": "105 万上下文 | 代码 Agent",
669
711
  "endpoint_types": [
670
- "openai",
671
- "anthropic"
712
+ "openai"
672
713
  ],
673
714
  "group": "",
674
715
  "group_name": "",
@@ -704,8 +745,7 @@
704
745
  "context_window": 1048576,
705
746
  "description": "105 万上下文 | 高速档",
706
747
  "endpoint_types": [
707
- "openai",
708
- "anthropic"
748
+ "openai"
709
749
  ],
710
750
  "group": "",
711
751
  "group_name": "",
@@ -739,8 +779,8 @@
739
779
  "context_window": 1000000,
740
780
  "description": "100 万上下文 | 编程",
741
781
  "endpoint_types": [
742
- "anthropic",
743
- "openai"
782
+ "openai",
783
+ "anthropic"
744
784
  ],
745
785
  "group": "",
746
786
  "group_name": "",
@@ -851,7 +891,6 @@
851
891
  "context_window": 1000000,
852
892
  "description": "100 万上下文 | 视觉理解",
853
893
  "endpoint_types": [
854
- "anthropic",
855
894
  "openai"
856
895
  ],
857
896
  "group": "",
@@ -917,8 +956,8 @@
917
956
  "context_window": 1000000,
918
957
  "description": "100 万上下文 | 推理 | 编程",
919
958
  "endpoint_types": [
920
- "anthropic",
921
- "openai"
959
+ "openai",
960
+ "anthropic"
922
961
  ],
923
962
  "group": "",
924
963
  "group_name": "",
@@ -949,8 +988,8 @@
949
988
  "context_window": 1000000,
950
989
  "description": "100 万上下文 | 均衡档",
951
990
  "endpoint_types": [
952
- "anthropic",
953
- "openai"
991
+ "openai",
992
+ "anthropic"
954
993
  ],
955
994
  "group": "",
956
995
  "group_name": "",
@@ -1356,8 +1395,8 @@
1356
1395
  "context_window": 1000000,
1357
1396
  "description": "100 万上下文 | 跨文件重构",
1358
1397
  "endpoint_types": [
1359
- "anthropic",
1360
- "openai"
1398
+ "openai",
1399
+ "anthropic"
1361
1400
  ],
1362
1401
  "group": "",
1363
1402
  "group_name": "",
@@ -1466,8 +1505,8 @@
1466
1505
  "context_window": 1000000,
1467
1506
  "description": "100 万上下文 | 高速档",
1468
1507
  "endpoint_types": [
1469
- "anthropic",
1470
- "openai"
1508
+ "openai",
1509
+ "anthropic"
1471
1510
  ],
1472
1511
  "group": "",
1473
1512
  "group_name": "",
@@ -1501,8 +1540,7 @@
1501
1540
  "context_window": 1048576,
1502
1541
  "description": "105 万上下文 | 代码 Agent",
1503
1542
  "endpoint_types": [
1504
- "openai",
1505
- "anthropic"
1543
+ "openai"
1506
1544
  ],
1507
1545
  "group": "",
1508
1546
  "group_name": "",
@@ -1538,8 +1576,7 @@
1538
1576
  "context_window": 1048576,
1539
1577
  "description": "105 万上下文 | 高速档",
1540
1578
  "endpoint_types": [
1541
- "openai",
1542
- "anthropic"
1579
+ "openai"
1543
1580
  ],
1544
1581
  "group": "",
1545
1582
  "group_name": "",
@@ -1573,8 +1610,8 @@
1573
1610
  "context_window": 1000000,
1574
1611
  "description": "100 万上下文 | 编程",
1575
1612
  "endpoint_types": [
1576
- "anthropic",
1577
- "openai"
1613
+ "openai",
1614
+ "anthropic"
1578
1615
  ],
1579
1616
  "group": "",
1580
1617
  "group_name": "",
@@ -1685,7 +1722,6 @@
1685
1722
  "context_window": 1000000,
1686
1723
  "description": "100 万上下文 | 视觉理解",
1687
1724
  "endpoint_types": [
1688
- "anthropic",
1689
1725
  "openai"
1690
1726
  ],
1691
1727
  "group": "",
@@ -1751,8 +1787,8 @@
1751
1787
  "context_window": 1000000,
1752
1788
  "description": "100 万上下文 | 推理 | 编程",
1753
1789
  "endpoint_types": [
1754
- "anthropic",
1755
- "openai"
1790
+ "openai",
1791
+ "anthropic"
1756
1792
  ],
1757
1793
  "group": "",
1758
1794
  "group_name": "",
@@ -1783,8 +1819,8 @@
1783
1819
  "context_window": 1000000,
1784
1820
  "description": "100 万上下文 | 均衡档",
1785
1821
  "endpoint_types": [
1786
- "anthropic",
1787
- "openai"
1822
+ "openai",
1823
+ "anthropic"
1788
1824
  ],
1789
1825
  "group": "",
1790
1826
  "group_name": "",
@@ -2144,7 +2180,7 @@
2144
2180
  "tool": "gemini"
2145
2181
  }
2146
2182
  ],
2147
- "revision": "2026-11-03T15:29:29Z-12",
2183
+ "revision": "2026-11-10T00:13:23Z-14",
2148
2184
  "schema": 1,
2149
2185
  "tools": {
2150
2186
  "claude": {
@@ -1 +1 @@
1
- import{getGatewayModelRules as e}from"./model-registry.js";export function autoCompactTokens(t,o){return o&&o>0?Math.min(o,t):Math.floor(t*e().autoCompactRatio)}export function gatewayModelSpecs(o,i,d=[]){const n=e().models,c=n.filter(e=>function(e,t){return"codebuddy"===e||("codex"===e?!1!==t.codex:"grok"===e?"grok"===modelFamily(t.id):!t.id.startsWith("claude-")&&!1!==t.claudeCode)}(o,e));if(!i)return c;const r=new Set(Object.values(i).flat().filter(e=>e.hidden).map(e=>e.id)),l=Object.fromEntries(Object.entries(i).map(([e,t])=>[e,t.filter(e=>!e.hidden)])),s=new Map;for(const e of Object.values(l).flat()){const t=e.clients?.[o];void 0===t||s.has(e.id)||s.set(e.id,t)}for(const[e,t]of s)t||r.add(e);const a=new Map(("claude-code"===o?n:c).map(e=>[e.id,e])),u=(l.gemini??[]).filter(e=>s.get(e.id)??!1!==n.find(t=>t.id===e.id)?.codex),f=("codebuddy"===o?[...l.claude??[],...l.codex??[],...l.gemini??[],...l.grok??[]]:"grok"===o?l.grok??[]:"codex"===o?[...l.codex??[],...u,...(l.claude??[]).filter(e=>e.id.startsWith("claude-")&&(s.get(e.id)??a.has(e.id)))]:function(e,t){return[...(e.codex??[]).filter(e=>"gpt"===modelFamily(e.id)),...e.gemini??[],...e.grok??[],...(e.claude??[]).filter(e=>!e.id.startsWith("claude-"))].filter(e=>e.clients?.["claude-code"]??t.get(e.id)?.claudeCode??!0)}(l,a)).filter(e=>!(e=>!1===s.get(e.id))(e));if(0===f.length)return c.filter(e=>!r.has(e.id));const m=new Set,g=[];for(const e of f){if(m.has(e.id))continue;m.add(e.id);const{clients:t,minClientVersion:o,rolloutPercent:i,...d}=e,n={...a.get(e.id),...d};void 0!==t?.codex&&(n.codex=t.codex),void 0!==t?.["claude-code"]&&(n.claudeCode=t["claude-code"]),g.push(n)}return t[o].some(e=>d.includes(e))?g:function(e,t,o){const i=[...e];return t.forEach((e,d)=>{if(o.has(e.id)||i.some(t=>t.id===e.id))return;const n=modelFamily(e.id),c=new Set(t.slice(d+1).filter(e=>modelFamily(e.id)===n).map(e=>e.id));let r=i.findIndex(e=>c.has(e.id));if(r<0){r=i.length;for(let e=i.length-1;e>=0;e--)if(modelFamily(i[e].id)===n){r=e+1;break}}i.splice(r,0,e)}),i}(g,c,r)}const t={grok:["grok"],codex:["codex","gemini","claude"],"claude-code":["codex","gemini","grok","claude"],codebuddy:["claude","codex","gemini","grok"]},o={gpt:"GPT",gemini:"Gemini",glm:"GLM",deepseek:"DeepSeek",minimax:"MiniMax",qwen:"Qwen"};export function modelBlurb(e,t={}){const o=[];for(const i of(e??"").split("|")){const e=i.trim();e&&(/\d\s*万?\s*输出|output\D*\d|\d\D*output/i.test(e)||(/[\d百千]\s*万?\s*上下文|context\D*\d|\d\D*context/i.test(e)?t.millionContext&&!o.includes("百万上下文")&&o.unshift("百万上下文"):o.push(e)))}return t.millionContext&&!o.includes("百万上下文")&&o.unshift("百万上下文"),o.length>0?o.join(" | "):void 0}export function prettyModelName(e){const t=e.replace(/^([a-z]+)(\d)/i,"$1 $2").split(/[-_\s]+/).filter(Boolean),i=[];for(const e of t){const t=i[i.length-1];if(/^\d+$/.test(e)&&t&&/^\d+$/.test(t)&&e.length<=2&&!/^\d{8}$/.test(e)){i[i.length-1]=`${t}.${e}`;continue}const d=e.toLowerCase();i.push(o[d]??(/^[a-z]\d/i.test(e)?e.toUpperCase():e[0].toUpperCase()+e.slice(1)))}return i.join(" ")}export function vendorNames(e){return[...new Set(e.map(e=>prettyModelName(e).split(" ")[0]))]}export function modelFamily(e){const t=e.toLowerCase();return t.startsWith("claude-")?"claude":t.startsWith("gemini")?"gemini":t.startsWith("grok")?"grok":/^(gpt|o\d|codex)/.test(t)?"gpt":"other"}
1
+ import{getGatewayModelRules as e}from"./model-registry.js";export function autoCompactTokens(t,o){return o&&o>0?Math.min(o,t):Math.floor(t*e().autoCompactRatio)}export function gatewayModelSpecs(o,i,d=[]){const n=e().models,c=n.filter(e=>function(e,t){return"codebuddy"===e||("codex"===e?!1!==t.codex:"grok"===e?"grok"===modelFamily(t.id):!t.id.startsWith("claude-")&&!1!==t.claudeCode)}(o,e));if(!i)return c;const r=new Set(Object.values(i).flat().filter(e=>e.hidden).map(e=>e.id)),l=Object.fromEntries(Object.entries(i).map(([e,t])=>[e,t.filter(e=>!e.hidden)])),s=new Map;for(const e of Object.values(l).flat()){const t="codex"===o&&"gpt"===modelFamily(e.id)?void 0:e.clients?.[o];void 0===t||s.has(e.id)||s.set(e.id,t)}for(const[e,t]of s)t||r.add(e);const a=new Map(("claude-code"===o?n:c).map(e=>[e.id,e])),u=(l.gemini??[]).filter(e=>s.get(e.id)??!1!==n.find(t=>t.id===e.id)?.codex),m=("codebuddy"===o?[...l.claude??[],...l.codex??[],...l.gemini??[],...l.grok??[]]:"grok"===o?l.grok??[]:"codex"===o?[...l.codex??[],...u,...(l.claude??[]).filter(e=>e.id.startsWith("claude-")&&(s.get(e.id)??a.has(e.id)))]:function(e,t){return[...(e.codex??[]).filter(e=>"gpt"===modelFamily(e.id)),...e.gemini??[],...e.grok??[],...(e.claude??[]).filter(e=>!e.id.startsWith("claude-"))].filter(e=>e.clients?.["claude-code"]??t.get(e.id)?.claudeCode??!0)}(l,a)).filter(e=>!(e=>!1===s.get(e.id))(e));if(0===m.length)return c.filter(e=>!r.has(e.id));const f=new Set,g=[];for(const e of m){if(f.has(e.id))continue;f.add(e.id);const{clients:t,minClientVersion:o,rolloutPercent:i,...d}=e,n={...a.get(e.id),...d};void 0!==t?.codex&&(n.codex=t.codex),void 0!==t?.["claude-code"]&&(n.claudeCode=t["claude-code"]),g.push(n)}return t[o].some(e=>d.includes(e))?g:function(e,t,o){const i=[...e];return t.forEach((e,d)=>{if(o.has(e.id)||i.some(t=>t.id===e.id))return;const n=modelFamily(e.id),c=new Set(t.slice(d+1).filter(e=>modelFamily(e.id)===n).map(e=>e.id));let r=i.findIndex(e=>c.has(e.id));if(r<0){r=i.length;for(let e=i.length-1;e>=0;e--)if(modelFamily(i[e].id)===n){r=e+1;break}}i.splice(r,0,e)}),i}(g,c,r)}const t={grok:["grok"],codex:["codex","gemini","claude"],"claude-code":["codex","gemini","grok","claude"],codebuddy:["claude","codex","gemini","grok"]},o={gpt:"GPT",gemini:"Gemini",glm:"GLM",deepseek:"DeepSeek",minimax:"MiniMax",qwen:"Qwen"};export function modelBlurb(e,t={}){const o=[];for(const i of(e??"").split("|")){const e=i.trim();e&&(/\d\s*万?\s*输出|output\D*\d|\d\D*output/i.test(e)||(/[\d百千]\s*万?\s*上下文|context\D*\d|\d\D*context/i.test(e)?t.millionContext&&!o.includes("百万上下文")&&o.unshift("百万上下文"):o.push(e)))}return t.millionContext&&!o.includes("百万上下文")&&o.unshift("百万上下文"),o.length>0?o.join(" | "):void 0}export function prettyModelName(e){const t=e.replace(/^([a-z]+)(\d)/i,"$1 $2").split(/[-_\s]+/).filter(Boolean),i=[];for(const e of t){const t=i[i.length-1];if(/^\d+$/.test(e)&&t&&/^\d+$/.test(t)&&e.length<=2&&!/^\d{8}$/.test(e)){i[i.length-1]=`${t}.${e}`;continue}const d=e.toLowerCase();i.push(o[d]??(/^[a-z]\d/i.test(e)?e.toUpperCase():e[0].toUpperCase()+e.slice(1)))}return i.join(" ")}export function vendorNames(e){return[...new Set(e.map(e=>prettyModelName(e).split(" ")[0]))]}export function modelFamily(e){const t=e.toLowerCase();return t.startsWith("claude-")?"claude":t.startsWith("gemini")?"gemini":t.startsWith("grok")?"grok":/^(gpt|o\d|codex)/.test(t)?"gpt":"other"}
@@ -1 +1 @@
1
- import{randomUUID as e}from"crypto";import{arch as t,homedir as r,release as o}from"os";import{format as n,stripVTControlCharacters as s}from"util";import{brand as a,brandEnv as i,CLI_NAME as c}from"./brand.js";import{clientVersion as l,installId as u}from"./client-config.js";import{configManager as p}from"./config.js";import{gatewayAddresses as f}from"./gateway-addresses.js";import{INSTALL_ID_HEADER as m,REPORT_PATH as d,TELEMETRY_PATH as g}from"./gateway-protocol.js";const h=e();let w="wizard",y=[];const T=new Set;let S=null,x=v;export function telemetryEnabled(){if(process.env.VITEST&&!k)return!1;const e=i("TELEMETRY")?.trim().toLowerCase();return!("0"===e||"false"===e||"off"===e)}let $,k=!1;export function setTelemetrySenderForTests(e){x=e??v,k=null!==e,y=[]}export function clientHeaders(){const e=`${c}/${l()} (${process.platform} ${o()}; ${t()}) node/${process.versions.node}`;return telemetryEnabled()?{"User-Agent":e,[m]:u()}:{"User-Agent":e}}export function installClientHeaders(){const e=globalThis.fetch;if(!e||e.gatewayHeaders)return;const t=(t,r)=>{try{const o=new URL("string"==typeof t||t instanceof URL?t.toString():t.url);if(new Set([p.getBaseUrl(),...f().map(e=>e.url)].map(e=>new URL(e).host)).has(o.host)){const o=new Headers(r?.headers??(t instanceof Request?t.headers:void 0));for(const[e,t]of Object.entries(clientHeaders()))o.has(e)||o.set(e,t);return e(t,{...r,headers:o})}}catch{}return e(t,r)};t.gatewayHeaders=!0,globalThis.fetch=t}export function telemetryPending(){return T.size>0}function _(){return{install_id:u(),cli_version:l(),brand:a().id,os:process.platform,os_release:o(),arch:t(),node_version:process.versions.node}}export function maskHome(e){const t=r();if(!t||t.length<2)return e;const o=new Set([t,t.replace(/\\/g,"/")]);let n=e;for(const e of o)n=n.split(e).join("~");return n}export function maskSecrets(e){return maskHome(e).replace(/(sk-[A-Za-z0-9_-]{2})[A-Za-z0-9_-]{8,}([A-Za-z0-9_-]{4})\b/g,"$1…$2").replace(/(Bearer\s+)[A-Za-z0-9._~+/=-]{8,}/gi,"$1…").replace(/(\b[a-z][a-z0-9+.-]*:\/\/)\S*@/gi,"$1…@").replace(/[^\s/@:]+:[^\s/]*@(?=[a-z0-9.-]+)/gi,"…@").replace(/\b((?:api[_-]?key|token|password|passwd|secret|auth)\s*[=:]\s*)("?)[^\s"&;,]{6,}\2/gi,"$1$2…$2")}let b=!1;export function noteFailureReason(e){const t=s(e).split("\n").map(e=>e.trim()).filter(Boolean).pop();t&&($=t)}export function lastFailureReason(){return $}export function watchConsoleErrors(){if(b)return;b=!0;const e=console.error;console.error=(...t)=>{noteFailureReason(n(...t)),e.apply(console,t)}}export function setTelemetryCommand(e){w=e}export function track(e,t,r={}){if(!telemetryEnabled())return;const o=void 0===r.error?void 0:maskSecrets(r.error instanceof Error?r.error.message:String(r.error)).slice(0,2e3);y.push({ts:Date.now(),session:h,command:w,step:e,status:t,...void 0!==r.duration_ms?{duration_ms:Math.round(r.duration_ms)}:{},...o?{error:o}:{},...r.detail?{detail:r.detail}:{}}),"start"===t?z():S||(S=setTimeout(z,500),S.unref())}export async function trackStep(e,t,r){const o=Date.now();track(e,"start",r?{detail:r}:{});try{const r=await t();return track(e,"ok",{duration_ms:Date.now()-o}),r}catch(t){throw track(e,"fail",{duration_ms:Date.now()-o,error:t}),t}}function z(){if(S&&(clearTimeout(S),S=null),0===y.length)return;const e=y.splice(0,50),t=x(g,{..._(),events:e},3e3).then(()=>{},()=>{}).finally(()=>T.delete(t));T.add(t),y.length>0&&z()}export async function flushTelemetry(e=1500){z(),0!==T.size&&await Promise.race([Promise.allSettled([...T]),new Promise(t=>setTimeout(t,e).unref())])}export async function uploadReport(e){try{const t=await x(d,{..._(),report:e},2e4),r=t?.data?.code;return"string"==typeof r&&r?r:null}catch{return null}}async function v(e,t,r){const o=p.getApiKey()?.trim(),n=await fetch(new URL(e,p.getBaseUrl()).toString(),{method:"POST",headers:{"Content-Type":"application/json",...clientHeaders(),...o?{Authorization:`Bearer ${o}`}:{}},body:JSON.stringify(t),signal:AbortSignal.timeout(r)});if(!n.ok)throw new Error(`HTTP ${n.status}`);return n.json().catch(()=>null)}
1
+ import{randomUUID as e}from"crypto";import{arch as t,homedir as r,release as o}from"os";import{format as n,stripVTControlCharacters as s}from"util";import{brand as a,brandEnv as i,CLI_NAME as c}from"./brand.js";import{clientVersion as l,installId as u}from"./client-config.js";import{configManager as p}from"./config.js";import{gatewayAddresses as f}from"./gateway-addresses.js";import{INSTALL_ID_HEADER as d,REPORT_PATH as m,TELEMETRY_PATH as h}from"./gateway-protocol.js";const g=e();let y="wizard",w=[];const T=new Set;let k=null,x=E;export function telemetryEnabled(){if(process.env.VITEST&&!$)return!1;const e=i("TELEMETRY")?.trim().toLowerCase();return!("0"===e||"false"===e||"off"===e)}let S,$=!1;export function setTelemetrySenderForTests(e){x=e??E,$=null!==e,w=[]}export function clientHeaders(){const e=`${c}/${l()} (${process.platform} ${o()}; ${t()}) node/${process.versions.node}`;return telemetryEnabled()?{"User-Agent":e,[d]:u()}:{"User-Agent":e}}export function installClientHeaders(){const e=globalThis.fetch;if(!e||e.gatewayHeaders)return;const t=(t,r)=>{try{const o=new URL("string"==typeof t||t instanceof URL?t.toString():t.url);if(new Set([p.getBaseUrl(),...f().map(e=>e.url)].map(e=>new URL(e).host)).has(o.host)){const o=new Headers(r?.headers??(t instanceof Request?t.headers:void 0));for(const[e,t]of Object.entries(clientHeaders()))o.has(e)||o.set(e,t);return e(t,{...r,headers:o})}}catch{}return e(t,r)};t.gatewayHeaders=!0,globalThis.fetch=t}export function telemetryPending(){return T.size>0}function _(){return{install_id:u(),cli_version:l(),brand:a().id,os:process.platform,os_release:o(),arch:t(),node_version:process.versions.node}}export function maskHome(e){const t=r();if(!t||t.length<2)return e;const o=new Set([t,t.replace(/\\/g,"/")]);let n=e;for(const e of o)n=n.split(e).join("~");return n}export function maskSecrets(e){return maskHome(e).replace(/(sk-[A-Za-z0-9_-]{2})[A-Za-z0-9_-]{8,}([A-Za-z0-9_-]{4})\b/g,"$1…$2").replace(/(Bearer\s+)[A-Za-z0-9._~+/=-]{8,}/gi,"$1…").replace(/(\b[a-z][a-z0-9+.-]*:\/\/)\S*@/gi,"$1…@").replace(/[^\s/@:]+:[^\s/]*@(?=[a-z0-9.-]+)/gi,"…@").replace(/\b((?:api[_-]?key|token|password|passwd|secret|auth)\s*[=:]\s*)("?)[^\s"&;,]{6,}\2/gi,"$1$2…$2")}let b=!1;export function noteFailureReason(e){const t=s(e).split("\n").map(e=>e.trim()).filter(Boolean).pop();t&&(S=t)}export function lastFailureReason(){return S}export function watchConsoleErrors(){if(b)return;b=!0;const e=console.error;console.error=(...t)=>{noteFailureReason(n(...t)),e.apply(console,t)}}export function setTelemetryCommand(e){y=e}export function track(e,t,r={}){if(!telemetryEnabled())return;const o=void 0===r.error?void 0:maskSecrets(r.error instanceof Error?r.error.message:String(r.error)).slice(0,2e3);w.push({ts:Date.now(),session:g,command:y,step:e,status:t,...void 0!==r.duration_ms?{duration_ms:Math.round(r.duration_ms)}:{},...o?{error:o}:{},...r.detail?{detail:r.detail}:{}}),"start"===t?z():k||(k=setTimeout(z,500),k.unref())}export async function trackStep(e,t,r){const o=Date.now();track(e,"start",r?{detail:r}:{});try{const r=await t();return track(e,"ok",{duration_ms:Date.now()-o}),r}catch(t){throw track(e,"fail",{duration_ms:Date.now()-o,error:t}),t}}function z(){if(k&&(clearTimeout(k),k=null),0===w.length)return;const e=w.splice(0,50),t=x(h,{..._(),events:e},3e3).then(()=>{},()=>{}).finally(()=>T.delete(t));T.add(t),w.length>0&&z()}export async function flushTelemetry(e=1500){z(),0!==T.size&&await Promise.race([Promise.allSettled([...T]),new Promise(t=>setTimeout(t,e).unref())])}export async function reportCrash(e,t=1500){const r=(e instanceof Error?(e.stack??"").split("\n").slice(e.message.split("\n").length):[]).map(e=>e.trim()).find(e=>/^at .+(\(.+:\d+:\d+\)|:\d+:\d+)$/.test(e));track("command","fail",{error:e,detail:{exit_code:1,type:"crash",...r?{at:maskSecrets(r).slice(0,200)}:{}}}),await flushTelemetry(t)}export async function uploadReport(e){try{const t=await x(m,{..._(),report:e},2e4),r=t?.data?.code;return"string"==typeof r&&r?r:null}catch{return null}}async function E(e,t,r){const o=p.getApiKey()?.trim(),n=await fetch(new URL(e,p.getBaseUrl()).toString(),{method:"POST",headers:{"Content-Type":"application/json",...clientHeaders(),...o?{Authorization:`Bearer ${o}`}:{}},body:JSON.stringify(t),signal:AbortSignal.timeout(r)});if(!n.ok)throw new Error(`HTTP ${n.status}`);return n.json().catch(()=>null)}
@@ -1 +1 @@
1
- import{spawnSync as t}from"child_process";import{existsSync as o,mkdtempSync as e,readFileSync as n,realpathSync as i,rmSync as s,statSync as r,writeFileSync as c}from"fs";import{tmpdir as l}from"os";import{delimiter as u,dirname as a,isAbsolute as d,join as p}from"path";import*as f from"@iarna/toml";import{fileURLToPath as m}from"url";import{logger as _}from"../../utils/logger.js";import{getCodexRules as x,compareVersions as g}from"../model-registry.js";import{autoCompactTokens as h,modelBlurb as w,prettyModelName as y}from"../gateway-models.js";import{codexHome as b,toolHome as v}from"./types.js";import{brandEnv as C,CLI_NAME as M,PROVIDER_KEY as j}from"../brand.js";const A=a(m(import.meta.url));export const CODEX_CATALOG_FILE=`${j}-model-catalog.json`;export const codexCatalogPath=()=>p(b(),CODEX_CATALOG_FILE);function O(){const t=C("CODEX_BIN");if(void 0!==t)return t.trim()?[t.trim()]:[];const o=["codex"];if("win32"===process.platform){const t=process.env.LOCALAPPDATA||p(v(),"AppData","Local");o.push(p(t,"Programs","OpenAI","Codex","bin","codex.exe"))}else o.push(p(v(),".local","bin","codex"));if("darwin"===process.platform)for(const t of["/Applications",p(v(),"Applications")])o.push(p(t,"ChatGPT.app/Contents/Resources/codex-cli/bin/codex")),o.push(p(t,"Codex.app/Contents/Resources/codex"));return o}function E(t){return!!t&&"object"==typeof t&&!Array.isArray(t)}function $(t){try{const o=JSON.parse(t),e=E(o)&&Array.isArray(o.models)?o.models.filter(E):[];return e.length>0?e:null}catch{return null}}function k(o,e,n){const i={encoding:"utf-8",timeout:2e4,maxBuffer:67108864,windowsHide:!0,stdio:["ignore","pipe","pipe"],...n?{env:n}:{}};return"win32"!==process.platform||"codex"!==o&&!/\.cmd$/i.test(o)?t(o,e,i):t(["codex"===o?"codex":`"${o}"`,...e].join(" "),{...i,shell:!0})}function P(t){const o=k(t,["debug","models","--bundled"]);if(0===o.status&&o.stdout){const t=$(o.stdout);if(t)return t}return(o.error||0!==o.status)&&_.logError("loadBundledCodexModels",o.error??new Error(`${t} exited ${o.status}`)),null}export function loadBundledCodexModels(t){if(t)return P(t);for(const t of O()){if("codex"!==t&&!o(t))continue;const e=P(t);if(e)return e}return null}function S(t){try{return r(t).isFile()}catch{return!1}}export function installedCodexBinaries(){const t=[],o=O();if(o.includes("codex")){const o="win32"===process.platform?["codex.exe","codex.cmd"]:["codex"];for(const e of(process.env.PATH??"").split(u))if(e&&d(e))for(const n of o)t.push(p(e,n))}t.push(...o.filter(t=>"codex"!==t));const e=new Set,n=[];for(const o of t){if(!S(o))continue;let t=o;try{t=i(o)}catch{}const s="win32"===process.platform?t.toLowerCase():t;e.has(s)||(e.add(s),n.push(o))}return n}export function codexBinaryVersion(t){const o=`${k(t,["--version"]).stdout??""}`.match(/(\d+)\.(\d+)\.(\d+)/);return o?o[0]:null}export function catalogRejections(t,o=installedCodexBinaries()){if(0===o.length)return[];const n=e(p(l(),`${M}-codex-`)),i=[];try{c(p(n,"config.toml"),f.stringify({model_catalog_json:t}));for(const t of o){const o=k(t,["debug","models"],{...process.env,CODEX_HOME:n});if(0===o.status)continue;const e=`${o.stderr??""}\n${o.stdout??""}`,s=e.split(/\r?\n/).find(t=>t.includes("model_catalog_json"));s?i.push({bin:t,version:codexBinaryVersion(t),error:s.trim()}):_.logError("catalogRejections",o.error??new Error(`${t} exited ${o.status}: ${e.trim().slice(0,500)}`))}}finally{s(n,{recursive:!0,force:!0})}return i}export function loadPreviousCodexModels(){const t=B()?.filter(t=>!L(t));return t&&t.length>0?t:null}export function previousGatewayModelIds(){return(B()??[]).filter(L).map(t=>String(t.slug))}function B(){return o(codexCatalogPath())?$(n(codexCatalogPath(),"utf-8")):null}function L(t){return"number"==typeof t.priority&&t.priority>=1e3}let W=null;function T(){if(null!==W)return W;const t=[p(A,"..","..","..","codex-base-instructions.md"),p(A,"..","..","codex-base-instructions.md"),p(A,"codex-base-instructions.md")],e=t.find(t=>o(t));if(!e)throw new Error(`codex-base-instructions.md not found, searched: ${t.join(", ")}`);return W=n(e,"utf-8"),W}function D(t){return"number"==typeof t&&Number.isFinite(t)&&t>0?t:void 0}function G(t,o,e,n){const i=e?t:Math.min(t,o);return{window:i,compact:h(i,n)}}function F(t,o,e,n){const{standardContextWindow:i}=x();let s=D(t.contextWindow)??i;n&&t.id.startsWith("claude-")&&(s=n.has(t.id)?Math.max(s,1e6):Math.min(s,2e5));const{window:r,compact:c}=G(s,i,e,D(t.autoCompactTokens));return{slug:t.id,display_name:t.name||y(t.id),description:w(t.description,{millionContext:r>=1e6})??null,supported_reasoning_levels:[],shell_type:"unified_exec",visibility:"list",supported_in_api:!0,priority:o,additional_speed_tiers:[],service_tiers:[],availability_nux:null,upgrade:null,model_messages:{instructions_template:T()},base_instructions:T(),supports_reasoning_summaries:!0,supports_parallel_tool_calls:!1,prefer_websockets:!1,include_skills_usage_instructions:!1,include_plugin_usage_instructions:!1,include_apps_usage_instructions:!1,default_reasoning_summary:"auto",support_verbosity:!1,default_verbosity:null,apply_patch_tool_type:null,web_search_tool_type:"text",truncation_policy:{mode:"bytes",limit:1e4},supports_image_detail_original:!1,context_window:r,max_context_window:r,auto_compact_token_limit:c,effective_context_window_percent:95,experimental_supported_tools:[],input_modalities:["text","image"],supports_search_tool:!1,supports_experimental_context:!1,use_responses_lite:!1,supports_reasoning_effort_updates:!1,node_repl_auto_review_required:!1,node_repl_disabled:!1}}const I={supports_parallel_tool_calls:!0,supports_reasoning_summaries:!0};export function fillFromOlderEntries(t,o){const e=new Map(o.map(t=>[t.slug,t])),n=new Map;for(const t of o)for(const[o,e]of Object.entries(t))n.has(o)||n.set(o,e);return t.map(t=>{const o=e.get(t.slug),i={...t};for(const[t,e]of n)t in i||(i[t]=o&&t in o?o[t]:e);return i})}function R(t,o,e){if("list"!==(t=function(t){const o=Object.keys(I).filter(o=>!(o in t));return 0===o.length?t:{...t,...Object.fromEntries(o.map(t=>[t,I[t]]))}}(t)).visibility)return t;const n=D(t.context_window);if(!n)return t;const i=D(t.max_context_window)??n,s=e?Math.min(D(o?.contextWindow)??i,i):n,{window:r,compact:c}=G(s,n,!0,D(o?.autoCompactTokens));return{...t,context_window:r,auto_compact_token_limit:c}}function X(t,o){if(!t.startsWith("gpt-"))return;let e,n=4;for(const i of o){const o="string"==typeof i.slug?i.slug:"";if(!o.startsWith("gpt-")||"list"!==i.visibility)continue;let s=0;for(;s<o.length&&o[s]===t[s];)s++;s>n&&(e=i,n=s)}return e}function H(t,o,e,n){return R({...t,...Object.fromEntries(["slug","display_name","description","priority"].map(t=>[t,o[t]])),upgrade:null,availability_nux:null},e,n)}export function buildCodexCatalog(t){const{bundled:o,specs:e,oneMillion:n,selectedModel:i}=t,s=t.claudeOneMillion?new Set(t.claudeOneMillion):void 0,r=t.keyModels?new Set(t.keyModels):null,c=new Set(t.gatewayAvailable),l=t=>!r||r.has(t)||t===i,u=t=>c.has(t)||t===i,a=new Map(e.map(t=>[t.id,t])),d=t.chosenGpt?new Set(t.chosenGpt):null,p=t=>!!d&&t.startsWith("gpt-")&&!d.has(t)&&t!==i,f=[],m=new Set;for(const t of o){const o="string"==typeof t.slug?t.slug:"";o&&!m.has(o)&&("list"!==t.visibility||l(o)&&!p(o))&&(m.add(o),f.push(R(t,a.get(o),n)))}const _=[...e];i&&!a.has(i)&&_.push({id:i});const x=function(t){const o=new Map;for(const e of t){const t=/^claude-([a-z]+)-(.+)$/.exec(e);if(!t)continue;const n=t[2].split("-").filter(t=>/^\d{1,2}$/.test(t)).join("."),i=o.get(t[1]);(!i||g(n,i.version)>0)&&o.set(t[1],{id:e,version:n})}return new Set([...o.values()].map(t=>t.id))}(_.map(t=>t.id).filter(u));for(const t of _){if(m.has(t.id)||!u(t.id))continue;if(t.id.startsWith("claude-")&&!x.has(t.id)&&t.id!==i)continue;m.add(t.id);const e=F(t,1e3+f.length,n,s),r=X(t.id,o);f.push(r?H(r,e,t,n):e)}return{models:f}}
1
+ import{spawnSync as t}from"child_process";import{existsSync as e,mkdtempSync as o,readFileSync as n,realpathSync as i,rmSync as s,statSync as r,writeFileSync as l}from"fs";import{tmpdir as c}from"os";import{delimiter as u,dirname as a,isAbsolute as d,join as p}from"path";import*as f from"@iarna/toml";import{fileURLToPath as m}from"url";import{logger as _}from"../../utils/logger.js";import{getCodexRules as x,compareVersions as g}from"../model-registry.js";import{autoCompactTokens as h,modelBlurb as w,prettyModelName as y}from"../gateway-models.js";import{codexHome as b,toolHome as v}from"./types.js";import{brandEnv as C,CLI_NAME as M,PROVIDER_KEY as j}from"../brand.js";const A=a(m(import.meta.url));export const CODEX_CATALOG_FILE=`${j}-model-catalog.json`;export const codexCatalogPath=()=>p(b(),CODEX_CATALOG_FILE);function O(){const t=C("CODEX_BIN");if(void 0!==t)return t.trim()?[t.trim()]:[];const e=["codex"];if("win32"===process.platform){const t=process.env.LOCALAPPDATA||p(v(),"AppData","Local");e.push(p(t,"Programs","OpenAI","Codex","bin","codex.exe"))}else e.push(p(v(),".local","bin","codex"));if("darwin"===process.platform)for(const t of["/Applications",p(v(),"Applications")])e.push(p(t,"ChatGPT.app/Contents/Resources/codex-cli/bin/codex")),e.push(p(t,"Codex.app/Contents/Resources/codex"));return e}function $(t){return!!t&&"object"==typeof t&&!Array.isArray(t)}function E(t){try{const e=JSON.parse(t),o=$(e)&&Array.isArray(e.models)?e.models.filter($):[];return o.length>0?o:null}catch{return null}}function S(e,o,n){const i={encoding:"utf-8",timeout:2e4,maxBuffer:67108864,windowsHide:!0,stdio:["ignore","pipe","pipe"],...n?{env:n}:{}};return"win32"!==process.platform||"codex"!==e&&!/\.cmd$/i.test(e)?t(e,o,i):t(["codex"===e?"codex":`"${e}"`,...o].join(" "),{...i,shell:!0})}function k(t){const e=S(t,["debug","models","--bundled"]);if(0===e.status&&e.stdout){const t=E(e.stdout);if(t)return t}return(e.error||0!==e.status)&&_.logError("loadBundledCodexModels",e.error??new Error(`${t} exited ${e.status}`)),null}export function loadBundledCodexModels(t){if(t)return k(t);for(const t of O()){if("codex"!==t&&!e(t))continue;const o=k(t);if(o)return o}return null}function P(t){try{return r(t).isFile()}catch{return!1}}export function installedCodexBinaries(){const t=[],e=O();if(e.includes("codex")){const e="win32"===process.platform?["codex.exe","codex.cmd"]:["codex"];for(const o of(process.env.PATH??"").split(u))if(o&&d(o))for(const n of e)t.push(p(o,n))}t.push(...e.filter(t=>"codex"!==t));const o=new Set,n=[];for(const e of t){if(!P(e))continue;let t=e;try{t=i(e)}catch{}const s="win32"===process.platform?t.toLowerCase():t;o.has(s)||(o.add(s),n.push(e))}return n}export function codexBinaryVersion(t){const e=`${S(t,["--version"]).stdout??""}`.match(/(\d+)\.(\d+)\.(\d+)/);return e?e[0]:null}export function catalogRejections(t,e=installedCodexBinaries()){if(0===e.length)return[];const n=o(p(c(),`${M}-codex-`)),i=[];try{l(p(n,"config.toml"),f.stringify({model_catalog_json:t}));for(const t of e){const e=S(t,["debug","models"],{...process.env,CODEX_HOME:n});if(0===e.status)continue;const o=`${e.stderr??""}\n${e.stdout??""}`,s=o.split(/\r?\n/).find(t=>t.includes("model_catalog_json"));s?i.push({bin:t,version:codexBinaryVersion(t),error:s.trim()}):_.logError("catalogRejections",e.error??new Error(`${t} exited ${e.status}: ${o.trim().slice(0,500)}`))}}finally{s(n,{recursive:!0,force:!0})}return i}export function loadPreviousCodexModels(){const t=W()?.filter(t=>!B(t));return t&&t.length>0?t:null}export function previousGatewayModelIds(){return(W()??[]).filter(B).map(t=>String(t.slug))}function W(){return e(codexCatalogPath())?E(n(codexCatalogPath(),"utf-8")):null}function B(t){return"number"==typeof t.priority&&(t.priority>=1e3||t.priority<0)}let L=null;function T(){if(null!==L)return L;const t=[p(A,"..","..","..","codex-base-instructions.md"),p(A,"..","..","codex-base-instructions.md"),p(A,"codex-base-instructions.md")],o=t.find(t=>e(t));if(!o)throw new Error(`codex-base-instructions.md not found, searched: ${t.join(", ")}`);return L=n(o,"utf-8"),L}function D(t){return"number"==typeof t&&Number.isFinite(t)&&t>0?t:void 0}function G(t,e,o,n){const i=o?t:Math.min(t,e);return{window:i,compact:h(i,n)}}function I(t,e,o,n){const{standardContextWindow:i}=x();let s=D(t.contextWindow)??i;n&&t.id.startsWith("claude-")&&(s=n.has(t.id)?Math.max(s,1e6):Math.min(s,2e5));const{window:r,compact:l}=G(s,i,o,D(t.autoCompactTokens));return{slug:t.id,display_name:t.name||y(t.id),description:w(t.description,{millionContext:r>=1e6})??null,supported_reasoning_levels:[],shell_type:"unified_exec",visibility:"list",supported_in_api:!0,priority:e,additional_speed_tiers:[],service_tiers:[],availability_nux:null,upgrade:null,model_messages:{instructions_template:T()},base_instructions:T(),supports_reasoning_summaries:!0,supports_parallel_tool_calls:!1,prefer_websockets:!1,include_skills_usage_instructions:!1,include_plugin_usage_instructions:!1,include_apps_usage_instructions:!1,default_reasoning_summary:"auto",support_verbosity:!1,default_verbosity:null,apply_patch_tool_type:null,web_search_tool_type:"text",truncation_policy:{mode:"bytes",limit:1e4},supports_image_detail_original:!1,context_window:r,max_context_window:r,auto_compact_token_limit:l,effective_context_window_percent:95,experimental_supported_tools:[],input_modalities:["text","image"],supports_search_tool:!1,supports_experimental_context:!1,use_responses_lite:!1,supports_reasoning_effort_updates:!1,node_repl_auto_review_required:!1,node_repl_disabled:!1}}const F={supports_parallel_tool_calls:!0,supports_reasoning_summaries:!0};export function fillFromOlderEntries(t,e){const o=new Map(e.map(t=>[t.slug,t])),n=new Map;for(const t of e)for(const[e,o]of Object.entries(t))n.has(e)||n.set(e,o);return t.map(t=>{const e=o.get(t.slug),i={...t};for(const[t,o]of n)t in i||(i[t]=e&&t in e?e[t]:o);return i})}function R(t,e,o){if("list"!==(t=function(t){const e=Object.keys(F).filter(e=>!(e in t));return 0===e.length?t:{...t,...Object.fromEntries(e.map(t=>[t,F[t]]))}}(t)).visibility)return t;const n=D(t.context_window);if(!n)return t;const i=D(t.max_context_window)??n,s=o?Math.min(D(e?.contextWindow)??i,i):n,{window:r,compact:l}=G(s,n,!0,D(e?.autoCompactTokens));return{...t,context_window:r,auto_compact_token_limit:l}}function X(t){return/^gpt-(\d+(?:\.\d+)?)(?:-|$)/.exec(t)?.[1]}function H(t,e){if(!t.startsWith("gpt-"))return;let o,n=4;for(const i of e){const e="string"==typeof i.slug?i.slug:"";if(!e.startsWith("gpt-")||"list"!==i.visibility)continue;let s=0;for(;s<e.length&&e[s]===t[s];)s++;s>n&&(o=i,n=s)}if(o||!X(t))return o;const i=t.slice(t.lastIndexOf("-")),s=e.filter(t=>"list"===t.visibility&&"string"==typeof t.slug&&X(t.slug));return s.find(t=>String(t.slug).endsWith(i))??s[0]}function N(t,e,o,n){return R({...t,...Object.fromEntries(["slug","display_name","description","priority"].map(t=>[t,e[t]])),upgrade:null,availability_nux:null},o,n)}export function buildCodexCatalog(t){const{bundled:e,specs:o,oneMillion:n,selectedModel:i}=t,s=t.claudeOneMillion?new Set(t.claudeOneMillion):void 0,r=t.keyModels?new Set(t.keyModels):null,l=new Set(t.gatewayAvailable),c=t=>!r||r.has(t)||t===i,u=t=>l.has(t)||t===i,a=new Map(o.map(t=>[t.id,t])),d=t.chosenGpt?new Set(t.chosenGpt):null,p=t=>!!d&&t.startsWith("gpt-")&&!d.has(t)&&t!==i,f=[],m=new Set;for(const t of e){const e="string"==typeof t.slug?t.slug:"";e&&!m.has(e)&&("list"!==t.visibility||c(e)&&!p(e))&&(m.add(e),f.push(R(t,a.get(e),n)))}const _=[...o];i&&!a.has(i)&&_.push({id:i});const x=e.filter(t=>"list"===t.visibility).map(t=>X(String(t.slug))??"0").reduce((t,e)=>g(e,t)>0?e:t,"0"),h=t=>g(X(t)??"0",x)>0;let w=-_.length;const y=function(t){const e=new Map;for(const o of t){const t=/^claude-([a-z]+)-(.+)$/.exec(o);if(!t)continue;const n=t[2].split("-").filter(t=>/^\d{1,2}$/.test(t)).join("."),i=e.get(t[1]);(!i||g(n,i.version)>0)&&e.set(t[1],{id:o,version:n})}return new Set([...e.values()].map(t=>t.id))}(_.map(t=>t.id).filter(u));for(const t of _){if(m.has(t.id)||!u(t.id))continue;if(t.id.startsWith("claude-")&&!y.has(t.id)&&t.id!==i)continue;m.add(t.id);const o=I(t,h(t.id)?w++:1e3+f.length,n,s),r=H(t.id,e);f.push(r?N(r,o,t,n):o)}return{models:f}}
package/dist/models.json CHANGED
@@ -150,36 +150,31 @@
150
150
  "id": "gpt-6-astra",
151
151
  "name": "GPT-6 Astra",
152
152
  "description": "105 万上下文 | 编码 / 计算机操作",
153
- "contextWindow": 1050000,
154
- "codex": false
153
+ "contextWindow": 1050000
155
154
  },
156
155
  {
157
156
  "id": "gpt-6.1-sol",
158
157
  "name": "GPT-6.1 Sol",
159
158
  "description": "105 万上下文 | 工具调用 | 结构化输出",
160
- "contextWindow": 1050000,
161
- "codex": false
159
+ "contextWindow": 1050000
162
160
  },
163
161
  {
164
162
  "id": "gpt-6-sol",
165
163
  "name": "GPT-6 Sol",
166
164
  "description": "105 万上下文 | 复杂编程与 Agent 工作流",
167
- "contextWindow": 1050000,
168
- "codex": false
165
+ "contextWindow": 1050000
169
166
  },
170
167
  {
171
168
  "id": "gpt-6-luna",
172
169
  "name": "GPT-6 Luna",
173
170
  "contextWindow": 1050000,
174
- "claudeCode": false,
175
- "codex": false
171
+ "claudeCode": false
176
172
  },
177
173
  {
178
174
  "id": "gpt-5.6-sol",
179
175
  "name": "GPT-5.6 Sol",
180
176
  "description": "105 万上下文 | 前沿档",
181
177
  "contextWindow": 1050000,
182
- "codex": false,
183
178
  "claudeCode": false
184
179
  },
185
180
  {
@@ -187,7 +182,6 @@
187
182
  "name": "GPT-5.6 Terra",
188
183
  "description": "105 万上下文 | 均衡生产档",
189
184
  "contextWindow": 1050000,
190
- "codex": false,
191
185
  "claudeCode": false
192
186
  },
193
187
  {
@@ -195,7 +189,6 @@
195
189
  "name": "GPT-5.6 Luna",
196
190
  "description": "105 万上下文 | 大批量低成本档",
197
191
  "contextWindow": 1050000,
198
- "codex": false,
199
192
  "claudeCode": false
200
193
  },
201
194
  {
package/models.json CHANGED
@@ -150,36 +150,31 @@
150
150
  "id": "gpt-6-astra",
151
151
  "name": "GPT-6 Astra",
152
152
  "description": "105 万上下文 | 编码 / 计算机操作",
153
- "contextWindow": 1050000,
154
- "codex": false
153
+ "contextWindow": 1050000
155
154
  },
156
155
  {
157
156
  "id": "gpt-6.1-sol",
158
157
  "name": "GPT-6.1 Sol",
159
158
  "description": "105 万上下文 | 工具调用 | 结构化输出",
160
- "contextWindow": 1050000,
161
- "codex": false
159
+ "contextWindow": 1050000
162
160
  },
163
161
  {
164
162
  "id": "gpt-6-sol",
165
163
  "name": "GPT-6 Sol",
166
164
  "description": "105 万上下文 | 复杂编程与 Agent 工作流",
167
- "contextWindow": 1050000,
168
- "codex": false
165
+ "contextWindow": 1050000
169
166
  },
170
167
  {
171
168
  "id": "gpt-6-luna",
172
169
  "name": "GPT-6 Luna",
173
170
  "contextWindow": 1050000,
174
- "claudeCode": false,
175
- "codex": false
171
+ "claudeCode": false
176
172
  },
177
173
  {
178
174
  "id": "gpt-5.6-sol",
179
175
  "name": "GPT-5.6 Sol",
180
176
  "description": "105 万上下文 | 前沿档",
181
177
  "contextWindow": 1050000,
182
- "codex": false,
183
178
  "claudeCode": false
184
179
  },
185
180
  {
@@ -187,7 +182,6 @@
187
182
  "name": "GPT-5.6 Terra",
188
183
  "description": "105 万上下文 | 均衡生产档",
189
184
  "contextWindow": 1050000,
190
- "codex": false,
191
185
  "claudeCode": false
192
186
  },
193
187
  {
@@ -195,7 +189,6 @@
195
189
  "name": "GPT-5.6 Luna",
196
190
  "description": "105 万上下文 | 大批量低成本档",
197
191
  "contextWindow": 1050000,
198
- "codex": false,
199
192
  "claudeCode": false
200
193
  },
201
194
  {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aizoo321/cli",
3
- "version": "0.0.169",
3
+ "version": "0.0.172",
4
4
  "description": "Configure Claude Code, Codex, Grok Build and other coding tools for Zoo AI with one command",
5
5
  "main": "dist/index.js",
6
6
  "bin": {