Skip to content

feat(plugins)!: 插件 API 单一基线(版本归 0),插件契约、文档与 SDK 并入 Core - #17

Merged
xiaoyumuxi merged 4 commits into
mainfrom
feature/plugin-api-single-baseline
Nov 11, 2026
Merged

xiaoyumuxi merged 4 commits into
mainfrom
feature/plugin-api-single-baseline

Conversation

@xiaoyumuxi

@xiaoyumuxi xiaoyumuxi commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

关联

背景

插件 API 过去每个能力各有 1–12 不等的版本,宿主、清单、SDK 和文档都要处理“某能力到第几版才有某字段”。这些旧版本没有需要兼容的已发布插件,留着只会增加理解和实现成本。同时,契约在三个地方各有一份:Lithe-IDEA 的 shared/contracts/plugins/、Core 的 shared/plugins/contract/、lithe-plugin-docs 的副本,SDK 也不和协议在同一个仓库里验证。

本 PR 把每个能力收敛到当前最完整的那一版,并从 0 重新编号;版本字段和协商机制都保留,以后新增功能时从 0 往上加。插件契约、开发资料和 SDK 合并到本仓库的 shared/plugins/,作为唯一来源。

改动

1. 插件 API 单一基线(83f853d)

  • SUPPORTED_PLUGIN_API_VERSIONS = [0];18 个能力在 capabilities.rs 中都只支持 [0],每个能力只保留最高、最完整的那一版行为。
  • 清单 schemaVersion、市场索引 schemaVersion、原生 UI 文档 schemaVersion、litheBuildModel 等后端协议的 version、plugins.editorActions.decode 的 version、网页桥 window.lithe.version 全部为 0。
  • 删除按能力版本分叉的旧代码路径、旧字段兼容和对应测试;serverProcess、executableResolution 不再是能力(requires 里出现时按 plugin.manifest.invalid 拒绝,fixture 已覆盖)。
  • 契约 README、schema、fixture 同步为单一基线;invalid-manifests.json 现为 189 个拒绝用例。

2. 目录整理(ca610c2)

  • shared/ 只保留 plugins/;Core 自己的接口契约、测试数据和日志事件目录移到 rust/contracts/、rust/fixtures/、rust/logging/。
  • 删除 GitGraph 对照数据和依赖它的测试;scripts/rust-core/ 保留,它是 develop-lithe Skill 要求的 Core 注释门禁(模块文档、英文注释、unsafe 安全说明、导出项 Rustdoc)。

3. 并入 lithe-plugin-docs(本次新增提交)

  • shared/plugins/README.md:插件开发入口(中英)。
  • shared/plugins/guides/:语言服务器、后端工作区、构建工具、原生构建流程、调试适配器、原生终端、插件日志等指南,按基线 0 重写,去掉版本对照表和 macOS/Windows 宿主现状说法。
  • shared/plugins/reference/:API 总表(api-catalog.md)、能力与版本(capabilities-and-versions.md)、协议更新记录(protocol-changelog.md,登记本 PR)、domains/ 下 15 个领域参考页。
  • shared/plugins/sdk/{node,java,rust}:三个官方后端 SDK 与示例,版本为 Node 0.5.0、Java 0.5.0、Rust 0.4.0;sdk/e2e/ 为 SDK 端到端场景,经 rust/lithe-core/Cargo.toml 的 plugin-sdk-e2e feature 编译。
    • 5 个用 Node/Java 启动的示例清单补上 requiresTools(基线 0 要求列出启动用到的每个工具,否则 plugin.runtime.undeclared)。
    • e2e 改为按真实宿主流程启动后端:新增 sdk/e2e/runtime-tools.plugin.json(node、java 工具定义,代替运行时插件),共用的 host_launch_arguments 调 toolchains.instantiateLaunch 展开启动模板、探测版本,再用 toolchains.checkVersion 校验最低版本;替换了已删除的 plugins.declarative.checkRuntimeVersion 和 plan 里不再存在的 versionArguments。构建、原生构建、VCS 三个场景都用它。
  • shared/plugins/scripts/:verify-docs.mjs(schema $id、相对链接、拒绝指向 lithe-plugin-docs 的文件链接)及其测试,sdk-e2e.mjs(构建三个 SDK 的示例并跑端到端测试)。
  • .github/workflows/:plugins-verify.yml(文档检查与 SDK 测试)、plugins-release-{node,java,rust}-sdk.yml(按 sdk-*-v* 标签发布)。
  • 契约 README:删除 “Windows mapping”“Current Windows availability” 两节和其他宿主平台现状句,改为与宿主无关的表述;vcs-provider-v1.md 状态块同样改写;修复失效锚点和指向 Lithe-IDEA 平台目录的死链;构建系统一节删掉早已不存在的 build-host-integration fixture,改为说明 hostIntegration 来源没有 fixture。
  • 三个 SDK README 不再各自罗列桌面端没注册的宿主服务(和能力页的清单已经不一致),改为链接 capabilities-and-versions.md 的唯一清单。
  • 根目录 README.md:说明目录分工与常用命令;.gitignore 忽略 SDK 构建产物。
  • 合并 main 的 feat(git): mark reported queries and fold their output in the console #16(Git 控制台折叠内部查询):它改的 shared/contracts/rust-core-api.md 和 shared/fixtures/git/execution-events-v1.json 已按本分支的新位置落到 rust/contracts/、rust/fixtures/。
  • cargo fmt:ca610c2 缩短 fixture 路径后,include_str! 等调用能放进一行,相关文件重新格式化(只有空白变化)。

