@jabberwocky238/dsh-ssh 0.0.0-stage → 0.2.4

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
@@ -1,3 +1,113 @@
1
- # Temporary Holding Version
1
+ ---
2
+ description: "OpenSSH connection configuration and remote helper lifecycle for deployments composing POSIX file, process and sandbox providers."
3
+ kind: "package-reference"
4
+ ---
2
5
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
6
+ # @deepseek-ai/dsh-ssh
7
+
8
+ English | [中文](README.zh.md)
9
+
10
+ ## Summary
11
+
12
+ `dsh-ssh` connects a POSIX Harness host to an installed helper on a POSIX SSH host. One deployment-owned OpenSSH alias supplies authentication and host identity; the paired filesystem, subprocess and sandbox providers use that connection. The connection verifies installed artifact digests before readiness; the helper owns remote cleanup when the connection closes or its lease expires.
13
+
14
+ ## Table of Contents
15
+
16
+ - [Use this package](#use-this-package)
17
+ - [Understand the implementation](#understand-the-implementation)
18
+ - [Further Exploration](#further-exploration)
19
+ - [Model Experience](#model-experience)
20
+ - [Known Limitations and Deferred Work](#known-limitations-and-deferred-work)
21
+ - [Dev Note](#dev-note)
22
+
23
+ -----
24
+
25
+ <a id="use-this-package"></a>
26
+ ## Use this package
27
+
28
+ Compose this service with [`fs-ssh`](../fs-ssh/README.md), [`subprocess-ssh`](../subprocess-ssh/README.md) and [`sandbox-ssh`](../sandbox-ssh/README.md) in a custom `dsh` profile. The host runs the Harness, model transport and Session storage; the remote machine supplies the files and processes. Headless profiles support this arrangement.
29
+
30
+ ### Deployment prerequisites
31
+
32
+ Both endpoints require Linux or macOS. The local `ssh` command must support connection multiplexing and Unix-socket forwarding; the server must permit that forwarding. Configure the alias, credentials and known-host entry before startup: the service enables `BatchMode`, requires strict host-key checking, disables agent forwarding and adds no interactive authentication flow.
33
+
34
+ Install an [SSH helper executable archive](../ssh-helper-runtime/README.md), or the built helper script with its matching Node dependencies. Keep the runtime outside the workspace and writable temporary roots. They must also remain outside a backend’s replaced temporary tree, such as bwrap’s private `/tmp`; the workspace may still be under `/tmp`. Digest verification detects an unexpected installed artifact after helper startup; it does not make writable deployment files safe to execute or authenticate a malicious SSH host.
35
+
36
+ | Field | Default | Meaning |
37
+ |---|---|---|
38
+ | `host` | required | Existing OpenSSH host alias |
39
+ | `launch` | required | `{ kind: "executable" }`, or `{ kind: "node-script", node: "/absolute/node" }` |
40
+ | `helper`, `workspace` | required | Absolute remote helper entry and default workspace |
41
+ | `helperHash` | required | Lowercase SHA-256 of the installed helper entry |
42
+ | `launch.bootstrapPath`, `launch.bootstrapHash` | omitted | Paired remote PTC script and digest; only for `node-script` |
43
+ | `requestTimeoutMs` | `30000` | Connection and administrative-request deadline, from 1 through 2,147,483,647 ms |
44
+ | `maxFrameBytes` | `67108864` | Per-message JSON payload ceiling, at most 64 MiB |
45
+ | `maxPending` | `128` | Ordinary outstanding requests; heartbeat and bounded cleanup requests have reserved capacity |
46
+ | `leaseMs` | `30000` | Helper heartbeat lease, from 3000 to 600000 ms |
47
+ | `loginIdleMs` | `600000` | Idle time after which a connection opened for a bound login closes |
48
+
49
+ Pass the verified `ctx.ssh.ptcLaunch` as the `launch` configuration of [`NodePtcRuntime`](../../ptc-runtime/ptc-runtime-node/README.md). Executable deployments include their worker. Script deployments require both bootstrap fields for PTC; filesystem and Bash use may omit them. The getter refuses an unconfigured script bootstrap. The client rejects mismatched protocol versions, runtime kinds and helper digests before readiness.
50
+
51
+ ### Run an Agent's operations as another login
52
+
53
+ `ctx.ssh.bindLogin(agent, login)` makes every operation that Agent drives run as `login` on the same alias: the service opens a second connection with `ssh -l <login> <host>`, starts that login's own helper, and closes it after `loginIdleMs` without work. An Agent drives an operation while it is the current initiator (`ctx.agents.currentInitiator()`), which covers its tools' filesystem, process and sandbox calls; work outside an initiator, or inside `ctx.agents.withoutInitiator()`, keeps the alias's own login. A process, terminal or text stream stays on the connection that created it, so a later wait or cancellation reaches the helper that owns it. Register the returned disposer as an effect of the Agent's context. The remote host must accept the alias's key for each bound login, and the installed helper must be executable by it.
54
+
55
+ -----
56
+
57
+ <a id="understand-the-implementation"></a>
58
+ ## Understand the implementation
59
+
60
+ <details>
61
+ <summary>Implementation internals — click to expand</summary>
62
+
63
+ The OpenSSH master carries private administrative RPC. Each program stream uses a separate forwarded Unix socket and an independent SSH channel. Program stdout cannot forge administrative replies or occupy the control stream’s channel window. SSH transport congestion still affects the shared connection.
64
+
65
+ Each stream reservation has a random 256-bit TLS pre-shared key carried only by administrative RPC. TLS authenticates both endpoints and protects every stream byte; the key is never sent as a stream preface. Socket directories are private (`0700`) and sockets use `0600`. Replacing a writable socket path cannot impersonate an endpoint or reveal the stream key; an attacker can still interrupt service or relay opaque TLS records.
66
+
67
+ Connection disposal joins forwarding and cancellation subprocesses and partially established streams before removing local resources. Transport loss rejects pending operations and invalidates the connection. The helper starts managed cleanup on SSH EOF, termination signals or heartbeat expiry. A disconnected client cannot confirm the remote outcome; operations are never reconnected or replayed automatically.
68
+
69
+ Failed startup and process results release their reservations after native quiescence; the bounded completion cache preserves the original rejection for later result reads. Helper shutdown also joins endpoint and directory cleanup already in progress.
70
+
71
+ For terminals opting into shell activity observation, root exit retains the reservation and its remaining work. Activity RPC continues to reach the provider; explicit termination awaits quiescence before releasing endpoints and recording the completed result. Helper connection disposal and lease expiry retain their existing termination authority.
72
+
73
+ The connection disables the helper’s SIGUSR1 debugger activation: the script invocation uses `--disable-sigusr1`, and the executable invocation supplies that flag through `NODE_OPTIONS`.
74
+
75
+ </details>
76
+
77
+ -----
78
+
79
+ <a id="further-exploration"></a>
80
+ ## Further Exploration
81
+
82
+ - [SSH subsystem](../../../docs/subsystems/ssh.md) — execution coordinates, transport semantics and lifecycle ownership.
83
+ - [POSIX SSH decision](../../../.agents/notes/implemented/architecture/2026-09-11-posix-ssh-runtime.md) — rationale, alternatives and required verification.
84
+
85
+ -----
86
+
87
+ <a id="model-experience"></a>
88
+ ## Model Experience
89
+
90
+ None, as host aliases, authentication and stream capabilities are private deployment details and consumers own every model-visible operation.
91
+
92
+ #### KV Cache effect
93
+
94
+ This provider contributes no request-prefix content. Its consumers own model-visible tools and results.
95
+
96
+ ## Known Limitations and Deferred Work
97
+
98
+ <a id="known-limitations-and-deferred-work"></a>
99
+
100
+ - No Windows endpoint, automatic provisioning, reconnect or replay is supplied.
101
+ - A bound login covers only the bound Agent: a child Agent it creates runs as the alias's own login unless it is bound too.
102
+ - Web workspace UI paths still assume host filesystem access; use headless or a custom composition whose consumers honor provider paths.
103
+ - TLS stream keys do not protect against remote OS process-memory inspection or debugging. File-effect policy retains the selected sandbox backend’s limits.
104
+
105
+ <a id="dev-note"></a>
106
+ ### Dev Note
107
+
108
+ <details>
109
+ <summary>Working context for maintainers — click to expand</summary>
110
+
111
+ None.
112
+
113
+ </details>
package/README.zh.md ADDED
@@ -0,0 +1,113 @@
1
+ ---
2
+ description: "面向组合 POSIX 文件、进程与沙箱提供方的部署者,说明 OpenSSH 连接配置及远端辅助进程生命周期。"
3
+ kind: "package-reference"
4
+ ---
5
+
6
+ # @deepseek-ai/dsh-ssh
7
+
8
+ [English](README.md) | 中文
9
+
10
+ ## 概述
11
+
12
+ `dsh-ssh` 将 POSIX Harness 主机连接到 POSIX SSH 主机上已安装的辅助程序。部署方持有的 OpenSSH 主机别名提供认证与主机身份;配套的文件系统、子进程和沙箱提供方共享该连接。连接在就绪前验证已安装产物的摘要;辅助程序在连接关闭或租期到期时负责远端清理。
13
+
14
+ ## 目录
15
+
16
+ - [使用本包](#use-this-package)
17
+ - [理解实现](#understand-the-implementation)
18
+ - [进一步探索](#further-exploration)
19
+ - [模型体验](#model-experience)
20
+ - [已知限制与延后工作](#known-limitations-and-deferred-work)
21
+ - [开发备注](#dev-note)
22
+
23
+ -----
24
+
25
+ <a id="use-this-package"></a>
26
+ ## 使用本包
27
+
28
+ 在自定义 `dsh` 配置组合中,将本服务与 [`fs-ssh`](../fs-ssh/README.zh.md)、[`subprocess-ssh`](../subprocess-ssh/README.zh.md) 和 [`sandbox-ssh`](../sandbox-ssh/README.zh.md) 组合。主机运行 Harness、模型传输和 Session 存储;远端机器提供文件与进程。headless 配置组合支持这种安排。
29
+
30
+ ### 部署前提
31
+
32
+ 两端均需运行 Linux 或 macOS。本地 `ssh` 命令必须支持连接复用与 Unix 套接字转发,服务器也必须允许该转发。启动前配置主机别名、凭据与已知主机记录:本服务启用 `BatchMode`、要求严格检查主机密钥、禁用认证代理转发,且不提供交互认证流程。
33
+
34
+ 安装 [SSH helper 可执行文件发行包](../ssh-helper-runtime/README.zh.md),或已构建的 helper 脚本及其匹配的 Node 依赖。运行时必须位于工作区和可写临时目录之外,也必须位于后端会替换的临时目录树之外,例如 bwrap 的私有 `/tmp`;工作区仍可位于 `/tmp` 下。摘要校验在辅助程序启动后发现非预期的已安装产物;它不能保证可写部署文件的执行安全,也不能认证恶意 SSH 主机。
35
+
36
+ | 字段 | 默认值 | 含义 |
37
+ |---|---|---|
38
+ | `host` | 必填 | 已有的 OpenSSH 主机别名 |
39
+ | `launch` | 必填 | `{ kind: "executable" }`,或 `{ kind: "node-script", node: "/absolute/node" }` |
40
+ | `helper`、`workspace` | 必填 | 远端 helper 入口和默认工作区的绝对路径 |
41
+ | `helperHash` | 必填 | 已安装辅助程序入口的小写 SHA-256 |
42
+ | `launch.bootstrapPath`、`launch.bootstrapHash` | 省略 | 成对提供的远端 PTC 脚本及摘要;仅用于 `node-script` |
43
+ | `requestTimeoutMs` | `30000` | 连接与管理请求的截止时限,范围为 1 至 2,147,483,647 毫秒 |
44
+ | `maxFrameBytes` | `67108864` | 每条 JSON 消息的负载上限,最大为 64 MiB |
45
+ | `maxPending` | `128` | 普通未完成请求的数量上限;心跳与有界清理请求使用预留容量 |
46
+ | `leaseMs` | `30000` | 辅助进程心跳租期,范围为 3000 至 600000 毫秒 |
47
+ | `loginIdleMs` | `600000` | 为已绑定登录名打开的连接空闲多久后关闭 |
48
+
49
+ 将验证后的 `ctx.ssh.ptcLaunch` 作为 [`NodePtcRuntime`](../../ptc-runtime/ptc-runtime-node/README.zh.md) 的 `launch` 配置。可执行文件部署包含 worker;脚本部署使用 PTC 时需要两个引导字段,仅使用文件系统和 Bash 时可以省略。脚本引导未配置时,getter 会拒绝访问。客户端在就绪前拒绝不匹配的协议版本、运行形式和 helper 摘要。
50
+
51
+ ### 让某个 Agent 以另一个登录名执行
52
+
53
+ `ctx.ssh.bindLogin(agent, login)` 让该 Agent 发起的所有操作都在同一别名上以 `login` 执行:服务用 `ssh -l <login> <host>` 另开一条连接,启动该登录名自己的 helper,空闲 `loginIdleMs` 后关闭。Agent 作为当前发起者(`ctx.agents.currentInitiator()`)期间的操作都算它发起的,包括其工具的文件系统、进程与沙箱调用;不在任何发起者之下、或处于 `ctx.agents.withoutInitiator()` 之内的操作,仍以别名自身的登录名执行。进程、终端和文本流始终留在创建它的那条连接上,所以之后的等待或取消会到达拥有它的 helper。请把返回的 disposer 注册为该 Agent 上下文的 effect。远端必须对每个绑定的登录名接受别名所用的密钥,已安装的 helper 也必须能由该登录名执行。
54
+
55
+ -----
56
+
57
+ <a id="understand-the-implementation"></a>
58
+ ## 理解实现
59
+
60
+ <details>
61
+ <summary>实现细节 — 点击展开</summary>
62
+
63
+ OpenSSH 主连接承载私有管理 RPC。每条程序流使用独立转发的 Unix 套接字和独立 SSH 通道。程序 stdout 无法伪造管理回复,也不会占用控制流的通道窗口;SSH 传输拥塞仍会影响共享连接。
64
+
65
+ 每个流预留项都有一个随机 256 位 TLS 预共享密钥,仅由管理 RPC 传递。TLS 认证两端并保护流中的每个字节;密钥绝不作为流前缀发送。套接字目录为私有目录(`0700`),套接字使用 `0600` 权限。替换可写套接字路径无法冒充端点或获知流密钥;攻击者仍可中断服务或转发不透明的 TLS 记录。
66
+
67
+ 连接释放会先等待转发与取消子进程,以及尚在建立的流结束,再删除本地资源。传输丢失会拒绝待处理操作并使连接失效。辅助进程在 SSH EOF、终止信号或心跳到期时启动托管清理。断连客户端无法确认远端结果;操作不会自动重连或重放。
68
+
69
+ 启动或进程结果失败后,预留项在原生进程范围清空后释放;有界完成缓存保留原始拒绝结果,供后续读取。辅助程序关闭也会等待已在进行的端点与目录清理。
70
+
71
+ 终端启用 shell 活动观察时,根进程退出会保留 reservation 及其剩余工作。活动 RPC 继续访问 provider;明确终止时先等待进程范围完全停稳,再释放端点并记录完成结果。helper 连接卸载和租约到期仍保留原有的终止权限。
72
+
73
+ 连接会禁用 helper 的 SIGUSR1 调试器激活:脚本调用使用 `--disable-sigusr1`,可执行文件调用通过 `NODE_OPTIONS` 提供该标志。
74
+
75
+ </details>
76
+
77
+ -----
78
+
79
+ <a id="further-exploration"></a>
80
+ ## 进一步探索
81
+
82
+ - [SSH 子系统](../../../docs/subsystems/ssh.zh.md) — 执行坐标、传输语义及生命周期归属。
83
+ - [POSIX SSH 决策](../../../.agents/notes/implemented/architecture/2026-09-11-posix-ssh-runtime.zh.md) — 理由、替代方案及必要验证。
84
+
85
+ -----
86
+
87
+ <a id="model-experience"></a>
88
+ ## 模型体验
89
+
90
+ 无,因为主机别名、认证与流能力令牌属于私有部署细节,每项面向模型的操作均由消费方负责。
91
+
92
+ #### KV Cache 影响
93
+
94
+ 本提供方不贡献请求前缀内容。面向模型的工具与结果由消费方负责。
95
+
96
+ ## 已知限制与延后工作
97
+
98
+ <a id="known-limitations-and-deferred-work"></a>
99
+
100
+ - 不提供 Windows 端点、自动配置远端环境、重连或重放。
101
+ - 绑定的登录名只作用于被绑定的 Agent:它创建的子 Agent 仍以别名自身的登录名执行,除非也做了绑定。
102
+ - Web 工作区界面的路径仍假定可访问主机文件系统;请使用 headless 或所有消费方都遵守提供方路径语义的自定义组合。
103
+ - TLS 流密钥不防御远端操作系统级进程内存检查或调试。文件效果策略保留所选沙箱后端的限制。
104
+
105
+ <a id="dev-note"></a>
106
+ ### 开发备注
107
+
108
+ <details>
109
+ <summary>维护者工作上下文 — 点击展开</summary>
110
+
111
+ 无。
112
+
113
+ </details>