Skip to content

Local-first AI coding agent desktop: Electron + Rust host core + pi Agent Harness + user-installable plugins

Merge remote-tracking branch 'origin/main' into feat/remote-host-ssh-bootstrap

vastsaa850370f58ce
diff --cc docs/adr/0291-ssh-remote-host-bootstrap.md
index f4b0b3565,000000000..2e884a930
mode 100644,000000..100644
--- a/docs/adr/0291-ssh-remote-host-bootstrap.md
+++ b/docs/adr/0291-ssh-remote-host-bootstrap.md
@@@ -1,177 -1,0 +1,177 @@@
+# ADR 0291: SSH bootstrap for remote hosts
+
+- Status: Accepted for implementation
+- Date: 2026-09-19
- - Decision: D452
++- Decision: D453
+- Related: ADR 0205 (D373 / D374 / D375), ADR 0285 (D448), ADR 0286 (D449),
+ `02-architecture/05-remote-agent-control.md` §5.2,
+ `05-security/02-remote-control-security.md` §3.4,
+ `06-delivery/07-remote-control-rollout.md` §2 R2b
+
+## Context
+
+ADR 0286 delivered the desktop-side R2a kernel and left the bootstrap explicitly
+out of scope: "Every paired host today assumes the loopback URL already exists."
+Reaching another machine meant the user installed `pi-host` there, started it,
+opened `ssh -L` themselves, and pasted the resulting URL and a pairing token into
+Settings.
+
+R2's exit criteria do not accept that (rollout §2 R2b, security §3.4). The
+desktop has to install and pair a host on a machine the user already reaches over
+SSH, under two boundaries the security spec fixes: the desktop never uploads
+executable bytes, and it never holds an SSH secret.
+
+Three properties of the system as it stands shaped the design:
+
+- `release.yml` publishes `pi-host-<version>-<platform>-<arch>.tar.gz` and its
+ `.sha256` to the `v<version>` GitHub Release, and the bundle matrix is Linux
+ x64 only.
+- A paired host is a URL in `remote-hosts.json`, but a bootstrapped host has no
+ stable URL: the local port of a forward is chosen per launch.
+- `bootstrap/remote-hosts.ts` already owns every host's lifecycle, so the
+ bootstrap plugs into that layer instead of beside it.
+
+## Decision
+
+The bootstrap is five modules under `apps/desktop/electron/main/remote/`, one
+extended boot hook, and one new IPC channel.
+
+1. **The system `ssh` client is the transport.** Shelling out to `ssh` beats
+ linking an SSH library because the user's `~/.ssh/config`, agent, jump hosts,
+ and `known_hosts` then apply unchanged, and the app never holds a secret to
+ leak. `BatchMode=yes` is what keeps that honest: a host needing an interactive
+ password or passphrase fails immediately with a typed error instead of hanging
+ a modal behind an invisible prompt. The module always sets
+ `StrictHostKeyChecking=accept-new`, `ConnectTimeout=15`, and
+ `ExitOnForwardFailure=yes`.
+
+2. **Pure release coordinates (`pi-host-release.ts`).** The artifact is resolved
+ for the *remote* platform at the *desktop's* version, and the SHA-256 the
+ release publishes is the trust anchor. `PUBLISHED_TARGETS` is the release
+ matrix (`linux-x64` today), so any other target is refused with
+ `HOST_BOOTSTRAP_FAILED` before a download starts rather than as a 404 halfway
+ through one. URL derivation, `uname` parsing, checksum-file parsing,
+ constant-work digest comparison, and the version-parity rule are all pure
+ functions with no network and no SSH.
+
+3. **One script runs remotely (`pi-host-bootstrap-script.ts`).** It downloads the
+ pinned URL, verifies the digest, installs under `$HOME/.pi-desktop/pi-host`,
+ (re)starts the host on loopback with `--pair`, and echoes `PI_HOST_READY` /
+ `PI_HOST_PAIRING_TOKEN`. It runs under `umask 077`, so the single-use pairing
+ token only ever exists in a work file inside the bootstrap directory and on
+ the SSH channel's stdout — never a world-readable path, never a URL
+ (security §3.4). Every failure exits non-zero after a
+ `PI_HOST_BOOTSTRAP_FAILED <step>` line, so the desktop reports the step that
+ failed instead of a bare exit code. Generating it is pure and every input is
+ shell-quoted by `shellQuote`, which is what lets the tests execute the
+ generated text for real.
+
+4. **`ssh-transport.ts` is a port, not a dependency.** `exec` / `execWithInput` /
+ `forward` / `dispose` let the orchestrator be tested end to end against a fake
+ with no process spawned; `createSystemSshTransport` is the only implementation
+ that spawns. `execWithInput` pipes the script into `sh -s`, so the script
+ never survives an argv round trip and never lands in a remote file to clean
+ up. Values that reach the `ssh` argv are refused by `assertSshArgument` when
+ they are empty or start with `-`: passed as its own argv entry, a leading dash
+ becomes an option (`-oProxyCommand=…`), not a destination.
+
+5. **Forwards are durable and owned, not incidental (`ssh-tunnel.ts`).** The
+ persisted record stores the SSH descriptor, not a URL; the manager reserves a
+ loopback port, runs `ssh -N -L 127.0.0.1:<local>:127.0.0.1:<remotePort>`, and
+ derives `ws://127.0.0.1:<port>/v1/racp/ws` per launch, so a restart
+ re-establishes the tunnel before connecting instead of dialling a stale port.
+ The bootstrap's own forward is *adopted*, not closed and reopened, so pairing
+ pays for exactly one tunnel. A forward counts as ready only once its local
+ port accepts a connection, because a healthy `ssh -N -L` prints nothing.
+
+6. **Version parity is checked before a forward exists.** The desktop's version
+ is what gets downloaded — there is no version negotiation — and
+ `PI_HOST_READY.version` must equal it (`v` prefix tolerated either way). A
+ mismatch raises `HOST_VERSION_MISMATCH` (D375) before any forward exists, and
+ the desktop tears down the SSH processes it spawned on the way out instead of
+ leaving a half-connected host behind.
+
+7. **The registry keeps a descriptor, not a URL.** `metadata.transport = "ssh"`
+ plus `metadata.ssh` (host, optional port / user / identity file,
+ `remotePort`, `version`). `remote-hosts.json` is user-editable, so the
+ descriptor is re-validated on every read: a missing host or a `remotePort`
+ outside 1..65535 degrades the record to "not an SSH host" instead of
+ producing an `ssh` spawn with garbage arguments. Records written before this
+ change carry no `transport` and read as `direct`.
+
+8. **One IPC channel and one pairing exchange.**
+ `pi-desktop/remoteHost/bootstrap` joins `list` / `pair` / `remove` and carries
+ a host, never a credential. The `connection/pair` exchange was factored into
+ `exchangePairingToken`, used by both the pasted-URL path and the bootstrap
+ path, and it closes its throwaway connection on every path. `bootstrapHost`
+ adopts the forward before persisting the record, because the device token only
+ works over that forward.
+
+## Invariants
+
+- No SSH secret is stored, prompted for, or transmitted by the app. The only
+ credentials the bootstrap touches are the ones the system `ssh` client
+ resolves itself.
+- No executable bytes travel over the SSH channel. The remote script downloads
+ the bundle; the bytes the desktop sends are the script text on stdin.
+- `pi-host` keeps binding loopback only. The desktop reaches it through a
+ forward and never opens a listener of its own.
+- The renderer stays transport-agnostic. `RemoteHostSummary.transport` is
+ optional and rendered as a label; no renderer call branches on it.
+- An empty registry stays a full no-op: nothing connects and no tunnel opens.
+- A failed bootstrap leaves nothing running: its transport is disposed unless
+ the caller adopts the forward, and an SSH host whose connect fails has its
+ tunnel closed rather than left idle.
+
+## Out of scope
+
+Still open for R2b and later:
+
+- **Terminal work-panel client (Stage 5)** and **reverse tool relay (Stage 6)**
+ from ADR 0286. Both remain unbuilt.
+- **Provider configuration over the SSH channel.** Spec §3.4 and §5.2 name it as
+ part of the bootstrap step, but it needs host-side provider schema work and is
+ not in this change, so a freshly bootstrapped host still fails `turn/start`
+ closed with `MODEL_NOT_CONFIGURED` until a provider is configured on it.
+- **The resync watchdog**: `resync.required` events are still dropped.
+- **Non-Linux remote targets, and Windows as a *remote* target.** Only
+ `linux-x64` is published, so both are refused before a download starts.
+
+## Alternatives considered
+
+- **An `ssh2`-style library instead of the system client.** Rejected: it
+ re-implements config, agent, and jump-host semantics the user already has, and
+ asks them to re-enter credentials the app should never hold.
+- **Download the artifact on the desktop and upload it.** Rejected by security
+ §3.4: the desktop never uploads executable bytes.
+- **Let the script read the published `.sha256` itself.** Rejected: the desktop
+ should hold the trust anchor, and this keeps the script's only input a URL plus
+ a digest.
+- **Store the forwarded URL in the registry.** Simpler read path, but the local
+ port is not stable across launches, so a restart would dial a port nothing
+ listens on. Rejected in favour of the descriptor.
+- **Install the host into a user-level service manager.** Rejected: the script
+ installs under `$HOME` and restarts the process its own pidfile tracks, which
+ keeps the bootstrap privilege-free.
+
+## Testing
+
+The release rules and the script generator are pure and covered by `node --test`
+fixtures; the generator's tests run `sh -n` over the produced text and execute it
+against a stubbed `PATH`. The orchestrator runs end to end against a fake
+transport, a fake checksum fetch, reserved ports, and a fake pairing exchange, so
+step order, the digest failure path, the version-mismatch path with no forward,
+and the adopt-don't-reopen rule are asserted without spawning a process.
+
+## Consequences
+
+- `remote-hosts.json` gains a second record shape and stays backward compatible:
+ existing records have no `transport` and are read as `direct`.
+- A machine without outbound GitHub access still cannot be bootstrapped (D375).
+- The desktop now spawns `ssh` processes, which is new and visible to
+ endpoint-security tooling; until now the remote stack only opened outbound
+ WebSocket connections.
+- The 16 new `settings.remoteHosts` i18n keys must be translated in every shipped
+ locale, because the catalog type is exhaustive.
+- No new runtime dependency: the bootstrap adds no SSH library, no HTTP client,
+ and no archive tool to `apps/desktop`.
diff --cc docs/adr/README.md
index 2dd462ac8,774427b77..4873de391
--- a/docs/adr/README.md
+++ b/docs/adr/README.md
@@@ -317,5 -317,4 +317,5 @@@ Each ADR includes
| 0288 | [Package-local theme assets remain available](0288-package-local-theme-assets.md) | Accepted for implementation (amends ADR 0255) |
| 0289 | [Signed macOS GitHub Releases and in-app update delivery](0289-signed-macos-github-releases.md) | Accepted (D450; amends ADR 0022 / 0145 / 0191 / 0204 / D078) |
| 0290 | [Restore resizable sidebar width with collapse-below-threshold](0290-resizable-sidebar-collapse-threshold.md) | Accepted (D451; amends ADR 0141 / ADR 0238) |
- | 0291 | [SSH bootstrap for remote hosts](0291-ssh-remote-host-bootstrap.md) | Accepted for implementation (D452; ADR 0205 R2b, extends ADR 0286) |
++| 0291 | [SSH bootstrap for remote hosts](0291-ssh-remote-host-bootstrap.md) | Accepted for implementation (D453; ADR 0205 R2b, extends ADR 0286) |
| turn-process-and-thinking-display | [Turn process and thinking presentation](turn-process-and-thinking-display.md) | Accepted |
diff --cc docs/spec/06-delivery/07-remote-control-rollout.md
index e23c6f1e8,93b87327c..39eba4d7f
--- a/docs/spec/06-delivery/07-remote-control-rollout.md
+++ b/docs/spec/06-delivery/07-remote-control-rollout.md
@@@ -434,26 -434,8 +434,26 @@@ Recorded on the `feat/remote-agent-host
server and client cores, the `ws` binding on loopback, and device-token
pairing; handshake, authorization, idempotency, queue order, approvals,
cursor replay, eviction, epoch change, slow clients, and reconnect without
- duplicate execution are package tests. The `pi-host` bundle, the SSH
- bootstrap, and the desktop adapter are not started.
+ duplicate execution are package tests. The `pi-host` bundle, the desktop
+ adapter, and the SSH bootstrap have since started: the R2a desktop kernel
+ (D449 / ADR 0286) brought the adapter and the bundle, and the SSH bootstrap
- followed in D452 / ADR 0291.
- - R2b partial (2026-09-19, D452 / ADR 0291): the desktop installs and pairs
++ followed in D453 / ADR 0291.
++- R2b partial (2026-09-19, D453 / ADR 0291): the desktop installs and pairs
+ a `pi-host` over the user's own `ssh` client with `BatchMode=yes`, so the
+ user's configuration, agent, and jump hosts apply and no SSH secret reaches
+ the app. `remote/pi-host-release.ts` holds the pure release coordinates
+ (remote platform, desktop version, published SHA-256, refusal of unpublished
+ targets) and `remote/pi-host-bootstrap-script.ts` generates the single
+ `umask 077` script that downloads, verifies, installs under the remote
+ `$HOME`, restarts the host on loopback with `--pair`, and echoes
+ `PI_HOST_READY` / `PI_HOST_PAIRING_TOKEN`; `remote/ssh-transport.ts` is the
+ injectable transport port and `remote/ssh-tunnel.ts` owns one durable
+ `ssh -N -L` forward per host, re-established on every launch and adopted
+ from the bootstrap so pairing opens exactly one tunnel. Records carry
+ `metadata.transport = "ssh"` plus an SSH descriptor instead of a URL, and
+ `pi-desktop/remoteHost/bootstrap` joins `list` / `pair` / `remove`. The
+ terminal work-panel client, the reverse tool relay, and provider-configuration
+ propagation over the SSH channel are not in this slice.
## 8. Amendment history
diff --cc docs/spec/08-meta/decisions-log.md
index c69afed2d,faea33eae..44a13ddad
--- a/docs/spec/08-meta/decisions-log.md
+++ b/docs/spec/08-meta/decisions-log.md
@@@ -6079,36 -6079,20 +6079,54 @@@ that was sitting at the bottom — incl
- Renderer only: existing `pi.desktop.sidebarWidth` preference, no IPC or native
window change. See ADR 0290 and E2E-168.
- ## 2026-09-19 — SSH bootstrap for remote hosts (D452)
+ ## 2026-09-19 — MCP catalogs are bounded by protocol guards, not truncated (D452)
+
+ - Amend D176 / ADR 0038: the per-server `tools/list` bound stops being a silent
+ truncation at 64 tools and 8 pages. The client now follows pagination to the
+ last page under Codex-parity protocol guards — 2048 tools, 100 pages, a cursor
+ that repeats or is malformed, and 30s for the whole traversal — and a server
+ that breaks one loses its handshake instead of contributing a prefix of its
+ catalog.
+ - The cap was never the prompt's protection: MCP tools reach the model as
+ deferred on-demand entries behind `ToolSearch`, and the prompt block that
+ advertises them is capped independently, so a 300-tool server costs nothing
+ until one of its tools is activated.
+ - `plugin.mcp.tools.truncated` is gone. A refusal is audited as
+ `plugin.mcp.connect` / `mcp.connect` with the guard's error code and message,
+ and reaches the user as the status message of a user-configured server.
+ - See ADR 0038 and E2E-024K; `apps/desktop/test/plugin-mcp.test.mjs` covers the
+ whole catalog, each guard, and the old truncation as a failing baseline.
++
++## 2026-09-19 — SSH bootstrap for remote hosts (D453)
+
+- The desktop installs and pairs a `pi-host` on a machine the user already
+ reaches over SSH using the system `ssh` client, so `~/.ssh/config`, the agent,
+ and jump hosts apply unchanged and the app holds no SSH secret; `BatchMode=yes`
+ makes a host that needs an interactive password or passphrase fail with a
+ typed error instead of hanging behind an invisible prompt.
+- The desktop resolves the bundle for the remote platform at its own version,
+ holds the SHA-256 the release publishes, and refuses an unpublished target
+ (`linux-x64` only today) before any download. The uploaded script downloads,
+ verifies, and installs the bundle under the remote `$HOME`; no executable
+ bytes cross the SSH channel.
+- The script runs under `umask 077` and echoes `PI_HOST_READY` /
+ `PI_HOST_PAIRING_TOKEN`, so the single-use pairing token exists only in a work
+ file and on the SSH channel, never in a world-readable path or a URL
+ (security §3.4). `PI_HOST_READY.version` must equal the desktop's; a mismatch
+ is `HOST_VERSION_MISMATCH` (D375) and is checked before a forward exists.
+- A paired host now stores an SSH descriptor (`metadata.transport = "ssh"`)
+ instead of a URL, because the local forward port is not stable across
+ launches; the tunnel manager re-establishes `ssh -N -L` on every launch and
+ adopts the bootstrap's own live forward so pairing opens exactly one tunnel.
+ The descriptor is re-validated on every registry read, and a malformed one
+ degrades to "not an SSH host" rather than spawning `ssh` with garbage
+ arguments.
+- `pi-desktop/remoteHost/bootstrap` joins `list` / `pair` / `remove`, and the
+ `connection/pair` exchange was factored into one `exchangePairingToken` used
+ by the pasted-URL path and the bootstrap path alike.
+- Not in this slice: the terminal work-panel client (Stage 5), the reverse tool
+ relay (Stage 6), the resync watchdog, non-Linux and Windows remote targets,
+ and provider configuration over the SSH channel — a freshly bootstrapped host
+ still fails `turn/start` closed with `MODEL_NOT_CONFIGURED` until a provider is
+ configured on it. See ADR 0291, `06-delivery/07-remote-control-rollout.md` §7,
+ and `05-security/02-remote-control-security.md` §3.4.
diff --cc docs/zh-CN/spec/06-delivery/07-remote-control-rollout.md
index bce8503b9,74689f894..91f58d57e
--- a/docs/zh-CN/spec/06-delivery/07-remote-control-rollout.md
+++ b/docs/zh-CN/spec/06-delivery/07-remote-control-rollout.md
@@@ -147,8 -147,7 +147,8 @@@ runbook 写明 feature flag、配对撤
镜像 `agent/event/queueChanged`,“立即发送”即 `turn/prioritize` 加优雅停止。
- R1 部分完成(2026-09-18):运行时级别的逐回合权限上限已在 JS 端全链路串通(`AgentPromptRequest.permissionMode` → agent-ipc → `RuntimeService.startTurn` → sidecar `agent.prompt`),桥接层不再对每一处会话/生效模式不一致直接拒绝。生效模式比会话更宽的请求(提权)仍作为深度防御拒绝;更窄的上限透传并在 sidecar 侧作为文档化的占位收下。turn 级的真正执行还差 host-core 一步(`session.beginTurn` 接受覆盖参数),因此本地回合上的收紧目前尚未夹紧工具决策。
- R2 已开始(2026-09-18,D447 / ADR 0284):`packages/host-runtime` 承载与 Electron 无关的运行时层 —— host-core 与 sidecar 的 stdio 传输、重启监督器、`RuntimeService`(模块的 `RuntimePort`,含持久回合生命周期)、转录持久化、无头启动解析器与已批准 Plan/Goal 的派发 —— Electron main 通过薄适配层运行其上。
- - R2(2026-09-18,D448 / ADR 0285):`packages/racp` 承载 `RACP-WS` 服务端与客户端核心、回环上的 `ws` 绑定与设备令牌配对;握手、鉴权、幂等、队列顺序、审批、游标重放、驱逐、epoch 变更、慢客户端与不重复执行的重连都是包内测试。`pi-host` 包、桌面适配器与 SSH 引导此后均已开始:R2a 桌面内核(D449 / ADR 0286)带来了适配器与 `pi-host` 包,SSH 引导随后在 D452 / ADR 0291 落地。
- - R2b 部分完成(2026-09-19,D452 / ADR 0291):桌面使用用户自己的 `ssh` 客户端并以 `BatchMode=yes` 在远端安装并配对 `pi-host`,用户的配置、agent 与跳板机照常生效,应用不持有任何 SSH 密钥。`remote/pi-host-release.ts` 承载纯发布坐标(远端平台、桌面版本、已发布的 SHA-256、拒绝未发布的目标),`remote/pi-host-bootstrap-script.ts` 生成唯一的 `umask 077` 脚本:下载、校验、安装到远端 `$HOME`、以 `--pair` 在回环上重启主机,并回显 `PI_HOST_READY` / `PI_HOST_PAIRING_TOKEN`;`remote/ssh-transport.ts` 是可注入的传输端口,`remote/ssh-tunnel.ts` 为每台主机维护一条持久的 `ssh -N -L` 转发,每次启动重新建立,并在引导时被收编(adopt),使配对只建立一条隧道。记录以 `metadata.transport = "ssh"` 加 SSH 描述符取代 URL,`pi-desktop/remoteHost/bootstrap` 加入 `list` / `pair` / `remove`。终端工作面板客户端、反向工具中继,以及经 SSH 通道下发 provider 配置均不在本次范围内。
-- R2(2026-09-18,D448 / ADR 0285):`packages/racp` 承载 `RACP-WS` 服务端与客户端核心、回环上的 `ws` 绑定与设备令牌配对;握手、鉴权、幂等、队列顺序、审批、游标重放、驱逐、epoch 变更、慢客户端与不重复执行的重连都是包内测试。`pi-host` 包、SSH 引导与桌面适配器尚未开始。
++- R2(2026-09-18,D448 / ADR 0285):`packages/racp` 承载 `RACP-WS` 服务端与客户端核心、回环上的 `ws` 绑定与设备令牌配对;握手、鉴权、幂等、队列顺序、审批、游标重放、驱逐、epoch 变更、慢客户端与不重复执行的重连都是包内测试。`pi-host` 包、桌面适配器与 SSH 引导此后均已开始:R2a 桌面内核(D449 / ADR 0286)带来了适配器与 `pi-host` 包,SSH 引导随后在 D453 / ADR 0291 落地。
++- R2b 部分完成(2026-09-19,D453 / ADR 0291):桌面使用用户自己的 `ssh` 客户端并以 `BatchMode=yes` 在远端安装并配对 `pi-host`,用户的配置、agent 与跳板机照常生效,应用不持有任何 SSH 密钥。`remote/pi-host-release.ts` 承载纯发布坐标(远端平台、桌面版本、已发布的 SHA-256、拒绝未发布的目标),`remote/pi-host-bootstrap-script.ts` 生成唯一的 `umask 077` 脚本:下载、校验、安装到远端 `$HOME`、以 `--pair` 在回环上重启主机,并回显 `PI_HOST_READY` / `PI_HOST_PAIRING_TOKEN`;`remote/ssh-transport.ts` 是可注入的传输端口,`remote/ssh-tunnel.ts` 为每台主机维护一条持久的 `ssh -N -L` 转发,每次启动重新建立,并在引导时被收编(adopt),使配对只建立一条隧道。记录以 `metadata.transport = "ssh"` 加 SSH 描述符取代 URL,`pi-desktop/remoteHost/bootstrap` 加入 `list` / `pair` / `remove`。终端工作面板客户端、反向工具中继,以及经 SSH 通道下发 provider 配置均不在本次范围内。
## 8. 修订记录
diff --cc docs/zh-CN/spec/08-meta/decisions-log.md
index c2eb2a87d,a07d322f2..39a37e667
--- a/docs/zh-CN/spec/08-meta/decisions-log.md
+++ b/docs/zh-CN/spec/08-meta/decisions-log.md
@@@ -4427,11 -4427,9 +4427,18 @@@ that amendment are retired by ADR 0268
- 仅渲染层:无 IPC、存储、schema、协议或插件 SDK 改动,也没有新增默认值。见 `04-ux/07-ui-design-system.md` §9、`apps/desktop/test/settings-dialog-overlay.test.mjs`,以及 `06-delivery/04-e2e-test-plan.md` 的 E2E-LAYOUT-three-column-width-priority(其四条浮层断言位于 `scripts/e2e-three-column-layout.mjs`)。
- 未做、留作后续的事项:真正的模态 —— 不可交互化、焦点收束、快捷键让位 —— 需要这些浮层进入浏览器顶层(`<dialog>.showModal()`)。在它们打开的弹出菜单、工具提示与 toast(portal 到 `document.body`)同样迁入顶层之前,这一步无法进行,因为顶层内容会绘制在它们之上并使其不可用;此前的一次尝试正因此被撤回。
- ## 2026-09-19 —— 远端主机的 SSH 引导(D452)
+ ## 2026-09-19 —— MCP 目录由协议护栏约束,而不是被截断 (D452)
+
+ - 修订 D176 / ADR 0038:每服务器的 `tools/list` 上限不再是「64 个工具、8 页」的静默截断。客户端现在在 Codex 同级的协议护栏下跟进分页直到最后一页 —— 2048 个工具、100 页、重复或畸形游标、整轮遍历 30 秒 —— 突破任一护栏的服务器会失去它的握手,而不是贡献其目录的一个前缀。
+ - 该上限从来不是对提示词的保护:MCP 工具以 `ToolSearch` 之后的延迟按需条目到达模型,宣传它们的提示词区块另有独立上限,因此一个 300 个工具的服务器在被激活之前不产生任何成本。
+ - `plugin.mcp.tools.truncated` 已移除。拒绝会以 `plugin.mcp.connect` / `mcp.connect` 记入审计并带上护栏的错误码与消息,对用户自建的服务器则显示为其状态消息。
+ - 见 ADR 0038 与 E2E-024K;`apps/desktop/test/plugin-mcp.test.mjs` 覆盖完整目录、各项护栏,以及把旧的截断行为作为失败基线。
++
++## 2026-09-19 —— 远端主机的 SSH 引导(D453)
+
+- 桌面用系统 `ssh` 客户端在用户已能通过 SSH 到达的机器上安装并配对 `pi-host`,因此 `~/.ssh/config`、agent 与跳板机照常生效,应用不持有任何 SSH 密钥;`BatchMode=yes` 让需要交互式密码或口令短语的主机立即以带类型的错误失败,而不是把模态框吊在一个不可见的提示后面。
+- 桌面按远端平台、以自己的版本解析 `pi-host` 包,持有发布随附的 SHA-256,并在任何下载之前拒绝未发布的目标(目前只有 `linux-x64`)。上传的脚本在远端 `$HOME` 下下载、校验并安装该包;SSH 通道上不传输任何可执行字节。
+- 脚本以 `umask 077` 运行并回显 `PI_HOST_READY` / `PI_HOST_PAIRING_TOKEN`,因此一次性配对令牌只存在于工作文件和 SSH 通道上,既不落在全局可读路径,也不出现在 URL 中(安全规格 §3.4)。`PI_HOST_READY.version` 必须与桌面版本一致;不一致为 `HOST_VERSION_MISMATCH`(D375),并在建立转发之前就已检查。
+- 已配对主机的记录改存 SSH 描述符(`metadata.transport = "ssh"`)而非 URL,因为本地转发端口在每次启动间并不稳定;隧道管理器在每次启动时重新建立 `ssh -N -L`,并收编(adopt)引导自己打开的存活转发,使配对只建立一条隧道。描述符在每次读取注册表时都会重新校验,格式不合规时降级为「非 SSH 主机」,而不会用垃圾参数去 spawn `ssh`。
+- `pi-desktop/remoteHost/bootstrap` 加入 `list` / `pair` / `remove`,`connection/pair` 交换被抽成单一的 `exchangePairingToken`,粘贴 URL 与 SSH 引导两条路径共用。
+- 本次不做:终端工作面板客户端(Stage 5)、反向工具中继(Stage 6)、resync 看门狗、非 Linux 与 Windows 远端目标,以及经 SSH 通道下发 provider 配置 —— 刚引导好的主机在配置 provider 之前,`turn/start` 仍以 `MODEL_NOT_CONFIGURED` 关闭。见 ADR 0291、`06-delivery/07-remote-control-rollout.md` §7 与 `05-security/02-remote-control-security.md` §3.4。