Repository navigation
feat(remote): 连接窗口的地址解析、搜索、导入、ssh -G 生效值和连接阶段(#2231) - #154
Merged
Merged
Conversation
- remote.parseAddress:把快速连接输入的 [ssh://][user@]host[:port](IPv6 写成 [地址])拆成表单字段,按 remote.probe 的规则检查,出错时指出 host/user/port 哪一项。 - remote.connections 新增可选 query:名称、分组和 [user@]host[:port] 都包含每个词(不分大小写)的条目才留在 sections 里。 - remote.editConnections 新增 import(批量添加,重名自动加 " (2)" 后缀,fills 只给缺颜色/分组的已有条目补上)和 markConnected(记录 lastConnectedAt,换目标时与最近文件夹一起清除)。 - remote.effectiveSettings:用 ssh -G 分别带和不带配置文件(-F none)各跑一次,给出主机名、端口、用户、密钥、跳板、连接超时、保活间隔的实际值和来源(connection/sshConfig/default)。 - remote.sshConfigHosts:读取 ~/.ssh/config 及其 Include(只读家目录内,最多 64 个文件、每个 1 MiB、16 层),列出每个 Host 名(最多 256 个),给出状态(importable/exists/pattern/invalid/unreadable)、解析结果和被谁当作跳板。 - remote.mottyHosts:只读打开 Motty 的 config.db(格式 28),不打开 vault;逐项列出每个主机会导入哪些设置、哪些不导入及原因;数据库不存在或格式不支持时作为结果返回。 - remote.connect 新增 remoteStage 事件(authenticated/platformChecked/uploading/installed);认证询问新增 kind(hostKey/password/passphrase/code/other),主机密钥询问带 keyType 和 fingerprint。 - ssh -G 使用与 remote.probe 相同的受限环境、允许列表选项和 10 秒上限(导入整体 30 秒),可取消,诊断输出已脱敏。 - lithe-remote 新增 motty 特性(rusqlite bundled),只有桌面端 Core 打开,宿主服务端不带 SQLite。 - 更新契约 rust-core-api.md 和测试。
xiaoyumuxi
marked this pull request as ready for review
November 21, 2026 07:55
This was referenced Nov 21, 2026
xiaoyumuxi
added a commit
that referenced
this pull request
Nov 22, 2026
…e-IDEA#2231) (#170) #154 给 lithe-remote 加了 motty(bundled rusqlite),lithe-workspace 默认 打开它。从那以后,“Lint for Windows” 在 Linux runner 上编译 SQLite 的 C 源码时找不到 MSVC 的 lib.exe,所有 PR 的 Rust Core / Linux 和 gate 都失败。 - 这个步骤加 LIBSQLITE3_SYS_USE_PKG_CONFIG=1:libsqlite3-sys 只复制预生成 绑定、输出链接指令,不编译 C 源码。clippy 不链接,检查结果不变。 - 步骤停摆期间漏进来的告警:ssh_configuration 测试里只给 Unix 测试用的 Directory::write、lines、DEFAULTS 加 #[cfg(unix)]。 - CONTRIBUTING 的本地 Windows clippy 命令同样加上这个变量。
1 task done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
关联 Issue
1lck/Lithe-IDEA#2231(远程开发完整设计):远程开发窗口重设计的剩余功能,参照 Motty 的“新建主机”。这个 PR 补上窗口需要的 Core 能力:快速连接地址解析、列表搜索、从 Motty 和
~/.ssh/config导入、ssh -G实际生效值及来源、最近连接时间、连接步骤事件,以及按类型区分的认证询问(主机密钥、密码、密钥口令、验证码)。桌面端只负责显示。类型
remote.parseAddress、remote.effectiveSettings、remote.sshConfigHosts、remote.mottyHosts;remote.connections新增query;remote.editConnections新增import和markConnected;remote.connect新增remoteStage事件;authentication事件新增kind、keyType、fingerprint改动说明
连接文档与列表(
crates/remote/src/client/connections.rs、crates/workspace/src/connections.rs)parse_address:解析[ssh://][user@]host[:port],IPv6 写成[地址]。拆出的字段按remote.probe的规则检查,不合规时返回{ field: host|user|port, reason }。不解析域名,也不发起连接。remote.connections新增可选的query(最多 256 个字符):[user@]host[:port]包含所有词(不分大小写)的条目才留在sections里;connections仍返回完整列表。lastConnectedAt(Unix 秒)。换主机、端口、用户或跳板时,和最近文件夹一起清除。文档仍为 version 1,未设置时不写这个字段。remote.editConnections新增两种操作,每次请求仍然只能带一种操作:markConnected: { id }:记录当前时间;id 不存在时返回reason: "unknown"。import: { entries, fills }:(2)…(256)后缀,所以导入不会覆盖已有条目;fills只给缺颜色或缺分组的已有条目补上;ids。ssh -G实际生效值(crates/remote/src/client/ssh_config.rs、crates/workspace/src/ssh_configuration.rs)remote.effectiveSettings对同一个连接运行两次ssh -G,一次读配置文件,一次带-F none不读,比较两次的结果。hostName、port、user、identityFiles、proxyJump、connectTimeoutSeconds和keepAliveSeconds,每项都是{ value, source },source是connection、sshConfig或default。-o的优先级高于配置文件,而连接超时和保活间隔总是由命令行传入,所以这两项的来源只会是connection或default。remote.sshConfigHosts读取~/.ssh/config和它 Include 的文件:importable、exists(带已有条目的 id 和名称)、pattern、invalid或unreadable;usedAsJumpBy,即哪些主机把它当作跳板。Match exec仍然会执行命令,所以ssh -G使用和remote.probe相同的受限环境与允许列表选项;Motty 导入(
crates/remote/src/client/motty.rs、crates/workspace/src/motty.rs)<平台用户配置目录>/motty/config.db,只支持格式 28;Motty 正在写入时最多等 500 ms。importable、partial、exists或unsupported;lithe字段写明会导入到哪里,没导入的写原因:secret、noSetting、protocol、command、kerberos、extraKey或invalid。unavailable,导入页据此说明原因。连接步骤与询问分类(
crates/remote/src/client/launch.rs、prompt.rs,以及crates/workspace/src/sessions.rs、probe.rs)remote.connect依次发出remoteStage事件:authenticated:远端 shell 输出第一行;platformChecked:shell 报告了平台;uploading { sentBytes, totalBytes }:开始发送和之后每 256 KiB 各一次;installed { uploaded }:服务端已就位。execution_events::emit是线程本地的。hostKey、password、passphrase、code和other。主机密钥询问还带keyType和fingerprint,各最多 128 个字符。remote.probe和remote.connect共用同一套分类。依赖
lithe-remote新增motty特性,依赖rusqlite 0.32(bundled)。lithe-workspace)打开这个特性。宿主服务端(server特性)不带 SQLite:cargo tree -p lithe-remote --no-default-features --features server -e normal | grep rusqlite没有输出。范围说明
主要改动在
crates/remote。另外有三处必要的接线:crates/workspace:命令实现,以及把事件交回请求线程的部分;crates/core:protocol/command.rs中的命令名、runtime/dispatcher/remote.rs中的分发(新增answer辅助函数),以及tests/remote_sessions.rs中的调度测试;rust/contracts/rust-core-api.md:命令表、事件表,以及 Remote connections、Saved connections(新增 Connection window helpers 小节)和 Remote connections that stay open 三节。remote/Cargo.toml的test-features加上了motty,沿用已有的 CI 机制,没有新增 CI 步骤。验证
cargo test -p lithe-remote --features server,motty:全部通过(单元测试 141 个,集成测试套件全部通过)。新增 motty、ssh_config、prompt、地址解析、搜索、导入、markConnected的测试,tests/server.rs断言了连接阶段的顺序。cargo test -p lithe-workspace:47 个通过。用假ssh脚本覆盖来源判断、失败诊断脱敏、缺少客户端、Include 顺序、跳板反查和 256 个上限。cargo test -p lithe-core:887 个通过,包括新增的connection_window_helpers_answer_through_the_dispatcher和契约命令表检查。cargo clippy -p lithe-remote -p lithe-workspace -p lithe-core --all-targets --all-features -D warnings:通过。lithe-remote --target x86_64-pc-windows-msvc也通过。带 motty 的 Windows 交叉检查在 macOS 上做不了,因为 bundled SQLite 需要 Windows SDK 头文件;桌面端 Windows Core 在 Windows runner 上用 MinGW 原生编译。cargo fmt --all --check、scripts/rust-core/verify-rust-core-comments.sh:通过。桌面端 Draft PR 会先固定到本分支的 commit,本 PR 合入后再换成 main 上的 commit。