@caishenai/cli 0.0.170 → 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{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)}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@caishenai/cli",
3
- "version": "0.0.170",
3
+ "version": "0.0.172",
4
4
  "description": "Configure Claude Code, Codex, Grok Build and other coding tools for 财神 AI with one command",
5
5
  "main": "dist/index.js",
6
6
  "bin": {