@xhscopy-ai/cli 0.0.140 → 0.0.141
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.
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"claude": [
|
|
11
11
|
{
|
|
12
12
|
"description": "100 万上下文 | 高强度推理 | 长时 Agent | SWE-bench Verified 95%",
|
|
13
|
-
"group": "
|
|
13
|
+
"group": "grp_6eg2dq9ywgrg",
|
|
14
14
|
"group_name": "",
|
|
15
15
|
"hidden": false,
|
|
16
16
|
"id": "claude-fable-5",
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
},
|
|
20
20
|
{
|
|
21
21
|
"description": "100 万上下文 | 12.8 万输出 | 自适应思考常开 | 长时 Agent 与多步研究",
|
|
22
|
-
"group": "
|
|
22
|
+
"group": "grp_6eg2dq9ywgrg",
|
|
23
23
|
"group_name": "",
|
|
24
24
|
"hidden": false,
|
|
25
25
|
"id": "claude-fable-5-1",
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
},
|
|
29
29
|
{
|
|
30
30
|
"description": "轻量档 | 低延迟 | 高频短任务",
|
|
31
|
-
"group": "
|
|
31
|
+
"group": "grp_6eg2dq9ywgrg",
|
|
32
32
|
"group_name": "",
|
|
33
33
|
"hidden": false,
|
|
34
34
|
"id": "claude-haiku-4-5-20251001",
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
},
|
|
38
38
|
{
|
|
39
39
|
"description": "100 万上下文 | 12.8 万输出 | 低延迟 | 高频轻量任务",
|
|
40
|
-
"group": "
|
|
40
|
+
"group": "grp_6lyxfgbs440g",
|
|
41
41
|
"group_name": "",
|
|
42
42
|
"hidden": false,
|
|
43
43
|
"id": "claude-haiku-5-5",
|
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
},
|
|
56
56
|
{
|
|
57
57
|
"description": "100 万上下文 | 推理 | 编程 | 长上下文不加价",
|
|
58
|
-
"group": "
|
|
58
|
+
"group": "grp_6eg2dq9ywgrg",
|
|
59
59
|
"group_name": "",
|
|
60
60
|
"hidden": false,
|
|
61
61
|
"id": "claude-opus-4-7",
|
|
@@ -64,7 +64,7 @@
|
|
|
64
64
|
},
|
|
65
65
|
{
|
|
66
66
|
"description": "100 万上下文 | 推理 | 编程 | 长上下文不加价",
|
|
67
|
-
"group": "
|
|
67
|
+
"group": "grp_6co8aqwefsoh",
|
|
68
68
|
"group_name": "",
|
|
69
69
|
"hidden": false,
|
|
70
70
|
"id": "claude-opus-4-8",
|
|
@@ -73,7 +73,7 @@
|
|
|
73
73
|
},
|
|
74
74
|
{
|
|
75
75
|
"description": "100 万上下文 | 12.8 万输出 | 自适应思考五档 | Agent 编程",
|
|
76
|
-
"group": "
|
|
76
|
+
"group": "grp_rld6af0zorqd",
|
|
77
77
|
"group_name": "",
|
|
78
78
|
"hidden": false,
|
|
79
79
|
"id": "claude-opus-5",
|
|
@@ -82,7 +82,7 @@
|
|
|
82
82
|
},
|
|
83
83
|
{
|
|
84
84
|
"description": "100 万上下文 | 长时 Agent 编程 | 知识工作",
|
|
85
|
-
"group": "
|
|
85
|
+
"group": "grp_6eg2dq9ywgrg",
|
|
86
86
|
"group_name": "",
|
|
87
87
|
"hidden": false,
|
|
88
88
|
"id": "claude-opus-5-5",
|
|
@@ -91,7 +91,7 @@
|
|
|
91
91
|
},
|
|
92
92
|
{
|
|
93
93
|
"description": "100 万上下文 | Agent 编程 | 长上下文不加价",
|
|
94
|
-
"group": "
|
|
94
|
+
"group": "grp_irydsgijuckh",
|
|
95
95
|
"group_name": "",
|
|
96
96
|
"hidden": false,
|
|
97
97
|
"id": "claude-sonnet-4-6",
|
|
@@ -100,7 +100,7 @@
|
|
|
100
100
|
},
|
|
101
101
|
{
|
|
102
102
|
"description": "100 万上下文 | Agent 编程 | 工具调用 | 知识工作",
|
|
103
|
-
"group": "
|
|
103
|
+
"group": "grp_6eg2dq9ywgrg",
|
|
104
104
|
"group_name": "",
|
|
105
105
|
"hidden": false,
|
|
106
106
|
"id": "claude-sonnet-5",
|
|
@@ -120,7 +120,7 @@
|
|
|
120
120
|
"codex": [
|
|
121
121
|
{
|
|
122
122
|
"description": "105 万上下文 | 12.8 万输出 | 大批量低成本档",
|
|
123
|
-
"group": "
|
|
123
|
+
"group": "grp_bsbtt432saoq",
|
|
124
124
|
"group_name": "",
|
|
125
125
|
"hidden": false,
|
|
126
126
|
"id": "gpt-5.6-luna",
|
|
@@ -138,7 +138,7 @@
|
|
|
138
138
|
},
|
|
139
139
|
{
|
|
140
140
|
"description": "105 万上下文 | 12.8 万输出 | 均衡生产档",
|
|
141
|
-
"group": "
|
|
141
|
+
"group": "grp_irydsgijuckh",
|
|
142
142
|
"group_name": "",
|
|
143
143
|
"hidden": false,
|
|
144
144
|
"id": "gpt-5.6-terra",
|
|
@@ -156,7 +156,7 @@
|
|
|
156
156
|
},
|
|
157
157
|
{
|
|
158
158
|
"description": "转发至 gpt-6-sol | 实际由 gpt-6-sol 响应 | 105 万上下文 | 12.8 万输出",
|
|
159
|
-
"group": "
|
|
159
|
+
"group": "grp_irydsgijuckh",
|
|
160
160
|
"group_name": "",
|
|
161
161
|
"hidden": false,
|
|
162
162
|
"id": "gpt-6-luna",
|
|
@@ -174,7 +174,7 @@
|
|
|
174
174
|
},
|
|
175
175
|
{
|
|
176
176
|
"description": "105 万上下文 | 12.8 万输出 | 文字与图像输入 | 工具调用、联网搜索、结构化输出 | 工具调用使用 Responses API",
|
|
177
|
-
"group": "
|
|
177
|
+
"group": "grp_irydsgijuckh",
|
|
178
178
|
"group_name": "",
|
|
179
179
|
"hidden": false,
|
|
180
180
|
"id": "gpt-6.1-sol",
|
|
@@ -183,7 +183,7 @@
|
|
|
183
183
|
},
|
|
184
184
|
{
|
|
185
185
|
"description": "105 万上下文 | 12.8 万输出 | 计算机操作与日常 Agent 任务 | 均衡档",
|
|
186
|
-
"group": "
|
|
186
|
+
"group": "grp_mb5v069lpnze",
|
|
187
187
|
"group_name": "",
|
|
188
188
|
"hidden": false,
|
|
189
189
|
"id": "gpt-6.1-terra",
|
|
@@ -230,7 +230,7 @@
|
|
|
230
230
|
},
|
|
231
231
|
{
|
|
232
232
|
"description": "Gemini 3.1 Pro 预览版 | 约 100 万上下文 | 深度推理 | 文本、图像、音视频输入",
|
|
233
|
-
"group": "
|
|
233
|
+
"group": "grp_z5khwusxuh2j",
|
|
234
234
|
"group_name": "",
|
|
235
235
|
"hidden": false,
|
|
236
236
|
"id": "gemini-3.1-pro-preview",
|
|
@@ -248,7 +248,7 @@
|
|
|
248
248
|
},
|
|
249
249
|
{
|
|
250
250
|
"description": "约 208 token/秒 | 高吞吐 | 多语言 | 编码",
|
|
251
|
-
"group": "
|
|
251
|
+
"group": "grp_3pi5kyqkp51b",
|
|
252
252
|
"group_name": "",
|
|
253
253
|
"hidden": false,
|
|
254
254
|
"id": "gemini-3.6-flash",
|
|
@@ -266,7 +266,7 @@
|
|
|
266
266
|
},
|
|
267
267
|
{
|
|
268
268
|
"description": "推理与编码 | HLE-Verified 54.9% | 长文档工作流",
|
|
269
|
-
"group": "
|
|
269
|
+
"group": "grp_3pi5kyqkp51b",
|
|
270
270
|
"group_name": "",
|
|
271
271
|
"hidden": false,
|
|
272
272
|
"id": "gemini-3.8-flash",
|
|
@@ -313,7 +313,7 @@
|
|
|
313
313
|
},
|
|
314
314
|
{
|
|
315
315
|
"description": "50 万上下文 | 长时 Agent | 编码与视觉项目",
|
|
316
|
-
"group": "
|
|
316
|
+
"group": "grp_irydsgijuckh",
|
|
317
317
|
"group_name": "",
|
|
318
318
|
"hidden": false,
|
|
319
319
|
"id": "grok-4.7",
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"claude": [
|
|
11
11
|
{
|
|
12
12
|
"description": "100 万上下文 | 高强度推理 | 长时 Agent | SWE-bench Verified 95%",
|
|
13
|
-
"group": "
|
|
13
|
+
"group": "grp_6eg2dq9ywgrg",
|
|
14
14
|
"group_name": "",
|
|
15
15
|
"hidden": false,
|
|
16
16
|
"id": "claude-fable-5",
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
},
|
|
20
20
|
{
|
|
21
21
|
"description": "100 万上下文 | 12.8 万输出 | 自适应思考常开 | 长时 Agent 与多步研究",
|
|
22
|
-
"group": "
|
|
22
|
+
"group": "grp_6eg2dq9ywgrg",
|
|
23
23
|
"group_name": "",
|
|
24
24
|
"hidden": false,
|
|
25
25
|
"id": "claude-fable-5-1",
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
},
|
|
29
29
|
{
|
|
30
30
|
"description": "轻量档 | 低延迟 | 高频短任务",
|
|
31
|
-
"group": "
|
|
31
|
+
"group": "grp_6eg2dq9ywgrg",
|
|
32
32
|
"group_name": "",
|
|
33
33
|
"hidden": false,
|
|
34
34
|
"id": "claude-haiku-4-5-20251001",
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
},
|
|
38
38
|
{
|
|
39
39
|
"description": "100 万上下文 | 12.8 万输出 | 低延迟 | 高频轻量任务",
|
|
40
|
-
"group": "
|
|
40
|
+
"group": "grp_6lyxfgbs440g",
|
|
41
41
|
"group_name": "",
|
|
42
42
|
"hidden": false,
|
|
43
43
|
"id": "claude-haiku-5-5",
|
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
},
|
|
56
56
|
{
|
|
57
57
|
"description": "100 万上下文 | 推理 | 编程 | 长上下文不加价",
|
|
58
|
-
"group": "
|
|
58
|
+
"group": "grp_6eg2dq9ywgrg",
|
|
59
59
|
"group_name": "",
|
|
60
60
|
"hidden": false,
|
|
61
61
|
"id": "claude-opus-4-7",
|
|
@@ -64,7 +64,7 @@
|
|
|
64
64
|
},
|
|
65
65
|
{
|
|
66
66
|
"description": "100 万上下文 | 推理 | 编程 | 长上下文不加价",
|
|
67
|
-
"group": "
|
|
67
|
+
"group": "grp_6co8aqwefsoh",
|
|
68
68
|
"group_name": "",
|
|
69
69
|
"hidden": false,
|
|
70
70
|
"id": "claude-opus-4-8",
|
|
@@ -73,7 +73,7 @@
|
|
|
73
73
|
},
|
|
74
74
|
{
|
|
75
75
|
"description": "100 万上下文 | 12.8 万输出 | 自适应思考五档 | Agent 编程",
|
|
76
|
-
"group": "
|
|
76
|
+
"group": "grp_rld6af0zorqd",
|
|
77
77
|
"group_name": "",
|
|
78
78
|
"hidden": false,
|
|
79
79
|
"id": "claude-opus-5",
|
|
@@ -82,7 +82,7 @@
|
|
|
82
82
|
},
|
|
83
83
|
{
|
|
84
84
|
"description": "100 万上下文 | 长时 Agent 编程 | 知识工作",
|
|
85
|
-
"group": "
|
|
85
|
+
"group": "grp_6eg2dq9ywgrg",
|
|
86
86
|
"group_name": "",
|
|
87
87
|
"hidden": false,
|
|
88
88
|
"id": "claude-opus-5-5",
|
|
@@ -91,7 +91,7 @@
|
|
|
91
91
|
},
|
|
92
92
|
{
|
|
93
93
|
"description": "100 万上下文 | Agent 编程 | 长上下文不加价",
|
|
94
|
-
"group": "
|
|
94
|
+
"group": "grp_irydsgijuckh",
|
|
95
95
|
"group_name": "",
|
|
96
96
|
"hidden": false,
|
|
97
97
|
"id": "claude-sonnet-4-6",
|
|
@@ -100,7 +100,7 @@
|
|
|
100
100
|
},
|
|
101
101
|
{
|
|
102
102
|
"description": "100 万上下文 | Agent 编程 | 工具调用 | 知识工作",
|
|
103
|
-
"group": "
|
|
103
|
+
"group": "grp_6eg2dq9ywgrg",
|
|
104
104
|
"group_name": "",
|
|
105
105
|
"hidden": false,
|
|
106
106
|
"id": "claude-sonnet-5",
|
|
@@ -120,7 +120,7 @@
|
|
|
120
120
|
"codex": [
|
|
121
121
|
{
|
|
122
122
|
"description": "105 万上下文 | 12.8 万输出 | 大批量低成本档",
|
|
123
|
-
"group": "
|
|
123
|
+
"group": "grp_bsbtt432saoq",
|
|
124
124
|
"group_name": "",
|
|
125
125
|
"hidden": false,
|
|
126
126
|
"id": "gpt-5.6-luna",
|
|
@@ -138,7 +138,7 @@
|
|
|
138
138
|
},
|
|
139
139
|
{
|
|
140
140
|
"description": "105 万上下文 | 12.8 万输出 | 均衡生产档",
|
|
141
|
-
"group": "
|
|
141
|
+
"group": "grp_irydsgijuckh",
|
|
142
142
|
"group_name": "",
|
|
143
143
|
"hidden": false,
|
|
144
144
|
"id": "gpt-5.6-terra",
|
|
@@ -156,7 +156,7 @@
|
|
|
156
156
|
},
|
|
157
157
|
{
|
|
158
158
|
"description": "转发至 gpt-6-sol | 实际由 gpt-6-sol 响应 | 105 万上下文 | 12.8 万输出",
|
|
159
|
-
"group": "
|
|
159
|
+
"group": "grp_irydsgijuckh",
|
|
160
160
|
"group_name": "",
|
|
161
161
|
"hidden": false,
|
|
162
162
|
"id": "gpt-6-luna",
|
|
@@ -174,7 +174,7 @@
|
|
|
174
174
|
},
|
|
175
175
|
{
|
|
176
176
|
"description": "105 万上下文 | 12.8 万输出 | 文字与图像输入 | 工具调用、联网搜索、结构化输出 | 工具调用使用 Responses API",
|
|
177
|
-
"group": "
|
|
177
|
+
"group": "grp_irydsgijuckh",
|
|
178
178
|
"group_name": "",
|
|
179
179
|
"hidden": false,
|
|
180
180
|
"id": "gpt-6.1-sol",
|
|
@@ -183,7 +183,7 @@
|
|
|
183
183
|
},
|
|
184
184
|
{
|
|
185
185
|
"description": "105 万上下文 | 12.8 万输出 | 计算机操作与日常 Agent 任务 | 均衡档",
|
|
186
|
-
"group": "
|
|
186
|
+
"group": "grp_mb5v069lpnze",
|
|
187
187
|
"group_name": "",
|
|
188
188
|
"hidden": false,
|
|
189
189
|
"id": "gpt-6.1-terra",
|
|
@@ -230,7 +230,7 @@
|
|
|
230
230
|
},
|
|
231
231
|
{
|
|
232
232
|
"description": "Gemini 3.1 Pro 预览版 | 约 100 万上下文 | 深度推理 | 文本、图像、音视频输入",
|
|
233
|
-
"group": "
|
|
233
|
+
"group": "grp_z5khwusxuh2j",
|
|
234
234
|
"group_name": "",
|
|
235
235
|
"hidden": false,
|
|
236
236
|
"id": "gemini-3.1-pro-preview",
|
|
@@ -248,7 +248,7 @@
|
|
|
248
248
|
},
|
|
249
249
|
{
|
|
250
250
|
"description": "约 208 token/秒 | 高吞吐 | 多语言 | 编码",
|
|
251
|
-
"group": "
|
|
251
|
+
"group": "grp_3pi5kyqkp51b",
|
|
252
252
|
"group_name": "",
|
|
253
253
|
"hidden": false,
|
|
254
254
|
"id": "gemini-3.6-flash",
|
|
@@ -266,7 +266,7 @@
|
|
|
266
266
|
},
|
|
267
267
|
{
|
|
268
268
|
"description": "推理与编码 | HLE-Verified 54.9% | 长文档工作流",
|
|
269
|
-
"group": "
|
|
269
|
+
"group": "grp_3pi5kyqkp51b",
|
|
270
270
|
"group_name": "",
|
|
271
271
|
"hidden": false,
|
|
272
272
|
"id": "gemini-3.8-flash",
|
|
@@ -313,7 +313,7 @@
|
|
|
313
313
|
},
|
|
314
314
|
{
|
|
315
315
|
"description": "50 万上下文 | 长时 Agent | 编码与视觉项目",
|
|
316
|
-
"group": "
|
|
316
|
+
"group": "grp_irydsgijuckh",
|
|
317
317
|
"group_name": "",
|
|
318
318
|
"hidden": false,
|
|
319
319
|
"id": "grok-4.7",
|
package/dist/lib/auto-update.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{chmodSync as e,copyFileSync as t,existsSync as r,lstatSync as
|
|
1
|
+
import{chmodSync as e,copyFileSync as t,existsSync as r,lstatSync as o,mkdirSync as n,readdirSync as s,readFileSync as a,readlinkSync as i,renameSync as l,rmSync as c,symlinkSync as u,writeFileSync as p}from"fs";import{homedir as d}from"os";import{basename as m,dirname as f,join as h,sep as _}from"path";import{spawnSync as g}from"child_process";import y from"chalk";import{checkForUpdate as v,readLocalPackage as x,UPDATE_SOURCES as w}from"../commands/update.js";import{i18n as k}from"./i18n.js";import{isColorEnabled as S}from"./runtime-options.js";import{logger as b}from"../utils/logger.js";import{isHelpRequest as $}from"./cli-help.js";import{brand as E,brandEnvName as P}from"./brand.js";import{flushTelemetry as I,track as j}from"./telemetry.js";export const INSTALL_RETRY_INTERVAL_MS=36e5;export const INSTALL_TIMEOUT_MS=45e3;function A(e,t){return S()?e(t):t}export function resolveUpdateCachePath(e=process.env){const t=e[P("CONFIG_DIR")]?.trim();if(t)return h(t,"update-state.json");const r=e[P("TEST_HOME")]?.trim();return h(r||d(),E().configDirName,"update-state.json")}export function isGlobalPackageInstall(e){return e.split(_).includes("node_modules")}export function isNpxExecution(e=process.env){return"exec"===e.npm_command||"npx"===e.npm_lifecycle_event}export function isPnpmGlobalInstall(e){return e.includes(`${_}.pnpm${_}`)||e.includes(`${_}pnpm${_}global${_}`)}export function resolveNpmGlobalPrefix(e){const t=`${_}node_modules${_}`,r=e.indexOf(t);if(r<0)return null;const o=e.slice(0,r);return o.endsWith(`${_}lib`)?f(o):o}export function shouldSkipStartupUpdate(e,t=process.env){return"1"===t[P("SKIP_AUTO_UPDATE")]||"1"===t[P("DISABLE_AUTO_UPDATE")]||(!(!["--json","--non-interactive","--dry-run","--help","-h","--version","-v"].some(t=>e.includes(t))&&!$(e))||e.includes("update")||e.includes("completion"))}function N(t,r,o,s,a){try{n(f(t),{recursive:!0,mode:448});const i=`${t}.tmp-${process.pid}`,c={package_name:r,checked_at:o,latest:s.latest,source:s.source,registry:s.registry,errors:s.errors,...void 0===a?{}:{install_attempted_at:a,install_attempted_version:s.latest||void 0}};p(i,JSON.stringify(c),{encoding:"utf-8",mode:384}),l(i,t),e(t,384)}catch(e){b.warn("Failed to persist update check cache:",e)}}export function windowsShellCommand(e,t){return[e,...t.map(e=>`"${e}"`)].join(" ")}const T=(e,t)=>{const r={stdio:"inherit",timeout:45e3,killSignal:"SIGTERM"};return"win32"===process.platform?g(windowsShellCommand(e,t),{...r,shell:!0}):g(e,t,r)},U=(e,t)=>g(process.execPath,[process.argv[1],...e],{stdio:"inherit",env:t}),O="-update-";function D(e,t){for(let r=0;;r++)try{return void l(e,t)}catch(e){const t=e.code;if(r>=9||"EPERM"!==t&&"EACCES"!==t&&"EBUSY"!==t)throw e;Atomics.wait(new Int32Array(new SharedArrayBuffer(4)),0,0,200)}}export function swapStagedPackage(e,s,l,p,d){const _=p.split("/"),g=[h(e,"node_modules",..._),h(e,"lib","node_modules",..._)].find(e=>r(h(e,"package.json")));if(!g)return!1;const y=JSON.parse(a(h(g,"package.json"),"utf-8"));if(y.version!==d)return!1;const v=h(f(l),`.${m(l)}${O}old-${process.pid}`);D(l,v);try{D(g,l)}catch(e){throw D(v,l),e}c(v,{recursive:!0,force:!0,maxRetries:3});const x="string"==typeof y.bin?[_[_.length-1]]:Object.keys(y.bin||{});for(const[r,a]of[[h(e,"bin"),h(s,"bin")],[e,s]])for(const e of x.flatMap(e=>["",".cmd",".ps1"].map(t=>e+t))){const s=h(r,e),l=h(a,e),c=o(s,{throwIfNoEntry:!1});if(!o(l,{throwIfNoEntry:!1})&&c&&!c.isDirectory())try{n(a,{recursive:!0}),c.isSymbolicLink()?u(i(s),l):t(s,l)}catch(e){b.warn("Failed to restore command shim:",e)}}return!0}export async function runStartupUpdate(e,t={}){const o=t.env||process.env,n=t.localPackage||x(),i=t.globalInstall??isGlobalPackageInstall(n.root),l=t.npx??isNpxExecution(o);if(!i||l||shouldSkipStartupUpdate(e,o))return{status:"skipped",handled:!1,source:null};const u=t.now??Date.now(),p=t.cachePath||resolveUpdateCachePath(o),d=function(e,t){try{if(!r(e))return null;const o=JSON.parse(a(e,"utf-8"));return o.package_name===t.name&&Number.isFinite(o.checked_at)?o:null}catch{return null}}(p,n);let g=function(e,t,r){if(!e||e.latest||r-e.checked_at>=6e5)return null;const o=Array.isArray(e.errors)?e.errors:[];return{current:t.version,latest:null,up_to_date:null,source:e.source,registry:e.registry,errors:o,error:o.map(e=>`${e.source}: ${e.error}`).join("; ")||"unknown"}}(d,n,u),S=null;if(g||(g=await v({localPackage:n,fetchFn:t.fetchFn}),g.latest&&d?.install_attempted_version===g.latest&&Number.isFinite(d.install_attempted_at)&&(S=d.install_attempted_at),N(p,n.name,u,g,S??void 0)),!g.latest)return{status:"unavailable",handled:!1,source:null};if(g.up_to_date)return{status:"current",handled:!1,source:g.source};if(null!==S&&u-S<36e5)return{status:"update_failed",handled:!1,source:g.source};const b=t.output||console.log,$=t.errorOutput||console.error,E=t.installRunner||T,D=isPnpmGlobalInstall(n.root),R=D?"win32"===process.platform?"pnpm.cmd":"pnpm":"win32"===process.platform?"npm.cmd":"npm",C=D?null:resolveNpmGlobalPrefix(n.root),G=n.root,F=C&&G.endsWith(_+n.name.split("/").join(_))?h(f(G),`.${m(G)}${O}${process.pid}`):null;F&&function(e,t){try{for(const r of s(e))r.startsWith(`.${t}${O}`)&&c(h(e,r),{recursive:!0,force:!0})}catch{}}(f(G),m(G)),N(p,n.name,u,g,u),b(A(y.cyan,k.t("update.auto_installing",{version:g.latest})));const L={from:n.version,to:g.latest,staged:Boolean(F)};j("self-update","start",{detail:L}),await I();const M=[...g.registry?[g.registry]:[],...w.map(e=>e.registry).filter(e=>e!==g.registry)],B=Date.now();let J=null,W="unknown",K=0;for(const e of M){if(Date.now()-B>=45e3)break;K++;const t=E(R,D?["add","--global",`${n.name}@${g.latest}`,"--registry",e]:["install","--global",...F?["--prefix",F]:C?["--prefix",C]:[],`${n.name}@${g.latest}`,"--registry",e,"--no-audit","--no-fund","--fetch-timeout=15000","--fetch-retries=1","--fetch-retry-mintimeout=1000","--fetch-retry-maxtimeout=3000"]);if(0===t.status){if(!F){J=e;break}try{if(!swapStagedPackage(F,C,G,n.name,g.latest)){W="staged install incomplete";continue}J=e;break}catch(e){W=e instanceof Error?e.message:String(e);break}finally{c(F,{recursive:!0,force:!0,maxRetries:3})}}else W=t.error?.message||`exit ${t.status??"unknown"}`,F&&c(F,{recursive:!0,force:!0,maxRetries:3})}const Y=Date.now()-B;if(j("self-update",J?"ok":Y>=45e3?"timeout":"fail",{duration_ms:Y,...J?{}:{error:W},detail:{...L,attempts:K,registry:J}}),await I(),!J)return $(A(y.yellow,k.t("update.auto_failed",{error:W}))),{status:"update_failed",handled:!1,source:g.source};b(A(y.green,k.t("update.auto_installed",{version:g.latest})));const H=(t.reexecRunner||U)(e,{...o,[P("SKIP_AUTO_UPDATE")]:"1"});return H.error?($(A(y.yellow,k.t("update.reexec_failed",{error:H.error.message}))),{status:"update_failed",handled:!1,source:g.source}):(process.exitCode=H.status??1,{status:"reexecuted",handled:!0,source:g.source})}
|