Repository navigation
feat(build): macOS 宿主启动构建 Provider 并发送 lithe/build/* 请求 (#1351) - #1356
Merged
Merged
Conversation
- Rust Core:initialize 在 capabilities.experimental.litheBuild 下协商 Provider 协议版本;新增 lsp.buildRequest,只把协商版本内的 lithe/build/model、lithe/build/dependencies 写给已协商的会话。 - macOS:MacBuildProviderSessions 按“插件 + 构建系统 + 工作区”各启动一个 独立 Provider 进程(JSON-RPC over stdio),用户加载模型/依赖时才启动, 切换工作区、停用或更新插件、退出应用时停止;状态写入插件构建系统状态目录。 - 共享写法只复用同一插件的语言服务器会话,跨插件时拒绝。 - BuildSystemService 把 provider 计划发给 Provider,回复作为 providerResult 交给 Core 解码;工具窗口对 provider 来源显示“加载模型”。 - 宿主声明 buildProviders: [1],gradle-provider / mix-provider 可通过安装审查。 - 更新契约 README、rust-core-api、Agent Note、提案与功能矩阵,补充测试。
8 of 24 tasks
xiaoyumuxi
marked this pull request as ready for review
October 20, 2026 02:06
Lithe Review结论: ❓ 审查未完成 审查失败:codex exited with code 1。可以重新评论 |
xiaoyumuxi
commented
Oct 20, 2026
xiaoyumuxi
left a comment
Collaborator
Author
There was a problem hiding this comment.
整体设计方向合理:Rust Core 对 litheBuild 的协议版本和方法白名单有明确校验;独立 Provider 的进程/工作区隔离、与共享语言服务器的来源插件检查也值得保留。
这次 review 有 1 项 P1 和 2 项 P2(详见行内评论),建议在合并前处理 Provider 的更新回收、设置变更和可执行入口校验。当前新增的 BuildSystemServiceTests 主要使用 FakeBuildProviders,建议补充真实 MacBuildProviderSessions 的生命周期测试:并发请求只启动一次、初始化失败后重试、插件更新/同版本重装/卸载、设置变更后重启进程、无效包内入口拒绝以及工作区切换时取消未完成的请求。
基于 PR head 370642b5 的源码静态审查;GitHub CI 已通过,但尚未做真实 Gradle/Mix Provider 的端到端验证。
处理 PR #1356 评审意见: - [P1] 插件安装/同版本重装/回滚/卸载前,MacPluginManager 的 beforePackageReplacement 钩子直接按插件 ID 停止该插件全部 Provider (MacBuildProviderSessions.stopProviders(ofPlugin:)),不再依赖 BuildSystemService 启动时的插件快照比较。 - [P2] 每个 Provider 进程记录启动时展开的插件设置值;下一次请求发现 设置不同(如 providerHeapMB)就停止旧进程并按新参数重启。 - [P2] 安装时对声明了 provider 的构建系统展开启动计划,要求包内路径 存在、不越界、不经过符号链接,包内可执行文件和打包运行时为普通 可执行文件,否则拒绝安装(buildProviderLaunchMissing);启动时 resolveBuildProvider 同样检查 regular file + executable。 - DeclarativeBuildSystem 新增 declaresProvider(解码 provider 字段是否存在)。 - 新增 MacBuildProviderSessionsTests(真实会话表 + 脚本化 Core)和 PluginPackageStoreTests 的 Provider 入口校验用例;同步契约 README 与 Agent Note。
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.
关联 #1351(PR 1:macOS 宿主启动构建 Provider 并发送
lithe/build/model/lithe/build/dependencies)。改了什么
Rust Core
lsp/interface/build_provider.rs(新):initialize时在capabilities.experimental.litheBuild下发送{"versions": [1]},Provider 回{"version": 1}才算协商成功;版本 1 只接受lithe/build/model、lithe/build/dependencies。lsp.buildRequest {sessionId, method, params, timeoutMilliseconds}(protocol/command.rs、runtime/dispatcher.rs、engine.rs):未协商的会话或不在版本内的方法直接失败,不写入进程;结果经requestCompleted返回。shared/contracts/rust-core-api.md同步。macOS
Platform/MacOS/Build/MacBuildProviderSessions.swift(新,实现BuildProviderRequesting):command/runtime复用MacBuildToolResolver(与构建命令同一套运行时、PATH、最低版本检查)。LanguageServerRuntimeSession,登记进程账本,模块 ID 为该插件的构建系统扩展。MacPluginLanguageServerLaunchResolver.resolveBuildProvider:按buildSystemID取 Core 启动计划,只用该插件自己的设置;可写状态放<插件状态目录>/build-systems/<buildSystemID>,不写 app bundle / 插件包。LanguageToolingSessionManager.requestBuildProvider发送前核对语言运行时的来源插件 ID,只允许复用同一插件的语言服务器会话。LanguageServerSession.buildRequest(就绪检查、取消时cancelLanguageServerOperation);RustCoreBridge.lspBuildRequest/RustLanguageServerRuntimeAdapter.requestBuildProvider。BuildSystemContracts.swift:BuildOutputPlan.provider(BuildProviderRequest)(带 params、optionFingerprint、两个标志)、BuildCommandOutput.providerResult、BuildProviderTarget、BuildProviderRequesting端口、BuildSystemInstance.loadsModelOnRequest。BuildSystemService:provider 计划发给 Provider,回复作为result交给build.decodeModel/build.decodeDependencies;Build Output 显示▶ 标题 → method;reset(含退出应用)停止全部 Provider,pluginsChanged停止已停用或已更新(包目录变化)插件的 Provider。BuildSystemToolWindowView:provider来源与command一样显示「加载模型」/重新加载。MacServiceContainer构造MacBuildProviderSessions并注入;AppServices.connectBuildProviderLanguageSessions让AppModel接上语言会话管理器(语言模块未激活时共享写法提示先打开该语言文件)。PluginTypes.hostCapabilities新增buildProviders: [1],gradle-provider/mix-provider现在可通过 macOS 安装审查。RustDeclarativePluginOperations:启动计划解码executable、buildProvider,新增buildProviderLaunchPlan。文档
build-system-plugins更新 macOS 描述和证据路径。没有做(后续)
lithe/build/execute(Provider 自己执行任务并流式汇报)。验证
cargo test -p lithe-core --lib:1019 通过;verify-rust-core.sh、verify-rust-core-comments.sh、verify-rust-core-swift-bridge.sh通过。BuildSystemServiceTests):providerModelSendsThePlannedRequestAndDecodesItsReply、providerDependenciesDecodeTheProvidersReply、workspaceSwitchAndDisabledPluginStopTheirProviders、providerModelFailsWithoutAProviderHost、failedProviderRequestReportsItsMessage;PluginMarketplaceServiceTests.buildProvidersAreAcceptedByTheMacOSHost取代原先的“拒绝”用例。PluginUIIconTests.renderedTemplateAndBrandIconsAdaptToThemesAndHostSize(图标像素颜色断言)和RunEntryPointTests.runWithExistingConfigurationLaunchesOnlyAfterTheSnapshotArrives(超出本地耗时预算 1.5s)外全部通过;两者不在本 PR 改动范围,单独重跑仍复现,尚未在 preview 基线上对照。verify-shared-contracts.sh、verify-service-boundaries.sh、verify-module-boundaries.sh、verify-runtime-bundle-immutability.sh、verify-test-stability.sh、verify-agent-notes.sh、verify-platform-feature-matrix.sh、verify-platform-feature-matrix-change.sh origin/preview HEAD通过。