dsh-remote-go 0.3.1 → 0.3.3
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 +1 -0
- package/dist/client.js +224 -41
- package/dist/src/bootstrap.js +2 -1
- package/dist/src/connect/pipeline.js +3 -2
- package/dist/src/connect/reattach.js +6 -0
- package/dist/src/constants.js +20 -4
- package/dist/src/context.js +3 -1
- package/dist/src/errors.js +46 -6
- package/dist/src/host-lifecycle.js +36 -8
- package/dist/src/remote-proc.js +8 -2
- package/dist/src/remote-web/start.js +104 -24
- package/dist/src/runtime/rules.js +8 -1
- package/dist/src/ssh.js +4 -2
- package/dist/src/tools-report.js +9 -7
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
- **连接过程可见**:首次连接在浮窗里完成:确认主机指纹、按需输入密码,下方按阶段打印 SSH → 探测 → 准备运行时 → 启动 → 隧道 → 校验的日志并自动跟随;失败时的错误与建议也留在这个窗口里。连上后窗口自动关闭并接管整窗。
|
|
14
14
|
- **远端运行时自管**:远端不需要预装 Node,也不用安装本插件。插件把 Node 装到 `~/.dsh/remote-go/node`,再用 `npx` 拉起 `@deepseek-ai/dsh@<本机版本>`(`--port 0`),所以两端版本恒等,不动系统 Node、不需要 root,也不干扰远端其他项目。
|
|
15
15
|
- **重启 / 关闭远端 DSH**:已连接的主机卡片上可以直接重启或关闭远端 DSH。重启复用当前 SSH 会话,不重新认证,换新端口与新 token;关闭先弹一句确认,然后停掉本连接管理的远端进程并断开(不自动重连,点「重连」得到全新实例)。「重启」和「重连」都会浮出这台主机的连接窗口,进度与连接日志都在那里。远端自己重启(例如在远端更新插件)时,探活确认后会自动重新接管。
|
|
16
|
+
- **弱网也能自己缓过来**:SSH keepalive 容忍约 60 秒的停顿;探活要连续三次失败才判定远端不可用;自动重连在快速退避预算用尽后继续每约 30 秒试一次、最长 10 分钟,连接窗口会显示「链路仍未恢复,N 秒后继续重试」;远端自重启的重挂若因网络问题失败,也会自动重拨,不用手动点「重连」。
|
|
16
17
|
- **远端文件下载**:远端 Files 面板右键文件「下载」、右键文件夹「下载到本地」,Host 用同一条 SSH/SFTP 连接流式写入本地目录;不打包 ZIP、不限大小或数量,重名自动加 ` (2)`,保存位置限本机用户主目录。
|
|
17
18
|
- **给本地 AI 会话用主机**:注册三个模型工具——只读的 `remote_hosts_list`(清单、连接状态、SSH 用户与端口)、`remote_host_report`(单台主机的十项体检 + 连接日志)、`remote_exec`(在已连接主机上跑一条命令,复用插件已有的 SSH 会话)。三个工具默认全部隐藏,只注入解锁入口 `remote_tools`;调用后按会话解锁并在下一步可用。返回值不含密码、token、指纹原文或私钥路径,`remote_exec` 的写模式默认关闭,需在插件配置里显式打开。
|
|
18
19
|
|
package/dist/client.js
CHANGED
|
@@ -717,13 +717,29 @@ window.__ModuleLoader__.load({
|
|
|
717
717
|
cardStopRemote: ['关闭', 'Stop'],
|
|
718
718
|
cardStopping: ['正在关闭…', 'Stopping…'],
|
|
719
719
|
cardStopRemoteName: ['关闭远端 DSH', 'Stop the remote DSH'],
|
|
720
|
-
|
|
720
|
+
// One confirmation component for the three link actions; the host name and the consequence difference are the point.
|
|
721
|
+
stopRemoteTitle: ['关闭「{name}」的远端 DSH?', 'Stop the remote DSH on "{name}"?'],
|
|
721
722
|
stopRemoteBody: [
|
|
722
|
-
'
|
|
723
|
-
'
|
|
723
|
+
'会停止「{name}」上的远端 DSH 并断开连接;远端正在进行的任务会被终止。',
|
|
724
|
+
'This stops the remote DSH on "{name}" and disconnects. Remote tasks in progress will be terminated.',
|
|
724
725
|
],
|
|
725
726
|
stopRemoteConfirm: ['关闭', 'Stop'],
|
|
726
727
|
stopRemoteBusy: ['正在关闭…', 'Stopping…'],
|
|
728
|
+
restartRemoteTitle: ['重启「{name}」的远端 DSH?', 'Restart the remote DSH on "{name}"?'],
|
|
729
|
+
restartRemoteBody: [
|
|
730
|
+
'会重启「{name}」的远端 DSH(换新端口),正在进行中的远端任务会被终止。',
|
|
731
|
+
'This restarts the remote DSH on "{name}" on a new port. Remote tasks in progress will be terminated.',
|
|
732
|
+
],
|
|
733
|
+
restartRemoteConfirm: ['重启', 'Restart'],
|
|
734
|
+
restartRemoteBusy: ['正在重启…', 'Restarting…'],
|
|
735
|
+
disconnectRemoteTitle: ['断开与「{name}」的连接?', 'Disconnect from "{name}"?'],
|
|
736
|
+
disconnectRemoteBody: [
|
|
737
|
+
'只断开与「{name}」的链路,远端 DSH 继续运行,之后可以重连。',
|
|
738
|
+
'This only drops the link to "{name}". The remote DSH keeps running, and you can reconnect later.',
|
|
739
|
+
],
|
|
740
|
+
disconnectRemoteConfirm: ['断开', 'Disconnect'],
|
|
741
|
+
disconnectRemoteBusy: ['正在断开…', 'Disconnecting…'],
|
|
742
|
+
thisHost: ['这台主机', 'this host'],
|
|
727
743
|
cardDiagnose: ['诊断', 'Diagnose'],
|
|
728
744
|
cardEdit: ['编辑', 'Edit'],
|
|
729
745
|
cardDelete: ['删除', 'Delete'],
|
|
@@ -811,6 +827,10 @@ window.__ModuleLoader__.load({
|
|
|
811
827
|
'progress.verifying': ['正在验证远端界面…', 'Verifying the remote UI…'],
|
|
812
828
|
'progress.ready': ['就绪', 'Ready'],
|
|
813
829
|
'progress.reconnecting': ['断线重连中(第 {attempt}/{max} 次)…', 'Reconnecting ({attempt}/{max})…'],
|
|
830
|
+
'progress.reconnect-waiting': [
|
|
831
|
+
'链路仍未恢复,{retryInSec} 秒后继续重试(第 {attempt} 次)…',
|
|
832
|
+
'The link is still down; retrying in {retryInSec}s (attempt {attempt})…',
|
|
833
|
+
],
|
|
814
834
|
'progress.restarting-remote': [
|
|
815
835
|
'远端 DSH 正在重启,正在重新挂载界面…',
|
|
816
836
|
'The remote DSH is restarting; re-attaching the remote UI…',
|
|
@@ -2704,22 +2724,55 @@ window.__ModuleLoader__.load({
|
|
|
2704
2724
|
box('p', 'drg-paragraph', props.body),
|
|
2705
2725
|
)
|
|
2706
2726
|
}
|
|
2707
|
-
|
|
2727
|
+
const HOST_ACTION_DIALOGS = {
|
|
2728
|
+
stop: {
|
|
2729
|
+
title: 'stopRemoteTitle',
|
|
2730
|
+
body: 'stopRemoteBody',
|
|
2731
|
+
confirm: 'stopRemoteConfirm',
|
|
2732
|
+
busy: 'stopRemoteBusy',
|
|
2733
|
+
testId: 'stop-remote-dialog',
|
|
2734
|
+
prefix: 'stop-remote',
|
|
2735
|
+
},
|
|
2736
|
+
restart: {
|
|
2737
|
+
title: 'restartRemoteTitle',
|
|
2738
|
+
body: 'restartRemoteBody',
|
|
2739
|
+
confirm: 'restartRemoteConfirm',
|
|
2740
|
+
busy: 'restartRemoteBusy',
|
|
2741
|
+
testId: 'restart-remote-dialog',
|
|
2742
|
+
prefix: 'restart-remote',
|
|
2743
|
+
},
|
|
2744
|
+
disconnect: {
|
|
2745
|
+
title: 'disconnectRemoteTitle',
|
|
2746
|
+
body: 'disconnectRemoteBody',
|
|
2747
|
+
confirm: 'disconnectRemoteConfirm',
|
|
2748
|
+
busy: 'disconnectRemoteBusy',
|
|
2749
|
+
testId: 'disconnect-dialog',
|
|
2750
|
+
prefix: 'disconnect',
|
|
2751
|
+
},
|
|
2752
|
+
}
|
|
2753
|
+
function HostActionDialog(props) {
|
|
2708
2754
|
const t = translatorOf(props)
|
|
2755
|
+
const kind = props.kind && HOST_ACTION_DIALOGS[props.kind] ? props.kind : 'stop'
|
|
2756
|
+
const spec = HOST_ACTION_DIALOGS[kind]
|
|
2757
|
+
const rawName = typeof props.hostName === 'string' ? props.hostName.trim() : ''
|
|
2758
|
+
const name = rawName === '' ? t('thisHost') : rawName
|
|
2709
2759
|
const busy = props.busy === true
|
|
2710
2760
|
return h(ConfirmDialog, {
|
|
2711
|
-
title: t(
|
|
2712
|
-
body: t(
|
|
2713
|
-
confirmLabel: busy ? t(
|
|
2761
|
+
title: t(spec.title, { name }),
|
|
2762
|
+
body: t(spec.body, { name }),
|
|
2763
|
+
confirmLabel: busy ? t(spec.busy) : t(spec.confirm),
|
|
2714
2764
|
cancelLabel: t('cancel'),
|
|
2715
2765
|
busy,
|
|
2716
|
-
testId:
|
|
2717
|
-
confirmTestId: '
|
|
2718
|
-
cancelTestId: '
|
|
2766
|
+
testId: spec.testId,
|
|
2767
|
+
confirmTestId: spec.prefix + '-confirm',
|
|
2768
|
+
cancelTestId: spec.prefix + '-cancel',
|
|
2719
2769
|
onConfirm: props.onConfirm,
|
|
2720
2770
|
onCancel: props.onCancel,
|
|
2721
2771
|
})
|
|
2722
2772
|
}
|
|
2773
|
+
function StopRemoteDialog(props) {
|
|
2774
|
+
return h(HostActionDialog, { ...props, kind: 'stop' })
|
|
2775
|
+
}
|
|
2723
2776
|
function LoadingBlock(props) {
|
|
2724
2777
|
const t = translatorOf(props)
|
|
2725
2778
|
return box('div', 'drg-loading', h(Spinner, { size: 20 }), h('span', null, props.label || t('loading')))
|
|
@@ -2773,8 +2826,8 @@ window.__ModuleLoader__.load({
|
|
|
2773
2826
|
}
|
|
2774
2827
|
const iconButton = (testId, icon, label, callback, disabled) =>
|
|
2775
2828
|
h(IconButton, { icon, label, testId, onClick: fire(callback), disabled })
|
|
2776
|
-
const ghost = (testId, label, callback, disabled, ariaLabel) =>
|
|
2777
|
-
h(Button, { variant: 'ghost', testId, ariaLabel, onClick: fire(callback), disabled }, label)
|
|
2829
|
+
const ghost = (testId, label, callback, disabled, ariaLabel, variant) =>
|
|
2830
|
+
h(Button, { variant: variant || 'ghost', testId, ariaLabel, onClick: fire(callback), disabled }, label)
|
|
2778
2831
|
const stripText = meta.strip === 'alert' ? t('errorReason', { detail: reason || t(meta.hint) }) : t(meta.hint)
|
|
2779
2832
|
const stripDiagnose = h(
|
|
2780
2833
|
'button',
|
|
@@ -2857,6 +2910,8 @@ window.__ModuleLoader__.load({
|
|
|
2857
2910
|
props.onRestart,
|
|
2858
2911
|
linkBusy,
|
|
2859
2912
|
t('cardRestartName'),
|
|
2913
|
+
// Restart kills the running remote tasks: the same danger treatment as stop, never a silent click.
|
|
2914
|
+
'danger',
|
|
2860
2915
|
)
|
|
2861
2916
|
: null,
|
|
2862
2917
|
stopAvailable
|
|
@@ -2866,6 +2921,7 @@ window.__ModuleLoader__.load({
|
|
|
2866
2921
|
props.onStopRemote,
|
|
2867
2922
|
linkBusy,
|
|
2868
2923
|
t('cardStopRemoteName'),
|
|
2924
|
+
'danger',
|
|
2869
2925
|
)
|
|
2870
2926
|
: null,
|
|
2871
2927
|
meta.retry === true ? ghost('host-reconnect', t('cardReconnect'), props.onReconnect, busy) : null,
|
|
@@ -2904,21 +2960,6 @@ window.__ModuleLoader__.load({
|
|
|
2904
2960
|
const visibleHosts = hosts.filter((host) => Boolean(host))
|
|
2905
2961
|
const connected = hosts.filter((host) => host && host.status === 'connected').length
|
|
2906
2962
|
const busyHostId = props.busyHostId || null
|
|
2907
|
-
const [pendingStop, setPendingStop] = useState(null)
|
|
2908
|
-
const [stopBusy, setStopBusy] = useState(false)
|
|
2909
|
-
const requestStop = (host) => {
|
|
2910
|
-
if (host) setPendingStop(host)
|
|
2911
|
-
}
|
|
2912
|
-
const confirmStop = () => {
|
|
2913
|
-
if (pendingStop === null || stopBusy) return
|
|
2914
|
-
const host = pendingStop
|
|
2915
|
-
setStopBusy(true)
|
|
2916
|
-
const settle = () => {
|
|
2917
|
-
setStopBusy(false)
|
|
2918
|
-
setPendingStop(null)
|
|
2919
|
-
}
|
|
2920
|
-
Promise.resolve(typeof props.onStopRemote === 'function' ? props.onStopRemote(host) : null).then(settle, settle)
|
|
2921
|
-
}
|
|
2922
2963
|
const card = (host) =>
|
|
2923
2964
|
h(HostCard, {
|
|
2924
2965
|
key: host.id,
|
|
@@ -2931,7 +2972,7 @@ window.__ModuleLoader__.load({
|
|
|
2931
2972
|
onDisconnect: props.onDisconnectHost,
|
|
2932
2973
|
onReconnect: props.onReconnectHost,
|
|
2933
2974
|
onRestart: props.onRestartHost,
|
|
2934
|
-
onStopRemote:
|
|
2975
|
+
onStopRemote: props.onStopRemote,
|
|
2935
2976
|
onEdit: props.onEditHost,
|
|
2936
2977
|
onDelete: props.onDeleteHost,
|
|
2937
2978
|
onDiagnose: props.onDiagnoseHost,
|
|
@@ -2943,15 +2984,7 @@ window.__ModuleLoader__.load({
|
|
|
2943
2984
|
h(StatusDot, { status: connected > 0 ? 'connected' : 'idle' }),
|
|
2944
2985
|
h('span', null, t('summary', { connected, total: hosts.length })),
|
|
2945
2986
|
)
|
|
2946
|
-
const
|
|
2947
|
-
key: 'stop-remote:' + (pendingStop ? pendingStop.id : ''),
|
|
2948
|
-
t,
|
|
2949
|
-
busy: stopBusy,
|
|
2950
|
-
onConfirm: confirmStop,
|
|
2951
|
-
onCancel: () => !stopBusy && setPendingStop(null),
|
|
2952
|
-
})
|
|
2953
|
-
const stopDialogNode = pendingStop !== null ? stopDialog : null
|
|
2954
|
-
const body = box('div', 'drg-host-body', summary, visibleHosts.length > 0 ? list : null, stopDialogNode)
|
|
2987
|
+
const body = box('div', 'drg-host-body', summary, visibleHosts.length > 0 ? list : null)
|
|
2955
2988
|
const retryProps = {
|
|
2956
2989
|
variant: 'secondary',
|
|
2957
2990
|
testId: 'live-reconnect',
|
|
@@ -4794,6 +4827,95 @@ window.__ModuleLoader__.load({
|
|
|
4794
4827
|
return null
|
|
4795
4828
|
}
|
|
4796
4829
|
}
|
|
4830
|
+
const REMOTE_TITLE_POLL_MS = 1e3
|
|
4831
|
+
let localTitleBeforeRemote = null
|
|
4832
|
+
let titleBridgeEntry = null
|
|
4833
|
+
function documentTitleOf(win) {
|
|
4834
|
+
try {
|
|
4835
|
+
const title = win && win.document ? win.document.title : ''
|
|
4836
|
+
return typeof title === 'string' ? title.trim() : ''
|
|
4837
|
+
} catch (_error) {
|
|
4838
|
+
return ''
|
|
4839
|
+
}
|
|
4840
|
+
}
|
|
4841
|
+
function rememberLocalTitle() {
|
|
4842
|
+
if (localTitleBeforeRemote !== null || typeof document === 'undefined') return
|
|
4843
|
+
localTitleBeforeRemote = typeof document.title === 'string' ? document.title : ''
|
|
4844
|
+
}
|
|
4845
|
+
function restoreLocalTitle() {
|
|
4846
|
+
const saved = localTitleBeforeRemote
|
|
4847
|
+
localTitleBeforeRemote = null
|
|
4848
|
+
if (saved === null || saved === '' || typeof document === 'undefined' || document.title === saved) return
|
|
4849
|
+
document.title = saved
|
|
4850
|
+
}
|
|
4851
|
+
function syncRemoteTitle(entry) {
|
|
4852
|
+
if (entry === null || entry === void 0 || carrierPool.current !== entry.hostId) return
|
|
4853
|
+
const title = documentTitleOf(webWindow(entry))
|
|
4854
|
+
if (title === '' || typeof document === 'undefined' || document.title === title) return
|
|
4855
|
+
document.title = title
|
|
4856
|
+
}
|
|
4857
|
+
function attachTitleObserver(entry) {
|
|
4858
|
+
const win = webWindow(entry)
|
|
4859
|
+
if (win === null) return
|
|
4860
|
+
let node = null
|
|
4861
|
+
try {
|
|
4862
|
+
node = win.document.querySelector('title')
|
|
4863
|
+
} catch (_error) {
|
|
4864
|
+
return
|
|
4865
|
+
}
|
|
4866
|
+
if (!node || entry.titleNode === node) return
|
|
4867
|
+
try {
|
|
4868
|
+
if (entry.titleObserver) entry.titleObserver.disconnect()
|
|
4869
|
+
} catch (_error) {}
|
|
4870
|
+
entry.titleNode = node
|
|
4871
|
+
if (typeof MutationObserver !== 'function') return
|
|
4872
|
+
try {
|
|
4873
|
+
const observer = new MutationObserver(() => syncRemoteTitle(entry))
|
|
4874
|
+
observer.observe(node, { childList: true, subtree: true, characterData: true })
|
|
4875
|
+
entry.titleObserver = observer
|
|
4876
|
+
} catch (_error) {}
|
|
4877
|
+
}
|
|
4878
|
+
function attachParentTitleGuard(entry) {
|
|
4879
|
+
entry.parentTitleObserver?.disconnect()
|
|
4880
|
+
if (typeof MutationObserver !== 'function' || typeof document === 'undefined' || !document.head) return
|
|
4881
|
+
try {
|
|
4882
|
+
const observer = new MutationObserver(() => syncRemoteTitle(entry))
|
|
4883
|
+
observer.observe(document.head, { childList: true, subtree: true, characterData: true })
|
|
4884
|
+
entry.parentTitleObserver = observer
|
|
4885
|
+
} catch (_error) {}
|
|
4886
|
+
}
|
|
4887
|
+
function stopTitleBridge(entry) {
|
|
4888
|
+
if (entry === null || entry === void 0) return
|
|
4889
|
+
try {
|
|
4890
|
+
entry.titleObserver?.disconnect()
|
|
4891
|
+
entry.parentTitleObserver?.disconnect()
|
|
4892
|
+
} catch (_error) {}
|
|
4893
|
+
if (entry.titlePollTimer !== null && entry.titlePollTimer !== void 0 && typeof clearInterval === 'function') {
|
|
4894
|
+
clearInterval(entry.titlePollTimer)
|
|
4895
|
+
}
|
|
4896
|
+
entry.titleObserver = null
|
|
4897
|
+
entry.parentTitleObserver = null
|
|
4898
|
+
entry.titlePollTimer = null
|
|
4899
|
+
entry.titleNode = null
|
|
4900
|
+
if (titleBridgeEntry === entry) titleBridgeEntry = null
|
|
4901
|
+
}
|
|
4902
|
+
function startTitleBridge(entry) {
|
|
4903
|
+
if (entry === null || entry === void 0 || entry.kind !== 'web') return
|
|
4904
|
+
if (carrierPool.current !== entry.hostId) return
|
|
4905
|
+
if (titleBridgeEntry !== null && titleBridgeEntry !== entry) stopTitleBridge(titleBridgeEntry)
|
|
4906
|
+
rememberLocalTitle()
|
|
4907
|
+
titleBridgeEntry = entry
|
|
4908
|
+
attachTitleObserver(entry)
|
|
4909
|
+
attachParentTitleGuard(entry)
|
|
4910
|
+
if (entry.titlePollTimer === null || entry.titlePollTimer === void 0) {
|
|
4911
|
+
entry.titlePollTimer = setInterval(() => {
|
|
4912
|
+
attachTitleObserver(entry)
|
|
4913
|
+
syncRemoteTitle(entry)
|
|
4914
|
+
}, REMOTE_TITLE_POLL_MS)
|
|
4915
|
+
unrefTimer(entry.titlePollTimer)
|
|
4916
|
+
}
|
|
4917
|
+
syncRemoteTitle(entry)
|
|
4918
|
+
}
|
|
4797
4919
|
function onWebFrameLoad(entry) {
|
|
4798
4920
|
if (entry === null || entry.kind !== 'web') return
|
|
4799
4921
|
const win = webWindow(entry)
|
|
@@ -4821,6 +4943,7 @@ window.__ModuleLoader__.load({
|
|
|
4821
4943
|
}
|
|
4822
4944
|
hideCarrierError(entry.errorLayer)
|
|
4823
4945
|
markCarrierReady(entry)
|
|
4946
|
+
startTitleBridge(entry)
|
|
4824
4947
|
const installed = installWebCarrier(entry, win)
|
|
4825
4948
|
if (!installed) scheduleCarrierInstall(entry)
|
|
4826
4949
|
if (carrierPool.current === entry.hostId) pushGuestHostRow()
|
|
@@ -5000,6 +5123,7 @@ window.__ModuleLoader__.load({
|
|
|
5000
5123
|
}
|
|
5001
5124
|
function disposeWebCarrier(entry) {
|
|
5002
5125
|
stopCarrierInstall(entry)
|
|
5126
|
+
stopTitleBridge(entry)
|
|
5003
5127
|
if (entry.loadGuard) entry.loadGuard.dispose()
|
|
5004
5128
|
try {
|
|
5005
5129
|
entry.frame.src = 'about:blank'
|
|
@@ -5084,10 +5208,15 @@ window.__ModuleLoader__.load({
|
|
|
5084
5208
|
entry.view.reload()
|
|
5085
5209
|
} catch (_error) {}
|
|
5086
5210
|
}
|
|
5087
|
-
for (const other of carrierPool.entries)
|
|
5211
|
+
for (const other of carrierPool.entries) {
|
|
5212
|
+
if (other === entry) continue
|
|
5213
|
+
other.root.style.display = 'none'
|
|
5214
|
+
if (other.kind === 'web') stopTitleBridge(other)
|
|
5215
|
+
}
|
|
5088
5216
|
carrierPool.entries = [entry, ...carrierPool.entries.filter((item) => item !== entry)]
|
|
5089
5217
|
const alreadyShown = carrierPool.current === hostId && entry.root.style.display !== 'none'
|
|
5090
5218
|
carrierPool.current = hostId
|
|
5219
|
+
if (entry.kind === 'web') startTitleBridge(entry)
|
|
5091
5220
|
if (alreadyShown) {
|
|
5092
5221
|
entry.root.style.pointerEvents = ''
|
|
5093
5222
|
entry.root.style.opacity = ''
|
|
@@ -5106,8 +5235,12 @@ window.__ModuleLoader__.load({
|
|
|
5106
5235
|
carrierPool.wanted = null
|
|
5107
5236
|
if (carrierPool.current === null) return
|
|
5108
5237
|
stopHostRowPoll()
|
|
5109
|
-
for (const entry of carrierPool.entries)
|
|
5238
|
+
for (const entry of carrierPool.entries) {
|
|
5239
|
+
entry.root.style.display = 'none'
|
|
5240
|
+
if (entry.kind === 'web') stopTitleBridge(entry)
|
|
5241
|
+
}
|
|
5110
5242
|
carrierPool.current = null
|
|
5243
|
+
restoreLocalTitle()
|
|
5111
5244
|
ownCaptionBand(null, false)
|
|
5112
5245
|
}
|
|
5113
5246
|
let onCarrierDisposed = null
|
|
@@ -5121,6 +5254,8 @@ window.__ModuleLoader__.load({
|
|
|
5121
5254
|
carrierPool.current = null
|
|
5122
5255
|
ownCaptionBand(null, false)
|
|
5123
5256
|
}
|
|
5257
|
+
if (entry.kind === 'web') stopTitleBridge(entry)
|
|
5258
|
+
if (wasShown) restoreLocalTitle()
|
|
5124
5259
|
await entry.backend.dispose(entry)
|
|
5125
5260
|
if (typeof onCarrierDisposed === 'function') onCarrierDisposed(entry.hostId)
|
|
5126
5261
|
if (wasShown) updateSwitcher({ current: 'local' })
|
|
@@ -5142,6 +5277,8 @@ window.__ModuleLoader__.load({
|
|
|
5142
5277
|
async function closeOverlay() {
|
|
5143
5278
|
stopHostRowPoll()
|
|
5144
5279
|
const hosts = carrierPool.entries.map((entry) => entry.hostId)
|
|
5280
|
+
for (const entry of carrierPool.entries) if (entry.kind === 'web') stopTitleBridge(entry)
|
|
5281
|
+
restoreLocalTitle()
|
|
5145
5282
|
carrierPool.current = null
|
|
5146
5283
|
ownCaptionBand(null, false)
|
|
5147
5284
|
if (captionStateWatcher !== null) {
|
|
@@ -6507,6 +6644,35 @@ window.__ModuleLoader__.load({
|
|
|
6507
6644
|
function ManageWindow(props) {
|
|
6508
6645
|
const t = translatorOf(props)
|
|
6509
6646
|
const locale = localeOf(props)
|
|
6647
|
+
const [pendingAction, setPendingAction] = useState(null)
|
|
6648
|
+
const [actionBusy, setActionBusy] = useState(false)
|
|
6649
|
+
const askHostAction = (kind, host2) => {
|
|
6650
|
+
if (!host2 || typeof host2.id !== 'string') return
|
|
6651
|
+
setPendingAction({ kind, host: host2 })
|
|
6652
|
+
}
|
|
6653
|
+
const cancelHostAction = () => {
|
|
6654
|
+
if (!actionBusy) setPendingAction(null)
|
|
6655
|
+
}
|
|
6656
|
+
const confirmHostAction = () => {
|
|
6657
|
+
const pending = pendingAction
|
|
6658
|
+
if (!pending || actionBusy) return
|
|
6659
|
+
const callback =
|
|
6660
|
+
pending.kind === 'stop'
|
|
6661
|
+
? props.onStopRemoteHost
|
|
6662
|
+
: pending.kind === 'restart'
|
|
6663
|
+
? props.onRestartHost
|
|
6664
|
+
: props.onDisconnectHost
|
|
6665
|
+
setActionBusy(true)
|
|
6666
|
+
const settle = () => {
|
|
6667
|
+
setActionBusy(false)
|
|
6668
|
+
setPendingAction(null)
|
|
6669
|
+
}
|
|
6670
|
+
try {
|
|
6671
|
+
Promise.resolve(typeof callback === 'function' ? callback(pending.host) : null).then(settle, settle)
|
|
6672
|
+
} catch (_error) {
|
|
6673
|
+
settle()
|
|
6674
|
+
}
|
|
6675
|
+
}
|
|
6510
6676
|
if (props.open !== true) return null
|
|
6511
6677
|
const host = props.host || null
|
|
6512
6678
|
const connecting = props.view === 'connect' && host !== null && statusOf(host.status).window === true
|
|
@@ -6516,7 +6682,7 @@ window.__ModuleLoader__.load({
|
|
|
6516
6682
|
h(
|
|
6517
6683
|
Modal,
|
|
6518
6684
|
{ wide: true, onClose: props.onClose, closeLabel: t('cancel'), ariaLabel: t('hostsTitle') },
|
|
6519
|
-
// The host list reads a subset under its own names
|
|
6685
|
+
// The host list reads a subset under its own names: the three destructive actions ask here, before they run.
|
|
6520
6686
|
connecting
|
|
6521
6687
|
? h(ConnectWindow, {
|
|
6522
6688
|
t,
|
|
@@ -6529,8 +6695,24 @@ window.__ModuleLoader__.load({
|
|
|
6529
6695
|
onRetry: () => props.onRetry(host),
|
|
6530
6696
|
onDiagnose: () => props.onDiagnose(host),
|
|
6531
6697
|
})
|
|
6532
|
-
: h(HostListView, {
|
|
6698
|
+
: h(HostListView, {
|
|
6699
|
+
...props,
|
|
6700
|
+
onDisconnectHost: (target) => askHostAction('disconnect', target),
|
|
6701
|
+
onRestartHost: (target) => askHostAction('restart', target),
|
|
6702
|
+
onStopRemote: (target) => askHostAction('stop', target),
|
|
6703
|
+
}),
|
|
6533
6704
|
),
|
|
6705
|
+
pendingAction
|
|
6706
|
+
? h(HostActionDialog, {
|
|
6707
|
+
key: pendingAction.kind + ':' + pendingAction.host.id,
|
|
6708
|
+
t,
|
|
6709
|
+
kind: pendingAction.kind,
|
|
6710
|
+
hostName: String(pendingAction.host.name || pendingAction.host.id),
|
|
6711
|
+
busy: actionBusy,
|
|
6712
|
+
onConfirm: confirmHostAction,
|
|
6713
|
+
onCancel: cancelHostAction,
|
|
6714
|
+
})
|
|
6715
|
+
: null,
|
|
6534
6716
|
)
|
|
6535
6717
|
}
|
|
6536
6718
|
function createOverlayActions(deps) {
|
|
@@ -7498,6 +7680,7 @@ window.__ModuleLoader__.load({
|
|
|
7498
7680
|
{ RemoteIcon, PluginOverlay, HostListView, HostCard, EmptyHosts },
|
|
7499
7681
|
{ ManageWindow, ConnectWindow, ConnectLog, ConnectProgress, ErrorCard },
|
|
7500
7682
|
{ FingerprintCard, PasswordPrompt, RemoteConflictPrompt, StopRemoteDialog, KeyFilePicker },
|
|
7683
|
+
{ HostActionDialog },
|
|
7501
7684
|
{ WizardDialog, DiagnoseDrawer, SettingsModal, DownloadCenter, DownloadProgress },
|
|
7502
7685
|
{ StatusDot, Modal, Button, Notice, Toast },
|
|
7503
7686
|
)
|
package/dist/src/bootstrap.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/** Remote runtime preparation: `npx` pinned to the local DSH version against the remote's real `$DSH_HOME`; the
|
|
2
2
|
* executor runs only fixed templates. */
|
|
3
3
|
import { errors } from './errors.js';
|
|
4
|
+
import { REMOTE_OWNED_ENV } from './constants.js';
|
|
4
5
|
import { headTail, shellQuote } from './util.js';
|
|
5
6
|
import { isNodeVersionSupported, normalizeVersion, parseVersion, versionsEqual } from './version.js';
|
|
6
7
|
export function assertSupportedRemote(facts) {
|
|
@@ -58,7 +59,7 @@ export function planNpx(input) {
|
|
|
58
59
|
export function buildPreflightCommand(plan) {
|
|
59
60
|
const pathPrefix = plan.start.nodeBinDir ? `PATH=${shellQuote(plan.start.nodeBinDir)}:"$PATH" ` : '';
|
|
60
61
|
return `set -eu
|
|
61
|
-
${pathPrefix}npm_config_loglevel=http ${shellQuote(plan.start.npxPath)} -y @deepseek-ai/dsh@${normalizeVersion(plan.start.targetVersion)} --version`;
|
|
62
|
+
${pathPrefix}npm_config_loglevel=http ${REMOTE_OWNED_ENV}=1 ${shellQuote(plan.start.npxPath)} -y @deepseek-ai/dsh@${normalizeVersion(plan.start.targetVersion)} --version`;
|
|
62
63
|
}
|
|
63
64
|
export async function verifyNpxVersion(ssh, plan, options = {}) {
|
|
64
65
|
const timeoutMs = options.timeoutMs ?? 0;
|
|
@@ -283,6 +283,7 @@ async function connectPipeline(ctx, runtime) {
|
|
|
283
283
|
profile,
|
|
284
284
|
timeoutMs: REMOTE_START_TIMEOUT_MS,
|
|
285
285
|
onLine: (line) => log('debug', `remote: ${line}`),
|
|
286
|
+
onNotice: (line) => log('warn', line),
|
|
286
287
|
});
|
|
287
288
|
log('info', `remote DSH started: pid ${webInfo.pid ?? '?'}, port ${webInfo.port}`);
|
|
288
289
|
}
|
|
@@ -366,8 +367,8 @@ async function connectPipeline(ctx, runtime) {
|
|
|
366
367
|
runtime.connectPromise = null;
|
|
367
368
|
}
|
|
368
369
|
}
|
|
369
|
-
/** Arm the next automatic attempt; `scheduleReconnect` owns the settings gate and the budget, so a spent budget is reported once. */
|
|
370
|
-
function scheduleConnectRetry(ctx, runtime) {
|
|
370
|
+
/** Arm the next automatic attempt; `scheduleReconnect` owns the settings gate and the budget, so a spent budget is reported once. Exported for the one-shot actions whose failure leaves no usable transport (`reattach.ts`): they must hand the link back to the same retry loop instead of parking at an error card. */
|
|
371
|
+
export function scheduleConnectRetry(ctx, runtime) {
|
|
371
372
|
if (ctx.state.disposed === true || runtime.desired !== 'connected')
|
|
372
373
|
return;
|
|
373
374
|
if (!runtime.entry.autoReconnect || !ctx.settings().autoReconnect.enabled)
|
|
@@ -12,6 +12,7 @@ import { markConnected, recordRestart } from './attach.js';
|
|
|
12
12
|
import { SSH_CLOSED_DETAIL } from './failures.js';
|
|
13
13
|
import { LinkCancelled, linkActionState } from './guards.js';
|
|
14
14
|
import { rememberBound } from './ownership.js';
|
|
15
|
+
import { scheduleConnectRetry } from './pipeline.js';
|
|
15
16
|
import { openTunnelFor } from './transport.js';
|
|
16
17
|
import { verifyRemoteUi } from './verify.js';
|
|
17
18
|
export async function reattachHost(ctx, runtime, info = {}) {
|
|
@@ -180,6 +181,11 @@ async function runReattach(ctx, runtime, info, token) {
|
|
|
180
181
|
caller: 'script',
|
|
181
182
|
emit: false,
|
|
182
183
|
});
|
|
184
|
+
// A re-attach that lost the transport (the stall the probe saw first) leaves no usable link: hand it back to the
|
|
185
|
+
// retry loop, otherwise the error card would wait for a click while the network has already recovered. A policy
|
|
186
|
+
// failure (no launch token, version mismatch) stays terminal — reconnecting cannot fix it.
|
|
187
|
+
if (runtime.ssh?.connected !== true || view.code === 'network')
|
|
188
|
+
scheduleConnectRetry(ctx, runtime);
|
|
183
189
|
ctx.emitState();
|
|
184
190
|
}
|
|
185
191
|
finally {
|
package/dist/src/constants.js
CHANGED
|
@@ -6,24 +6,40 @@ export const API_PREFIX = '/dsh-remote-go/api';
|
|
|
6
6
|
export const REMOTE_VIEW_PREFIX = '/dsh-remote-go/remote/';
|
|
7
7
|
export const API_HEADER = 'x-dsh-remote-go';
|
|
8
8
|
export const PLUGIN_ID = 'dsh-remote-go';
|
|
9
|
-
|
|
9
|
+
/** Environment marker every DSH process this plugin launches carries, so the foreign-process scan can tell the
|
|
10
|
+
* plugin's own npx launch apart from a manual `dsh` (issue #97). It is inherited through npx into the final node. */
|
|
11
|
+
export const REMOTE_OWNED_ENV = 'DSH_REMOTE_GO_OWNED';
|
|
12
|
+
export const PLUGIN_VERSION = '0.3.3';
|
|
10
13
|
export const MIN_DSH_VERSION = '0.2.2-rc.3';
|
|
11
14
|
export const API_VERSION = '2.12';
|
|
12
15
|
export const DEFAULT_KEY_PATH = '~/.ssh/id_rsa';
|
|
13
16
|
export const REMOTE_START_TIMEOUT_MS = 300_000;
|
|
14
17
|
export const REMOTE_CONFLICT_TIMEOUT_MS = 120_000;
|
|
15
18
|
export const SSH_READY_TIMEOUT_MS = 20_000;
|
|
19
|
+
/** SSH keepalive cadence: a probe every 15 s keeps NAT/firewall state alive without loading a thin link. */
|
|
20
|
+
export const SSH_KEEPALIVE_INTERVAL_MS = 15_000;
|
|
21
|
+
/** Unanswered keepalives tolerated before the transport is declared dead: 4 x 15 s rides out a ~60 s stall
|
|
22
|
+
* (mobile handoff, VPN re-key, congestion) that used to drop the session after 45 s. */
|
|
23
|
+
export const SSH_KEEPALIVE_COUNT_MAX = 4;
|
|
16
24
|
export const DEFAULT_IDLE_MINUTES = 15;
|
|
17
25
|
export const TUNNEL_PROBE_TIMEOUT_MS = 10_000;
|
|
18
26
|
export const REMOTE_HEARTBEAT_DEFAULT_SEC = 30;
|
|
19
27
|
export const REMOTE_HEARTBEAT_MIN_SEC = 5;
|
|
20
28
|
export const REMOTE_HEARTBEAT_MAX_SEC = 600;
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
export const
|
|
29
|
+
/** Consecutive failed probes before a re-attach. Two was one lost packet away from tearing down a healthy link over a
|
|
30
|
+
* slow tunnel; the quick recheck after each failure still proves a real restart in a few seconds. */
|
|
31
|
+
export const REMOTE_UNREACHABLE_FAILURES = 3;
|
|
32
|
+
export const REMOTE_UNREACHABLE_CONFIRM_DELAY_MS = 2_500;
|
|
33
|
+
export const REMOTE_UNREACHABLE_RECHECK_DELAY_MS = 3_500;
|
|
24
34
|
export const REMOTE_EPISODE_COOLDOWN_MS = 15_000;
|
|
25
35
|
export const REMOTE_REPAIR_BACKOFF_MS = 30_000;
|
|
26
36
|
export const REMOTE_REPAIR_BACKOFF_MAX_MS = 120_000;
|
|
27
37
|
export const REMOTE_TUNNEL_REPAIR_SETTLE_MS = 5_000;
|
|
28
38
|
export const REMOTE_REATTACH_ATTEMPTS = 6;
|
|
29
39
|
export const REMOTE_REATTACH_INTERVAL_MS = 2_000;
|
|
40
|
+
/** Spacing of the slow retries that follow the fast reconnect budget: one attempt every 30 s keeps a bad link from
|
|
41
|
+
* being hammered while the user still gets the link back on its own. */
|
|
42
|
+
export const REMOTE_RECONNECT_SLOW_DELAY_MS = 30_000;
|
|
43
|
+
/** How long the slow phase keeps trying before auto-reconnect gives up: 10 minutes covers a reboot, a VPN re-dial or
|
|
44
|
+
* a carrier handoff, which is exactly the window where a user expects the connection to come back by itself. */
|
|
45
|
+
export const REMOTE_RECONNECT_PATIENCE_MS = 10 * 60_000;
|
package/dist/src/context.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* 47-key god-`ctx`, so a module reaches only the capability it declares; the assembled object keeps the same keys and
|
|
3
3
|
* paths because tests use `service.ctx` as public API. Narrowing is in the parameter types, never a rename. */
|
|
4
4
|
import { planNpx, verifyNpxVersion } from './bootstrap.js';
|
|
5
|
-
import { REMOTE_CONFLICT_TIMEOUT_MS, REMOTE_REATTACH_ATTEMPTS, REMOTE_REATTACH_INTERVAL_MS, REMOTE_TUNNEL_REPAIR_SETTLE_MS, REMOTE_UNREACHABLE_CONFIRM_DELAY_MS, REMOTE_UNREACHABLE_RECHECK_DELAY_MS, } from './constants.js';
|
|
5
|
+
import { REMOTE_CONFLICT_TIMEOUT_MS, REMOTE_REATTACH_ATTEMPTS, REMOTE_REATTACH_INTERVAL_MS, REMOTE_RECONNECT_PATIENCE_MS, REMOTE_RECONNECT_SLOW_DELAY_MS, REMOTE_TUNNEL_REPAIR_SETTLE_MS, REMOTE_UNREACHABLE_CONFIRM_DELAY_MS, REMOTE_UNREACHABLE_RECHECK_DELAY_MS, } from './constants.js';
|
|
6
6
|
import { createConnectProgress } from './connect-progress.js';
|
|
7
7
|
import { loadLocalSshMaterial } from './local-ssh.js';
|
|
8
8
|
import { ensureRemoteNode } from './node-runtime.js';
|
|
@@ -31,6 +31,8 @@ export function createCtx(options, hooks) {
|
|
|
31
31
|
reattachAttempts: options.reattachAttempts ?? REMOTE_REATTACH_ATTEMPTS,
|
|
32
32
|
reattachIntervalMs: options.reattachIntervalMs ?? REMOTE_REATTACH_INTERVAL_MS,
|
|
33
33
|
tunnelRepairSettleMs: options.tunnelRepairSettleMs ?? REMOTE_TUNNEL_REPAIR_SETTLE_MS,
|
|
34
|
+
reconnectSlowDelayMs: options.reconnectSlowDelayMs ?? REMOTE_RECONNECT_SLOW_DELAY_MS,
|
|
35
|
+
reconnectPatienceMs: options.reconnectPatienceMs ?? REMOTE_RECONNECT_PATIENCE_MS,
|
|
34
36
|
};
|
|
35
37
|
const deps = {
|
|
36
38
|
sshFactory: options.sshFactory ?? ((sshOptions) => createSsh2Port(sshOptions)),
|
package/dist/src/errors.js
CHANGED
|
@@ -175,14 +175,54 @@ export const errors = {
|
|
|
175
175
|
remoteDshMissing: plain('remote-dsh-missing'),
|
|
176
176
|
nodeInstallFailed: plain('remote-node-install-failed'),
|
|
177
177
|
remoteDshRunning: plain('remote-dsh-running'),
|
|
178
|
-
remoteDshStartFailed: (tail
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
178
|
+
remoteDshStartFailed: (tail, details = {}) => {
|
|
179
|
+
const phase = details.phase ?? 'unknown';
|
|
180
|
+
const npm = details.npm ?? { status: 'unknown' };
|
|
181
|
+
const summary = phase === 'exited'
|
|
182
|
+
? say('远端 DSH 进程启动后立即退出,没有打印 Web 地址。', 'The remote DSH process exited right after launch without printing its Web URL.')
|
|
183
|
+
: phase === 'timeout'
|
|
184
|
+
? say('远端 DSH 进程在等待时间内没有打印 Web 地址。', 'The remote DSH process did not print its Web URL within the wait window.')
|
|
185
|
+
: phase === 'unparseable'
|
|
186
|
+
? say('远端 DSH 进程已经启动,但没有打印可识别的 Web 地址。', 'The remote DSH process started but never printed a recognizable Web URL.')
|
|
187
|
+
: say('远端 DSH 没有成功打印 Web 地址,启动过程中断。', 'The remote DSH did not print its Web URL; the launch did not complete.');
|
|
188
|
+
const steps = [];
|
|
189
|
+
steps.push(['查看下方的启动输出与远端日志尾部', 'Read the launch output and remote log tail below']);
|
|
190
|
+
if (npm.status === 'unwritable') {
|
|
191
|
+
steps.push([
|
|
192
|
+
`远端 ~/.npm/_logs 不可写,npm 无法创建调试日志;检查该目录的权限与空间`,
|
|
193
|
+
'The remote ~/.npm/_logs is not writable, so npm could not create a debug log; check its permissions and free space',
|
|
194
|
+
]);
|
|
195
|
+
}
|
|
196
|
+
else if (npm.status === 'found') {
|
|
197
|
+
steps.push([
|
|
198
|
+
'npm 调试日志已附在技术详情末尾,先看其中的 error 行',
|
|
199
|
+
'The newest npm debug log is appended to the technical details; read its error lines first',
|
|
200
|
+
]);
|
|
201
|
+
}
|
|
202
|
+
else {
|
|
203
|
+
steps.push(['核对远端磁盘空间、端口与 npm 可用性', 'Check remote disk space, usable ports and npm availability']);
|
|
204
|
+
}
|
|
205
|
+
steps.push([
|
|
182
206
|
'重试一次,若仍失败可手动在远端验证 `dsh --profile web --no-open`',
|
|
183
207
|
'Retry, or verify `dsh --profile web --no-open` manually on the remote host',
|
|
184
|
-
]
|
|
185
|
-
|
|
208
|
+
]);
|
|
209
|
+
// The technical block starts with the launch tail, then appends the npm debug log the panel used to leave on the
|
|
210
|
+
// remote. The phase lives in the visible detail, so this section stays valid raw process output line by line.
|
|
211
|
+
const sections = [tail];
|
|
212
|
+
if (npm.status === 'found') {
|
|
213
|
+
sections.push(`--- npm log ${npm.path ?? '~/.npm/_logs'} ---`, npm.tail ?? '(empty)');
|
|
214
|
+
}
|
|
215
|
+
else if (npm.status === 'unwritable') {
|
|
216
|
+
sections.push('--- npm log ---', '~/.npm/_logs is not writable; npm could not create a debug log');
|
|
217
|
+
}
|
|
218
|
+
else if (npm.status === 'missing') {
|
|
219
|
+
sections.push('--- npm log ---', '~/.npm/_logs does not exist; npm wrote no debug log');
|
|
220
|
+
}
|
|
221
|
+
else if (npm.status === 'empty') {
|
|
222
|
+
sections.push('--- npm log ---', '~/.npm/_logs has no *-debug-0.log file');
|
|
223
|
+
}
|
|
224
|
+
return fail('remote-dsh-start-failed', summary, steps, { technical: sections.join('\n') });
|
|
225
|
+
},
|
|
186
226
|
remoteUiUnreachable: plain('remote-ui-unreachable'),
|
|
187
227
|
// Kept apart from `remote-ui-unreachable`: here the tunnel may be fine and the process is what is
|
|
188
228
|
// missing, which is what the restart button exists for.
|
|
@@ -67,22 +67,50 @@ export function scheduleReconnect(ctx, runtime, onDue) {
|
|
|
67
67
|
const settings = ctx.settings();
|
|
68
68
|
if (!runtime.entry.autoReconnect || !settings.autoReconnect.enabled)
|
|
69
69
|
return skip();
|
|
70
|
-
|
|
71
|
-
|
|
70
|
+
// `maxAttempts` bounds the fast, exponential phase; the patience window then adds slow attempts on top, so a
|
|
71
|
+
// multi-minute outage (reboot, VPN re-dial, carrier handoff) still recovers instead of parking at an error card.
|
|
72
|
+
// `maxAttempts: 0` and a spent patience window both stay "no retry", exactly as before.
|
|
73
|
+
const fastAttempts = Math.max(0, Number(settings.autoReconnect.maxAttempts) || 0);
|
|
74
|
+
const slowDelayMs = Math.max(0, Number(ctx.timers.reconnectSlowDelayMs) || 0);
|
|
75
|
+
const patienceMs = Math.max(0, Number(ctx.timers.reconnectPatienceMs) || 0);
|
|
76
|
+
const slowAttempts = fastAttempts > 0 && slowDelayMs > 0 ? Math.floor(patienceMs / slowDelayMs) : 0;
|
|
77
|
+
const totalAttempts = fastAttempts + slowAttempts;
|
|
78
|
+
if (totalAttempts <= 0 || runtime.reconnectAttempts >= totalAttempts) {
|
|
79
|
+
if (slowAttempts > 0) {
|
|
80
|
+
ctx.progress.log(runtime, 'warn', `auto reconnect gave up after ${totalAttempts} attempts (${fastAttempts} fast + ${slowAttempts} slow, about ${Math.round(patienceMs / 60_000)} min)`);
|
|
81
|
+
}
|
|
72
82
|
const view = toErrorView(errors.network({
|
|
73
|
-
zh: `连接已断开,自动重连 ${
|
|
74
|
-
en: `The connection dropped and ${
|
|
83
|
+
zh: `连接已断开,自动重连 ${totalAttempts} 次均失败。远端任务可能仍在运行。`,
|
|
84
|
+
en: `The connection dropped and ${totalAttempts} automatic retries failed. Remote tasks may still be running.`,
|
|
75
85
|
}));
|
|
76
|
-
const event = { type: 'reconnect.gaveup', maxAttempts, view };
|
|
86
|
+
const event = { type: 'reconnect.gaveup', maxAttempts: totalAttempts, view };
|
|
77
87
|
void dispatch(effectsOf(ctx), runtime, event, scopeFactsFor(ctx, runtime, event), { caller: 'timer' });
|
|
78
88
|
return;
|
|
79
89
|
}
|
|
80
90
|
const attempt = runtime.reconnectAttempts + 1;
|
|
91
|
+
const slow = attempt > fastAttempts;
|
|
81
92
|
const baseDelayMs = settings.autoReconnect.baseDelayMs;
|
|
82
|
-
const delay =
|
|
93
|
+
const delay = slow
|
|
94
|
+
? randomDelay(slowDelayMs * 0.85, slowDelayMs * 1.15)
|
|
95
|
+
: randomDelay(baseDelayMs, baseDelayMs * 2 ** Math.min(attempt, 4));
|
|
83
96
|
const seconds = Math.round(delay / 100) / 10;
|
|
84
|
-
|
|
85
|
-
|
|
97
|
+
if (slow) {
|
|
98
|
+
// The slow phase is long by design: one line when it starts and every fifth attempt after it, the rest at debug.
|
|
99
|
+
const slowIndex = attempt - fastAttempts;
|
|
100
|
+
const level = slowIndex === 1 || slowIndex % 5 === 0 ? 'info' : 'debug';
|
|
101
|
+
ctx.progress.log(runtime, level, `still offline; retrying in ${seconds}s (slow retry ${slowIndex}/${slowAttempts})`);
|
|
102
|
+
}
|
|
103
|
+
else {
|
|
104
|
+
ctx.progress.log(runtime, 'warn', `link lost; retrying in ${seconds}s (attempt ${attempt}/${fastAttempts})`);
|
|
105
|
+
}
|
|
106
|
+
// `max` stays the fast budget the setting names; a slow retry reports its own count on the card instead.
|
|
107
|
+
const scheduled = {
|
|
108
|
+
type: 'reconnect.scheduled',
|
|
109
|
+
attempt,
|
|
110
|
+
max: fastAttempts,
|
|
111
|
+
delayMs: delay,
|
|
112
|
+
...(slow ? { slow: true } : {}),
|
|
113
|
+
};
|
|
86
114
|
void dispatch(effectsOf(ctx), runtime, scheduled, scopeFactsFor(ctx, runtime, scheduled), {
|
|
87
115
|
caller: 'timer',
|
|
88
116
|
armReconnect: (ms) => {
|
package/dist/src/remote-proc.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/** Remote process and reachability primitives: find, stop and probe DSH processes on the remote, plus the one HTTP round-trip that proves the remote UI answers. */
|
|
2
2
|
import http from 'node:http';
|
|
3
|
-
import { TUNNEL_PROBE_TIMEOUT_MS } from './constants.js';
|
|
3
|
+
import { REMOTE_OWNED_ENV, TUNNEL_PROBE_TIMEOUT_MS } from './constants.js';
|
|
4
4
|
import { isPid, messageOf } from './util.js';
|
|
5
5
|
/** A listener answering 200, 302 or 401 is up: 401 without the launch cookie still proves it serves. */
|
|
6
6
|
export function isUiUp(status) {
|
|
@@ -24,7 +24,13 @@ printf '%s\\n' "$PS_OUT" | while IFS= read -r LINE; do
|
|
|
24
24
|
case "$COMM" in node|dsh|npm|npx) ;; *) continue ;; esac
|
|
25
25
|
case "$ARGS" in *"@deepseek-ai/dsh"*|*"/bin/dsh "*|*" dsh "*) ;; *) continue ;; esac
|
|
26
26
|
case "$ARGS" in *"ps -eww"*|*"PS_OUT"*|*"IGNORE"*) continue ;; esac
|
|
27
|
-
|
|
27
|
+
ENV_TEXT=$(tr '\\0' '\\n' < "/proc/$PID/environ" 2>/dev/null || true)
|
|
28
|
+
# Every npx launch this plugin performs carries REMOTE_OWNED_ENV, and the marker survives npx into the final node
|
|
29
|
+
# process. Matching it is the identity check the scan was missing: the plugin's own launch has the same argv and the
|
|
30
|
+
# same DSH_HOME as a manual DSH, and its pid is only knowable after the registry lands.
|
|
31
|
+
OWNED=$(printf '%s\\n' "$ENV_TEXT" | sed -n 's/^${REMOTE_OWNED_ENV}=//p' | tail -n 1)
|
|
32
|
+
[ -n "\${OWNED:-}" ] && continue
|
|
33
|
+
ENV_HOME=$(printf '%s\\n' "$ENV_TEXT" | sed -n 's/^DSH_HOME=//p' | tail -n 1)
|
|
28
34
|
if [ -n "\${ENV_HOME:-}" ] && [ "$ENV_HOME" != "$HOME/.dsh" ]; then continue; fi
|
|
29
35
|
printf '%s\\t%s\\n' "$PID" "$ARGS"
|
|
30
36
|
done`;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { DEFAULT_REMOTE_PROFILE, REMOTE_START_TIMEOUT_MS } from '../constants.js';
|
|
1
|
+
import { DEFAULT_REMOTE_PROFILE, REMOTE_OWNED_ENV, REMOTE_START_TIMEOUT_MS } from '../constants.js';
|
|
2
2
|
import { errors } from '../errors.js';
|
|
3
3
|
import { remoteLayout } from '../layout.js';
|
|
4
4
|
import { headTail, isLoopbackHost, isPid, messageOf, shellQuote } from '../util.js';
|
|
@@ -17,19 +17,23 @@ export function buildStartCommand(plan, layout, options = {}) {
|
|
|
17
17
|
const patch = options.patchPath ? `--patch ${shellQuote(options.patchPath)} ` : '';
|
|
18
18
|
const args = `${patch}--profile ${shellQuote(profile)} --no-open --port 0`;
|
|
19
19
|
const pathPrefix = plan.start.nodeBinDir ? `PATH=${shellQuote(plan.start.nodeBinDir)}:"$PATH" ` : '';
|
|
20
|
-
return `env DSH_HOME=${shellQuote(layout.dshHome)} ${pathPrefix}${shellQuote(plan.start.npxPath ?? 'npx')} -y @deepseek-ai/dsh@${normalizeVersion(plan.start.targetVersion)} ${args}`;
|
|
20
|
+
return `env DSH_HOME=${shellQuote(layout.dshHome)} ${REMOTE_OWNED_ENV}=1 ${pathPrefix}${shellQuote(plan.start.npxPath ?? 'npx')} -y @deepseek-ai/dsh@${normalizeVersion(plan.start.targetVersion)} ${args}`;
|
|
21
21
|
}
|
|
22
22
|
export function buildBrowserCarrierProbe(plan, layout, profile) {
|
|
23
23
|
const pathPrefix = plan.start.nodeBinDir ? `PATH=${shellQuote(plan.start.nodeBinDir)}:"$PATH" ` : '';
|
|
24
24
|
const dumpFile = shellQuote(`${layout.root}/profile-dump.yml`);
|
|
25
|
+
const errorFile = shellQuote(`${layout.root}/profile-dump.err`);
|
|
25
26
|
const patchFile = shellQuote(`${layout.root}/${BROWSER_CARRIER_PATCH_FILE}`);
|
|
26
27
|
return `set -u
|
|
27
28
|
umask 077
|
|
28
29
|
mkdir -p ${shellQuote(layout.root)}
|
|
29
30
|
DUMP=${dumpFile}
|
|
30
|
-
|
|
31
|
+
DUMP_ERR=${errorFile}
|
|
32
|
+
if ! env DSH_HOME=${shellQuote(layout.dshHome)} ${REMOTE_OWNED_ENV}=1 ${pathPrefix}${shellQuote(plan.start.npxPath ?? 'npx')} -y @deepseek-ai/dsh@${normalizeVersion(plan.start.targetVersion)} --profile ${shellQuote(profile)} --dump-config > "$DUMP" 2>"$DUMP_ERR"; then
|
|
31
33
|
echo "DUMP-FAILED"
|
|
32
|
-
|
|
34
|
+
# The probe failure used to be a debug line with no reason: hand its stderr back so the warning names it (#96).
|
|
35
|
+
tail -n 20 "$DUMP_ERR" 2>/dev/null || true
|
|
36
|
+
rm -f "$DUMP" "$DUMP_ERR"
|
|
33
37
|
exit 0
|
|
34
38
|
fi
|
|
35
39
|
if grep -A6 'id: api-remotes' "$DUMP" | grep -q 'disabled: true'; then
|
|
@@ -40,7 +44,7 @@ DSH_REMOTE_GO_PATCH
|
|
|
40
44
|
else
|
|
41
45
|
echo "CLEAR"
|
|
42
46
|
fi
|
|
43
|
-
rm -f "$DUMP"`;
|
|
47
|
+
rm -f "$DUMP" "$DUMP_ERR"`;
|
|
44
48
|
}
|
|
45
49
|
export async function ensureBrowserCarrier(ssh, options) {
|
|
46
50
|
try {
|
|
@@ -56,12 +60,12 @@ export async function ensureBrowserCarrier(ssh, options) {
|
|
|
56
60
|
options.onLine?.('browser carrier: api-remotes is enabled by the profile');
|
|
57
61
|
return { status: 'clear', patchPath: null };
|
|
58
62
|
}
|
|
59
|
-
options.
|
|
63
|
+
options.onNotice?.(`browser carrier: profile probe failed (${headTail(result.stdout + result.stderr, 300)})`);
|
|
60
64
|
return { status: 'unknown', patchPath: null };
|
|
61
65
|
}
|
|
62
66
|
catch (error) {
|
|
63
67
|
// swallow-ok: launching without the overlay keeps the start error (missing profile, npx failure)
|
|
64
|
-
options.
|
|
68
|
+
options.onNotice?.(`browser carrier: probe failed (${messageOf(error)})`);
|
|
65
69
|
return { status: 'unknown', patchPath: null };
|
|
66
70
|
}
|
|
67
71
|
}
|
|
@@ -121,10 +125,76 @@ export function parseLaunchedPid(text) {
|
|
|
121
125
|
const started = /(?:^|\n)PID:(\d+)\s*(?:\n|$)/.exec(combined);
|
|
122
126
|
return started ? { pid: Number(started[1]), port: 0 } : { pid: 0, port: 0 };
|
|
123
127
|
}
|
|
128
|
+
/** The newest remote npm debug log, or the one reason it cannot be read. Never throws: a diagnostic read failing must
|
|
129
|
+
* not replace the start failure that asked for it. */
|
|
130
|
+
export async function readRemoteNpmLogDiagnostics(ssh, options = {}) {
|
|
131
|
+
try {
|
|
132
|
+
const result = await ssh.exec(buildNpmLogProbeCommand(), {
|
|
133
|
+
timeoutMs: options.timeoutMs ?? 8_000,
|
|
134
|
+
maxBytes: 64_000,
|
|
135
|
+
});
|
|
136
|
+
if (result.code !== 0)
|
|
137
|
+
return { status: 'unknown' };
|
|
138
|
+
return parseNpmLogProbe(result.stdout);
|
|
139
|
+
}
|
|
140
|
+
catch {
|
|
141
|
+
// swallow-ok: the npm log is best-effort evidence; the start error still carries its launch output
|
|
142
|
+
return { status: 'unknown' };
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
/** The remote-side probe: prove whether `~/.npm/_logs` is writable, then hand back the newest debug log's tail. */
|
|
146
|
+
export function buildNpmLogProbeCommand() {
|
|
147
|
+
return `set -u
|
|
148
|
+
LOG_DIR="$HOME/.npm/_logs"
|
|
149
|
+
if [ ! -d "$LOG_DIR" ]; then echo "NPM-LOGS:missing"; exit 0; fi
|
|
150
|
+
PROBE="$LOG_DIR/.dsh-remote-go-probe.$$"
|
|
151
|
+
if ! (: > "$PROBE") 2>/dev/null; then echo "NPM-LOGS:unwritable"; exit 0; fi
|
|
152
|
+
rm -f "$PROBE" 2>/dev/null || true
|
|
153
|
+
LATEST=$(ls -1t "$LOG_DIR"/*-debug-0.log 2>/dev/null | head -n 1)
|
|
154
|
+
if [ -z "$LATEST" ]; then echo "NPM-LOGS:empty"; exit 0; fi
|
|
155
|
+
echo "NPM-LOGS:found"
|
|
156
|
+
echo "NPM-PATH:$LATEST"
|
|
157
|
+
tail -n 40 "$LATEST" 2>/dev/null || true`;
|
|
158
|
+
}
|
|
159
|
+
export function parseNpmLogProbe(stdout) {
|
|
160
|
+
const text = String(stdout ?? '');
|
|
161
|
+
const status = /^NPM-LOGS:(missing|empty|unwritable|found)$/m.exec(text)?.[1];
|
|
162
|
+
if (status === undefined)
|
|
163
|
+
return { status: 'unknown' };
|
|
164
|
+
if (status !== 'found')
|
|
165
|
+
return { status: status };
|
|
166
|
+
const result = { status: 'found' };
|
|
167
|
+
const path = /^NPM-PATH:(.+)$/m.exec(text)?.[1]?.trim();
|
|
168
|
+
if (path)
|
|
169
|
+
result.path = path;
|
|
170
|
+
const bodyStart = text.search(/^NPM-PATH:.*$/m);
|
|
171
|
+
const body = bodyStart < 0 ? '' : text.slice(text.indexOf('\n', bodyStart) + 1).trim();
|
|
172
|
+
const tail = headTail(body, 4_000).trim();
|
|
173
|
+
if (tail !== '')
|
|
174
|
+
result.tail = tail;
|
|
175
|
+
return result;
|
|
176
|
+
}
|
|
177
|
+
/** Which failure the launch script proved: it exited, it waited out the window, or it started without a usable URL. */
|
|
178
|
+
export function startFailurePhase(text, code) {
|
|
179
|
+
const value = String(text ?? '');
|
|
180
|
+
if (/(?:^|\n)EXITED:\d+/.test(value) || code === 3)
|
|
181
|
+
return 'exited';
|
|
182
|
+
if (/(?:^|\n)TIMEOUT(?:\n|$)/.test(value) || code === 4)
|
|
183
|
+
return 'timeout';
|
|
184
|
+
if (code === 0 || /(?:^|\n)(?:DONE|LINE):/.test(value))
|
|
185
|
+
return 'unparseable';
|
|
186
|
+
return 'unknown';
|
|
187
|
+
}
|
|
124
188
|
export async function startRemoteWeb(ssh, options) {
|
|
125
189
|
const layout = options.layout ?? remoteLayout(options.home);
|
|
126
190
|
const profile = options.profile ?? options.plan.profile ?? DEFAULT_REMOTE_PROFILE;
|
|
127
|
-
const carrier = await ensureBrowserCarrier(ssh, {
|
|
191
|
+
const carrier = await ensureBrowserCarrier(ssh, {
|
|
192
|
+
plan: options.plan,
|
|
193
|
+
layout,
|
|
194
|
+
profile,
|
|
195
|
+
onLine: options.onLine,
|
|
196
|
+
onNotice: options.onNotice,
|
|
197
|
+
});
|
|
128
198
|
const startCommand = buildStartCommand(options.plan, layout, { profile, patchPath: carrier.patchPath });
|
|
129
199
|
const script = buildStartScript(startCommand, layout, {
|
|
130
200
|
waitSeconds: Math.ceil((options.timeoutMs ?? REMOTE_START_TIMEOUT_MS) / 1000),
|
|
@@ -147,28 +217,38 @@ export async function startRemoteWeb(ssh, options) {
|
|
|
147
217
|
// The launch script prints its pid before it waits, so a failure can still stop what it started.
|
|
148
218
|
const combined = `${result.stdout}\n${result.stderr}`;
|
|
149
219
|
const launched = parseLaunchedPid(combined);
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
// swallow-ok: an unreadable liveness check means "cannot prove it is ours", so no signal
|
|
158
|
-
}
|
|
159
|
-
if (alive) {
|
|
160
|
-
const stopped = await stopRemoteWeb(ssh, layout, { pid: launched.pid });
|
|
161
|
-
const outcome = stopped.ok === true ? 'it was stopped' : 'it could not be stopped';
|
|
162
|
-
options.onLine?.(`start failed after pid ${launched.pid} was launched; ${outcome}`);
|
|
163
|
-
}
|
|
220
|
+
/** Stop what this launch started before its error surfaces: a failed start must not leave an orphan behind. */
|
|
221
|
+
const stopLaunched = async () => {
|
|
222
|
+
if (!isPid(launched.pid))
|
|
223
|
+
return;
|
|
224
|
+
let alive = false;
|
|
225
|
+
try {
|
|
226
|
+
alive = await remotePidAlive(ssh, launched.pid);
|
|
164
227
|
}
|
|
228
|
+
catch {
|
|
229
|
+
// swallow-ok: an unreadable liveness check means "cannot prove it is ours", so no signal
|
|
230
|
+
}
|
|
231
|
+
if (alive) {
|
|
232
|
+
const stopped = await stopRemoteWeb(ssh, layout, { pid: launched.pid });
|
|
233
|
+
const outcome = stopped.ok === true ? 'it was stopped' : 'it could not be stopped';
|
|
234
|
+
options.onLine?.(`start failed after pid ${launched.pid} was launched; ${outcome}`);
|
|
235
|
+
}
|
|
236
|
+
};
|
|
237
|
+
const failed = async (error) => {
|
|
238
|
+
await stopLaunched();
|
|
165
239
|
return error;
|
|
166
240
|
};
|
|
241
|
+
/** A start failure: stop the pid, then read the npm debug log so the panel carries the real cause (issue #96). */
|
|
242
|
+
const failStart = async (phase) => {
|
|
243
|
+
await stopLaunched();
|
|
244
|
+
const npm = await readRemoteNpmLogDiagnostics(ssh);
|
|
245
|
+
return errors.remoteDshStartFailed(headTail(combined, 1500), { phase, npm });
|
|
246
|
+
};
|
|
167
247
|
if (result.code !== 0)
|
|
168
|
-
throw await
|
|
248
|
+
throw await failStart(startFailurePhase(combined, result.code));
|
|
169
249
|
const parsed = parseWebLine(combined);
|
|
170
250
|
if (!parsed)
|
|
171
|
-
throw await
|
|
251
|
+
throw await failStart(startFailurePhase(combined, result.code));
|
|
172
252
|
if (!isLoopbackHost(parsed.host)) {
|
|
173
253
|
throw await failed(errors.remoteUiUnreachable({
|
|
174
254
|
zh: `远端 DSH 宣布的地址不是回环地址(${parsed.host}),无法安全地经 SSH 隧道访问。`,
|
|
@@ -419,7 +419,14 @@ export const TABLE = {
|
|
|
419
419
|
guard: (state) => (state.desired === 'connected' ? true : 'illegal-transition'),
|
|
420
420
|
apply: (state, event) => move(state, {
|
|
421
421
|
reconnectAttempts: event.attempt,
|
|
422
|
-
|
|
422
|
+
// A slow retry says when it comes back rather than how many quick attempts were spent: after the fast budget
|
|
423
|
+
// the attempt count alone would read as "the 7th of 5 tries".
|
|
424
|
+
progress: event.slow === true
|
|
425
|
+
? progressOf('reconnect-waiting', {
|
|
426
|
+
attempt: event.attempt,
|
|
427
|
+
retryInSec: Math.round(event.delayMs / 100) / 10,
|
|
428
|
+
})
|
|
429
|
+
: progressOf('reconnecting', { attempt: event.attempt, max: event.max }),
|
|
423
430
|
}),
|
|
424
431
|
effects: (_state, event) => [arm('reconnect', event.delayMs), emit()],
|
|
425
432
|
},
|
package/dist/src/ssh.js
CHANGED
|
@@ -6,6 +6,7 @@ import { open } from 'node:fs/promises';
|
|
|
6
6
|
import { homedir } from 'node:os';
|
|
7
7
|
import path from 'node:path';
|
|
8
8
|
import ssh2 from '../vendor/ssh2.bundle.cjs';
|
|
9
|
+
import { SSH_KEEPALIVE_COUNT_MAX, SSH_KEEPALIVE_INTERVAL_MS } from './constants.js';
|
|
9
10
|
import { errors } from './errors.js';
|
|
10
11
|
import { fingerprintFromBlob } from './known-hosts.js';
|
|
11
12
|
import { classifySshFailure, closedError, isHostKeyError } from './ssh-failures.js';
|
|
@@ -56,7 +57,8 @@ export class SshConnection extends EventEmitter {
|
|
|
56
57
|
pinnedFingerprint: null,
|
|
57
58
|
knownHostFingerprints: [],
|
|
58
59
|
readyTimeoutMs: 20_000,
|
|
59
|
-
keepaliveIntervalMs:
|
|
60
|
+
keepaliveIntervalMs: SSH_KEEPALIVE_INTERVAL_MS,
|
|
61
|
+
keepaliveCountMax: SSH_KEEPALIVE_COUNT_MAX,
|
|
60
62
|
home: homedir(),
|
|
61
63
|
...options,
|
|
62
64
|
identityFiles: options.identityFiles ?? [],
|
|
@@ -135,7 +137,7 @@ export class SshConnection extends EventEmitter {
|
|
|
135
137
|
username: this.options.username ?? undefined,
|
|
136
138
|
readyTimeout: this.options.readyTimeoutMs,
|
|
137
139
|
keepaliveInterval: this.options.keepaliveIntervalMs,
|
|
138
|
-
keepaliveCountMax:
|
|
140
|
+
keepaliveCountMax: this.options.keepaliveCountMax,
|
|
139
141
|
tryKeyboard: false,
|
|
140
142
|
...(this.options.sock ? { sock: this.options.sock } : {}),
|
|
141
143
|
...authConfig,
|
package/dist/src/tools-report.js
CHANGED
|
@@ -311,17 +311,19 @@ export function reportTool(options) {
|
|
|
311
311
|
const id = input.id;
|
|
312
312
|
const wanted = selectedParts(input.parts);
|
|
313
313
|
// The two halves are read lazily, so a composition that mounts only one still answers its half: the missing
|
|
314
|
-
// member is a structured UNSUPPORTED, never a TypeError.
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
314
|
+
// member is a structured UNSUPPORTED, never a TypeError. Both are bound to the service on purpose: they are
|
|
315
|
+
// prototype methods that read `this.ctx` / `this.init`, and a detached copy used to die with
|
|
316
|
+
// "Cannot read properties of undefined (reading 'init')" exactly when the host was not connected.
|
|
317
|
+
const diagnose = typeof service.diagnose === 'function' ? service.diagnose.bind(service) : null;
|
|
318
|
+
const logView = typeof service.logView === 'function' ? service.logView.bind(service) : null;
|
|
319
|
+
if (wanted.checks && diagnose === null)
|
|
318
320
|
return { ok: false, error: unsupported('checks') };
|
|
319
|
-
if (wanted.logs &&
|
|
321
|
+
if (wanted.logs && logView === null)
|
|
320
322
|
return { ok: false, error: unsupported('logs') };
|
|
321
323
|
await service.init?.();
|
|
322
324
|
const result = { ok: true, host: hostRow(service, id) };
|
|
323
325
|
let dropped = false;
|
|
324
|
-
if (wanted.checks) {
|
|
326
|
+
if (wanted.checks && diagnose !== null) {
|
|
325
327
|
// A thrown coded error is this half's unknown-host answer: `serviceError` keeps the code and the bilingual
|
|
326
328
|
// reason, and the catch below logs it once.
|
|
327
329
|
const report = await diagnose(id);
|
|
@@ -335,7 +337,7 @@ export function reportTool(options) {
|
|
|
335
337
|
result.counts = checks.counts;
|
|
336
338
|
dropped = checks.dropped;
|
|
337
339
|
}
|
|
338
|
-
if (wanted.logs) {
|
|
340
|
+
if (wanted.logs && logView !== null) {
|
|
339
341
|
const view = logView(id);
|
|
340
342
|
if (!view)
|
|
341
343
|
return { ok: false, error: hostNotFound(id) };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-remote-go",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.3",
|
|
4
4
|
"description": "DSH 插件:在本地 DSH 里通过 SSH 使用远端 DSH(主机条切换、整窗接管、连接进度与日志、重启/关闭远端、远端文件下载、给本地 AI 会话的主机清单 / 体检报告 / 受控远端命令,三者默认隐藏按需解锁;插件自带 Node + npx,数据留在远端 ~/.dsh) | DSH plugin: use a remote DSH over SSH inside your local DSH (host switcher, full-window UI, connect progress and log, remote restart/stop, remote file downloads, and a host list / diagnosis report / guarded remote command for local AI sessions — hidden until the session unlocks them; plugin-managed Node + npx, data stays in the remote ~/.dsh)",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"deepseek",
|
|
@@ -65,12 +65,12 @@
|
|
|
65
65
|
},
|
|
66
66
|
"dependencies": {},
|
|
67
67
|
"devDependencies": {
|
|
68
|
-
"@types/node": "^
|
|
68
|
+
"@types/node": "^26.6.6",
|
|
69
69
|
"@types/react": "^19.3.0",
|
|
70
70
|
"esbuild": "0.28.2",
|
|
71
71
|
"js-yaml": "^5.5.0",
|
|
72
72
|
"prettier": "^3.10.1",
|
|
73
|
-
"puppeteer-core": "^25.
|
|
73
|
+
"puppeteer-core": "^25.18.1",
|
|
74
74
|
"react": "^19.3.1",
|
|
75
75
|
"react-dom": "^19.3.1",
|
|
76
76
|
"ssh2": "1.17.0",
|