From 28bde7a59b05d304041fb7b08b3645feb98beb99 Mon Sep 17 00:00:00 2001 From: Yao Jingxi <23722032@bjtu.edu.cn> Date: Mon, 2 Nov 2026 23:06:58 +0800 Subject: [PATCH] fix(plugins): admit toolchain plugins on macOS --- .../2026-10-17-plugin-capability-versions.md | 22 ++++++ .../Platform/MacOS/MacServiceContainer.swift | 1 + .../Plugins/DeclarativePluginContracts.swift | 14 +++- .../Lifecycle/ModuleTypes.swift | 5 ++ .../LitheModuleAPI/Plugins/PluginTypes.swift | 5 +- .../ToolchainPluginAdmissionTests.swift | 67 +++++++++++++++++++ shared/contracts/plugins/v1/README.md | 23 ++++--- .../features/plugin-injected-toolchains.json | 12 ++-- 8 files changed, 132 insertions(+), 17 deletions(-) create mode 100644 macos/Tests/LitheTests/ToolchainPluginAdmissionTests.swift diff --git a/.agents/notes/implemented/architecture/2026-10-17-plugin-capability-versions.md b/.agents/notes/implemented/architecture/2026-10-17-plugin-capability-versions.md index 1bd4a798f0..343832524d 100644 --- a/.agents/notes/implemented/architecture/2026-10-17-plugin-capability-versions.md +++ b/.agents/notes/implemented/architecture/2026-10-17-plugin-capability-versions.md @@ -61,6 +61,28 @@ Core 能校验一个能力,不代表宿主能运行它。宿主在 `plugins.de macOS 宿主接受级别 1 到 3(`supportedDeclarativeAPIVersions = [1, 2, 3]`),能力表是 `PluginManifest.hostCapabilities`,在校验、索引和安装审查时都发给 Core;其中的 `buildSystems: [1]` 随 macOS 的 Build 工具窗口一起加入,`buildProviders: [1]` 在 macOS 接入构建 Provider 会话后才加入。`vcsProviders: [1]` 同样等 macOS 接入 VCS Provider 会话(版本控制工具窗口、项目树状态和文件移动)后才加入,见[统一 VCS 模型提案](../../proposed/architecture/2026-10-22-unified-vcs-provider-model.md)的 P3。Core 自己支持 `buildProviders: 1` 和 `vcsProviders: 1`,不传宿主表时仍可校验清单、生成 Provider 计划、识别工作副本根并转发请求。Windows 还没有声明式插件宿主,不发送能力表,所以 Windows 不列出级别 3 的插件。宿主接入某个能力时,要做两件事:让宿主接受级别 3,并在宿主自己的能力表里加上这个能力的版本,而且只在宿主真正能运行它时才加。 +### 2.1 工具链只读查询的 macOS 准入 + +macOS 的运行环境设置页已有声明式扫描、版本探测、后端协商与 `toolchains/query` 查询后, +宿主登记 `toolDefinitions: [1]`、`toolchainProviders: [1]` 和 `executableResolution: [1, 2]`。 +三个准入入口继续使用同一张能力表;漏登记会让最新 AutoBuild 仍把 mise 等插件显示为“需要更新 Lithe”。 +此登记只承诺现有只读查询,不代表 Build、Run、LSP 已消费工具链选择,Windows 仍不登记。 + +仅有工具定义的合法插件必须拥有启用状态。描述器在没有其他模块时生成不启动进程的 +`.toolchains` 应用级模块,组合根为它登记普通声明式工厂;有后端的提供方仍使用已有 +backend 模块,不增加第二个开关。正确做法是让纯定义插件通过普通插件启用流程进入设置加载器; +不要用空模块列表、按插件名强行启用,或扩大 `canActivateWithoutRestart` 来跳过启动注册。 +新增安装仍在重启后进入设置加载器的启动快照,禁用则随已有启用状态从后续查询中撤回。 + +备选是只增加能力表、或等待所有运行时消费者迁移完毕。前者会把纯定义插件留在 +`emptyPlugin` / `missingModuleFactory` 拒绝路径;后者让已经具备的只读能力持续不可安装,均不采用。 +本次不新增下载资源或可写路径;查询沿用平台用户状态目录,发行 bundle 和插件包保持只读, +不改变代码签名或 Sparkle delta 基线。代价是纯定义模块也须遵循现有重启和模块所有权规则。 + +`ToolchainPluginAdmissionTests` 用正式契约样例和真实 Core 覆盖索引、安装审查、清单、 +纯定义模块与工厂登记;`MacToolchainDiscoveryTests` 和 `ToolchainSettingsLoaderTests` 覆盖已有查询路线。 +这类组件证据不代替真实 mise 应用内验收,完整框架状态继续由功能矩阵记录。 + ### 3. 市场索引带上能力版本 - 索引里级别 3 的 `versions[].requires` 必填,内容就是包内清单的 `requires`;级别 1、2 禁止出现。宿主因此在下载之前就能判断装不装得了。 diff --git a/macos/Sources/Lithe/Platform/MacOS/MacServiceContainer.swift b/macos/Sources/Lithe/Platform/MacOS/MacServiceContainer.swift index 60368151e4..0b3bab478d 100644 --- a/macos/Sources/Lithe/Platform/MacOS/MacServiceContainer.swift +++ b/macos/Sources/Lithe/Platform/MacOS/MacServiceContainer.swift @@ -1448,6 +1448,7 @@ final class MacServiceContainer { || $0.manifest.id == .debugAdaptersExtension(descriptor.id.rawValue) || $0.manifest.id == .grammarsExtension(descriptor.id.rawValue) || $0.manifest.id == .backendExtension(descriptor.id.rawValue) + || $0.manifest.id == .toolchainsExtension(descriptor.id.rawValue) || $0.manifest.id == .projectGeneratorsExtension(descriptor.id.rawValue) }.map { declaration in ModuleFactory(manifest: declaration.manifest, contributions: declaration.contributions) { diff --git a/macos/Sources/LitheCoreContracts/Plugins/DeclarativePluginContracts.swift b/macos/Sources/LitheCoreContracts/Plugins/DeclarativePluginContracts.swift index e67a02ddc4..ee0c855706 100644 --- a/macos/Sources/LitheCoreContracts/Plugins/DeclarativePluginContracts.swift +++ b/macos/Sources/LitheCoreContracts/Plugins/DeclarativePluginContracts.swift @@ -828,6 +828,15 @@ public struct DeclarativePluginDescriptor: Equatable, Sendable { activationPolicy: .onDemand ))) } + if decoded.hasToolDefinitions && modules.isEmpty { + // Definitions are valid on their own. Give them an enablement owner + // so plugin management can expose them to the settings loader. + modules.append(PluginModuleDeclaration(manifest: ModuleManifest( + id: .toolchainsExtension(decoded.id), displayName: decoded.displayName, + scope: .application, defaultState: enabledByDefault ? .enabled : .disabled, + activationPolicy: .onDemand + ))) + } let debuggedLanguages = Set(debugAdapters.flatMap(\.languageIDs)) let languageSupports = decoded.languages.map { language in let execution = executionByLanguage[language.id] @@ -1385,6 +1394,8 @@ public struct DeclarativePluginDescriptor: Equatable, Sendable { /// Launch fields stay with Rust Core; the host only needs to know /// a backend exists. let backend: ToolingJSONValue? + /// Core owns definition semantics; this bit only supplies an enablement module. + let hasToolDefinitions: Bool /// What plugin management lists. Fields and steps stay with Rust Core, /// which evaluates the New Project form and plans every step. @@ -1414,12 +1425,13 @@ public struct DeclarativePluginDescriptor: Equatable, Sendable { settingActions = try values.decodeIfPresent([SettingAction].self, forKey: .settingActions) ?? [] projectGenerators = try values.decodeIfPresent([ProjectGenerator].self, forKey: .projectGenerators) ?? [] backend = try values.decodeIfPresent(ToolingJSONValue.self, forKey: .backend) + hasToolDefinitions = !(try values.decodeIfPresent([ToolingJSONValue].self, forKey: .toolDefinitions) ?? []).isEmpty } private enum CodingKeys: String, CodingKey { case id, displayName, version, pluginAPIVersion, vendor, permissions, activationEvents case languages, languageServers, executionProviders, buildSystems, vcsProviders, ui, settings, settingActions - case projectGenerators, backend, debugAdapters + case projectGenerators, backend, debugAdapters, toolDefinitions } } } diff --git a/macos/Sources/LitheModuleAPI/Lifecycle/ModuleTypes.swift b/macos/Sources/LitheModuleAPI/Lifecycle/ModuleTypes.swift index d049041dab..4f605a15c4 100644 --- a/macos/Sources/LitheModuleAPI/Lifecycle/ModuleTypes.swift +++ b/macos/Sources/LitheModuleAPI/Lifecycle/ModuleTypes.swift @@ -324,6 +324,11 @@ public extension ModuleID { ModuleID("\(pluginID).backend") } + /// Enablement for tool definitions with no process or other contribution module. + static func toolchainsExtension(_ pluginID: String) -> ModuleID { + ModuleID("\(pluginID).toolchains") + } + /// The language grammars one declarative plugin declares, enabled /// together. Nothing runs while it is enabled; it only gates highlighting. static func grammarsExtension(_ pluginID: String) -> ModuleID { diff --git a/macos/Sources/LitheModuleAPI/Plugins/PluginTypes.swift b/macos/Sources/LitheModuleAPI/Plugins/PluginTypes.swift index 7ac2b2ed1a..2f4e4af16d 100644 --- a/macos/Sources/LitheModuleAPI/Plugins/PluginTypes.swift +++ b/macos/Sources/LitheModuleAPI/Plugins/PluginTypes.swift @@ -522,13 +522,16 @@ public struct PluginManifest: Equatable, Codable, Sendable { "packageTrust": [1], "backend": [1, 2], "buildProviders": [1, 2, 3, 4, 5, 6], "buildModelInputs": [1], - "buildSystems": [1, 2], "debugAdapters": [1, 2], "executableResolution": [1], + "buildSystems": [1, 2], "debugAdapters": [1, 2], "executableResolution": [1, 2], "executionProviders": [1], "languageServers": [1, 2], "languages": [1, 2], "projectGenerators": [1], "serverProcess": [1], "settings": [1, 2], + // Toolchain discovery and provider queries are hosted by the read-only settings pages. + "toolDefinitions": [1], + "toolchainProviders": [1], "ui": [1, 2, 3, 4], "vcsProviders": [1] ] diff --git a/macos/Tests/LitheTests/ToolchainPluginAdmissionTests.swift b/macos/Tests/LitheTests/ToolchainPluginAdmissionTests.swift new file mode 100644 index 0000000000..c107df753a --- /dev/null +++ b/macos/Tests/LitheTests/ToolchainPluginAdmissionTests.swift @@ -0,0 +1,67 @@ +import Foundation +import LitheApplicationKernel +import LitheCoreContracts +import LitheModuleAPI +import Testing +@testable import Lithe + +/// Uses the published contract fixtures and production Core adapters at all three admission gates. +@Suite("Toolchain plugin admission") +@MainActor +struct ToolchainPluginAdmissionTests { + @Test func providerIsAvailableReviewedAndLoadedWithBackendEnablement() throws { + let manifest = try fixture("toolchain-provider.plugin.json") + let descriptor = try checkAdmission(manifest) + #expect(descriptor.declaresBackend) + #expect(descriptor.pluginManifest.modules.map(\.manifest.id) == [.backendExtension(descriptor.id.rawValue)]) + #expect(MacPluginBackendSessions.toolchainProviderIDs(ofManifest: descriptor.normalizedManifest) == ["mise"]) + let review = try PluginMarketplaceTestSupport.evaluator.installReview( + manifest: manifest, expectedID: descriptor.id.rawValue, + expectedVersion: descriptor.pluginManifest.version.description, approvedPrograms: nil) + #expect(review.permissions == ["backend.launch", "toolchains.provide"]) + #expect(review.programs.map(\.path) == ["bin/mise-provider"]) + } + + @Test func standaloneDefinitionHasEnablementAndRequiresRestart() throws { + let descriptor = try checkAdmission(fixture("tool-definition.plugin.json")) + #expect(!descriptor.declaresBackend) + #expect(descriptor.pluginManifest.modules.map(\.manifest.id) == [.toolchainsExtension(descriptor.id.rawValue)]) + #expect(descriptor.pluginManifest.modules.allSatisfy { $0.manifest.defaultState == .disabled }) + #expect(!descriptor.canActivateWithoutRestart) + let registry = try ValidatedPluginCatalog(manifests: [descriptor.pluginManifest], + hostVersion: BuiltInPluginCatalog.hostVersion) + #expect(registry.manifests.count == 1) + let installed = InstalledPluginPackage(descriptor: descriptor, + installation: PluginInstallationRecord(pluginID: descriptor.id, + activeVersion: descriptor.pluginManifest.version, origin: .localDevelopment), + packageURL: DeclarativePluginTestSupport.repositoryRoot) + let factories = MacServiceContainer.declarativePluginFactories([installed], + executionHost: MacLanguageExecutionHost(processRegistry: ManagedProcessRegistry()), + planner: DeclarativePluginTestSupport.operations) + #expect(factories.map(\.manifest.id) == descriptor.pluginManifest.modules.map(\.manifest.id)) + } + + private func fixture(_ name: String) throws -> Data { + try Data(contentsOf: DeclarativePluginTestSupport.repositoryRoot + .appendingPathComponent("shared/contracts/plugins/v1/fixtures/\(name)")) + } + + private func checkAdmission(_ manifest: Data) throws -> DeclarativePluginDescriptor { + let object = try #require(try JSONSerialization.jsonObject(with: manifest) as? [String: Any]) + let id = try #require(object["id"] as? String) + var entry = PluginMarketplaceTestSupport.entry(id: id, repository: "https://github.com/example/toolchain", + version: "1.0.0", archiveURL: "https://github.com/example/toolchain/releases/download/v1.0.0/toolchain.zip", + sha256: String(repeating: "a", count: 64)) + var versions = try #require(entry["versions"] as? [[String: Any]]) + versions[0]["pluginAPIVersion"] = object["pluginAPIVersion"] + versions[0]["requires"] = object["requires"] + entry["versions"] = versions + let index = try PluginMarketplaceTestSupport.evaluator.validateIndex( + PluginMarketplaceTestSupport.indexData([entry]), sourceKind: .official, platform: "darwin-arm64") + let listed = try #require(index.plugins.first) + #expect(listed.availability.download?.version == "1.0.0") + _ = try PluginMarketplaceTestSupport.evaluator.installReview(manifest: manifest, + expectedID: id, expectedVersion: "1.0.0", approvedPrograms: nil) + return try DeclarativePluginTestSupport.operations.validate(manifest: manifest) + } +} diff --git a/shared/contracts/plugins/v1/README.md b/shared/contracts/plugins/v1/README.md index 12b4059b2b..fdf5d1d0e7 100644 --- a/shared/contracts/plugins/v1/README.md +++ b/shared/contracts/plugins/v1/README.md @@ -56,13 +56,14 @@ admit new sources into existing Build candidate sets. Definitions are entirely plugin-owned, with reserved short IDs checked against host-verified official provenance when constructing the registry. -Neither native host advertises or integrates this foundation yet. Core consumes -captured host facts; it does not start a provider, run a probe, watch files, scan -the system, persist pins, or change current Java/Maven selection. The broader -proposal remains unsupported where it exceeds this implemented slice. In -particular, `toolchainConsumers`, generic runtime launches, settings pages, mise -and SDKMAN providers, and live backend activation are not implemented here. -Proposal envelopes remain separate from production manifests. +macOS advertises these capabilities for its read-only toolchain settings pages. +The native adapter scans declarations, probes checked executables, queries plugin +backends and watches their inputs; Core consumes captured facts and owns validation +and resolution. Windows does not advertise the capabilities. Saving pins, +`toolchainConsumers`, generic runtime launches and live backend activation remain +unsupported, and current Java/Maven/Build/Run selection is unchanged. Version-manager +implementations such as mise belong to their own plugin packages. Proposal +envelopes remain separate from production manifests. See [the implemented slice](toolchains.md). ## Package layout @@ -96,7 +97,7 @@ symbolic links. A host treats an installed package as read-only. | `settings` | User-adjustable plugin options (level 2 and later). | | `ui` | Host-rendered tool windows and commands (level 2 and later). | | `buildSystems` | Project-level build tools (level 3). | -| `toolDefinitions` | Plugin-owned tool policy ([Core foundation](toolchains.md)); requires `toolDefinitions: 1` and `executableResolution: 2`; native adapters are not connected. | +| `toolDefinitions` | Plugin-owned tool policy ([Core foundation](toolchains.md)); requires `toolDefinitions: 1` and `executableResolution: 2`; macOS hosts read-only discovery. | | `toolchainProviders` | Backend fact-provider declarations ([Core foundation](toolchains.md)); requires `toolchainProviders: 1`, backend/server-process capabilities and `toolchains.provide`. | Unknown fields are refused (`plugin.manifest.invalid`) so an older host @@ -513,9 +514,9 @@ hosts. Level 3 versions each section on its own. A level 3 manifest lists in | `debugAdapters` | [`debugAdapters[]`](#api-level-4-debug-adapters); v2 adds target arguments/environment | `1`, `2` | | `projectGenerators` | [`projectGenerators[]`](#project-generators): entries of the New Project window | `1` | | `backend` | [`backend`](#plugin-backend): the plugin's own long-lived process | `1`, `2` (adds [start without a page and workspace contexts](#backend-2-workspace-contexts)) | -| `toolDefinitions` | [Tool identities, layouts, discovery and four-layer candidates](toolchains.md) | `1` (Core only) | -| `toolchainProviders` | [Provider declarations and permission-bound answer validation](toolchains.md) | `1` (Core only) | -| `executableResolution` | [Shared executable candidates](#shared-executable-candidates-executableresolution-1); v2 adds tool-definition candidates without changing existing Build candidate sets | `1`, `2` (v2 Core only) | +| `toolDefinitions` | [Tool identities, layouts, discovery and four-layer candidates](toolchains.md) | `1` (Core; macOS read-only settings) | +| `toolchainProviders` | [Provider declarations and permission-bound answer validation](toolchains.md) | `1` (Core; macOS read-only settings) | +| `executableResolution` | [Shared executable candidates](#shared-executable-candidates-executableresolution-1); v2 adds tool-definition candidates without changing existing Build candidate sets | `1`, `2` (v2 Core; macOS read-only settings) | Version 1 of every capability means what its section means at level 2 (runtime launches, launch templates, `initializationOptions`, and so on), so diff --git a/shared/platform-feature-matrix/features/plugin-injected-toolchains.json b/shared/platform-feature-matrix/features/plugin-injected-toolchains.json index d662efe667..37e1e9345a 100644 --- a/shared/platform-feature-matrix/features/plugin-injected-toolchains.json +++ b/shared/platform-feature-matrix/features/plugin-injected-toolchains.json @@ -2,7 +2,7 @@ "id": "plugin-injected-toolchains", "area": "扩展", "group": "插件与主题", - "capability": "工具链领域框架:共享 Core 校验插件贡献、来源与四层解析;macOS 提供只读的运行环境和环境来源设置页,目录、工具、版本文件、固定值、登录 Shell 与版本管理器均来自已启用插件的声明和磁盘上的真实文件。自动检测按插件声明真实扫描本机安装并运行定义的版本探测;版本管理器通过插件后端的 toolchains/query 报告安装和项目/全局要求,回复经 Core 校验后显示,监视的文件变化时整份重查;每行哪一层生效由 Core toolchains.resolve 按同一份事实决定。Lithe 全局默认、保存与运行时消费者仍未接入,不能把只读页面当作已生效配置。", + "capability": "工具链领域框架:共享 Core 校验插件贡献、来源与四层解析;macOS 提供只读的运行环境和环境来源设置页,目录、工具、版本文件、固定值、登录 Shell 与版本管理器均来自已启用插件的声明和磁盘上的真实文件。自动检测按插件声明真实扫描本机安装并运行定义的版本探测;版本管理器通过插件后端的 toolchains/query 报告安装和项目/全局要求,回复经 Core 校验后显示,监视的文件变化时整份重查;每行哪一层生效由 Core toolchains.resolve 按同一份事实决定。Lithe 全局默认、保存与运行时消费者仍未接入,不能把只读页面当作已生效配置。 macOS 已登记 toolDefinitions、toolchainProviders 与 executableResolution 2,允许具备这些能力的插件经过市场筛选、安装审查和加载;仅含工具定义的插件也有独立启用模块。", "macos": { "implementationStatus": "partial", "verificationStatus": "pending", @@ -30,7 +30,11 @@ "rust/lithe-core/src/lsp/interface/toolchain_provider.rs", "macos/Sources/Lithe/Platform/MacOS/Runtime/MacToolchainDiscovery+Providers.swift", "macos/Sources/Lithe/Platform/MacOS/Runtime/MacToolchainInputWatcher.swift", - "macos/Sources/Lithe/Platform/MacOS/Plugins/MacPluginBackendSessions.swift" + "macos/Sources/Lithe/Platform/MacOS/Plugins/MacPluginBackendSessions.swift", + "macos/Sources/LitheModuleAPI/Plugins/PluginTypes.swift", + "macos/Sources/LitheCoreContracts/Plugins/DeclarativePluginContracts.swift", + "macos/Sources/Lithe/Platform/MacOS/MacServiceContainer.swift", + "macos/Tests/LitheTests/ToolchainPluginAdmissionTests.swift" ] }, "windows": { @@ -46,6 +50,6 @@ ] }, "owner": "Plugin Platform", - "verification": "共享 Core:cargo test --manifest-path rust/Cargo.toml -p lithe-core --lib toolchain,核对定义独占与官方短 ID、第二种通用工具、旧候选边界、答案身份/代次、Windows 路径大小写、工作区排除、固定值失效不回落、最近项目要求、冲突选择、最低版本、环境隔离和纯声明扫描;按逐项计时工具生成 HTML/JUnit。macOS 与 Windows 原生后续验收均需先实现对应 adapter:启动提供方并协商、取消/超时和过期结果隔离、输入新建/删除后整体重查、目录固定保存/取消/冲突回读、插件停用撤回、真实 Build/LSP/Run 消费者取得同一选择、发行目录哈希不变与子进程清理。未完成原生流程前保持 pending,不以 Core 测试代替实机验证。 提供方查询:cargo test -p lithe-core --lib toolchain(含 lsp 引擎脚本后端:只有插件后端被提供 litheToolchains、未协商的提供方不写请求、错误回复原样返回;别名链接只有链接路径事实时仍选中规范 home);MacToolchainDiscoveryTests 用真实临时目录与注入的查询验证同一轮查询共享代次而 operationID 各不相同、链接 home 规范化、工作区内 home 整份拒绝,以及 toolchains.resolve 选出项目要求、未安装的要求记为 unmet 并退到下一层、固定值只在自己的目录生效且失效时不回落,以及超时和后端不可用的提供方经 toolchains.failureReply 交给 Core 记为 providerUnavailable(cause 区分两者)并由下一层决定;ToolchainSettingsLoaderTests 验证每行读取其固定值目录或最近版本文件目录的解析结果;ToolchainSettingsFeatureTests 验证监视文件连续变化只重载一次、外部输入观察随关闭释放。真实 mise 插件端到端尚未在应用内验证。 原生布局回归 ToolchainSettingsLayoutTests:同一设置宿主按900/1180/1400/900重复缩放,真实分隔条拖动;来源页按500/666/946/500缩放,检查AX控件边界、卡片不重叠、选择和快照不改变。此几何验证不代表提供方查询或保存功能已完成。 声明式扫描 MacToolchainDiscoveryTests:真实临时目录、注入的用户目录与探测,覆盖 homeLayouts 首个匹配、隐藏与未匹配条目、链接到工作区的条目不探测、只探测 Core 返回的可执行文件、同版本冲突、被拒声明不扫描,以及隔离预览样例清单通过 Core 准入;不运行本机安装的工具。", - "notes": "本条仅记录 #1581 重设计的 Core 基础切片。两端共享同一确定性模型但均未接原生产品,不广告工具链 hostCapabilities;现有 Java/Maven/Node 发现与选择未迁移。安装来源支持两条途径:工具定义里的声明式扫描(由宿主展开)和提供方查询(toolchains/query,可只报告安装);Core 在自动层把两条途径按规范化目录合并;macOS 设置页已接入声明式扫描(宿主按 discoveryPlan 展开、收集文件事实、只探测 toolchains.candidates 返回的可执行文件,扫描与探测有数量和时长上限),macOS 设置页已接入提供方查询(启动或复用插件后端、协商 litheToolchains、同一轮查询共享代次而每次查询独立 operationID、超时 15 秒、取消发送 $/cancelRequest,回复交 toolchains.decodeReply 用宿主读取的文件事实校验,失败原样显示提供方原因;超时或后端不可用时由 toolchains.failureReply 生成错误回复交 Core 记为 providerUnavailable,工具行写出哪个版本管理器未响应或不可用);Windows 仍未接。Core 不运行 mise/SDKMAN、不解析其文件格式、不下载、不监听或写配置。通用 runtime 消费者、环境/来源界面、项目环境 symlink 完整原生验证及带后端免重启仍未完成;没有新增运行时资源或可复用下载目录。 macOS 设置页只读:运行环境页按目录列出工具,展开后按固定、项目文件、全局、自动四个来源排列并框出 Core toolchains.resolve 选中的来源,提供方报告的要求与版本显示在项目与全局步骤中,固定值由 Core 校验、不可用时显示原因,来源冲突只显示原因;环境来源页显示登录 Shell 的读取状态、变量数(不显示值)、耗时和 PATH 各目录的来源,以及插件声明的版本管理器在本项目找到的版本文件。未实现的添加、切换、保存和冲突选择入口不显示。Debug 隔离预览只有插件清单是样例,工作区文件、固定值和登录 Shell 均真实读取,不启动工具、不写真实配置。Core 独立位于 rust/lithe-core/src/toolchain/,插件只是声明贡献入口。" + "verification": "共享 Core:cargo test --manifest-path rust/Cargo.toml -p lithe-core --lib toolchain,核对定义独占与官方短 ID、第二种通用工具、旧候选边界、答案身份/代次、Windows 路径大小写、工作区排除、固定值失效不回落、最近项目要求、冲突选择、最低版本、环境隔离和纯声明扫描;按逐项计时工具生成 HTML/JUnit。macOS 与 Windows 原生后续验收均需先实现对应 adapter:启动提供方并协商、取消/超时和过期结果隔离、输入新建/删除后整体重查、目录固定保存/取消/冲突回读、插件停用撤回、真实 Build/LSP/Run 消费者取得同一选择、发行目录哈希不变与子进程清理。未完成原生流程前保持 pending,不以 Core 测试代替实机验证。 提供方查询:cargo test -p lithe-core --lib toolchain(含 lsp 引擎脚本后端:只有插件后端被提供 litheToolchains、未协商的提供方不写请求、错误回复原样返回;别名链接只有链接路径事实时仍选中规范 home);MacToolchainDiscoveryTests 用真实临时目录与注入的查询验证同一轮查询共享代次而 operationID 各不相同、链接 home 规范化、工作区内 home 整份拒绝,以及 toolchains.resolve 选出项目要求、未安装的要求记为 unmet 并退到下一层、固定值只在自己的目录生效且失效时不回落,以及超时和后端不可用的提供方经 toolchains.failureReply 交给 Core 记为 providerUnavailable(cause 区分两者)并由下一层决定;ToolchainSettingsLoaderTests 验证每行读取其固定值目录或最近版本文件目录的解析结果;ToolchainSettingsFeatureTests 验证监视文件连续变化只重载一次、外部输入观察随关闭释放。真实 mise 插件端到端尚未在应用内验证。 原生布局回归 ToolchainSettingsLayoutTests:同一设置宿主按900/1180/1400/900重复缩放,真实分隔条拖动;来源页按500/666/946/500缩放,检查AX控件边界、卡片不重叠、选择和快照不改变。此几何验证不代表提供方查询或保存功能已完成。 声明式扫描 MacToolchainDiscoveryTests:真实临时目录、注入的用户目录与探测,覆盖 homeLayouts 首个匹配、隐藏与未匹配条目、链接到工作区的条目不探测、只探测 Core 返回的可执行文件、同版本冲突、被拒声明不扫描,以及隔离预览样例清单通过 Core 准入;不运行本机安装的工具。 ToolchainPluginAdmissionTests 使用正式契约 fixture 与真实 Core 验证市场可安装、完整安装审查、清单加载,以及无后端纯工具定义插件的启用模块和工厂登记;本地编译验证不代替真实 mise 与 Windows 工作流验收。 2026-11-02 本机 Swift 6.4.2:准入、后端、发现和加载器 42 项通过,新增两个准入用例分别 4/6 ms;Swift 6.3.3 在本机 Xcode 27.2 SDK 下编译依赖清单崩溃,不能作为固定工具链通过。真实 mise 0.2.1 发布包 SHA-256 与市场一致,Core 证明修复前 unsupported、修复后 available;真实后端完成协商、查询并停止销毁,当前环境未安装 mise,查询真实返回 miseNotFound,未验证安装列表和应用内工作流。", + "notes": "本条仅记录 #1581 重设计的 Core 基础切片。两端共享同一确定性模型;macOS 已接入只读设置查询,登记工具链 hostCapabilities,Windows 继续不登记;现有 Java/Maven/Node 发现与选择未迁移。安装来源支持两条途径:工具定义里的声明式扫描(由宿主展开)和提供方查询(toolchains/query,可只报告安装);Core 在自动层把两条途径按规范化目录合并;macOS 设置页已接入声明式扫描(宿主按 discoveryPlan 展开、收集文件事实、只探测 toolchains.candidates 返回的可执行文件,扫描与探测有数量和时长上限),macOS 设置页已接入提供方查询(启动或复用插件后端、协商 litheToolchains、同一轮查询共享代次而每次查询独立 operationID、超时 15 秒、取消发送 $/cancelRequest,回复交 toolchains.decodeReply 用宿主读取的文件事实校验,失败原样显示提供方原因;超时或后端不可用时由 toolchains.failureReply 生成错误回复交 Core 记为 providerUnavailable,工具行写出哪个版本管理器未响应或不可用);Windows 仍未接。Core 不运行 mise/SDKMAN、不解析其文件格式、不下载、不监听或写配置。通用 runtime 消费者、环境/来源界面、项目环境 symlink 完整原生验证及带后端免重启仍未完成;没有新增运行时资源或可复用下载目录。 macOS 设置页只读:运行环境页按目录列出工具,展开后按固定、项目文件、全局、自动四个来源排列并框出 Core toolchains.resolve 选中的来源,提供方报告的要求与版本显示在项目与全局步骤中,固定值由 Core 校验、不可用时显示原因,来源冲突只显示原因;环境来源页显示登录 Shell 的读取状态、变量数(不显示值)、耗时和 PATH 各目录的来源,以及插件声明的版本管理器在本项目找到的版本文件。未实现的添加、切换、保存和冲突选择入口不显示。Debug 隔离预览只有插件清单是样例,工作区文件、固定值和登录 Shell 均真实读取,不启动工具、不写真实配置。Core 独立位于 rust/lithe-core/src/toolchain/,插件只是声明贡献入口。" }