@inventec/dsh-copilot-auth 1.2.17 → 1.2.18
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 +2 -1
- package/lib/client.js +18 -1
- package/package.json +2 -2
- package/src/auth-host.mjs +9 -1
package/README.md
CHANGED
|
@@ -33,7 +33,8 @@
|
|
|
33
33
|
|
|
34
34
|
| 本插件 | DSH 实测版本 | authorization 服务 | 说明 |
|
|
35
35
|
|---|---|---|---|
|
|
36
|
-
| v1.2.
|
|
36
|
+
| v1.2.18+ | `0.1.7-rc.2`+ | runtime 内置,插件不挂载 | **授权失败附网络失败码+人性化提示**:`fetch failed` 这类 Node undici 网络层异常的原话不含定位信息,现按 `cause.code` 映射为可操作的提示——超时/拒连→「检查网络或代理设置」、域名解析失败→「检查 DNS」、证书校验失败→「可能存在企业 TLS 检查拦截」;原始失败码弱化展示供诊断。其余同 v1.2.17 |
|
|
37
|
+
| v1.2.17 | `0.1.7-rc.2`+ | runtime 内置,插件不挂载 | **保留模型逐项列出**(弱化色,与增/删同构)——「保留 (N)」自 v1.2.8 起只有计数没有清单,预览终态不可审计;数据服务端一直有,本版补上渲染。其余同 v1.2.16 |
|
|
37
38
|
| v1.2.16 | `0.1.7-rc.2`+ | runtime 内置,插件不挂载 | **移除物化中指示浮层**:勾选为乐观即时反馈、物化通常亚秒完成,任何显隐指示都构成闪烁(主人裁决完全移除)。物化中「应用更改」点击由状态机安全忽略(防旧 previewId 提交),指示移除后卡片视觉零变化。其余同 v1.2.15 |
|
|
38
39
|
| v1.2.15 | `0.1.7-rc.2`+ | runtime 内置,插件不挂载 | **物化指示改右上角浮层**(绝对定位、透明度渐显渐隐、不占布局流)——取代 v1.2.14 的常驻占位行(占位行零位移但留空行,显空旷);弹跳与空行双消除。其余同 v1.2.14 |
|
|
39
40
|
| v1.2.14 | `0.1.7-rc.2`+ | runtime 内置,插件不挂载 | **消除弹窗上下弹跳**:「拉取预览中…」物化指示改为**常驻占位行**(visibility 显隐,不插入/移除节点)——v1.2.13 固定高度解决了整卡伸缩,本版消除指示条插入/移除引起的垂直位移。其余同 v1.2.13 |
|
package/lib/client.js
CHANGED
|
@@ -587,6 +587,10 @@ var DICTS = {
|
|
|
587
587
|
copy: "Copy",
|
|
588
588
|
copied: "Copied \u2713",
|
|
589
589
|
unknown: "Unknown error",
|
|
590
|
+
netConnect: "Cannot reach GitHub. Check this machine's network or proxy settings.",
|
|
591
|
+
netDns: "Cannot resolve github.com. Check DNS or network settings.",
|
|
592
|
+
netCert: "GitHub certificate verification failed. A corporate proxy or TLS inspection may be intercepting the connection.",
|
|
593
|
+
netGeneric: "The authorization request failed over the network.",
|
|
590
594
|
statusUnknown: "Status unknown",
|
|
591
595
|
errNetwork: "Network error: cannot reach the authorization service. Retrying automatically.",
|
|
592
596
|
errGateway: "Gateway error: the DSH service may be restarting. Retrying automatically.",
|
|
@@ -671,6 +675,10 @@ var DICTS = {
|
|
|
671
675
|
copy: "\u590D\u5236",
|
|
672
676
|
copied: "\u5DF2\u590D\u5236 \u2713",
|
|
673
677
|
unknown: "\u672A\u77E5\u9519\u8BEF",
|
|
678
|
+
netConnect: "\u65E0\u6CD5\u8FDE\u63A5 GitHub\uFF1A\u8BF7\u68C0\u67E5\u672C\u673A\u7F51\u7EDC\u6216\u4EE3\u7406\u8BBE\u7F6E\u3002",
|
|
679
|
+
netDns: "\u65E0\u6CD5\u89E3\u6790 GitHub \u57DF\u540D\uFF1A\u8BF7\u68C0\u67E5 DNS \u6216\u7F51\u7EDC\u8BBE\u7F6E\u3002",
|
|
680
|
+
netCert: "GitHub \u8BC1\u4E66\u6821\u9A8C\u5931\u8D25\uFF1A\u53EF\u80FD\u5B58\u5728\u4F01\u4E1A\u4EE3\u7406\u6216 TLS \u68C0\u67E5\u62E6\u622A\u3002",
|
|
681
|
+
netGeneric: "\u6388\u6743\u8BF7\u6C42\u7F51\u7EDC\u5931\u8D25\u3002",
|
|
674
682
|
statusUnknown: "\u72B6\u6001\u672A\u77E5",
|
|
675
683
|
errNetwork: "\u7F51\u7EDC\u5F02\u5E38\uFF1A\u65E0\u6CD5\u8FDE\u63A5\u6388\u6743\u670D\u52A1\uFF0C\u6B63\u5728\u81EA\u52A8\u91CD\u8BD5\u3002",
|
|
676
684
|
errGateway: "\u7F51\u5173\u9519\u8BEF\uFF1ADSH \u670D\u52A1\u53EF\u80FD\u6B63\u5728\u91CD\u542F\uFF0C\u6B63\u5728\u81EA\u52A8\u91CD\u8BD5\u3002",
|
|
@@ -1159,7 +1167,16 @@ function CopilotSection({ t = (key) => DICTS.en[key] ?? key }) {
|
|
|
1159
1167
|
"\u26A0 ",
|
|
1160
1168
|
t("unavailable")
|
|
1161
1169
|
] }),
|
|
1162
|
-
phase === "failed" && attempt?.error &&
|
|
1170
|
+
phase === "failed" && attempt?.error && (() => {
|
|
1171
|
+
const m = /^fetch failed \(([A-Za-z0-9_]+)\)$/.exec(attempt.error);
|
|
1172
|
+
if (!m) return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { style: styles.error, children: attempt.error });
|
|
1173
|
+
const code = m[1];
|
|
1174
|
+
const human = code === "ENOTFOUND" ? t("netDns") : code.startsWith("CERT") || code.includes("SIGNATURE") ? t("netCert") : t("netConnect");
|
|
1175
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
1176
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { style: styles.error, children: human }),
|
|
1177
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { style: { ...styles.modalText, opacity: 0.6 }, children: attempt.error })
|
|
1178
|
+
] });
|
|
1179
|
+
})(),
|
|
1163
1180
|
phase === "failed" && !attempt?.error && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
1164
1181
|
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("p", { style: styles.banner, children: [
|
|
1165
1182
|
"\u26A0 ",
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@inventec/dsh-copilot-auth",
|
|
3
|
-
"version": "1.2.
|
|
4
|
-
"description": "为内置 Copilot 提供方补设备码登录设置页,预置开箱路由;凭据入内置凭据库,模型目录兜底不覆盖定制。v1.2.
|
|
3
|
+
"version": "1.2.18",
|
|
4
|
+
"description": "为内置 Copilot 提供方补设备码登录设置页,预置开箱路由;凭据入内置凭据库,模型目录兜底不覆盖定制。v1.2.18:授权失败附网络失败码+人性化提示(检查网络/代理/DNS/TLS 检查)。v1.2.17:保留模型逐项列出。适配 DSH 0.1.7+(≤0.1.5 请用 1.1.x)。",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"author": "iasi",
|
package/src/auth-host.mjs
CHANGED
|
@@ -17,10 +17,18 @@ export const LIVE_STATUSES = ["starting", "waiting", "finishing"];
|
|
|
17
17
|
// 授权错误脱敏:仅保留安全字符集(字母/数字/空格/点/冒号/逗号/连字符),
|
|
18
18
|
// 阻断上游异常文本或疑似 token(含 = ; / + _ 等的串)进入状态面。
|
|
19
19
|
const SAFE_AUTH_ERROR = /^[A-Za-z0-9 .,:-]{1,140}$/;
|
|
20
|
+
// 网络层失败码(undici cause.code):严格大写/数字/下划线白名单,
|
|
21
|
+
// 如 ETIMEDOUT/ECONNRESET/ENOTFOUND/UNABLE_TO_VERIFY_LEAF_SIGNATURE
|
|
22
|
+
const SAFE_CAUSE_CODE = /^[A-Z0-9_]{3,60}$/;
|
|
20
23
|
|
|
21
24
|
export function sanitizeAuthError(err) {
|
|
22
25
|
const msg = String(err?.message ?? err);
|
|
23
|
-
|
|
26
|
+
const base = SAFE_AUTH_ERROR.test(msg) ? msg : "authorization-failed";
|
|
27
|
+
// v1.2.18:网络层失败的原话(如 Node 的 "fetch failed")不携带任何定位信息,
|
|
28
|
+
// 追加 cause.code(严格白名单)让桌面/代理类环境问题一眼可辨(主人 2026-10-05 裁决)
|
|
29
|
+
const causeCode = String(err?.cause?.code ?? "");
|
|
30
|
+
if (SAFE_CAUSE_CODE.test(causeCode)) return `${base} (${causeCode})`;
|
|
31
|
+
return base;
|
|
24
32
|
}
|
|
25
33
|
|
|
26
34
|
function authError(code, message, extra = {}) {
|