siluzan-tso-cli 1.1.66-beta.2 → 1.1.67-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md
CHANGED
|
@@ -51,7 +51,7 @@ siluzan-tso init -d /path/to/skills # 写入自定义目录
|
|
|
51
51
|
siluzan-tso init --force # 强制覆盖已存在文件
|
|
52
52
|
```
|
|
53
53
|
|
|
54
|
-
> **注意**:当前为测试版(1.1.
|
|
54
|
+
> **注意**:当前为测试版(1.1.67-beta.1),供内部测试使用。正式发布后安装命令将改为 `npm install -g siluzan-tso-cli`。
|
|
55
55
|
|
|
56
56
|
| 助手 | 建议 `--ai` |
|
|
57
57
|
| ----------------------- | ------------------------------------ |
|
package/dist/index.js
CHANGED
|
@@ -2645,7 +2645,7 @@ async function requestWithReadRetry(url, options) {
|
|
|
2645
2645
|
}
|
|
2646
2646
|
}
|
|
2647
2647
|
}
|
|
2648
|
-
async function apiFetch(url, config, options = {}, verbose = false) {
|
|
2648
|
+
async function apiFetch(url, config, options = {}, verbose = false, timeoutMs) {
|
|
2649
2649
|
const method = options.method ?? "GET";
|
|
2650
2650
|
const reqHeaders = {
|
|
2651
2651
|
"Content-Type": "application/json",
|
|
@@ -2662,7 +2662,8 @@ async function apiFetch(url, config, options = {}, verbose = false) {
|
|
|
2662
2662
|
method,
|
|
2663
2663
|
headers: reqHeaders,
|
|
2664
2664
|
body,
|
|
2665
|
-
signal: options.signal ?? void 0
|
|
2665
|
+
signal: options.signal ?? void 0,
|
|
2666
|
+
...timeoutMs !== void 0 ? { timeoutMs } : {}
|
|
2666
2667
|
});
|
|
2667
2668
|
return parseApiResponse(res.status, res.text, verbose);
|
|
2668
2669
|
}
|
|
@@ -4404,14 +4405,14 @@ async function withWriteAudit(params, execute) {
|
|
|
4404
4405
|
throw e;
|
|
4405
4406
|
}
|
|
4406
4407
|
}
|
|
4407
|
-
async function apiFetch2(url, config, options = {}, verbose = false) {
|
|
4408
|
+
async function apiFetch2(url, config, options = {}, verbose = false, timeoutMs) {
|
|
4408
4409
|
const method = options.method ?? "GET";
|
|
4409
4410
|
if (!isMutatingHttpMethod(method)) {
|
|
4410
|
-
return apiFetch(url, config, options, verbose);
|
|
4411
|
+
return apiFetch(url, config, options, verbose, timeoutMs);
|
|
4411
4412
|
}
|
|
4412
4413
|
const body = typeof options.body === "string" ? options.body : void 0;
|
|
4413
4414
|
return withWriteAudit({ config, url, method, body, verbose }, async () => ({
|
|
4414
|
-
value: await apiFetch(url, config, options, verbose)
|
|
4415
|
+
value: await apiFetch(url, config, options, verbose, timeoutMs)
|
|
4415
4416
|
}));
|
|
4416
4417
|
}
|
|
4417
4418
|
async function apiFetchWithHeaders2(url, config, options = {}, verbose = false) {
|
|
@@ -136852,18 +136853,24 @@ function buildDiagnosisScaffold(signals) {
|
|
|
136852
136853
|
// src/commands/website-diagnosis/lighthouse-with-fallback.ts
|
|
136853
136854
|
init_dist();
|
|
136854
136855
|
init_auth();
|
|
136855
|
-
var LIGHTHOUSE_MAX_ATTEMPTS =
|
|
136856
|
-
var LIGHTHOUSE_RETRY_DELAYS_MS = [2e3
|
|
136856
|
+
var LIGHTHOUSE_MAX_ATTEMPTS = 2;
|
|
136857
|
+
var LIGHTHOUSE_RETRY_DELAYS_MS = [2e3];
|
|
136858
|
+
var LIGHTHOUSE_TIMEOUT_MS = 12e4;
|
|
136857
136859
|
function lighthouseHasScores2(lh) {
|
|
136858
136860
|
if (!lh || typeof lh !== "object") return false;
|
|
136859
136861
|
const d = lh.desktop?.score;
|
|
136860
136862
|
const m = lh.mobile?.score;
|
|
136861
136863
|
return typeof d === "number" && Number.isFinite(d) || typeof m === "number" && Number.isFinite(m);
|
|
136862
136864
|
}
|
|
136865
|
+
var LIGHTHOUSE_SEND_FAILURE = /while sending the request|an error occurred while sending the request/i;
|
|
136863
136866
|
function isLighthouseRetryableError(error) {
|
|
136867
|
+
if (LIGHTHOUSE_SEND_FAILURE.test(error) || /请求超时/.test(error)) return false;
|
|
136864
136868
|
const status = parseHttpStatusFromError(new Error(error));
|
|
136865
136869
|
if (status === 401) return false;
|
|
136866
|
-
return true;
|
|
136870
|
+
if (error.includes("\u7A7A\u5206\u6570") || error.includes("\u672A\u627E\u5230\u6027\u80FD\u6307\u6807")) return true;
|
|
136871
|
+
if (status === 429 || status !== void 0 && status >= 500 && status < 600) return true;
|
|
136872
|
+
if (/status code (429|5\d\d)/i.test(error)) return true;
|
|
136873
|
+
return false;
|
|
136867
136874
|
}
|
|
136868
136875
|
function defaultSleep(ms) {
|
|
136869
136876
|
return new Promise((resolve26) => {
|
|
@@ -136893,7 +136900,8 @@ async function tryTsoLighthouseApi(config, websiteUrl, verbose) {
|
|
|
136893
136900
|
`${config.apiBaseUrl}/api/WebsiteDiagnosisReports/performance?url=${encodeURIComponent(websiteUrl)}`,
|
|
136894
136901
|
config,
|
|
136895
136902
|
{},
|
|
136896
|
-
verbose
|
|
136903
|
+
verbose,
|
|
136904
|
+
LIGHTHOUSE_TIMEOUT_MS
|
|
136897
136905
|
);
|
|
136898
136906
|
if (!lighthouseHasScores2(lighthouse)) {
|
|
136899
136907
|
return { ok: false, error: "TSO Lighthouse API \u8FD4\u56DE\u7A7A\u5206\u6570" };
|
package/dist/skill/_meta.json
CHANGED
|
@@ -65,7 +65,7 @@ siluzan-tso website-diagnosis render --data ./diagnosis.json --collect ./snap-we
|
|
|
65
65
|
|
|
66
66
|
## 数据缺失降级(Lighthouse 等)
|
|
67
67
|
|
|
68
|
-
**统一策略(P8 / P1 着陆页共用)**:打 TSO `WebsiteDiagnosisReports/performance
|
|
68
|
+
**统一策略(P8 / P1 着陆页共用)**:打 TSO `WebsiteDiagnosisReports/performance`。这一次请求限时 120 秒。发送失败(正文含 `while sending the request`)和超时不重试;空分数、指标解析失败、429、5xx 最多再试 1 次。**不再**用 HTML 下载耗时冒充 Lighthouse。拿不到分则 `lighthouseSource` / `landingPageAnalysis.source` = `none`,`m2i1`/`m5i1` 标 Absent。**禁止**编造 score/FCP。表单/导航等结构信号来自 collect 的 `signals`(完整 HTML),与测速成败无关。
|
|
69
69
|
|
|
70
70
|
`collect` **不会**因 Lighthouse 失败而中止;落盘含 `lighthouseWarning` 与:
|
|
71
71
|
|
|
@@ -9,7 +9,7 @@ $ErrorActionPreference = 'Stop'
|
|
|
9
9
|
# -- Package info (injected at build time) ------------------------------------
|
|
10
10
|
$PKG_NAME = 'siluzan-tso-cli'
|
|
11
11
|
# PKG_VERSION 锁定到与本脚本同批构建产物一致的版本,避免与 dist/skill 错位
|
|
12
|
-
$PKG_VERSION = '1.1.
|
|
12
|
+
$PKG_VERSION = '1.1.67-beta.1'
|
|
13
13
|
$CLI_BIN = 'siluzan-tso'
|
|
14
14
|
$SKILL_LABEL = 'Siluzan TSO'
|
|
15
15
|
$INSTALL_CMD = 'npm install -g siluzan-tso-cli@beta'
|
|
@@ -9,7 +9,7 @@ set -euo pipefail
|
|
|
9
9
|
# -- Package info (injected at build time) ------------------------------------
|
|
10
10
|
readonly PKG_NAME="siluzan-tso-cli"
|
|
11
11
|
# PKG_VERSION 锁定到与本脚本同批构建产物一致的版本,避免与 dist/skill 错位
|
|
12
|
-
readonly PKG_VERSION="1.1.
|
|
12
|
+
readonly PKG_VERSION="1.1.67-beta.1"
|
|
13
13
|
readonly CLI_BIN="siluzan-tso"
|
|
14
14
|
readonly SKILL_LABEL="Siluzan TSO"
|
|
15
15
|
readonly INSTALL_CMD="npm install -g siluzan-tso-cli@beta"
|