@tiphareth/dsh-hardssh 0.1.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/README.md +50 -0
- package/cordis.patch.yml +26 -0
- package/lib/client.js +17780 -0
- package/lib/environment-BL1jddfB.js +449 -0
- package/lib/fs.js +478 -0
- package/lib/index.js +6758 -0
- package/lib/subprocess.js +600 -0
- package/lib/switch-fs-CAJpFY9C.js +193 -0
- package/lib/switch-fs-RrZtG2gv.js +210 -0
- package/lib/types/backend.d.ts +108 -0
- package/lib/types/base/capability.d.ts +107 -0
- package/lib/types/base/index.d.ts +18 -0
- package/lib/types/base/ledger-router.d.ts +48 -0
- package/lib/types/base/ledger.d.ts +82 -0
- package/lib/types/base/model.d.ts +108 -0
- package/lib/types/base/namespace.d.ts +57 -0
- package/lib/types/base/plugin.d.ts +102 -0
- package/lib/types/base/registry.d.ts +60 -0
- package/lib/types/base/router.d.ts +40 -0
- package/lib/types/client/api.d.ts +85 -0
- package/lib/types/client/directory-flow.d.ts +82 -0
- package/lib/types/client/icons.d.ts +19 -0
- package/lib/types/client/index.d.ts +34 -0
- package/lib/types/client/locales.d.ts +104 -0
- package/lib/types/client/manager-button.d.ts +32 -0
- package/lib/types/client/migrate.d.ts +20 -0
- package/lib/types/client/ssh/api.d.ts +89 -0
- package/lib/types/client/ssh/apply.d.ts +23 -0
- package/lib/types/client/ssh/locales.d.ts +156 -0
- package/lib/types/client/ssh/mount.d.ts +13 -0
- package/lib/types/client/ssh/panel/ClusterTab.d.ts +8 -0
- package/lib/types/client/ssh/panel/HostFingerprintDialog.d.ts +16 -0
- package/lib/types/client/ssh/panel/HostFormDialog.d.ts +13 -0
- package/lib/types/client/ssh/panel/HostsTab.d.ts +10 -0
- package/lib/types/client/ssh/panel/SessionSecretDialog.d.ts +16 -0
- package/lib/types/client/ssh/panel/SshPanel.d.ts +14 -0
- package/lib/types/client/ssh/panel/TerminalTab.d.ts +12 -0
- package/lib/types/client/ssh/panel/TransferTab.d.ts +8 -0
- package/lib/types/client/ssh/panel/TunnelsTab.d.ts +8 -0
- package/lib/types/client/ssh/panel/controller.d.ts +23 -0
- package/lib/types/client/ssh/panel/helpers.d.ts +15 -0
- package/lib/types/client/ssh/panel/xterm.css.d.ts +3 -0
- package/lib/types/client/ssh/sidebar-entry.d.ts +25 -0
- package/lib/types/client/state.d.ts +32 -0
- package/lib/types/client/text.d.ts +11 -0
- package/lib/types/client/workspace-badges.d.ts +38 -0
- package/lib/types/client/workspace-gate.d.ts +15 -0
- package/lib/types/client-http.d.ts +15 -0
- package/lib/types/core.d.ts +43 -0
- package/lib/types/fs.d.ts +36 -0
- package/lib/types/host-http.d.ts +25 -0
- package/lib/types/index.d.ts +53 -0
- package/lib/types/ledger.d.ts +132 -0
- package/lib/types/protocol.d.ts +101 -0
- package/lib/types/providers/index.d.ts +19 -0
- package/lib/types/providers/local/provider.d.ts +58 -0
- package/lib/types/providers/ssh/provider.d.ts +112 -0
- package/lib/types/remote/environment.d.ts +29 -0
- package/lib/types/remote/output.d.ts +38 -0
- package/lib/types/remote/remote-fs.d.ts +69 -0
- package/lib/types/remote/remote-process.d.ts +41 -0
- package/lib/types/remote/remote-subprocess.d.ts +31 -0
- package/lib/types/remote/remote-terminal.d.ts +41 -0
- package/lib/types/remote-runner.d.ts +83 -0
- package/lib/types/remote-search.d.ts +50 -0
- package/lib/types/routes.d.ts +24 -0
- package/lib/types/runtime/workspace-core.d.ts +59 -0
- package/lib/types/seam-state.d.ts +69 -0
- package/lib/types/shell.d.ts +8 -0
- package/lib/types/ssh/connection/lease.d.ts +16 -0
- package/lib/types/ssh/connection/pool.d.ts +57 -0
- package/lib/types/ssh/engine.d.ts +434 -0
- package/lib/types/ssh/exec/output.d.ts +31 -0
- package/lib/types/ssh/known-hosts.d.ts +89 -0
- package/lib/types/ssh/plugin.d.ts +57 -0
- package/lib/types/ssh/protocol.d.ts +236 -0
- package/lib/types/ssh/routes.d.ts +44 -0
- package/lib/types/ssh/store.d.ts +107 -0
- package/lib/types/ssh/tools.d.ts +35 -0
- package/lib/types/ssh/transfer/progress.d.ts +14 -0
- package/lib/types/ssh/vault.d.ts +110 -0
- package/lib/types/subprocess.d.ts +32 -0
- package/lib/types/switch/switch-fs.d.ts +88 -0
- package/lib/types/switch/switch-subprocess.d.ts +34 -0
- package/lib/types/tools.d.ts +12 -0
- package/package.json +134 -0
- package/src/backend.ts +624 -0
- package/src/base/capability.ts +86 -0
- package/src/base/index.ts +18 -0
- package/src/base/ledger-router.ts +128 -0
- package/src/base/ledger.ts +299 -0
- package/src/base/model.ts +118 -0
- package/src/base/namespace.ts +102 -0
- package/src/base/plugin.ts +170 -0
- package/src/base/registry.ts +109 -0
- package/src/base/router.ts +43 -0
- package/src/client/api.ts +196 -0
- package/src/client/css-modules.d.ts +5 -0
- package/src/client/directory-flow.tsx +482 -0
- package/src/client/icons.tsx +50 -0
- package/src/client/index.ts +210 -0
- package/src/client/locales.ts +105 -0
- package/src/client/manager-button.tsx +269 -0
- package/src/client/migrate.ts +109 -0
- package/src/client/ssh/api.ts +411 -0
- package/src/client/ssh/apply.ts +50 -0
- package/src/client/ssh/locales.ts +322 -0
- package/src/client/ssh/mount.tsx +83 -0
- package/src/client/ssh/panel/ClusterTab.tsx +123 -0
- package/src/client/ssh/panel/HostFingerprintDialog.tsx +82 -0
- package/src/client/ssh/panel/HostFormDialog.tsx +228 -0
- package/src/client/ssh/panel/HostsTab.tsx +236 -0
- package/src/client/ssh/panel/SessionSecretDialog.tsx +80 -0
- package/src/client/ssh/panel/SshPanel.tsx +77 -0
- package/src/client/ssh/panel/TerminalTab.tsx +176 -0
- package/src/client/ssh/panel/TransferTab.tsx +232 -0
- package/src/client/ssh/panel/TunnelsTab.tsx +177 -0
- package/src/client/ssh/panel/controller.ts +48 -0
- package/src/client/ssh/panel/helpers.ts +26 -0
- package/src/client/ssh/panel/panel.module.css +1006 -0
- package/src/client/ssh/panel/xterm.css.ts +2 -0
- package/src/client/ssh/sidebar-entry.ts +123 -0
- package/src/client/state.ts +99 -0
- package/src/client/text.ts +22 -0
- package/src/client/workspace-badges.ts +96 -0
- package/src/client/workspace-gate.ts +225 -0
- package/src/client/workspace.module.css +283 -0
- package/src/client-http.ts +45 -0
- package/src/core.ts +47 -0
- package/src/fs.ts +85 -0
- package/src/host-http.ts +74 -0
- package/src/index.ts +244 -0
- package/src/ledger.ts +416 -0
- package/src/protocol.ts +114 -0
- package/src/providers/index.ts +34 -0
- package/src/providers/local/provider.ts +179 -0
- package/src/providers/ssh/provider.ts +274 -0
- package/src/remote/environment.ts +123 -0
- package/src/remote/output.ts +142 -0
- package/src/remote/remote-fs.ts +532 -0
- package/src/remote/remote-process.ts +203 -0
- package/src/remote/remote-subprocess.ts +159 -0
- package/src/remote/remote-terminal.ts +141 -0
- package/src/remote-runner.ts +201 -0
- package/src/remote-search.ts +163 -0
- package/src/routes.ts +395 -0
- package/src/runtime/workspace-core.ts +154 -0
- package/src/seam-state.ts +185 -0
- package/src/shell.ts +10 -0
- package/src/ssh/connection/lease.ts +17 -0
- package/src/ssh/connection/pool.ts +275 -0
- package/src/ssh/engine.ts +1761 -0
- package/src/ssh/exec/output.ts +70 -0
- package/src/ssh/known-hosts.ts +214 -0
- package/src/ssh/plugin.ts +184 -0
- package/src/ssh/protocol.ts +227 -0
- package/src/ssh/routes.ts +892 -0
- package/src/ssh/store.ts +544 -0
- package/src/ssh/tools.ts +402 -0
- package/src/ssh/transfer/progress.ts +75 -0
- package/src/ssh/vault.ts +477 -0
- package/src/subprocess.ts +71 -0
- package/src/switch/switch-fs.ts +253 -0
- package/src/switch/switch-subprocess.ts +59 -0
- package/src/tools.ts +221 -0
package/README.md
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
# dsh-hardssh — SSH 远程工作区 + SSH 运维插件
|
|
2
|
+
|
|
3
|
+
在 DSH Web GUI 中提供两块能力(原 `dsh-ssh` 插件已整体并入本包并删除,单包单引擎):
|
|
4
|
+
|
|
5
|
+
1. **SSH 运维**:侧边栏「SSH」入口 → 主机管理面板(增删改查 / `~/.ssh/config` 导入 / 连接测试)、Web 终端(xterm + WebSocket PTY)、文件上传下载、本地端口转发隧道、集群并发执行;`ssh_list` / `ssh_exec` / `ssh_upload` / `ssh_download` / `ssh_tunnel` / `ssh_cluster` 六个 Agent 工具;主机配置存 `~/.dsh/dsh-ssh.json`。
|
|
6
|
+
2. **SSH 工作区**:会话头部按钮进入 SSH 模式,左侧出现远程文件树面板;本地 harness 的 fs/subprocess 经接缝门面透明路由到远程主机执行(read/write/edit/bash 在 SSH 模式下即远程操作);`remote_*` 九个 Agent 工具用于显式操作。
|
|
7
|
+
|
|
8
|
+
## 架构
|
|
9
|
+
|
|
10
|
+
- **单一共享实例**:`HostStore` + `SshEngine`(ssh2 连接池)在 `src/index.ts` 创建一次,SSH 运维与 SSH 工作区共用同一引擎 —— 配置变更(PATCH/DELETE)同时失效所有连接,无双池问题。
|
|
11
|
+
- **接缝切换**:`cordis.patch.yml` 禁用部署自带的 `fs-sandbox` / `subprocess` 行,由 `dsh-hardssh/fs`、`dsh-hardssh/subprocess` 提供模式路由门面(本地 = 沙箱化原实现;远程 = SFTP/SSH 实现)。
|
|
12
|
+
- **REST**:`/api/dsh-ssh`(运维路由,loopback-only)+ `/api/dsh-hardssh`(工作区路由,loopback-only)。兼容协议名(`/api/dsh-ssh`、`dsh-ssh` settings namespace、`plugin:dsh-ssh` 提示词段)刻意保留,不改名。
|
|
13
|
+
- **工作区核心服务**:`ctx.hardsshCore` / `ctx.sshWorkspaceCore` 指向同一 core(ledger + engine + runner),供 `dsh-workbench-tiphareth`(四列 IDE)消费。
|
|
14
|
+
|
|
15
|
+
## 安装
|
|
16
|
+
|
|
17
|
+
```sh
|
|
18
|
+
# profile 机制,热插拔;需重启 dsh
|
|
19
|
+
dsh plugin --profile <name> add link:<repo>/packages/dsh-hardssh
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## 开发
|
|
23
|
+
|
|
24
|
+
```sh
|
|
25
|
+
# 改码后一键同步 + 验证(build → 同步 profile 插件快照 → 独立实例启动验证)
|
|
26
|
+
pwsh scripts/sync-verify.ps1
|
|
27
|
+
# 单测 / 类型 / 构建
|
|
28
|
+
pnpm --filter dsh-hardssh typecheck
|
|
29
|
+
pnpm --filter dsh-hardssh test
|
|
30
|
+
pnpm --filter dsh-hardssh build
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
> 注意:profile 的插件依赖是 `file:` 安装副本,pnpm install 会把它重建为指向源码的
|
|
34
|
+
> junction(会让 DSH 平台 peer 解析断链)。日常改码后**只跑 sync-verify.ps1**(复制快照 +
|
|
35
|
+
> 验证),不要跑 pnpm install;仅当 profile package.json 依赖声明变化时才 install,
|
|
36
|
+
> 之后必须重跑 sync-verify 恢复快照。
|
|
37
|
+
|
|
38
|
+
## 安全模型
|
|
39
|
+
|
|
40
|
+
- `/api/dsh-ssh/*` 与 `/api/dsh-hardssh/*` 仅限 loopback(含同源校验)。
|
|
41
|
+
- 认证材料沿用 `~/.dsh/dsh-ssh.json`(0600 / 0700),不新增存储。
|
|
42
|
+
- 路径 gate:远程操作 root 必须等于 resolved remoteRoot;相对路径禁止 `..`。
|
|
43
|
+
- 远程操作消耗真实远程资源:工具描述与宣告段明确「先确认再执行」;grep/glob 限深限条数。
|
|
44
|
+
- SSH 模式下本机沙箱不对远程执行生效(远程进程无法被本地内核沙箱约束)——门面的 `sandboxMode` 在远程模式报告 `undefined`。
|
|
45
|
+
|
|
46
|
+
## 已知限制
|
|
47
|
+
|
|
48
|
+
- SSH 模式下 `pwsh` 工具在 POSIX 远程主机上不可用(请用 bash 语义命令或 `ssh_exec`)。
|
|
49
|
+
- 远程 grep/glob/realpath 依赖 GNU find/grep/coreutils(-printf / -mz / base64 -w0);限深 4~6 层、限 200 条。
|
|
50
|
+
- 断线重连沿用引擎语义;传输/执行消耗真实远程资源,先确认再操作。
|
package/cordis.patch.yml
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# @tiphareth/dsh-hardssh bundle patch: inserts the plugin row into the web
|
|
2
|
+
# profile roster, and performs the SSH seam switch — disable the deployment's
|
|
3
|
+
# local filesystem/subprocess providers and mount the mode-routing facades
|
|
4
|
+
# (hardssh-fs / hardssh-subprocess) instead. Applied automatically as a
|
|
5
|
+
# profile bundle layer (the `dsh.bundle.patch` manifest field) when this
|
|
6
|
+
# package is installed — NO manual cordis.patch.yml editing needed.
|
|
7
|
+
#
|
|
8
|
+
# In SSH mode the model's read/write/edit/bash tools execute on the remote
|
|
9
|
+
# host transparently; in local mode the facades delegate to the same sandboxed
|
|
10
|
+
# local implementations the disabled rows mounted.
|
|
11
|
+
- insert:
|
|
12
|
+
- id: hardssh
|
|
13
|
+
name: '@tiphareth/dsh-hardssh'
|
|
14
|
+
|
|
15
|
+
- id: fs-sandbox
|
|
16
|
+
disabled: true
|
|
17
|
+
|
|
18
|
+
- id: subprocess
|
|
19
|
+
disabled: true
|
|
20
|
+
|
|
21
|
+
- insert:
|
|
22
|
+
- id: hardssh-fs
|
|
23
|
+
name: '@tiphareth/dsh-hardssh/fs'
|
|
24
|
+
|
|
25
|
+
- id: hardssh-subprocess
|
|
26
|
+
name: '@tiphareth/dsh-hardssh/subprocess'
|