dsh-winrm 0.2.0 → 0.3.0

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 CHANGED
@@ -15,7 +15,7 @@
15
15
  | PowerShell 控制台 | WebSocket 命令会话(每条命令通过原生 Node WinRM 客户端执行,输出实时返回) |
16
16
  | 服务管理 | 列出 / 启动 / 停止 / 重启 / 改启动类型(自动/手动/禁用) |
17
17
  | 进程管理 | 列出(CPU/内存/路径)/ 按 PID 结束 |
18
- | 文件传输 | base64 分块读写,**不依赖 SMB**,任意路径可传;上传自动建目录 |
18
+ | 文件传输 | WinRM 流式传输(上传单 shell 单流 / 下载并行区间,**不依赖 SMB**,任意路径可传);上传自动建目录 |
19
19
  | 集群 | 一条命令并发跑多台主机(按 aliases / environment / tags 过滤) |
20
20
 
21
21
  ## 认证与传输
@@ -47,7 +47,7 @@ powershell -ExecutionPolicy Bypass -File .\scripts\enable-winrm.ps1
47
47
  从 [Releases](https://github.com/MoRanYue/dsh-winrm/releases) 下载最新的 `dsh-winrm-*.tgz`,加入 profile:
48
48
 
49
49
  ```powershell
50
- dsh plugin --profile web add D:\downloads\dsh-winrm-0.2.0.tgz
50
+ dsh plugin --profile web add D:\downloads\dsh-winrm-0.3.0.tgz
51
51
  ```
52
52
 
53
53
  也可以直接从 npm 安装:
@@ -93,10 +93,11 @@ src/
93
93
  engine.ts WinRmEngine 门面:exec / services / processes / ls / upload / download / console / cluster / test
94
94
  store.ts ~/.dsh/dsh-winrm.json 主机存储(原子写,0600)
95
95
  protocol.ts 宿主↔浏览器 wire 类型
96
- powershell.ts PS 片段构造器 + stdin 信封(outer/child 包装 / 服务 / 进程 / 目录 / 分块读写)
96
+ powershell.ts PS 片段构造器 + stdin 信封(outer/child 包装 / 服务 / 进程 / 目录 / 流式收发脚本)
97
97
  routes.ts /api/dsh-winrm 路由族 + 控制台 WebSocket(loopback 围栏)
98
98
  tools.ts 7 个 winrm_* agent 工具
99
- engine/client.ts winrm-client 传输层:进程内认证(NTLM/Basic)、UTF-8 信封、分块传输
99
+ engine/client.ts winrm-client 传输层:进程内认证(NTLM/Basic)、UTF-8 信封、流式上传/下载 + 分块回退
100
+ engine/wsman.ts 手写 WSMan Send/Receive 信封(原始字节走 stdin,不做二次 base64;512000 信封上限)
100
101
  engine/console.ts 流式 PowerShell 控制台会话
101
102
  client/ 浏览器半:侧边栏入口 + 居中面板(5 页签)
102
103
  scripts/
@@ -109,7 +110,10 @@ scripts/
109
110
  ## 已知限制
110
111
 
111
112
  - 控制台是命令会话,不保持 PowerShell 变量和当前目录状态;每条命令独立执行
112
- - 传输按 48KB 分块,大文件较慢(每块一次往返);分块大小由 `TRANSFER_CHUNK` 决定,脚本本身已不再受命令行长度限制
113
+ - 上传走**单条 stdin 流**:一个 shell、一个命令,每 256KB 一个 `Send`,可压缩内容自动按块 gzip(实测 1.7MB JSON 线上仅 91KB)。旧的 48KB 分块路径保留为回退,仅在流式通道不可用时启用
114
+ - 下载走**并行区间流**:默认最多 4 个 worker,各自一个 shell 读同一文件的绝对字节区间,远端 gzip 后回传,本地按 offset 落位(实测 2MiB 约 10-12 秒,16MiB 约 21-23 秒,可压缩的 16MiB 约 6 秒;旧的 48KB 分块路径 2MiB 需 129 秒,保留为回退)。服务端单次 `Receive` 最多回 128KB,与信封大小无关,所以下载是往返次数受限而非带宽受限
115
+ - `channel=auto`(默认)先探测目标机 445 端口:`net use` 自身没有短超时,SMB 不可用时要等约 60 秒才失败,此前这段等待发生在每次上传之前。现在 3 秒内判定并直接走 WinRM
116
+ - 下载失败不留残file:已写入的数据会被丢弃、目标文件被删除;若失败发生在任何字节到达之前(路径不存在、目标是目录、主机不可达),已存在的本地文件保持原样不动(目标文件在首次写入时才创建)
113
117
  - 单命令默认 60s 超时,可传 `timeoutMs`
114
118
  - 目标机需已启用 WinRM(见上);HTTP 明文 Basic 不应用于公网
115
119
  - 面板关闭再打开会回到「主机」页签:面板是 `main` 插槽的占用者,切回对话时卸载,页签状态不跨开关保留
package/README.zh.md CHANGED
@@ -13,7 +13,7 @@
13
13
  | PowerShell 控制台 | WebSocket 命令会话(每条命令通过原生 Node WinRM 客户端执行,输出实时返回) |
14
14
  | 服务管理 | 列出 / 启动 / 停止 / 重启 / 改启动类型(自动/手动/禁用) |
15
15
  | 进程管理 | 列出(CPU/内存/路径)/ 按 PID 结束 |
16
- | 文件传输 | base64 分块读写,**不依赖 SMB**,任意路径可传;上传自动建目录 |
16
+ | 文件传输 | WinRM 流式传输(上传单 shell 单流 / 下载并行区间,**不依赖 SMB**,任意路径可传);上传自动建目录 |
17
17
  | 集群 | 一条命令并发跑多台主机(按 aliases / environment / tags 过滤) |
18
18
 
19
19
  ## 认证与传输
@@ -50,7 +50,7 @@ powershell -ExecutionPolicy Bypass -File .\scripts\enable-winrm.ps1
50
50
  从 [Releases](https://github.com/MoRanYue/dsh-winrm/releases) 下载最新的 `dsh-winrm-*.tgz`,加入 profile:
51
51
 
52
52
  ```powershell
53
- dsh plugin --profile web add D:\downloads\dsh-winrm-0.2.0.tgz
53
+ dsh plugin --profile web add D:\downloads\dsh-winrm-0.3.0.tgz
54
54
  ```
55
55
 
56
56
  也可以直接从 npm 安装:
@@ -96,10 +96,11 @@ src/
96
96
  engine.ts WinRmEngine 门面:exec / services / processes / ls / upload / download / console / cluster / test
97
97
  store.ts ~/.dsh/dsh-winrm.json 主机存储(原子写,0600)
98
98
  protocol.ts 宿主↔浏览器 wire 类型
99
- powershell.ts PS 片段构造器 + stdin 信封(outer/child 包装 / 服务 / 进程 / 目录 / 分块读写)
99
+ powershell.ts PS 片段构造器 + stdin 信封(outer/child 包装 / 服务 / 进程 / 目录 / 流式收发脚本)
100
100
  routes.ts /api/dsh-winrm 路由族 + 控制台 WebSocket(loopback 围栏)
101
101
  tools.ts 7 个 winrm_* agent 工具
102
- engine/client.ts winrm-client 传输层:进程内认证(NTLM/Basic)、UTF-8 信封、分块传输
102
+ engine/client.ts winrm-client 传输层:进程内认证(NTLM/Basic)、UTF-8 信封、流式上传/下载 + 分块回退
103
+ engine/wsman.ts 手写 WSMan Send/Receive 信封(原始字节走 stdin,不做二次 base64;512000 信封上限)
103
104
  engine/console.ts 流式 PowerShell 控制台会话
104
105
  client/ 浏览器半:侧边栏入口 + 居中面板(5 页签)
105
106
  scripts/
@@ -112,7 +113,10 @@ scripts/
112
113
  ## 已知限制
113
114
 
114
115
  - 控制台是命令会话,不保持 PowerShell 变量和当前目录状态;每条命令独立执行
115
- - 传输按 48KB 分块,大文件较慢(每块一次往返);分块大小由 `TRANSFER_CHUNK` 决定,脚本本身已不再受命令行长度限制
116
+ - 上传走**单条 stdin 流**:一个 shell、一个命令,每 256KB 一个 `Send`,可压缩内容自动按块 gzip(实测 1.7MB JSON 线上仅 91KB)。旧的 48KB 分块路径保留为回退,仅在流式通道不可用时启用
117
+ - 下载走**并行区间流**:默认最多 4 个 worker,各自一个 shell 读同一文件的绝对字节区间,远端 gzip 后回传,本地按 offset 落位(实测 2MiB 约 10-12 秒,16MiB 约 21-23 秒,可压缩的 16MiB 约 6 秒;旧的 48KB 分块路径 2MiB 需 129 秒,保留为回退)。服务端单次 `Receive` 最多回 128KB,与信封大小无关,所以下载是往返次数受限而非带宽受限
118
+ - `channel=auto`(默认)先探测目标机 445 端口:`net use` 自身没有短超时,SMB 不可用时要等约 60 秒才失败,此前这段等待发生在每次上传之前。现在 3 秒内判定并直接走 WinRM
119
+ - 下载失败不留残file:已写入的数据会被丢弃、目标文件被删除;若失败发生在任何字节到达之前(路径不存在、目标是目录、主机不可达),已存在的本地文件保持原样不动(目标文件在首次写入时才创建)
116
120
  - 单命令默认 60s 超时,可传 `timeoutMs`
117
121
  - 目标机需已启用 WinRM(见上);HTTP 明文 Basic 不应用于公网
118
122
  - 面板关闭再打开会回到「主机」页签:面板是 `main` 插槽的占用者,切回对话时卸载,页签状态不跨开关保留
package/lib/client.js CHANGED
@@ -565,93 +565,93 @@ if (typeof document !== "undefined" && document.querySelector("style[data-plugin
565
565
  document.head.appendChild(tag);
566
566
  }
567
567
  var panel_module_css_default = {
568
- "modalBackdrop": "hAbY3W_modalBackdrop",
569
- "panel": "hAbY3W_panel",
570
- "groupCount": "hAbY3W_groupCount",
571
- "tab": "hAbY3W_tab",
572
- "iconButton": "hAbY3W_iconButton",
573
- "banner": "hAbY3W_banner",
574
- "panelHeader": "hAbY3W_panelHeader",
575
- "utf8Note": "hAbY3W_utf8Note",
576
- "cellPre": "hAbY3W_cellPre",
577
- "dialog": "hAbY3W_dialog",
568
+ "table": "hAbY3W_table",
569
+ "modalFooter": "hAbY3W_modalFooter",
578
570
  "hiddenFile": "hAbY3W_hiddenFile",
579
- "linkButton": "hAbY3W_linkButton",
580
- "tabBody": "hAbY3W_tabBody",
581
- "dirName": "hAbY3W_dirName",
582
- "fillBody": "hAbY3W_fillBody",
571
+ "groupChevron": "hAbY3W_groupChevron",
572
+ "groupToggle": "hAbY3W_groupToggle",
573
+ "tab": "hAbY3W_tab",
574
+ "primaryButton": "hAbY3W_primaryButton",
575
+ "browsePath": "hAbY3W_browsePath",
576
+ "consoleInputRow": "hAbY3W_consoleInputRow",
583
577
  "backButton": "hAbY3W_backButton",
584
- "mono": "hAbY3W_mono",
585
- "actions": "hAbY3W_actions",
586
- "tunnelRow": "hAbY3W_tunnelRow",
587
- "commandInput": "hAbY3W_commandInput",
588
- "ghostButton": "hAbY3W_ghostButton",
589
- "dialogOverlay": "hAbY3W_dialogOverlay",
590
- "table": "hAbY3W_table",
591
- "termBody": "hAbY3W_termBody",
592
- "browseList": "hAbY3W_browseList",
593
- "radioRow": "hAbY3W_radioRow",
578
+ "dirType": "hAbY3W_dirType",
579
+ "termContainer": "hAbY3W_termContainer",
580
+ "browseHeader": "hAbY3W_browseHeader",
581
+ "modalBackdrop": "hAbY3W_modalBackdrop",
582
+ "groupName": "hAbY3W_groupName",
583
+ "tableWrap": "hAbY3W_tableWrap",
594
584
  "progressBar": "hAbY3W_progressBar",
595
- "dialogTitle": "hAbY3W_dialogTitle",
585
+ "toolbarSpacer": "hAbY3W_toolbarSpacer",
586
+ "inlineTest": "hAbY3W_inlineTest",
587
+ "termWrap": "hAbY3W_termWrap",
588
+ "tunnelLabel": "hAbY3W_tunnelLabel",
589
+ "dirName": "hAbY3W_dirName",
596
590
  "dirRow": "hAbY3W_dirRow",
597
- "groupHeader": "hAbY3W_groupHeader",
598
- "consoleOutput": "hAbY3W_consoleOutput",
599
- "spinner": "hAbY3W_spinner",
600
- "transferBlock": "hAbY3W_transferBlock",
591
+ "termBody": "hAbY3W_termBody",
592
+ "dialogOverlay": "hAbY3W_dialogOverlay",
593
+ "dialog": "hAbY3W_dialog",
594
+ "utf8Note": "hAbY3W_utf8Note",
601
595
  "consoleHeader": "hAbY3W_consoleHeader",
602
- "progressTrack": "hAbY3W_progressTrack",
603
- "termContainer": "hAbY3W_termContainer",
604
- "loading": "hAbY3W_loading",
596
+ "mono": "hAbY3W_mono",
597
+ "spinner": "hAbY3W_spinner",
605
598
  "tunnelList": "hAbY3W_tunnelList",
606
- "cellDetails": "hAbY3W_cellDetails",
607
- "consoleWrap": "hAbY3W_consoleWrap",
608
- "modal": "hAbY3W_modal",
609
- "formRow": "hAbY3W_formRow",
610
- "progressMeta": "hAbY3W_progressMeta",
599
+ "groupBySelect": "hAbY3W_groupBySelect",
600
+ "entryIcon": "hAbY3W_entryIcon",
601
+ "ghostButton": "hAbY3W_ghostButton",
602
+ "formCard": "hAbY3W_formCard",
603
+ "fieldLabel": "hAbY3W_fieldLabel",
611
604
  "controls": "hAbY3W_controls",
612
- "modalFooter": "hAbY3W_modalFooter",
613
- "groupName": "hAbY3W_groupName",
605
+ "linkButton": "hAbY3W_linkButton",
606
+ "formError": "hAbY3W_formError",
614
607
  "modalTitle": "hAbY3W_modalTitle",
615
- "radioLabel": "hAbY3W_radioLabel",
616
- "toolbarSpacer": "hAbY3W_toolbarSpacer",
617
- "browsePanel": "hAbY3W_browsePanel",
608
+ "tunnelRow": "hAbY3W_tunnelRow",
609
+ "modal": "hAbY3W_modal",
610
+ "panelContent": "hAbY3W_panelContent",
611
+ "empty": "hAbY3W_empty",
612
+ "loading": "hAbY3W_loading",
613
+ "progressMeta": "hAbY3W_progressMeta",
618
614
  "checkRow": "hAbY3W_checkRow",
619
- "entryIcon": "hAbY3W_entryIcon",
615
+ "panel": "hAbY3W_panel",
620
616
  "groupSection": "hAbY3W_groupSection",
621
- "input": "hAbY3W_input",
622
- "formError": "hAbY3W_formError",
623
- "empty": "hAbY3W_empty",
617
+ "banner": "hAbY3W_banner",
618
+ "formRow": "hAbY3W_formRow",
619
+ "progressTrack": "hAbY3W_progressTrack",
620
+ "cellMuted": "hAbY3W_cellMuted",
621
+ "tabBar": "hAbY3W_tabBar",
622
+ "browsePanel": "hAbY3W_browsePanel",
623
+ "cellDetails": "hAbY3W_cellDetails",
624
624
  "entry": "hAbY3W_entry",
625
- "badge": "hAbY3W_badge",
626
- "field": "hAbY3W_field",
627
- "browsePath": "hAbY3W_browsePath",
628
- "dshSshSpin": "hAbY3W_dshSshSpin",
629
- "toolbar": "hAbY3W_toolbar",
630
- "dirType": "hAbY3W_dirType",
625
+ "dirSize": "hAbY3W_dirSize",
626
+ "radioRow": "hAbY3W_radioRow",
627
+ "cellPre": "hAbY3W_cellPre",
628
+ "search": "hAbY3W_search",
629
+ "fieldHint": "hAbY3W_fieldHint",
630
+ "panelHeader": "hAbY3W_panelHeader",
631
631
  "panelTitle": "hAbY3W_panelTitle",
632
- "formCard": "hAbY3W_formCard",
633
- "browseHeader": "hAbY3W_browseHeader",
634
- "entryLabel": "hAbY3W_entryLabel",
635
- "groupChevron": "hAbY3W_groupChevron",
636
- "panelContent": "hAbY3W_panelContent",
637
- "termWrap": "hAbY3W_termWrap",
632
+ "radioLabel": "hAbY3W_radioLabel",
638
633
  "termPlaceholder": "hAbY3W_termPlaceholder",
639
- "fieldHint": "hAbY3W_fieldHint",
640
- "groupBySelect": "hAbY3W_groupBySelect",
641
- "groupToggle": "hAbY3W_groupToggle",
634
+ "browseList": "hAbY3W_browseList",
635
+ "clusterFilters": "hAbY3W_clusterFilters",
636
+ "transferBlock": "hAbY3W_transferBlock",
637
+ "consoleWrap": "hAbY3W_consoleWrap",
638
+ "dshSshSpin": "hAbY3W_dshSshSpin",
639
+ "groupCount": "hAbY3W_groupCount",
642
640
  "clusterForm": "hAbY3W_clusterForm",
643
- "fieldLabel": "hAbY3W_fieldLabel",
644
- "cellMuted": "hAbY3W_cellMuted",
645
- "tabBar": "hAbY3W_tabBar",
646
- "tableWrap": "hAbY3W_tableWrap",
647
- "consoleInputRow": "hAbY3W_consoleInputRow",
648
- "search": "hAbY3W_search",
649
- "inlineTest": "hAbY3W_inlineTest",
641
+ "consoleOutput": "hAbY3W_consoleOutput",
642
+ "fillBody": "hAbY3W_fillBody",
643
+ "entryLabel": "hAbY3W_entryLabel",
644
+ "toolbar": "hAbY3W_toolbar",
645
+ "groupHeader": "hAbY3W_groupHeader",
646
+ "badge": "hAbY3W_badge",
647
+ "commandInput": "hAbY3W_commandInput",
648
+ "dialogTitle": "hAbY3W_dialogTitle",
649
+ "tabBody": "hAbY3W_tabBody",
650
+ "iconButton": "hAbY3W_iconButton",
651
+ "field": "hAbY3W_field",
650
652
  "hint": "hAbY3W_hint",
651
- "tunnelLabel": "hAbY3W_tunnelLabel",
652
- "dirSize": "hAbY3W_dirSize",
653
- "clusterFilters": "hAbY3W_clusterFilters",
654
- "primaryButton": "hAbY3W_primaryButton"
653
+ "actions": "hAbY3W_actions",
654
+ "input": "hAbY3W_input"
655
655
  };
656
656
  //#endregion
657
657
  //#region src/client/panel/ConsoleTab.tsx