dsh-plugin-mobile-link 0.4.1 → 0.6.5
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 +10 -2
- package/cordis.patch.yml +35 -0
- package/lib/cli.js +6 -6
- package/lib/client.js +493 -0
- package/lib/diagnostics.js +172 -0
- package/lib/hello.js +19 -2
- package/lib/history/filter-scan.js +145 -0
- package/lib/history/records.js +125 -0
- package/lib/history/session-snapshot.js +119 -0
- package/lib/history/shared.js +25 -0
- package/lib/history/window.js +90 -0
- package/lib/history.js +401 -0
- package/lib/index.js +45 -6
- package/lib/journal.js +279 -0
- package/lib/link.js +179 -4
- package/lib/qr.js +34 -5
- package/lib/router.js +237 -2
- package/lib/routes.js +26 -55
- package/lib/session-digest.js +117 -0
- package/lib/status.js +28 -2
- package/package.json +5 -1
package/lib/status.js
CHANGED
|
@@ -33,8 +33,7 @@ export const HOST_HINTS = {
|
|
|
33
33
|
unknown: { hint: '无法识别当前宿主;若连不上,请按"排查"一节处理', docAnchor: '排查:连不上时看这里' },
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
-
/** 本机 DSH 侧的诊断块(老字段一个不少,新字段只增)。 */
|
|
37
|
-
function dshBlock(agent) {
|
|
36
|
+
/** 本机 DSH 侧的诊断块(老字段一个不少,新字段只增)。 */function dshBlock(agent) {
|
|
38
37
|
const errorKind = agent.dshError ? (agent.dsh?.errorKind ?? 'unreachable') : null
|
|
39
38
|
const entry = errorKind ? DSH_HINTS[errorKind] : undefined
|
|
40
39
|
return {
|
|
@@ -51,6 +50,31 @@ function dshBlock(agent) {
|
|
|
51
50
|
}
|
|
52
51
|
}
|
|
53
52
|
|
|
53
|
+
/**
|
|
54
|
+
* 生命周期流水的读法(只增字段)。
|
|
55
|
+
*
|
|
56
|
+
* 为什么状态接口要给这一块:`lastError` 只有最后一条,而"手机为什么连不上"往往要
|
|
57
|
+
* 看**之前**发生过什么(拆了几次链、每次什么原因、设备是不是同时开了两条)。
|
|
58
|
+
*
|
|
59
|
+
* 读法要说清楚:`recent` / `recorded` / `dropped` 都是**当前这个实例**的(热更会换实例,
|
|
60
|
+
* 换完这几个数从零开始);跨实例的完整历史只在 `path` 指的 JSONL 文件里——两者互补,
|
|
61
|
+
* 别拿 `recorded` 当"这台机器一共连过几次"。没有流水对象(老调用方、单测的假 agent)
|
|
62
|
+
* 时给空块,不是 `undefined`——读者不用做判空。
|
|
63
|
+
*/
|
|
64
|
+
function journalBlock(agent) {
|
|
65
|
+
const journal = agent.journal
|
|
66
|
+
return {
|
|
67
|
+
path: journal?.path ?? null,
|
|
68
|
+
recorded: journal?.recorded ?? 0,
|
|
69
|
+
dropped: journal?.dropped ?? 0,
|
|
70
|
+
fileErrors: journal?.fileErrors ?? 0,
|
|
71
|
+
recent: journal?.recent?.(STATUS_JOURNAL_ENTRIES) ?? [],
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/** `/status` 里随每次轮询带出的流水条数。完整历史读 `journal.path` 那个文件。 */
|
|
76
|
+
const STATUS_JOURNAL_ENTRIES = 20
|
|
77
|
+
|
|
54
78
|
/**
|
|
55
79
|
* @param {import('./link.js').MobileLinkAgent} agent
|
|
56
80
|
* @returns {Record<string, unknown>} 可直接序列化给 `/status` 的对象
|
|
@@ -97,5 +121,7 @@ export function statusSnapshot(agent) {
|
|
|
97
121
|
startedAt: agent.startedAt ?? null,
|
|
98
122
|
connectedAt: agent.connectedAt ?? null,
|
|
99
123
|
reconnectAttempts: agent.reconnectAttempts,
|
|
124
|
+
// 新增(只增不改):生命周期流水的摘要与最近若干条,见上面的 journalBlock。
|
|
125
|
+
journal: journalBlock(agent),
|
|
100
126
|
}
|
|
101
127
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-plugin-mobile-link",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.5",
|
|
4
4
|
"description": "Put your PC's DeepSeek Harness in your pocket: dials a relay over WSS so the native iOS client reaches this machine even without a public IP.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"dsh",
|
|
@@ -30,6 +30,7 @@
|
|
|
30
30
|
},
|
|
31
31
|
"exports": {
|
|
32
32
|
".": "./lib/index.js",
|
|
33
|
+
"./client": "./lib/client.js",
|
|
33
34
|
"./dlp": "./lib/dlp.js",
|
|
34
35
|
"./link": "./lib/link.js",
|
|
35
36
|
"./cordis.patch.yml": "./cordis.patch.yml",
|
|
@@ -49,6 +50,9 @@
|
|
|
49
50
|
"dsh": {
|
|
50
51
|
"bundle": {
|
|
51
52
|
"patch": "./cordis.patch.yml"
|
|
53
|
+
},
|
|
54
|
+
"client": {
|
|
55
|
+
"platform": "web"
|
|
52
56
|
}
|
|
53
57
|
}
|
|
54
58
|
}
|