不在本 PR 范围内

  • 归档 lithe-plugin-docs 仓库并在其 README 指向本目录、Lithe Store CI 改用本仓库的 plugin-index.schema.json URL:对外可见,由维护者执行。
  • 按 sdk-*-v* 打标签发布新版 SDK:合入后由维护者执行。
  • 已发布插件按基线 0 适配:在各插件仓库进行。

验证

命令 平台 结果
cargo test --manifest-path rust/Cargo.toml --workspace macOS 通过
bash scripts/rust-core/verify-rust-core-comments.sh macOS 通过
cargo fmt --all -- --check macOS 通过
node shared/plugins/scripts/sdk-e2e.mjs macOS 9 个测试全部通过(Node 3、Java 2、Rust 2、原生构建 2)
node shared/plugins/scripts/verify-docs.mjs、node --test shared/plugins/scripts/verify-docs.test.mjs macOS 通过(2/2)
Markdown 相对链接锚点检查(GitHub 标题 slug 规则) macOS 0 个失效
Node、Java、Rust 三个 SDK 的单元测试 macOS 通过
Lithe-IDEA 桌面端插件包测试(固定到本 PR HEAD 7a71cd6) macOS 见 1lck/Lithe-IDEA#1826

插件契约 shared/contracts/plugins/v1 原地重写为只保留每个 API 最完整的形态:

- pluginAPIVersion、清单 schemaVersion、全部能力版本、协议版本和文档版本都归 0;
  版本字段和协商保留,以后从 0 往上迭代。requires 必填,宿主只提供 0。
- serverProcess 和 executableResolution 并入基础契约,声明它们会被拒绝为
  plugin.api.unsupported。
- 删除宿主内置运行时(checkRuntimeVersion)和生成器 runtime 字段;工具一律经
  requiresTools 声明,未声明时报 plugin.runtime.undeclared。tool 字段暴露
  .version、.major、.executable。
- 语言服务器启动计划始终带 sessionPolicy;runtimeRequirements 统一为 kind tool。
- 构建文档(litheBuildModel、litheDependencies、litheTestResults、
  litheTestDiscovery、litheBuildConfiguration、litheConfigurationEdit、
  diagnostics、modelInputs)、索引、native-ui、bridge、VCS、editorActions、
  后端计划版本都为 0。
- 删除旧格式插件清单测试和 fixture(tests/plugins.rs、official-v1、
  language-support-v1、runtime-versions),fixture 去掉 -v2 后缀。
- invalid-manifests 的 expectedField 由测试校验。
- shared/fixtures → rust/fixtures,shared/logging → rust/logging,
  shared/contracts 下的非插件契约 → rust/contracts;四个 crate 的
  include_str!、测试路径和文档引用一起改。
- 插件契约 shared/contracts/plugins/v1 → shared/plugins/contract/v1。
- macos/Tests/LitheTests/Fixtures/GitGraph 的 issue410 对照数据移到
  rust/fixtures/git/graph-issue410,删除 macos/ 目录。
- 拆仓时没跟过来的 Lithe-IDEA 文件(根 README、i18n README、Agent Note、
  native-ui-lab)改为指向 Lithe-IDEA preview 的绝对链接。
@xiaoyumuxi
xiaoyumuxi marked this pull request as ready for review November 11, 2026 11:50
- shared/plugins/README.md 为插件开发入口;guides/、reference/(API 总表、能力与版本、协议更新记录、domains/ 领域参考)按基线 0 重写,去掉版本对照和宿主平台现状说法
- sdk/{node,java,rust} 三个官方后端 SDK 与示例并入;5 个用 Node/Java 启动的示例补上 requiresTools
- sdk/e2e 经 lithe-core 的 plugin-sdk-e2e feature 编译;新增 runtime-tools.plugin.json 代替运行时插件,host_launch_arguments 按宿主流程调 toolchains.instantiateLaunch 与 toolchains.checkVersion,替换已删除的 checkRuntimeVersion
- scripts/verify-docs.mjs(schema $id、相对链接、拒绝指向 lithe-plugin-docs 的文件链接)及测试,scripts/sdk-e2e.mjs
- .github/workflows:plugins-verify 与按 sdk-*-v* 标签发布三个 SDK
- 契约 README 删除 Windows 映射与宿主现状小节,修复失效锚点和死链,去掉不存在的 build-host-integration fixture;SDK README 的宿主服务缺口改为链接能力页的唯一清单
- 根目录 README 说明目录分工;.gitignore 忽略 SDK 构建产物;cargo fmt 处理路径缩短后的格式差异
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant