Repository navigation
feat(desktop): 远程工作区在主机上运行内置的程序和脚本运行配置及其执行前步骤 (#2231) - #2293
Merged
Merged
Conversation
- 运行配置的读取、校验和启动计划由 Core 路由到主机(固定 Core 43da0b3,Core #161) - 内置的程序和脚本运行经 remote.runProcess 在主机上启动:脚本写进主机临时目录并在结束后删除, 工作目录拼到主机根下,环境用主机登录环境叠加计划和配置的变量 - 输出经有上限(8 MiB)的缓冲送进 Run 窗口,标签页带“主机”徽标;停止先发 SIGTERM, 超过停止等待时间再强制结束;退出码、信号和断线各自说明 - 构建工具、插件运行、调试、启动前步骤、工具链程序和“当前文件”在远程工作区说明暂不支持(#43b) - 输出里的主机路径用 remote.stat 找到文件后换成占位路径打开,工作区以外的落在 .lithe-remote-host 下 - 中英词条、功能矩阵、Agent 笔记和无头截图
执行前列表里引用的程序或脚本运行配置在主机上按顺序先运行,输出和步骤标题进同一个控制台; 步骤非零退出时说明步骤名和退出码,配置不启动;停止或超出准备时间先给步骤的主机进程发 SIGTERM。 只有列表里有插件任务时才说明暂不支持(R3)。
xiaoyumuxi
marked this pull request as ready for review
November 22, 2026 01:18
# Conflicts: # desktop/internal/workbench/remote_workspace_test.go # scripts/desktop/build-desktop-core.sh # shared/i18n/features/remote-connections.json # shared/platform-feature-matrix/features/remote-workspace.json
# Conflicts: # shared/platform-feature-matrix/features/remote-workspace.json
# Conflicts: # desktop/internal/workbench/remote_workspace_test.go # shared/i18n/features/remote-connections.json # shared/platform-feature-matrix/features/remote-workspace.json
# Conflicts: # shared/i18n/features/remote-connections.json # shared/platform-feature-matrix/features/remote-workspace.json
This was referenced Nov 22, 2026
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 / Linked issue
PINNED_CORE_REVISION固定在 Core main 的ac80382(含 【bug】mac上的一些页面优化建议 #160、【bug】mac上卡顿问题 #161)PR 类型 / Type
改动说明 / What changes
背景 / Why
远程工作区的项目只在主机上,本机只有一个空的占位目录。原来 Run 窗口和标题栏的“运行”在远程工作区里一律说明“不支持”。如果照本机的方式起进程,程序会在空目录里运行,读不到项目文件。运行配置本身也存在项目目录里,不路由到主机就读不到,写入时还会写进占位目录。
本 PR 让远程工作区里内置的“程序”和“脚本”运行配置在主机上运行:配置的读写和启动计划由 Core 在主机上完成(Core #161),桌面端经
remote.runProcess在主机上起进程,输出进 Run 窗口。配置“执行前”列表里引用的其他内置运行配置也在主机上按顺序先运行(#43b)。改动 / Changes
在主机上启动(
desktop/internal/workbench/remote_run.go,新文件)launchRemoteProcessRun:先用remote.hostRequest的tempDirectory在主机临时目录建lithe-run-script-*,把它作为脚本基名交给runConfig.createLaunchPlan。脚本用“文件必须不存在”的预期版本写进这个目录,运行结束后无论成败、是否被停止都递归删除。remoteRunDirectory把计划里项目相对的/路径拼到主机根下,拒绝..、绝对路径和反斜杠。RemoteProcessEnvironmentLogin),叠加计划的environment和配置的env。进程带{kind: "run", name}标签,关闭确认里能看到它。remoteRunOutput追加、从不等待,由独立的泵按顺序送进控制台。缓冲上限 8 MiB,超出时丢掉最旧的未送出部分,控制台写一行提示(desktop.run.remote.outputDropped)。process.kill(force=false)给进程组发 SIGTERM,超过buildprocess.StopGrace仍未结束就取消请求,由 Core 强制结束;再按一次“停止”立即强制结束。desktop.run.remote.signal);断线时说明“无法确定是否仍在主机上运行”(desktop.run.remote.connectionLost),并交给窗口重新连接;未连接时拒绝启动(desktop.run.remote.notConnected)。Pid()返回 0,Run 窗口不采样它的端口、CPU 和内存。执行前步骤在主机上运行(#43b,
runconfig_before_launch.go、remote_run.go)runBeforeLaunchSteps在远程工作区为这次启动建一个remoteRunHost,每个配置步骤经新增的remoteRunHost.runStep运行:与主运行一样在主机临时目录规划、写脚本、经remote.runProcess启动,输出和步骤标题进同一个控制台,进程标签是步骤名;临时目录在下一步开始前删除。remoteProcess.Stop(SIGTERM,超过停止等待时间再取消请求),还没启动时直接取消,与本机buildprocess先请求、后强杀一致。被要求结束后以 0 退出的步骤仍按停止或超时处理,不会接着启动配置。failBeforeLaunch改按ExitCode() int读退出码,本机的*exec.ExitError和主机的remoteRunExit都能说明“以退出码 N 结束”。desktop.run.remote.beforeLaunch,词条改为说明插件任务暂不支持、请从“执行前”列表删除):任务由插件后端在本机计划,读不到主机文件([Feature] 远程开发完整设计:各平台连接 Linux(SSH、WSL、容器),插件留在本机、工具与项目进程在远端运行 #2231 §2,R3)。确认询问沿用本机的指纹记忆。Core 客户端(
desktop/internal/core/remote_process.go,新文件)RemoteRunProcess、RemoteProcessKill、RemoteTempDirectory、RemoteRemove的客户端封装,以及process.started和process.output事件的解析(base64 解码,只接受 stdout 和 stderr,空输出不送)。运行配置走主机(
runconfig.go、runconfig_process.go、runconfig_before_launch.go、runs.go、build.go、app.go)startRunConfigurationWith在远程工作区只放行IsProcess()且不是调试的启动,其余拒绝(desktop.run.remote.unsupported)。desktop.run.remote.beforeLaunch),需要工具链选择程序的计划也拒绝(desktop.run.remote.toolchain)。loadBuildSystems在远程工作区不探测构建系统,把build.failed设成desktop.run.remote.buildTools。运行配置菜单把它显示为一行不可点的说明,生成层快照保持为空,不往主机写生成层。标题栏(
title_run.go)refuseRemote。Run 窗口(
shell_view.go、run_view.go)desktop.run.remote.badge),悬停说明(desktop.run.remote.badgeHelp)。输出链接(
outputlinks.go)linux平台匹配路径。点击时用remote.stat找第一个在主机上存在的文件,经remoteplaceholder.LocalPath换成占位路径交给编辑器打开;工作区以外的路径落在占位根旁的.lithe-remote-host下,与“工作区以外的远端文件按 Zed 方式打开”一致。需要插件解析的链接拒绝,因为插件读的是本机文件。测试
remote_run_test.go(新):主机上的启动参数、工作目录、环境、标签、脚本写入和删除;退出码和信号;“停止”先发 SIGTERM;执行前的配置步骤在主机上依次运行、以 3 退出时不启动配置并写明退出码、运行步骤时“停止”先发 SIGTERM;插件任务步骤、工具链和调试的拒绝;工作目录的接受和拒绝;输出缓冲丢掉最旧部分;输出链接的主机文件查找;不记主机和路径。core/remote_process_test.go(新):事件解析。remote_git_test.go:原来断言“运行”在远程工作区被拒,现在改成断言“调试”被拒。remote_workspace_test.go:测试内核加runs字段。remote_run_visual_test.go(新):无头截图,“Greet”先在主机上运行执行前步骤“Prepare”。其他
shared/i18n/features/remote-connections.json:新增desktop.run.remote.*共 10 条中英词条;desktop.remote.workspace.localOnly补上“运行程序和脚本运行配置”;生成文件随之更新。scripts/desktop/build-desktop-core.sh:PINNED_CORE_REVISION固定到 Core main 的ac80382(【bug】mac上的一些页面优化建议 #160 常驻会话与关闭偏好、【bug】mac上卡顿问题 #161 运行配置走主机)。ac80382;合并后 vet、矩阵校验、internal/core、internal/remoteconn和 workbenchRemote|Run|Build|BeforeLaunch测试都通过。shared/platform-feature-matrix/features/remote-workspace.json:能力说明、两端证据和验证说明加上远程运行。.agents/notes/implemented/architecture/2026-11-22-remote-workspace-process-runs.md:决策、备选方案、后果。docs/assets/remote-run/。不在本 PR 范围内 / Out of scope
writeInlineScript的英文内部错误,没有改成界面文案。类型专属:feat
多平台对齐
桌面端代码由 macOS 和 Windows 共用,主机固定是 Linux 或 macOS,计划由 Core 按主机平台生成。Windows 原生验收未做,矩阵里 Windows 保持
pending。范围检查 / Scope checks
功能矩阵 / Feature matrix
shared/platform-feature-matrix/features/remote-workspace.json:两端的实现状态和验证状态、证据路径、owner、验证动作都如实填写;没有运行验证的保持pending./scripts/platform-feature-matrix/verify-platform-feature-matrix.sh;改了平台实现路径的,还运行了./scripts/platform-feature-matrix/verify-platform-feature-matrix-change.sh origin/main HEAD.artifacts/下生成的矩阵视图插件归属 / Plugin ownership
develop-lithe第三节“插件归属与宿主零依赖”的自查命令,结果为空shared/i18n/;插件的构建步骤、资源路径和补丁没有写进docs/ci-builds.md、Agent Note 或 SkillUI 验证 / UI evidence
LITHE_VISUAL_OUTPUT_DIR=… ../scripts/desktop/desktop-go.sh test -tags vivahead,lithevisual ./internal/workbench -run '^TestVisualRemoteRun$',提交90ed95221,场景为 Run 窗口(含执行前步骤)和运行配置菜单,浅色英文和深色中文,1200×760docs/assets/remote-workspace/;macOS 与 Windows 原生窗口验收未做统一日志系统 / Structured logging
operation事件(performed、operationRejected、operationFailed),没有新增事件 ID,没有NSLog、print或直接写 stderrloggedAny断言日志里没有主机名和主目录界面文案 / i18n
shared/i18n/补齐中英词条,运行node scripts/i18n/generate-i18n.mjs并提交生成结果,没有手改生成文件;Viva 代码通过desktop/internal/i18n/的接口读取node scripts/i18n/verify-app-language-localization.mjs和node scripts/i18n/generate-i18n.mjs --check,没有放宽脚本或扩大豁免名单逻辑归属 / Logic placement
filepath.Join对应性能与内存 / Performance and memory
post回到 UI设置 / Settings
N/A:没有新增或修改设置。
插件契约 / Plugin contract
N/A:没有改插件契约、能力版本或宿主方法;Core #161 只改执行层的路由。
发行包与资源 / Bundle and resources
./scripts/desktop/verify/verify-runtime-bundle-immutability.sh无用代码与重构 / Dead code and refactoring
验证 / Verification
scripts/desktop/desktop-go.sh test ./internal/... -count=1scripts/desktop/desktop-go.sh test -race -run 'TestRemote' ./internal/workbench ./internal/core -count=1scripts/desktop/desktop-go.sh vet ./internal/workbench ./internal/core,另外带-tags 'vivahead lithevisual'跑一遍gofmt -l检查 workbench、coreTestVisualRemoteRun(vivahead lithevisual)node scripts/i18n/verify-app-language-localization.mjs、node scripts/i18n/generate-i18n.mjs --check./scripts/platform-feature-matrix/verify-platform-feature-matrix.sh、verify-platform-feature-matrix-change.sh origin/main HEAD./scripts/agent-notes/verify-agent-notes.sh./scripts/desktop/verify/verify-runtime-bundle-immutability.shrg未能执行的检查和原因:
ac80382。提交前确认 / Final checks
main创建;目标分支为main.build/、target/、dist/、.artifacts/等产物,没有凭据、个人路径和未脱敏的日志或截图