Repository navigation
feat(remote): 自动发现容器环境并生成 Dev Container 基础配置 - #202
Merged
Merged
Conversation
…nfigurations Discover local Docker contexts, Podman and Windows WSL runtimes with bounded probes. Generate standard devcontainer configuration from basic form inputs and preserve the selected context and distribution through build, connection and trust.
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
38c60be716207fa99cd2f8827f81e7e7c75c4eb1,桌面端 pin 已随之更新。改动说明
现有 Dev Container 入口需要用户先准备
devcontainer.json,也不能明确选择本机不同 Docker context 或 Windows WSL 中的引擎。本 PR 在 Core 提供真实环境发现、基础配置生成及完整的目标传递,供桌面端以表单引导创建;标准 JSON 仍是 Agent 和官方 Dev Container CLI 的共同输入。remote.containerRuntimes:从 Docker CLI 读取 context 名称、描述和本地端点,实际探测 daemon 的就绪状态,保留 OrbStack、Docker Desktop、Linux Docker 的上游名称;沿用 Podman 支持。Windows 同时探测用户 WSL 发行版内的引擎,不修改全局 context,也不自动启动 daemon。{ engine, context?, wsl? }。先校验再执行,显式 context 仅作用于子进程,并清除会覆盖所选 context 的继承 Docker 连接变量;WSL 使用独立参数传递。只接纳unix:///npipe://端点,避免把本机目录交给远程 daemon 挂载。remote.devcontainerPrepare:校验名称、镜像或 Dockerfile、构建目录、用户、容器工作区、端口及创建后命令,生成标准.devcontainer/devcontainer.json。镜像和 Dockerfile 二选一,构建路径相对工作区解释;端口去重且最多 64 个,生成仅监听回环地址的appPort。remote.devcontainerConfigs/remote.devcontainerUp接受所选目标。WSL 文件夹通过wslpath解析,不假设/mnt/c;配置查询返回nativeFolder,供桌面端的确认写入和信任流程使用。WSL 只读列举使用 NUL 分隔和文件数上限。remote.listContainers可指定目标,与sessionId互斥,并校验 engine 一致性。构建、inspect、连接和重试保持同一 context / WSL 发行版;容器身份、exec 命令和信任键包含 Docker context,避免不同环境的同名容器复用信任。rust/fixtures/remote/devcontainer-configuration-v1.json,桌面端直接消费这份 fixture。Dev Container 的 features、生命周期、Compose 和镜像语义继续交给官方 CLI;Lithe 不重写该子系统,不额外添加挂载或权限,也不引入新的打包运行时。
应用 ABI 与兼容性
remote.containerRuntimesremote.devcontainerPrepareremote.devcontainerConfigsremote.devcontainerUpremote.listContainersremote.connect以上为宿主应用 C ABI 命令,不是插件 RPC 方法。没有修改
shared/plugins/contract/、插件能力版本、插件进程协议或四语 SDK,因此不提升插件 API / schema / 协议版本;原有请求省略目标时保持原行为。应用契约与 fixture 仅存于本仓库,桌面端固定 Core 主线 commit38c60be716207fa99cd2f8827f81e7e7c75c4eb1(与本分支提交内容相同)。验证
本地仅验证改动范围,未运行整个 Rust workspace。执行主机为 macOS;Windows target clippy 只证明编译检查通过,不代表 Windows 原生运行验收。
cargo test --manifest-path rust/Cargo.toml -p lithe-workspace --lib container --no-default-featurescargo test --manifest-path rust/Cargo.toml -p lithe-remote --lib client::containercargo test --manifest-path rust/Cargo.toml -p lithe-remote --lib client::trustcargo clippy --manifest-path rust/Cargo.toml -p lithe-core -p lithe-workspace -p lithe-remote --all-targets --all-features -- -D warningsLIBSQLITE3_SYS_USE_PKG_CONFIG=1 ZSTD_SYS_USE_PKG_CONFIG=1 PKG_CONFIG_ALLOW_CROSS=1 cargo clippy --manifest-path rust/Cargo.toml -p lithe-core -p lithe-workspace -p lithe-remote --all-targets --all-features --target x86_64-pc-windows-msvc -- -D warningscargo fmt --manifest-path rust/Cargo.toml --all -- --checkCARGO_TARGET_DIR="$PWD/rust/target" scripts/rust-core/verify-rust-core-comments.sh remote workspace corenode scripts/rust-core/verify-platform-tests.mjsgit diff --check日志使用既有统一日志路径;上游诊断只供显示,不作为自由文本存入日志。新增代码和测试不依赖任何具体插件。既有具体插件 fixture / 文档归属债务复用 桌面端 #2435 和 Core #195,不在此 PR 顺手修改。
尚未完成的检查与范围
affected-crates.mjs因应用契约和 fixture 选中全部 crate;本地只运行上表涉及改动的检查,其余交给 CI。提交前确认
main;提交d1b86b55f344af572fd472edaf60d91240cf1149已推送,工作区干净。