dsh-long-plugins 2.6.2 → 3.0.2
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/LICENSE +0 -0
- package/README.md +0 -0
- package/THIRD_PARTY_NOTICES.md +0 -0
- package/client/client.js +440 -980
- package/client/client.js.bak-v264 +3291 -0
- package/client/vendor/chart.umd.min.js +0 -0
- package/client/vendor/docx-preview.min.js +0 -0
- package/client/vendor/jszip.min.js +0 -0
- package/client/vendor/pptxviewjs.min.js +0 -0
- package/client/vendor/xlsx.full.min.js +0 -0
- package/cordis.patch.yml +0 -0
- package/dsh.plugin.json +1 -1
- package/lib/index.js +1 -1
- package/lib/index.js.bak-v264 +2836 -0
- package/package.json +2 -3
- package/skill/dsh-common-plugins-install/SKILL.md +0 -0
- package/skill/dsh-long-plugins-install/SKILL.md +0 -0
- package/skill/dsh-upgrade/SKILL.md +0 -0
- package/skill/dsh-web-start-panel-install/SKILL.md +0 -0
- package/skill/dsh-web-win-service-install/SKILL.md +0 -0
- package/patches/dsh-client-connection-heartbeat.sh +0 -112
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-long-plugins",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.2",
|
|
4
4
|
"description": "Merged DSH web plugins: upload manager (drag-and-drop attach any file to the message), workspace output files, skill docs, account balance, and polished file preview (Word & PowerPoint real preview with zoom/pan, rendered Markdown), plus an auto-repair install for DSH core patches (reverse-proxy WebSocket heartbeat, upgrade relink). | 一个插件整合 DSH Web 的常用增强:上传管理(拖放上传:拖任意文件到会话框直接附加)、工作区「输出文件」面板、技能文档浏览、账户余额显示、Word/PowerPoint 真实预览(可缩放、翻页);并自带修复安装,自动重连 DSH 核心补丁(反代 WebSocket 心跳、升级重连)。Office 读取/生成已独立到 dsh-office-reader;RA-Span 已独立到 dsh-span。",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -21,8 +21,7 @@
|
|
|
21
21
|
"skill/dsh-upgrade/SKILL.md",
|
|
22
22
|
"skill/dsh-common-plugins-install/SKILL.md",
|
|
23
23
|
"skill/dsh-web-win-service-install/SKILL.md",
|
|
24
|
-
"skill/dsh-web-start-panel-install/SKILL.md"
|
|
25
|
-
"patches/dsh-client-connection-heartbeat.sh"
|
|
24
|
+
"skill/dsh-web-start-panel-install/SKILL.md"
|
|
26
25
|
],
|
|
27
26
|
"dependencies": {
|
|
28
27
|
"mammoth": "^1.12.1",
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -1,112 +0,0 @@
|
|
|
1
|
-
#!/bin/sh
|
|
2
|
-
# dsh-client-connection-heartbeat.sh — 给 DSH 核心下行 WebSocket 加心跳补丁
|
|
3
|
-
#
|
|
4
|
-
# 作用:反代/中间设备会按只读超时关停长期沉默的上游 WebSocket。提问/审批窗口
|
|
5
|
-
# 等待人类作答时 agent 循环被暂停、无帧流动,mux/host 流被切断后前端清空
|
|
6
|
-
# 「待回答问题」→ 窗口消失,只能靠刷新重连恢复。
|
|
7
|
-
# 修复:给 DSH 核心 dsh-client-connection 的下行 WebSocket 每 15s 只 ping 一次,
|
|
8
|
-
# 保持下游流量,让反代下等待作答的问题窗口不再消失。只 ping、不做 pong 判定、
|
|
9
|
-
# 不 terminate,避免后台/节流的手机端(pong 延迟)被误判为死连接而断开。
|
|
10
|
-
#
|
|
11
|
-
# 该补丁改的是 DSH 核心模块(不在本插件内)。装 dsh-long-plugins 时 install.sh 会
|
|
12
|
-
# 调本脚本自动重打;DSH 升级会覆盖核心 → 需重跑本脚本(或跑插件升级流程)。
|
|
13
|
-
#
|
|
14
|
-
# 幂等:可重复执行,已打过会跳过。
|
|
15
|
-
# 用法:sh dsh-client-connection-heartbeat.sh
|
|
16
|
-
set -e
|
|
17
|
-
echo "==> dsh-client-connection 心跳补丁"
|
|
18
|
-
|
|
19
|
-
# 定位 DSH 核心里 dsh-client-connection 的 index.js
|
|
20
|
-
# 优先用 npm root -g;找不到再探测常见全局路径。
|
|
21
|
-
NPM_ROOT="$(npm root -g 2>/dev/null || true)"
|
|
22
|
-
CANDIDATES=""
|
|
23
|
-
[ -n "$NPM_ROOT" ] && CANDIDATES="$NPM_ROOT/@deepseek-ai/dsh/node_modules/@deepseek-ai/dsh-client-connection/lib/index.js"
|
|
24
|
-
CANDIDATES="$CANDIDATES
|
|
25
|
-
/volume1/npm/global/lib/node_modules/@deepseek-ai/dsh/node_modules/@deepseek-ai/dsh-client-connection/lib/index.js
|
|
26
|
-
/usr/local/lib/node_modules/@deepseek-ai/dsh/node_modules/@deepseek-ai/dsh-client-connection/lib/index.js
|
|
27
|
-
$HOME/.dsh/../node_modules/@deepseek-ai/dsh/node_modules/@deepseek-ai/dsh-client-connection/lib/index.js"
|
|
28
|
-
|
|
29
|
-
IDX=""
|
|
30
|
-
for c in $CANDIDATES; do
|
|
31
|
-
[ -f "$c" ] && IDX="$c" && break
|
|
32
|
-
done
|
|
33
|
-
if [ -z "$IDX" ]; then
|
|
34
|
-
echo "错误:找不到 dsh-client-connection/lib/index.js(核心未装或路径不同)" >&2
|
|
35
|
-
echo " 请确认 DSH 已安装,并把 $IDX 路径填入本脚本,或联系维护者。" >&2
|
|
36
|
-
exit 1
|
|
37
|
-
fi
|
|
38
|
-
echo " 目标: $IDX"
|
|
39
|
-
|
|
40
|
-
# 幂等:已含心跳常量则跳过
|
|
41
|
-
if grep -q 'WEBSOCKET_HEARTBEAT_MS' "$IDX"; then
|
|
42
|
-
echo " 已打过,跳过 ✓"
|
|
43
|
-
exit 0
|
|
44
|
-
fi
|
|
45
|
-
# DSH 已原生心跳(如 v0.1.2-alpha 网关定期 ping):检测到已是 ping 心跳即跳过,避免重复/冲突
|
|
46
|
-
if grep -q 'socket\.ping()' "$IDX"; then
|
|
47
|
-
echo " 检测到 DSH 已有 WebSocket ping 心跳(原生或已打过),跳过 ✓"
|
|
48
|
-
exit 0
|
|
49
|
-
fi
|
|
50
|
-
|
|
51
|
-
# 待替换的原始代码未在 -> 可能是 DSH 已改逻辑(如 v0.1.2-alpha 会话视图/网关重构):温和跳过而不是硬失败
|
|
52
|
-
if ! grep -q 'var WebSocketDownlinks = class {' "$IDX"; then
|
|
53
|
-
echo " 提示:未找到 WebSocketDownlinks 类,DSH 可能已改逻辑(如新版原生心跳),跳过本补丁(不再硬失败)" >&2
|
|
54
|
-
exit 0
|
|
55
|
-
fi
|
|
56
|
-
|
|
57
|
-
cp "$IDX" "$IDX.bak-heartbeat-$(date +%Y%m%d-%H%M)"
|
|
58
|
-
python3 - "$IDX" <<'PY'
|
|
59
|
-
import sys
|
|
60
|
-
p = sys.argv[1]
|
|
61
|
-
T = "\t"
|
|
62
|
-
with open(p, encoding="utf-8") as f:
|
|
63
|
-
s = f.read()
|
|
64
|
-
|
|
65
|
-
def rep(old, new, label):
|
|
66
|
-
global s
|
|
67
|
-
if old not in s:
|
|
68
|
-
sys.stderr.write(" 跳过(未找到): %s\n" % label); return
|
|
69
|
-
if s.count(old) > 1:
|
|
70
|
-
sys.stderr.write(" 警告(出现%d次,跳过): %s\n" % (s.count(old), label)); return
|
|
71
|
-
s = s.replace(old, new, 1)
|
|
72
|
-
print(" 已应用: %s" % label)
|
|
73
|
-
|
|
74
|
-
CONST_COMMENT = ("/** Downlink heartbeat interval: keep the browser streams from idling out under\n"
|
|
75
|
-
"* a reverse proxy, whose read timeout would drop a mux/host socket a paused\n"
|
|
76
|
-
"* agent leaves silent. Must stay below the proxy's read timeout. */\n")
|
|
77
|
-
rep("var WebSocketDownlinks = class {",
|
|
78
|
-
CONST_COMMENT + "const WEBSOCKET_HEARTBEAT_MS = 15_000;\nvar WebSocketDownlinks = class {",
|
|
79
|
-
"心跳常量")
|
|
80
|
-
|
|
81
|
-
o_ctor = ("host API supplying the typed event streams. */\n" + T + "constructor(api) {\n" + T + T + "this.api = api;")
|
|
82
|
-
p_ctor = ("host API supplying the typed event streams. */\n" + T + "constructor(api) {\n" + T + T + "this.api = api;\n" +
|
|
83
|
-
T + T + "// A reverse proxy cuts an upstream WebSocket that stays silent for its\n" +
|
|
84
|
-
T + T + "// read timeout; while a question or approval waits on the human the agent\n" +
|
|
85
|
-
T + T + "// loop is paused and no frames flow, so the mux/host streams drop and the\n" +
|
|
86
|
-
T + T + "// client clears its pending question. Pinging the clients every\n" +
|
|
87
|
-
T + T + "// WEBSOCKET_HEARTBEAT_MS keeps downstream traffic flowing so the proxy does\n" +
|
|
88
|
-
T + T + "// not idle the downlink out. The pings are only sent, never reaped: a\n" +
|
|
89
|
-
T + T + "// throttled/backgrounded mobile client may answer a pong late, and\n" +
|
|
90
|
-
T + T + "// terminating on a missed pong would reopen the very disconnect we are\n" +
|
|
91
|
-
T + T + "// preventing — dead sockets are cleaned by the ws close/error path anyway.\n" +
|
|
92
|
-
T + T + "this.heartbeat = setInterval(() => {\n" +
|
|
93
|
-
T + T + T + "for (const socket of this.server.clients) {\n" +
|
|
94
|
-
T + T + T + T + "if (socket.readyState === WebSocket.OPEN) socket.ping();\n" +
|
|
95
|
-
T + T + T + "}\n" +
|
|
96
|
-
T + T + "}, WEBSOCKET_HEARTBEAT_MS);\n" +
|
|
97
|
-
T + T + "this.heartbeat.unref?.();")
|
|
98
|
-
rep(o_ctor, p_ctor, "心跳 interval")
|
|
99
|
-
|
|
100
|
-
o_close = (T + "async close() {\n" + T + T + "for (const socket of this.server.clients) socket.terminate();")
|
|
101
|
-
p_close = (T + "async close() {\n" + T + T + "clearInterval(this.heartbeat);\n" + T + T + "for (const socket of this.server.clients) socket.terminate();")
|
|
102
|
-
rep(o_close, p_close, "close 清理心跳")
|
|
103
|
-
|
|
104
|
-
with open(p, "w", encoding="utf-8") as f:
|
|
105
|
-
f.write(s)
|
|
106
|
-
PY
|
|
107
|
-
|
|
108
|
-
echo " 已应用 ✓"
|
|
109
|
-
[ -f "$IDX" ] && node --check "$IDX" >/dev/null 2>&1 && echo " 语法检查 OK" || echo " 语法检查失败(请核对)" >&2
|
|
110
|
-
echo
|
|
111
|
-
echo "✅ 心跳补丁完成。请重启 dsh 并强刷浏览器。"
|
|
112
|
-
echo " (DSH 升级会覆盖核心,需重跑本脚本)"
|