Repository navigation
fix(epic,core,macos): 把 Java 专属逻辑全部移出 Core 与 macOS 宿主,改走通用插件 API - #1791
Merged
Merged
Conversation
…ven Core 命令 Issue #1495 把 Java/Maven 逻辑迁出 Rust Core 和宿主。Windows 前端仍通过旧命令名调用这些能力, 本提交把它们放进 Windows 专属的过渡 crate,对外只有 try_execute:命中旧命令名时返回与 Core 原先逐字节一致的 JSON 响应和错误码,其余命令返回 None,由调用方继续交给 Core。Windows 前端因此无需改动。 覆盖的命令:maven.scan、maven.launchPlan、maven.dependencyPlan、maven.dependencies、maven.diagnostics、 maven.testResults、java.workspacePolicy、java.jdtCacheRetention、java.jdtWorkspaceFingerprint、 java.sourceDefinition、java.runMarkers、spring.index、mybatis.index。 同时提供 Windows 宿主直接调用的函数:超长类路径 jar 规划、启动命令规划、JDK 选择、JDT 工作区键、 Maven settings 本地仓库改写、运行源码枚举。对应的 Core 单元测试一并移入 crate 的 src/tests。 crate 文档说明了它是过渡实现以及删除条件:Windows 的 Java/Maven 能力改由插件提供之后整体删除。 try_execute 仅模拟 Core 的取消作用域,不经过 request_trace、远程工作区作用域和 Git 执行策略作用域。
Issue #1495:这些能力已搬入 windows/tauri/crates/lithe-legacy-java,macOS 从未调用,Core 不再保留。 删除(已用 grep 确认 macOS 和 Core 其他模块没有引用): - maven.launchPlan、maven.dependencyPlan、maven.diagnostics 三个命令,以及 maven.scan、maven.dependencies、 maven.testResults 在 dispatcher 和 CoreCommand 中的分支;Core 内部仍使用的 scan、dependencies、 test_results 函数保留,供构建提供者调用 - 仅服务这些命令的 launch_plan、dependency_plan、diagnostics 实现与诊断响应类型 - execution::classpath_jar(超长类路径 jar 规划) - execution::workspace_scan 中的 list_run_java_sources 及其测试 - lib.rs 里的 jdt_workspace_key 包装;project 对 settings_with_local_repository 的公开导出改为 crate 内可见 (JDT Maven settings 仍在 Core 内使用) 保留并开放: - lithe_core::check_cancellation 与 CancellationScope,供 crate 的 try_execute 复用 Core 的取消语义 - execution 下版本比较与工具链需求相关的少量函数改为 pub,并从 execution 重新导出 - is_run_scan_excluded_directory 对外重新导出;launch_command 的内部常量改回私有 tests/languages.rs 中仍覆盖 scan、dependencies、test_results 的测试保留,经测试专用的 execute_json 垫片 直接调用 project 中的函数;已删除命令对应的测试随实现迁到 crate。
…测与功能矩阵 Issue #1495:Windows 前端不变,原先发给 Core 的旧命令在宿主入口先交给 lithe_legacy_java::try_execute。 - core_execute 与 platform_invoke 两个入口都先调用 try_execute,命中旧命令名即返回,否则继续走 Core - run.rs、run/launch_arguments.rs、lsp.rs、lsp/jdt_workspace.rs、maven/user_settings.rs 中对已迁出函数 (超长类路径 jar、启动命令规划、JDK 选择、JDT 工作区键、运行源码枚举、本地仓库 settings 改写)的调用 改为 lithe_legacy_java - Cargo.toml 增加 lithe-legacy-java 路径依赖;Cargo.lock 同步增加该包及其依赖项 - test-stability-windows.ps1 的 WindowsRust 范围新增 lithe-legacy-java 的计时测试,依赖包测试不会被 宿主包的 cargo test 带上 - 功能矩阵中 Windows 的证据文件从 Core 已删除或不再被 Windows 使用的路径改为 crate 路径: run-java-long-classpath、run-discovery、java-runtime-discovery、java-maven-profiles-dependencies、 maven-user-settings-editing
启动计划只需要确认模块属于当前 reactor,因此只收集模块相对路径; 插件继承、坐标校验等仅 Core 运行标记用过的解析一并删除。 parent 的 groupId/version 仍按 Maven 规则补给未声明的子模块。
解决与 preview 的四处冲突:保留 argument_text、Git 元数据导出和 diff.compareTexts, 删除已迁入 lithe-legacy-java 的 maven.scan / maven.launchPlan / settings_with_local_repository 导出。
- Core:删除 Java/Maven/Gradle/jdtls 的专属命令、hostIntegration: jdt、硬编码的 jdtls 设置推送、测试运行器解析与 Java 调试默认值;新增通用 run/start、 debug/start、editor/registerActions、languageServer/request、 outputLinkMatchers 1、debugAdapters 3(hotCodeReplace/stepFilters 由清单声明)、 serverProcess 4(工具定义引用,requiresTools)。 - macOS:移除内置 Java Support 插件包、旧 ID 安装横幅、Maven/Gradle 构建 JDK 查找 的写死路径;运行/调试/测试工作流、引用视图、问题视图、运行配置编辑器改为 语言无关实现,工具与运行时由插件注入的工具定义驱动。 - CI/发布:删除 release-official-plugins 工作流及对应缓存、构建步骤。 - 契约:shared/contracts/plugins/v1 补充上述能力版本与宿主方法说明。
- 状态栏 LSP 指示重新绑定插件持有的语言服务器会话(bindSessions),绿色 ● LSP 恢复 - 工具栏 Run/Debug 对插件语言改走 editor/registerActions 的编辑器动作 (languageSupportRoutingToEditorActions + PluginEditorActionLaunchSelection), 宿主不再按语言名分支;取消不记错误,其它失败记录 PluginsEditorActionFailed - DebugLaunchConfigurationResolver.launchesFiles:仅声明 attach 的适配器不再被当成可按文件启动 - Core hosting_language_server_plan:后端启动的语言服务器里内嵌 tcpLanguageServer 调试适配器时 生成 backend 类型 launch,不再要求 scratch 目录;补契约说明与测试 - 修复运行 JDK 与插件 java 工具定义不一致导致的 UnsupportedClassVersionError - 新增 plugins.editor.action_failed / actions_failed 日志事件与对应 i18n 词条 - Agent Note:删除官方插件脚本与 Java 专属文件后,29 份笔记的失效路径改写为迁出说明, 验证命令改为 verify-no-host-language-specifics.mjs,门禁恢复干净
xiaoyumuxi
marked this pull request as ready for review
November 7, 2026 09:50
This was referenced Nov 7, 2026
xiaoyumuxi
added a commit
that referenced
this pull request
Nov 7, 2026
#1791 把 MacBuildToolResolver 的 JAVA_HOME 特判换成通用 contributed 集合时, 工具链候选的 choice environment 取了调用方整份环境,contributed 因而包含进程 里所有变量,Core provider_hints 以“环境无效或过大”拒绝,Maven 后端启动前失败。 ResolvedDefinedToolchain 新增 exports,只装这次选择新加的变量(定义导出项与 pathPrepend 后的 PATH);构建解析器用它作为 choice environment,执行环境不变, provider 只收到 PATH、导出项和与宿主进程不同的变量。补回归测试。
2 tasks 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 / Linked issue
PR 类型 / Type
改动说明 / What changes
背景 / Why
#1495 的目标是让宿主和 Rust Core 不再持有任何 Java/Maven/JDT/Spring 领域逻辑,全部由 lithe-plugin-java、lithe-plugin-maven、lithe-plugin-gradle 通过通用插件 API 提供。此前宿主内置的 Java 运行/调试/测试、JDT 启动资源、Maven 模型、Spring/MyBatis 索引与官方插件打包流程和插件实现并存,同一能力有两个持有方,插件开发继续依赖改宿主。本 PR 把 macOS 宿主与 Core 的这部分全部移出,缺失的通用接线一并补齐,并用真实 macOS 构建加 Java 插件端到端跑通原有流程(LSP、运行、断点调试、停止、运行面板重跑)。
无用户可观察缺陷;动机是 #1495 规划的职责迁移。用户可观察的变化只有:Java 能力需要安装 Java 插件(Store 已有),不再有宿主内置版本。
改动 / Changes
Rust Core:删除 Java/Maven/Spring 领域逻辑
languages/{java,java_syntax,mybatis,spring,text}.rs、lsp/languages/{jdt*,java_*,project_preparation}.rs、project/maven*.rs、build/integrations/maven.rs、build/language_import.rs、debug/java_test.rs、execution/{java_selection,launch_command,project_ownership}.rs、execution/detectors/{maven,gradle}.rs及其测试与engine_real_jdt*真实 JDT 测试。debug.javaTestLaunch不再是 Core 命令;调试适配器的步进过滤改为读取插件声明的stepFilters特性和默认值,Core 不再内置任何适配器策略(shared/contracts/rust-core-api.md同步)。launch: {kind: "backend", function, timeoutMilliseconds}(serverProcess3),嵌入式tcpLanguageServer调试适配器由后端解析的服务器承载。plugins.declarative.checkRuntimeVersion只探测node;其他tool回答plugin.runtime.unsupported。lithe-ide-host:macOS 不再提供lithe_environment_*与lithe_maven_*MCP 工具(shared/contracts/ide-api/v1.md同步);目录本身的去 Maven 专名重构见 [Feature] lithe-ide-host MCP 工具目录去除 Maven/Java 专名,改为通用 toolchain 与 Build Provider 工具 #1784。lsp/interface/engine.rs)随 Java 目录删除整体迁入。原有 9 处thread::sleep中 6 处改为确定性等待:同管道探针诊断(probe_diagnostics)证明前一条消息已处理、await_session在会话事件信号上等待快照条件、Barrier保证wait_events先于stop。其余 3 处(向已退出进程写入迟到响应的两处、半帧缓冲一处)没有可观察的事件可等,保持原样;它们是搬动的既有代码,由下文修好的门禁识别为“搬动”,没有新增任何test-stability: allow例外。插件契约
shared/contracts/plugins/v1/serverProcess的tool/runtimeDependencies[].id/projectGenerators的runtime:java不再是宿主运行时;任何合法短工具定义 ID 都是对同名工具定义的隐式引用(每个serverProcess版本都适用),启动模板由定义提供,minimumVersion由toolchains.checkVersion校验。runtimeRequirements增加kind: "tool"。buildSystems[].languageImport(schema、fixture 同步);删除language-host-integration/build-host-integrationfixture。java.resolveLaunch一类后端解析函数的请求tools字段:宿主按requiresTools解析每个工具并带executable/home/version,缺失的工具不出现。lithe/host/run/start、lithe/host/debug/start为既有方法,只在 README 里补了调用场景。macOS 宿主:删除 Java 专属实现
Models/Java/*、Services/Java/*、AppModel+Java*、JavaFeatureModel、SpringFeatureModel、MybatisFeatureModel、JavaTestDebugWorkflowCoordinator、JavaTestResultServer、MacJdtHostIntegration及 JDT 启动资源/工作区状态、MacRuntimeDiscovery、ProjectRuntimeSettingsView、JavaLaunchDecisionDialog、SpringEndpointsView、TestJVMPerformance*、Java 文件图标解析、旧 Maven 配置迁移、RustJavaMavenOperations、MavenContracts、LanguageServerHostIntegrationContracts、JavaLaunchArguments。docs/assets/java-installation-guidance/)。LanguageTestWorkflowState(原 Java 测试工作流状态泛化)、Models/Run/ActiveTestTarget、RunModelAliases、EditorNavigationModels、ProjectRuntimeService+LanguageTools(工具链解析走插件工具定义)。macOS 宿主:补齐通用接线
bindSessions:拆分后绿色 LSP 指示失效,改为绑定插件语言服务器会话。PluginEditorActionLaunch/AppModel+PluginEditorActionLaunch,对声明式语言经languageSupportRoutingToEditorActions路由到editor/registerActions的动作(Run 取首个run/run-all图标动作,Debug 取其debug备选),匹配不到时给用户可见提示。DebugLaunchConfigurationResolver.launchesFiles:调试当前文件配置可由插件接管。runtimeDependencies、语言服务器启动解析、插件包校验:kind: runtime的tool通过插件工具定义解析(Maven/Gradle 插件的java依赖由 Java 插件注入的工具定义满足)。UnsupportedClassVersionError(宿主把解析到的工具随请求的tools传给后端)。plugins.editor.action_failed/plugins.editor.actions_failed,相关 i18n 词条补齐中英。构建与发布流程
Plugins/mac/Official/、Plugins/marketplace/official-plugins.json、scripts/plugins/*official*、scripts/macos/prepare/prepare-{jdk,jdtls}.sh、.github/workflows/release-official-plugins.yml;ci-macos.yml、ci-plugins.yml、release-macos.yml、release-preview-macos.yml去掉对应步骤。插件由各自仓库构建发布。scripts/architecture/verify-java-semantic-ownership.mjs由通用的verify-no-host-language-specifics.mjs取代,并刷新基线。.agents/skills/write-stable-tests/scripts/verify-test-stability.mjs重写比对逻辑(首次推送时它把搬动的 9 处既有sleep当作新增,macOS/Windows CI 的 Classify changes 作业失败):以 base 修订的内容建立“规则 + 所属测试声明 + 语句文本”的基线多重集,head 新增行能在基线中认领到同样条目的算搬动,不再报告;未改动行先认领基线,避免在同一测试里复制一条sleep躲过门禁。有--base时文件内容从 git 修订读取而不是工作区;diff 固定--no-renames和a/b/前缀,不受用户 diff 配置影响;删除的文件也进入基线;--head必须与--base同时给出;verify-test-stability.sh不再偷偷注入--platform macos(三个入口默认都是all)。自测test-verify-test-stability.mjs补齐跨文件搬动、换测试名、复制语句、去掉例外注释、平台过滤和真实 git 仓库的用例;ci-macos.yml的 Classify changes 作业新增一步运行该自测。Skill 文档同步写明两种比对模式和判定方式。功能矩阵、日志事件与文档
plugin-provided状态;13 项 Java/Maven/Spring/MyBatis 能力改为该状态,其余相关记录更新证据路径(含过渡 crate 改名)。shared/logging/events/lsp.json删除lsp.maven.*、lsp.workspace.import_*、lsp.navigation.*等 24 个无实现事件。docs/development/macos-plugin-api-plan.md:API-23 状态更新。不在本 PR 范围内 / Out of scope
windows/tauri/crates/lithe-legacy-tooling,迁到通用插件 API:[Feature] Windows 从过渡 crate lithe-legacy-tooling 迁到通用插件 API,复用 Java/Maven/Gradle 插件后端 #1788。.noEntries):[Feature] 插件语言的项目运行入口列表:运行面板与横幅不再对插件语言显示“无入口” #1783。lithe-ide-hostMCP 目录去 Maven/Java 专名:[Feature] lithe-ide-host MCP 工具目录去除 Maven/Java 专名,改为通用 toolchain 与 Build Provider 工具 #1784。language-providers.json的内置java条目:[Feature] Core language-providers.json 移除内置 java 条目,Java 语言服务只由插件声明 #1785。toolchains.list/resolve:[Feature] API-23 开放通用 toolchains.list / toolchains.resolve 宿主方法 #1786。类型专属:fix
复现与根因
检查项
PluginEditorActionLaunchTests、PluginServerProcessToolReferenceTests(工具栏 Run/Debug 路由到编辑器动作、隐式工具引用解析);Core 新增隐式工具引用与backend启动计划的用例。拆分前这些路径不存在,故不存在“修复前失败”的对照输出。.agents/notes/implemented/bug-fix/记录:本次是架构迁移,决策记录在既有 Note 的 2026-11-07 更新行与 [Feature] macOS 存量重构计划:清理废弃实现,将 Maven/Java 领域逻辑完整迁入插件后端 #1495,不另起 bug-fix Note。范围检查 / Scope checks
功能矩阵 / Feature matrix
shared/platform-feature-matrix/features/<id>.json:两端的实现状态和验证状态、证据路径、owner、验证动作都如实填写;没有运行验证的保持pending./scripts/platform-feature-matrix/verify-platform-feature-matrix.sh;改了平台实现路径的,还运行了./scripts/platform-feature-matrix/verify-platform-feature-matrix-change.sh origin/preview HEAD.artifacts/下生成的矩阵视图统一日志系统 / Structured logging
shared/logging/events/<root>.json声明,再用生成的事件类型和 span 记录;没有NSLog、os_log/Logger、直接写 stderr、print或手写事件 IDpath、错误用error类型,动态通道段来自已校验的 IDnode scripts/logging/generate-log-events.mjs --check和node scripts/logging/verify-log-usage.mjs;没有为新违规往scripts/logging/log-usage-allowlist.json加条目或增大计数界面文案 / i18n
shared/i18n/补齐中英词条,运行node scripts/i18n/generate-i18n.mjs并提交生成结果,没有手改生成文件;macOS 视图外使用L10n.stringnode scripts/i18n/verify-app-language-localization.mjs和node scripts/i18n/generate-i18n.mjs --check,没有放宽脚本或扩大豁免名单逻辑归属 / Logic placement
refactorIssue:工具栏 Run/Debug 到编辑器动作的选取规则(首个run/run-all、debug备选)目前在 Swift,Windows 接入时应下沉 Core,已记入 [Feature] Windows 从过渡 crate lithe-legacy-tooling 迁到通用插件 API,复用 Java/Maven/Gradle 插件后端 #1788。verify-no-host-language-specifics.mjs基线已刷新)性能与内存 / Performance and memory
设置 / Settings
ProjectRuntimeSettingsView与 Maven 原生配置页,通用运行环境页未改动。插件与共享契约 / Plugin and shared contracts
node scripts/sdk-e2e.mjs --source <本仓库路径> --ref <分支>,三个 SDK 示例后端仍能跑通:plugin_function.rs与capabilities.rs未改动;标记 ready 前会补跑一次并把结果写到这里。node scripts/contract.mjs sync --revision <合并后的 preview commit>,并在插件协议更新记录登记(合入日期、PR、修改人、协议或 API)runtimeRequirements.kind、删除languageImport)与既有方法的调用场景说明发行包与资源 / Bundle and resources
./scripts/macos/verify/verify-runtime-bundle-immutability.shscripts/resources/worktree-resources.json、scripts/resources/reuse-worktree-resources.mjs的校验路由、对应测试和docs/ci-builds.md“独立工作树的本地编译”一节:本 PR 删除了 JDK/JDT LS 的准备脚本,没有新增资源;资源清单中对应条目一并移除。无用代码与重构 / Dead code and refactoring
refactor标签的 Issue,没有在本 PR 顺手处理:[Feature] lithe-ide-host MCP 工具目录去除 Maven/Java 专名,改为通用 toolchain 与 Build Provider 工具 #1784 [Feature] Core language-providers.json 移除内置 java 条目,Java 语言服务只由插件声明 #1785 [Feature] 归档已迁出插件仓库的 Java/Maven/JDT/Spring Agent Note #1787 [Feature] Windows 从过渡 crate lithe-legacy-tooling 迁到通用插件 API,复用 Java/Maven/Gradle 插件后端 #1788验证 / Verification
cargo test -p lithe-core --libcargo fmt --all --checklithe-agent-host/src/claude_desktop.rs(未改动)在 rustc 1.96 下有格式差异,见 #1789cargo clippy --workspace --all-targetslithe-git-host、lithe-core-rules(未改动)3 条新 lint,见 #1789scripts/macos/build/build-macos.sh --configuration debug --triple arm64-apple-macosx+assemble-preview-app.shscripts/macos/test/test-macos.sh(全量)node scripts/i18n/generate-i18n.mjs --check、node scripts/i18n/verify-app-language-localization.mjsnode scripts/logging/generate-log-events.mjs --check、node scripts/logging/verify-log-usage.mjs./scripts/architecture/verify-shared-contracts.shnode scripts/architecture/verify-no-host-language-specifics.mjs./scripts/platform-feature-matrix/verify-platform-feature-matrix.sh、verify-platform-feature-matrix-change.sh origin/preview HEAD./scripts/macos/verify/verify-runtime-bundle-immutability.sh./scripts/agent-notes/verify-agent-notes.sh、verify-test-stability.sh(工作区模式)、test-verify-test-stability.mjs`未能执行的检查和原因:
sdk-e2e.mjs:标记 ready 前补跑。提交前确认 / Final checks
preview创建;目标分支:feat、fix、docs 为preview,release 以发布流程要求为准.build/、target/、dist/、.artifacts/等产物,没有凭据、个人路径和未脱敏的日志或截图