@honor-claw/yoyo 2026.6.9-beta.7 → 2026.6.9-beta.9
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/dist/capabilities/node/directory.mjs +2 -2
- package/dist/channel/messaging.mjs +13 -13
- package/dist/cloud-channel/transport/cloud-socket.mjs +7 -4
- package/dist/command/diagnose.mjs +3 -4
- package/dist/command/doctor.mjs +3 -3
- package/dist/diagnose/chat-id-resolver.mjs +42 -0
- package/dist/diagnose/index.mjs +2 -1
- package/dist/diagnose/report/diagnose.mjs +26 -21
- package/dist/diagnose/report/doctor/device-check.mjs +72 -0
- package/dist/diagnose/report/doctor/impl.mjs +95 -0
- package/dist/diagnose/report/doctor/index.mjs +1 -0
- package/dist/diagnose/report/formatter.mjs +1 -3
- package/dist/diagnose/report/index.mjs +2 -1
- package/dist/diagnose/report/status.mjs +21 -34
- package/dist/diagnose/report/trace.mjs +68 -21
- package/dist/messaging/dispatchers/stream/controller.mjs +3 -0
- package/dist/messaging/inbound/context.mjs +15 -15
- package/dist/messaging/inbound/interrupt.mjs +1 -1
- package/dist/messaging/inbound/new-session.mjs +1 -1
- package/dist/messaging/index.mjs +1 -1
- package/dist/messaging/target/address.mjs +24 -13
- package/dist/messaging/target/index.mjs +1 -1
- package/dist/messaging/target/outbound.mjs +9 -9
- package/dist/messaging/trace/lifecycle.mjs +9 -8
- package/package.json +1 -1
- package/skills/yoyo-phone-control/SKILL.md +73 -10
- package/skills/yoyo-phone-control/configs/sub-skills.json +1 -15
- package/dist/command/context.mjs +0 -20
- package/dist/diagnose/report/doctor.mjs +0 -121
- package/skills/yoyo-phone-control/references/alarm-create.md +0 -356
- package/skills/yoyo-phone-control/references/alarm-delete.md +0 -301
- package/skills/yoyo-phone-control/references/alarm-disable.md +0 -309
- package/skills/yoyo-phone-control/references/alarm-enable.md +0 -309
- package/skills/yoyo-phone-control/references/alarm-query.md +0 -411
- package/skills/yoyo-phone-control/references/alarm-update.md +0 -386
- package/skills/yoyo-phone-control/references/file-upload.md +0 -283
- package/skills/yoyo-phone-control/references/local-search.md +0 -221
- package/skills/yoyo-phone-control/references/schedule-create.md +0 -483
- package/skills/yoyo-phone-control/references/schedule-delete.md +0 -507
- package/skills/yoyo-phone-control/references/schedule-search.md +0 -591
- package/skills/yoyo-phone-control/references/schedule-update.md +0 -556
|
@@ -4,7 +4,7 @@ async function t() {
|
|
|
4
4
|
return (await e()).devices;
|
|
5
5
|
}
|
|
6
6
|
async function n(t) {
|
|
7
|
-
return (await e({ deviceIdList: [t] })).devices.find((e) => e.deviceId === t)
|
|
7
|
+
return (await e({ deviceIdList: [t] })).devices.find((e) => e.deviceId === t);
|
|
8
8
|
}
|
|
9
9
|
//#endregion
|
|
10
|
-
export { n as
|
|
10
|
+
export { n as getDeviceWithStatus, t as listDevicesWithStatus };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { YOYO_CHANNEL_ID as e } from "../consts.mjs";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { buildChatId as t, looksLikeChatId as n } from "../messaging/target/chat-id.mjs";
|
|
3
|
+
import { buildChatTo as r, buildFrom as i, readChatIdFromTo as a, readDeviceIdFromTo as o } from "../messaging/target/address.mjs";
|
|
4
4
|
import { resolveOutboundTarget as s } from "../messaging/target/outbound.mjs";
|
|
5
5
|
import { buildChannelOutboundSessionRoute as c, stripChannelTargetPrefix as l } from "openclaw/plugin-sdk/channel-core";
|
|
6
6
|
//#region src/channel/messaging.ts
|
|
@@ -9,25 +9,25 @@ function u(t) {
|
|
|
9
9
|
return d(n) ? n : void 0;
|
|
10
10
|
}
|
|
11
11
|
function d(e) {
|
|
12
|
-
let t =
|
|
13
|
-
if (t !== void 0) return t.length > 0 &&
|
|
14
|
-
let
|
|
15
|
-
return
|
|
12
|
+
let t = a(e);
|
|
13
|
+
if (t !== void 0) return t.length > 0 && n(t);
|
|
14
|
+
let r = o(e);
|
|
15
|
+
return r !== void 0 && r.length > 0;
|
|
16
16
|
}
|
|
17
|
-
async function f(
|
|
18
|
-
let s = await a
|
|
17
|
+
async function f(n, a, o) {
|
|
18
|
+
let s = await t(a, o);
|
|
19
19
|
return c({
|
|
20
|
-
cfg:
|
|
21
|
-
agentId:
|
|
20
|
+
cfg: n.cfg,
|
|
21
|
+
agentId: n.agentId,
|
|
22
22
|
channel: e,
|
|
23
|
-
accountId:
|
|
23
|
+
accountId: a,
|
|
24
24
|
peer: {
|
|
25
25
|
kind: "direct",
|
|
26
26
|
id: s
|
|
27
27
|
},
|
|
28
28
|
chatType: "direct",
|
|
29
|
-
from:
|
|
30
|
-
to:
|
|
29
|
+
from: i(s),
|
|
30
|
+
to: r(s)
|
|
31
31
|
});
|
|
32
32
|
}
|
|
33
33
|
async function p(e) {
|
|
@@ -13,6 +13,7 @@ var u = e("cloud-transport"), d = 3e4, f = 16e3, p = 1e3, m = 2, h = 5, g = clas
|
|
|
13
13
|
isConnecting = !1;
|
|
14
14
|
pingTimer = new c("recurring");
|
|
15
15
|
currentTraceId = "";
|
|
16
|
+
lastErrorMessage = "";
|
|
16
17
|
constructor(e) {
|
|
17
18
|
this.options = e;
|
|
18
19
|
}
|
|
@@ -43,7 +44,7 @@ var u = e("cloud-transport"), d = 3e4, f = 16e3, p = 1e3, m = 2, h = 5, g = clas
|
|
|
43
44
|
}
|
|
44
45
|
handleOpen = (e) => {
|
|
45
46
|
let t = this.retryCount > 0 ? "reconnected" : "connected", r = e.slice(0, 15), i = /\/(v\d+)\//.exec(e)?.[1] ?? "", a = i ? `${r}.../${i}` : r;
|
|
46
|
-
u.report(`${t} to ${a}`, { traceId: this.currentTraceId }), this.retryTimer.stop(), this.retryCount = 0, this.pingTimer.start(this.sendPing, d), n(), this.options.onOpen?.();
|
|
47
|
+
u.report(`${t} to ${a}`, { traceId: this.currentTraceId }), this.retryTimer.stop(), this.retryCount = 0, this.lastErrorMessage = "", this.pingTimer.start(this.sendPing, d), n(), this.options.onOpen?.();
|
|
47
48
|
};
|
|
48
49
|
handlePong = () => {};
|
|
49
50
|
handleClose = (e, n) => {
|
|
@@ -58,7 +59,7 @@ var u = e("cloud-transport"), d = 3e4, f = 16e3, p = 1e3, m = 2, h = 5, g = clas
|
|
|
58
59
|
u.report("connect errored", {
|
|
59
60
|
traceId: this.currentTraceId,
|
|
60
61
|
error: e
|
|
61
|
-
}), e.message.includes("401") ? (o(e.message), this.options.onError?.({ type: "unauthorized" })) : i(e.message);
|
|
62
|
+
}), this.lastErrorMessage = e.message, e.message.includes("401") ? (o(e.message), this.options.onError?.({ type: "unauthorized" })) : i(e.message);
|
|
62
63
|
};
|
|
63
64
|
send(e, t = !1) {
|
|
64
65
|
if (!this.ws || this.ws.readyState !== l.OPEN) return u.error("cannot send message: connection not open"), !1;
|
|
@@ -81,7 +82,9 @@ var u = e("cloud-transport"), d = 3e4, f = 16e3, p = 1e3, m = 2, h = 5, g = clas
|
|
|
81
82
|
u.report("retry attempts exhausted, giving up", {
|
|
82
83
|
traceId: this.currentTraceId,
|
|
83
84
|
retryCount: this.retryCount
|
|
84
|
-
})
|
|
85
|
+
});
|
|
86
|
+
let t = e || this.lastErrorMessage;
|
|
87
|
+
t && i(`重试耗尽:${t}`, this.retryCount);
|
|
85
88
|
return;
|
|
86
89
|
}
|
|
87
90
|
this.retryTimer.stop();
|
|
@@ -89,7 +92,7 @@ var u = e("cloud-transport"), d = 3e4, f = 16e3, p = 1e3, m = 2, h = 5, g = clas
|
|
|
89
92
|
this.retryCount += 1, u.report("scheduling reconnect attempt", {
|
|
90
93
|
retryCount: this.retryCount,
|
|
91
94
|
delay: t
|
|
92
|
-
}), a(e
|
|
95
|
+
}), a(e || this.lastErrorMessage || "连接断开,重连中", this.retryCount), this.retryTimer.start(() => void this.connect(), t);
|
|
93
96
|
}
|
|
94
97
|
calculateRetryDelay() {
|
|
95
98
|
let e = p * m ** Math.min(this.retryCount, 4);
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { resolveCommandCtx as e } from "../diagnose/chat-id-resolver.mjs";
|
|
2
|
+
import { renderTraceReport as t, runTrace as n } from "../diagnose/report/trace.mjs";
|
|
2
3
|
import "../diagnose/index.mjs";
|
|
3
|
-
import { resolveCommandChatId as n } from "./context.mjs";
|
|
4
4
|
//#region src/command/diagnose.ts
|
|
5
5
|
async function r(r, i) {
|
|
6
|
-
|
|
7
|
-
return a ? e(t(a, i)) : "YOYO 控虾消息分析异常\n\n[WARN] 缺少可用的 chatId";
|
|
6
|
+
return t(n(await e(r), i));
|
|
8
7
|
}
|
|
9
8
|
//#endregion
|
|
10
9
|
export { r as handleDiagnoseCommand };
|
package/dist/command/doctor.mjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { resolveCommandCtx as e } from "../diagnose/chat-id-resolver.mjs";
|
|
2
|
+
import { renderDoctorReport as t, runDoctor as n } from "../diagnose/report/doctor/impl.mjs";
|
|
2
3
|
import "../diagnose/index.mjs";
|
|
3
|
-
import { resolveCommandChatId as n } from "./context.mjs";
|
|
4
4
|
//#region src/command/doctor.ts
|
|
5
5
|
async function r(r) {
|
|
6
|
-
return
|
|
6
|
+
return t(await n(await e(r), r.accountId));
|
|
7
7
|
}
|
|
8
8
|
//#endregion
|
|
9
9
|
export { r as handleDoctorCommand };
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { clawLogger as e } from "../utils/claw-logger.mjs";
|
|
2
|
+
import { looksLikeChatId as t, parseChatId as n } from "../messaging/target/chat-id.mjs";
|
|
3
|
+
import { readChatIdFromSessionKey as r, readChatIdFromTo as i } from "../messaging/target/address.mjs";
|
|
4
|
+
import "../messaging/target/index.mjs";
|
|
5
|
+
//#region src/diagnose/chat-id-resolver.ts
|
|
6
|
+
var a = {
|
|
7
|
+
problem: "当前会话不是 YOYO 控虾会话",
|
|
8
|
+
remedy: "请切到 yoyo: 开头的会话后再执行该命令"
|
|
9
|
+
}, o = e("command");
|
|
10
|
+
async function s(e) {
|
|
11
|
+
o.info("resolve command ctx input", {
|
|
12
|
+
channel: e.channel,
|
|
13
|
+
to: e.to,
|
|
14
|
+
from: e.from,
|
|
15
|
+
sessionKey: e.sessionKey,
|
|
16
|
+
sessionId: e.sessionId
|
|
17
|
+
});
|
|
18
|
+
let s = e.to ? i(e.to) : void 0;
|
|
19
|
+
if (s && !t(s) && (s = void 0), !s && e.from) {
|
|
20
|
+
let n = i(e.from);
|
|
21
|
+
n && t(n) && (s = n);
|
|
22
|
+
}
|
|
23
|
+
if (s ??= r(e.sessionKey), !s) return {
|
|
24
|
+
ok: !1,
|
|
25
|
+
...a
|
|
26
|
+
};
|
|
27
|
+
try {
|
|
28
|
+
let { deviceId: e } = await n(s);
|
|
29
|
+
return {
|
|
30
|
+
ok: !0,
|
|
31
|
+
chatId: s,
|
|
32
|
+
deviceId: e
|
|
33
|
+
};
|
|
34
|
+
} catch {
|
|
35
|
+
return {
|
|
36
|
+
ok: !1,
|
|
37
|
+
...a
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
//#endregion
|
|
42
|
+
export { s as resolveCommandCtx };
|
package/dist/diagnose/index.mjs
CHANGED
|
@@ -15,7 +15,7 @@ var n = {
|
|
|
15
15
|
connecting: "连接中",
|
|
16
16
|
connected: "已连接",
|
|
17
17
|
reconnecting: "断开重连中",
|
|
18
|
-
unauthorized: "
|
|
18
|
+
unauthorized: "认证失败",
|
|
19
19
|
error: "异常",
|
|
20
20
|
authenticating: "认证中",
|
|
21
21
|
authenticated: "已认证",
|
|
@@ -30,38 +30,43 @@ function r(e) {
|
|
|
30
30
|
default: return "warn";
|
|
31
31
|
}
|
|
32
32
|
}
|
|
33
|
-
function i(t, i) {
|
|
33
|
+
function i(t, i, a) {
|
|
34
34
|
if (!i) return null;
|
|
35
|
-
|
|
36
|
-
|
|
35
|
+
if (a) return e(t, "skip", `${n[i.phase]}(${a})`);
|
|
36
|
+
let o = r(i.phase), s = n[i.phase];
|
|
37
|
+
return e(t, o, i.lastError ? s + "(" + i.lastError + ")" : s, ["请检查设备网络、代理是否正常后重试", "网络无异常,则云服务可能出现问题,请反馈给工作人员"]);
|
|
37
38
|
}
|
|
38
39
|
function a(t) {
|
|
39
40
|
let { enabledAccountIds: n, channelEnabled: r } = t;
|
|
40
|
-
return r ? n.length === 0 ? [e("account_config", "fail", "没有有效启用的账号", "
|
|
41
|
+
return r ? n.length === 0 ? [e("account_config", "fail", "没有有效启用的账号", ["启用已登录账号", "重新运行 openclaw honor login"])] : n.length > 1 ? [e("account_config", "warn", "发现 " + n.length + " 个启用账号,当前只支持单账号连接", "仅保留一个启用账号")] : [e("account_config", "pass", "已启用账号 " + n[0])] : [e("channel_config", "fail", "yoyo channel 已被全局禁用", "启用 channels.yoyo.enabled")];
|
|
41
42
|
}
|
|
42
|
-
function o(
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
let
|
|
48
|
-
|
|
43
|
+
function o(e, t) {
|
|
44
|
+
if (!e.channelEnabled) return "yoyo channel 未启用";
|
|
45
|
+
if (!t) return "账号未登录";
|
|
46
|
+
}
|
|
47
|
+
function s(n) {
|
|
48
|
+
let { account: r, configuration: s, connectionStates: c } = n, l = r.selected, u = [], d = [];
|
|
49
|
+
u.push(...a(s));
|
|
50
|
+
let f = o(s, l), p = i("cloud_socket", c.get("cloud"), f);
|
|
51
|
+
p && u.push(p);
|
|
52
|
+
let m = i("admin_gateway", c.get("admin"), f);
|
|
53
|
+
if (m && u.push(m), l) {
|
|
49
54
|
let t = {
|
|
50
55
|
valid: e("token", "pass", "Token 有效"),
|
|
51
|
-
needs_refresh: e("token", "warn", "
|
|
52
|
-
expired: e("token", "fail", "Token 已过期", "
|
|
53
|
-
absent: e("token", "fail", "未找到登录凭证", "
|
|
56
|
+
needs_refresh: e("token", "warn", "认证凭证已进入刷新窗口", "等待云侧刷新,无需操作"),
|
|
57
|
+
expired: e("token", "fail", "Token 已过期", ["可在 YOYO 控虾端发起对话并重新授权", "可运行 openclaw honor login 重新登录荣耀账号"]),
|
|
58
|
+
absent: e("token", "fail", "未找到登录凭证", "请运行 openclaw honor login 登录荣耀账号")
|
|
54
59
|
};
|
|
55
|
-
|
|
60
|
+
d.push(t[l.token.status]), d.push(l.registration.registered ? l.registration.matchesCurrent ? e("registration", "pass", "注册信息与当前插件版本一致") : e("registration", "fail", "注册信息已过期", "请运行 openclaw honor login 重新登录荣耀账号") : e("registration", "fail", "没有本地设备注册记录", "请运行 openclaw honor login 登录荣耀账号"));
|
|
56
61
|
}
|
|
57
|
-
let
|
|
62
|
+
let h = t([...u, ...d]);
|
|
58
63
|
return {
|
|
59
64
|
timestamp: n.timestamp,
|
|
60
|
-
overallStatus:
|
|
61
|
-
globalChecks:
|
|
62
|
-
accountChecks:
|
|
65
|
+
overallStatus: h,
|
|
66
|
+
globalChecks: u,
|
|
67
|
+
accountChecks: d,
|
|
63
68
|
snapshot: n
|
|
64
69
|
};
|
|
65
70
|
}
|
|
66
71
|
//#endregion
|
|
67
|
-
export {
|
|
72
|
+
export { s as evaluateDiagnostics, t as resolveOverallStatus };
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { toErrorMessage as e } from "../../../utils/error.mjs";
|
|
2
|
+
import { ToolError as t } from "../../../tools/error.mjs";
|
|
3
|
+
import { getDeviceWithStatus as n } from "../../../capabilities/node/directory.mjs";
|
|
4
|
+
import "../../../capabilities/node/index.mjs";
|
|
5
|
+
import { maskAccountId as r } from "../formatter.mjs";
|
|
6
|
+
//#region src/diagnose/report/doctor/device-check.ts
|
|
7
|
+
function i(n) {
|
|
8
|
+
if (n instanceof t) switch (n.code) {
|
|
9
|
+
case "unauthorized": return {
|
|
10
|
+
message: "当前账号未登录,无法查询设备",
|
|
11
|
+
remedy: "请先完成荣耀账号登录"
|
|
12
|
+
};
|
|
13
|
+
case "device_info": return {
|
|
14
|
+
message: "无法获取本地设备信息",
|
|
15
|
+
remedy: ["请重启 OpenClaw 网关后重试"]
|
|
16
|
+
};
|
|
17
|
+
case "api_failed": return {
|
|
18
|
+
message: `查询设备列表失败:${n.message}`,
|
|
19
|
+
remedy: ["云服务异常,请反馈给工作人员"]
|
|
20
|
+
};
|
|
21
|
+
case "network_error": return {
|
|
22
|
+
message: "查询设备列表失败:网络异常",
|
|
23
|
+
remedy: ["请检查设备网络、代理是否正常后重试"]
|
|
24
|
+
};
|
|
25
|
+
default: return {
|
|
26
|
+
message: `查询设备列表失败(${n.code}):${n.message}`,
|
|
27
|
+
remedy: ["云服务异常,请反馈给工作人员"]
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
return {
|
|
31
|
+
message: `设备列表查询失败:${e(n)}`,
|
|
32
|
+
remedy: ["云服务异常,请反馈给工作人员"]
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
async function a(e) {
|
|
36
|
+
if (!e.ok) return {
|
|
37
|
+
id: "current_device_unknown",
|
|
38
|
+
status: "warn",
|
|
39
|
+
message: e.problem,
|
|
40
|
+
remedy: e.remedy
|
|
41
|
+
};
|
|
42
|
+
let t = e.deviceId;
|
|
43
|
+
try {
|
|
44
|
+
let e = await n(t);
|
|
45
|
+
if (!e) return {
|
|
46
|
+
id: "current_device_not_found",
|
|
47
|
+
status: "fail",
|
|
48
|
+
message: `未找到设备(ID:${t})`,
|
|
49
|
+
remedy: "请确认当前荣耀账号已使用过 YOYO控虾端,确认后请重新发起对话"
|
|
50
|
+
};
|
|
51
|
+
let i = `${e.deviceName ?? "未知设备"}(${r(e.deviceId)})`;
|
|
52
|
+
return e.online ? {
|
|
53
|
+
status: "pass",
|
|
54
|
+
message: `设备 ${i} 在线可达`
|
|
55
|
+
} : {
|
|
56
|
+
id: "current_device_offline",
|
|
57
|
+
status: "fail",
|
|
58
|
+
message: `设备 ${i} 已离线`,
|
|
59
|
+
remedy: "请在手机上打开 YOYO 控虾应用"
|
|
60
|
+
};
|
|
61
|
+
} catch (e) {
|
|
62
|
+
let { message: t, remedy: n } = i(e);
|
|
63
|
+
return {
|
|
64
|
+
id: "current_device_unknown",
|
|
65
|
+
status: "warn",
|
|
66
|
+
message: t,
|
|
67
|
+
remedy: n
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
//#endregion
|
|
72
|
+
export { a as checkCurrentDeviceReachable };
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { collectDiagnosticsSnapshot as e } from "../../collector.mjs";
|
|
2
|
+
import { evaluateDiagnostics as t } from "../diagnose.mjs";
|
|
3
|
+
import { formatCheck as n, formatDateTime as r } from "../formatter.mjs";
|
|
4
|
+
import { checkCurrentDeviceReachable as i } from "./device-check.mjs";
|
|
5
|
+
//#region src/diagnose/report/doctor/impl.ts
|
|
6
|
+
var a = [
|
|
7
|
+
{
|
|
8
|
+
id: "account_config",
|
|
9
|
+
title: "尚未登录或凭证不可用"
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
id: "token",
|
|
13
|
+
title: "尚未登录或凭证不可用"
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
id: "cloud_socket",
|
|
17
|
+
title: "云通道不可用"
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
id: "admin_gateway",
|
|
21
|
+
title: "管理通道不可用"
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
id: "channel_config",
|
|
25
|
+
title: "Channel 配置异常"
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
id: "current_device_offline",
|
|
29
|
+
title: "当前对话设备离线"
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
id: "current_device_not_found",
|
|
33
|
+
title: "当前对话设备未找到"
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
id: "current_device_unknown",
|
|
37
|
+
title: "当前对话设备状态未知"
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
id: "registration",
|
|
41
|
+
title: "设备注册信息不匹配"
|
|
42
|
+
}
|
|
43
|
+
];
|
|
44
|
+
async function o(e, n) {
|
|
45
|
+
let r = t(e), o = [...r.globalChecks, ...r.accountChecks].filter((e) => e.status === "warn" || e.status === "fail"), s = await i(n);
|
|
46
|
+
s && s.status !== "pass" && o.push(s);
|
|
47
|
+
let c = [];
|
|
48
|
+
for (let e of a) {
|
|
49
|
+
let t = o.filter((t) => t.id === e.id);
|
|
50
|
+
if (t.length > 0) {
|
|
51
|
+
let n = [];
|
|
52
|
+
for (let e of t) {
|
|
53
|
+
let t = e.remedy, r = t === void 0 ? [] : Array.isArray(t) ? t : [t];
|
|
54
|
+
for (let e of r) e && !n.includes(e) && n.push(e);
|
|
55
|
+
}
|
|
56
|
+
c.push({
|
|
57
|
+
id: e.id,
|
|
58
|
+
title: e.title,
|
|
59
|
+
remedies: n,
|
|
60
|
+
checks: t
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
return {
|
|
65
|
+
timestamp: e.timestamp,
|
|
66
|
+
matchedSymptoms: c,
|
|
67
|
+
generalChecks: o
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
async function s(t, n) {
|
|
71
|
+
return o(await e(n), t);
|
|
72
|
+
}
|
|
73
|
+
function c(e) {
|
|
74
|
+
let t = r(e.timestamp);
|
|
75
|
+
if (e.matchedSymptoms.length === 0) return `YOYO 控虾问题诊断\n诊断时间:${t}\n\n[PASS] 所有检查通过`;
|
|
76
|
+
let i = [
|
|
77
|
+
"YOYO 控虾问题诊断",
|
|
78
|
+
`诊断时间:${t}`,
|
|
79
|
+
""
|
|
80
|
+
];
|
|
81
|
+
for (let t = 0; t < e.matchedSymptoms.length; t++) {
|
|
82
|
+
t > 0 && i.push("---", "");
|
|
83
|
+
let r = e.matchedSymptoms[t];
|
|
84
|
+
if (i.push(r.title), r.checks.length > 0) {
|
|
85
|
+
i.push("问题");
|
|
86
|
+
for (let e of r.checks) i.push(n(e));
|
|
87
|
+
}
|
|
88
|
+
i.push("解决方案");
|
|
89
|
+
for (let e of r.remedies) i.push(` ${e}`);
|
|
90
|
+
i.push("");
|
|
91
|
+
}
|
|
92
|
+
return i.join("\n");
|
|
93
|
+
}
|
|
94
|
+
//#endregion
|
|
95
|
+
export { o as buildDoctorReport, c as renderDoctorReport, s as runDoctor };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import "./impl.mjs";
|
|
@@ -10,9 +10,7 @@ var e = {
|
|
|
10
10
|
unhealthy: "异常"
|
|
11
11
|
};
|
|
12
12
|
function n(t) {
|
|
13
|
-
|
|
14
|
-
for (let e of t.details ?? []) n.push(e);
|
|
15
|
-
return n.join("\n");
|
|
13
|
+
return ` ${e[t.status]} ${t.message}`;
|
|
16
14
|
}
|
|
17
15
|
function r(e) {
|
|
18
16
|
return t[e];
|
|
@@ -2,7 +2,7 @@ import { evaluateDiagnostics as e } from "./diagnose.mjs";
|
|
|
2
2
|
import { formatDateTime as t, formatOverall as n, maskAccountId as r } from "./formatter.mjs";
|
|
3
3
|
//#region src/diagnose/report/status.ts
|
|
4
4
|
function i(e) {
|
|
5
|
-
return
|
|
5
|
+
return `【${e}】`;
|
|
6
6
|
}
|
|
7
7
|
var a = {
|
|
8
8
|
idle: "未启动",
|
|
@@ -15,54 +15,41 @@ var a = {
|
|
|
15
15
|
authenticated: "已认证",
|
|
16
16
|
closed: "已断开"
|
|
17
17
|
};
|
|
18
|
-
function o(e) {
|
|
19
|
-
|
|
20
|
-
}
|
|
21
|
-
function s(e, t, n) {
|
|
22
|
-
let r = [`${e} ${i(o(t))}`];
|
|
18
|
+
function o(e, t, n) {
|
|
19
|
+
let r = [i(e)];
|
|
23
20
|
return t ? (r.push(` 状态:${a[t.phase] ?? t.phase}`), t.retryCount !== void 0 && r.push(` 重试次数:${t.retryCount}`), t.lastError && r.push(` 最近错误:${t.lastError}`), r) : (r.push(` 状态:${n ?? "未连接"}`), r);
|
|
24
21
|
}
|
|
25
|
-
|
|
26
|
-
if (!e) return "warn";
|
|
27
|
-
switch (e.token.status) {
|
|
28
|
-
case "valid": return "pass";
|
|
29
|
-
case "needs_refresh": return "warn";
|
|
30
|
-
case "expired":
|
|
31
|
-
case "absent": return "fail";
|
|
32
|
-
default: return "warn";
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
var l = {
|
|
22
|
+
var s = {
|
|
36
23
|
valid: "有效",
|
|
37
24
|
needs_refresh: "待刷新",
|
|
38
25
|
expired: "已过期",
|
|
39
26
|
absent: "缺失"
|
|
40
27
|
};
|
|
41
|
-
function
|
|
42
|
-
return `主连接:${e ? a[e.phase] ?? e.phase : "未启动"}
|
|
28
|
+
function c(e) {
|
|
29
|
+
return `主连接:${e ? a[e.phase] ?? e.phase : "未启动"}`;
|
|
43
30
|
}
|
|
44
|
-
function
|
|
45
|
-
let { account:
|
|
46
|
-
if (
|
|
31
|
+
function l(a) {
|
|
32
|
+
let { account: l, configuration: u, connectionStates: d, devices: f, environment: p } = a, m = d.get("cloud"), h = d.get("admin"), g = l.selected, _ = l.accounts.toSorted((e, t) => Number(t.enabled) - Number(e.enabled)), v = m?.updatedAt && m.updatedAt > 0 ? m.updatedAt : a.collectedAtMs, y = [i("YOYO 连接状态")];
|
|
33
|
+
if (y.push(`总体状态:${n(e(a).overallStatus)}`), y.push(`更新时间:${t(v)}`, c(m), ""), y.push(i("Channel 配置")), y.push(`开启状态:${u.channelEnabled ? "已开启" : "未开启"}`), _.length === 0) y.push("账号列表:暂无账号");
|
|
47
34
|
else {
|
|
48
|
-
|
|
49
|
-
for (let e of
|
|
35
|
+
y.push("账号列表:", " | 账号 ID | 状态 |", " | --- | --- |");
|
|
36
|
+
for (let e of _) {
|
|
50
37
|
let t = r(e.accountId);
|
|
51
|
-
|
|
38
|
+
y.push(`| ${t} | ${e.enabled ? "已开启" : "未开启"} |`);
|
|
52
39
|
}
|
|
53
|
-
|
|
40
|
+
y.push("\n ");
|
|
54
41
|
}
|
|
55
|
-
if (
|
|
42
|
+
if (y.push(""), g ? y.push(i("认证信息"), `账号:${r(g.accountId)}`, `登录状态:${g.loggedIn ? "已登录" : "未登录"}`, `Token 状态:${s[g.token.status]}`, `Token 过期时间:${t(g.token.expiresAt)}`, `Token 刷新时间:${t(g.token.refreshExpiresAt)}`, "") : y.push(i("认证信息"), " 状态:无开启账号", ""), f === void 0) y.push(i("设备列表"), "设备查询失败,未能获取在线状态", "");
|
|
56
43
|
else {
|
|
57
|
-
let e =
|
|
58
|
-
|
|
59
|
-
for (let e of
|
|
44
|
+
let e = f.filter((e) => e.online).length;
|
|
45
|
+
y.push(i("设备列表"), `在线设备:${e}/${f.length}`), y.push("| 设备名称 | 设备 ID | 状态 |", " | --- | --- | --- |");
|
|
46
|
+
for (let e of f) {
|
|
60
47
|
let t = e.deviceName ?? `…${e.deviceId.slice(-4)}`;
|
|
61
|
-
|
|
48
|
+
y.push(` | ${t} | ${r(e.deviceId)} | ${e.online ? "在线" : "离线"} |`);
|
|
62
49
|
}
|
|
63
|
-
|
|
50
|
+
y.push("\n ");
|
|
64
51
|
}
|
|
65
|
-
return
|
|
52
|
+
return y.push(""), y.push(...o("管理通道", h, "未连接"), ""), y.push(i("环境信息"), ` Node 版本:${p.nodeVersion}(${p.platform}/${p.arch})`, ` 插件版本:${p.pluginVersion || p.pluginVersionCode || "-"}`, ` 运行环境:${p.envInfo.env}(${p.envInfo.source})`, ...p.grayTag ? [`灰度标签:${p.grayTag}`] : []), y.join("\n");
|
|
66
53
|
}
|
|
67
54
|
//#endregion
|
|
68
|
-
export {
|
|
55
|
+
export { l as renderStatusReport };
|