diff --git a/shared/plugins/README.md b/shared/plugins/README.md index 3ab8db3d..ef425bcd 100644 --- a/shared/plugins/README.md +++ b/shared/plugins/README.md @@ -111,7 +111,7 @@ Schema 只检查 JSON 结构。ID 引用、权限、激活事件、模板变量 | [Rust](sdk/rust/README.md) | 0.4.0 | Rust 1.87+ | [`sdk-rust-v0.4.0`](https://github.com/Lithe-IDEA/Lithe-core-rust/releases/tag/sdk-rust-v0.4.0):`lithe-plugin-sdk-rust-0.4.0.crate` 和 `.sha256` | 用 Git 依赖锁定标签(`Cargo.lock` 记录 commit),或解压后作为 `path` 依赖;编译成每个平台各一份的插件后端可执行文件 | | [Go](sdk/go/README.md) | 未发布 | Go 1.27.4+ | Go 模块标签 `shared/plugins/sdk/go/v<版本>`,由 Go 模块代理分发,没有 Release 附件;还没有打过标签 | `go get` 锁定标签或 commit(`go.sum` 记录内容哈希);编译成每个平台各一份的插件后端可执行文件 | | [Node.js](sdk/node/README.md) | 0.5.0 | Node.js 20.3+ | [`sdk-node-v0.5.0`](https://github.com/Lithe-IDEA/Lithe-core-rust/releases/tag/sdk-node-v0.5.0):`lithe-plugin-sdk-node-0.5.0.tgz` 和 `.sha256` | 解压后把 `package/` 复制进插件包,用相对路径导入 | -| [Java](sdk/java/README.md) | 0.5.0 | Java 8+ | [`sdk-java-v0.5.0`](https://github.com/Lithe-IDEA/Lithe-core-rust/releases/tag/sdk-java-v0.5.0):`lithe-plugin-sdk-java-0.5.0.jar` 和 `.sha256` | shade 进后端 JAR | +| [Java](sdk/java/README.md) | 0.5.0(源码版本) | Java 8+ | 尚无对应 Release;[固定 Core commit 引入源码](sdk/java/README.md#getting-the-sdk) | `sdk.lock.json` 固定 commit 和每个文件的 SHA-256,和后端一起编译进 JAR | Rust 的 Git 依赖这样写: @@ -125,7 +125,7 @@ Go 这样引入(第一个标签发布前写 `main` 上的 commit,Go 会记 go get github.com/Lithe-IDEA/Lithe-core-rust/shared/plugins/sdk/go@<标签或 commit> ``` -SDK 的源码都在本目录的 `sdk/` 下。Node.js、Java 和 Rust SDK 发布在 [Core 仓库的 Releases](https://github.com/Lithe-IDEA/Lithe-core-rust/releases) 里(标签 `sdk-node-v<版本>`、`sdk-java-v<版本>`、`sdk-rust-v<版本>`),不在 npm、Maven 或 crates.io 上;Go SDK 是本仓库子目录里的 Go 模块,版本就是标签 `shared/plugins/sdk/go/v<版本>`,由 Go 模块代理和校验和数据库分发。Rust 和 Go SDK 只实现插件后端(`backend`):插件函数和宿主服务;构建后端请用 Node.js 或 Java SDK,VCS 后端请用 Node.js SDK。各 SDK 的 README 有 “What the Lithe desktop serves” 一节,说明 Lithe 桌面端提供哪些协议;各协议的版本见[进程协议版本](reference/capabilities-and-versions.md#进程协议版本)。以上版本说的都是版本 `0` 的协议;已退役的 `lithe-plugin-docs` 仓库发布过更早的 SDK,它们说的是旧协议,Lithe 桌面端不接受用它们写的插件,请只使用 Core 仓库发布的版本。 +SDK 的源码都在本目录的 `sdk/` 下。Node.js 和 Rust SDK 的发布入口是 [Core 仓库的 Releases](https://github.com/Lithe-IDEA/Lithe-core-rust/releases)(标签 `sdk-node-v<版本>`、`sdk-rust-v<版本>`),不在 npm 或 crates.io 上;Java SDK 暂无对应 Release,也不发布到 Maven 仓库,按[获取说明](sdk/java/README.md#getting-the-sdk)固定 Core commit 引入源码;Go SDK 是本仓库子目录里的 Go 模块,版本就是标签 `shared/plugins/sdk/go/v<版本>`,由 Go 模块代理和校验和数据库分发。Rust 和 Go SDK 只实现插件后端(`backend`):插件函数和宿主服务;构建后端请用 Node.js 或 Java SDK,VCS 后端请用 Node.js SDK。各 SDK 的 README 有 “What the Lithe desktop serves” 一节,说明 Lithe 桌面端提供哪些协议;各协议的版本见[进程协议版本](reference/capabilities-and-versions.md#进程协议版本)。以上版本说的都是版本 `0` 的协议;已退役的 `lithe-plugin-docs` 仓库发布过更早的 SDK,它们说的是旧协议,Lithe 桌面端不接受用它们写的插件,请只使用 Core 仓库中的 SDK。 SDK 与插件后端在构建时下载,并按锁定的 SHA-256(或 Git commit、`go.sum`)校验;插件包安装后没有 `npm install` 步骤。独立的大型依赖可声明 [`managedRuntimes`](contract/v1/README.md#managed-runtimes):宿主在用户批准安装后校验并准备,完整缓存可离线复用;插件自身不能用启动脚本绕过这项声明或自行改写包。 @@ -332,7 +332,7 @@ A plugin that uses only language servers, run, and test needs no backend. When y | [Rust](sdk/rust/README.md) | 0.4.0 | Rust 1.87+ | [`sdk-rust-v0.4.0`](https://github.com/Lithe-IDEA/Lithe-core-rust/releases/tag/sdk-rust-v0.4.0): `lithe-plugin-sdk-rust-0.4.0.crate` and `.sha256` | Pin the tag as a Git dependency (`Cargo.lock` records the commit), or unpack it as a `path` dependency; compile one backend executable per platform | | [Go](sdk/go/README.md) | Unreleased | Go 1.27.4+ | Go module tags `shared/plugins/sdk/go/v`, served by the Go module proxy with no Release assets; not tagged yet | Pin a tag or commit with `go get` (`go.sum` records the content hash); compile one backend executable per platform | | [Node.js](sdk/node/README.md) | 0.5.0 | Node.js 20.3+ | [`sdk-node-v0.5.0`](https://github.com/Lithe-IDEA/Lithe-core-rust/releases/tag/sdk-node-v0.5.0): `lithe-plugin-sdk-node-0.5.0.tgz` and `.sha256` | Unpack it, copy `package/` into the plugin package, and import it by relative path | -| [Java](sdk/java/README.md) | 0.5.0 | Java 8+ | [`sdk-java-v0.5.0`](https://github.com/Lithe-IDEA/Lithe-core-rust/releases/tag/sdk-java-v0.5.0): `lithe-plugin-sdk-java-0.5.0.jar` and `.sha256` | Shade it into the backend JAR | +| [Java](sdk/java/README.md) | 0.5.0 (source version) | Java 8+ | No corresponding Release; [vendor sources from a pinned Core commit](sdk/java/README.md#getting-the-sdk) | Pin the commit and per-file SHA-256 in `sdk.lock.json`, then compile into the backend JAR | The Rust Git dependency looks like this: @@ -346,7 +346,7 @@ Add the Go SDK like this (until the first tag, name a commit of `main`; Go recor go get github.com/Lithe-IDEA/Lithe-core-rust/shared/plugins/sdk/go@ ``` -All SDK sources live under `sdk/` in this directory. The Node.js, Java, and Rust SDKs are published in the [Core repository's Releases](https://github.com/Lithe-IDEA/Lithe-core-rust/releases) (tags `sdk-node-v`, `sdk-java-v`, `sdk-rust-v`), not on npm, Maven, or crates.io; the Go SDK is a Go module in a subdirectory of this repository, its versions are the tags `shared/plugins/sdk/go/v`, and the Go module proxy and checksum database serve it. The Rust and Go SDKs implement only the plugin backend (`backend`): plugin functions and host services; write build backends with the Node.js or Java SDK and VCS backends with the Node.js SDK. Each SDK's README has a "What the Lithe desktop serves" section naming the protocols the Lithe desktop client provides; the version of each protocol is in [Process protocol versions](reference/capabilities-and-versions.md#process-protocol-versions). The versions above all speak the version `0` protocols; the retired `lithe-plugin-docs` repository published earlier SDKs that speak an older protocol, and the Lithe desktop client does not accept plugins written with them, so use only versions released from the Core repository. +All SDK sources live under `sdk/` in this directory. The Node.js and Rust SDK release location is the [Core repository's Releases](https://github.com/Lithe-IDEA/Lithe-core-rust/releases) (tags `sdk-node-v` and `sdk-rust-v`), not npm or crates.io; the Java SDK has no corresponding Release or Maven repository publication, so [vendor its sources from a pinned Core commit](sdk/java/README.md#getting-the-sdk); the Go SDK is a Go module in a subdirectory of this repository, its versions are the tags `shared/plugins/sdk/go/v`, and the Go module proxy and checksum database serve it. The Rust and Go SDKs implement only the plugin backend (`backend`): plugin functions and host services; write build backends with the Node.js or Java SDK and VCS backends with the Node.js SDK. Each SDK's README has a "What the Lithe desktop serves" section naming the protocols the Lithe desktop client provides; the version of each protocol is in [Process protocol versions](reference/capabilities-and-versions.md#process-protocol-versions). The versions above all speak the version `0` protocols; the retired `lithe-plugin-docs` repository published earlier SDKs that speak an older protocol, and the Lithe desktop client does not accept plugins written with them, so use only SDKs from the Core repository. Download SDKs and plugin backends at build time and verify against the SHA-256 (or Git commit, or `go.sum`) you pinned. An installed package has no `npm install` step. Large independent dependencies can declare [`managedRuntimes`](contract/v1/README.md#managed-runtimes): the host verifies and prepares them after approved installation, and complete cached sets work offline. Plugin launch scripts must not bypass this declaration or rewrite the package. diff --git a/shared/plugins/guides/plugin-backend-workspace.md b/shared/plugins/guides/plugin-backend-workspace.md index 2210367a..4f3ae445 100644 --- a/shared/plugins/guides/plugin-backend-workspace.md +++ b/shared/plugins/guides/plugin-backend-workspace.md @@ -13,8 +13,7 @@ > 四个官方 SDK 都实现了本篇的协议:Node.js SDK 0.5.0、Java SDK 0.5.0、Rust SDK 0.4.0 和 Go SDK(还没有发布标签) > (见各自 README 的 Host services:[Node.js](../sdk/node/README.md#host-services)、[Java](../sdk/java/README.md#host-services)、 > [Rust](../sdk/rust/README.md#host-services)、[Go](../sdk/go/README.md#host-services);发布页:[sdk-node-v0.5.0](https://github.com/Lithe-IDEA/Lithe-core-rust/releases/tag/sdk-node-v0.5.0)、 -> [sdk-java-v0.5.0](https://github.com/Lithe-IDEA/Lithe-core-rust/releases/tag/sdk-java-v0.5.0)、 -> [sdk-rust-v0.4.0](https://github.com/Lithe-IDEA/Lithe-core-rust/releases/tag/sdk-rust-v0.4.0))。用其他语言需要自己处理下文的请求和通知。 +> [sdk-rust-v0.4.0](https://github.com/Lithe-IDEA/Lithe-core-rust/releases/tag/sdk-rust-v0.4.0);Java SDK [固定 Core commit 引入源码](../sdk/java/README.md#getting-the-sdk))。用其他语言需要自己处理下文的请求和通知。 > 各能力在 Core 和桌面端的支持情况见[能力与协议版本对照](../reference/capabilities-and-versions.md)。对契约有疑问,请到 > [Lithe-core-rust 的 Issues](https://github.com/Lithe-IDEA/Lithe-core-rust/issues) 反馈。 @@ -339,8 +338,7 @@ The [contract](../contract/v1/README.md#backend-lifecycle-and-workspace-contexts > All four official SDKs implement the protocol in this guide: Node.js SDK 0.5.0, Java SDK 0.5.0, Rust SDK 0.4.0, and the Go SDK (not tagged yet) > (see Host services in each README: [Node.js](../sdk/node/README.md#host-services), [Java](../sdk/java/README.md#host-services), > [Rust](../sdk/rust/README.md#host-services), [Go](../sdk/go/README.md#host-services); release pages: [sdk-node-v0.5.0](https://github.com/Lithe-IDEA/Lithe-core-rust/releases/tag/sdk-node-v0.5.0), -> [sdk-java-v0.5.0](https://github.com/Lithe-IDEA/Lithe-core-rust/releases/tag/sdk-java-v0.5.0), -> [sdk-rust-v0.4.0](https://github.com/Lithe-IDEA/Lithe-core-rust/releases/tag/sdk-rust-v0.4.0)). With another language, handle the requests and notifications below yourself. +> [sdk-rust-v0.4.0](https://github.com/Lithe-IDEA/Lithe-core-rust/releases/tag/sdk-rust-v0.4.0); Java uses [sources from a pinned Core commit](../sdk/java/README.md#getting-the-sdk)). With another language, handle the requests and notifications below yourself. > For how far Core and the desktop support each capability, see the [capability and protocol versions](../reference/capabilities-and-versions.md). Questions about the contract go to > [Lithe-core-rust Issues](https://github.com/Lithe-IDEA/Lithe-core-rust/issues). diff --git a/shared/plugins/guides/plugin-logging.md b/shared/plugins/guides/plugin-logging.md index f422defb..aacd6486 100644 --- a/shared/plugins/guides/plugin-logging.md +++ b/shared/plugins/guides/plugin-logging.md @@ -8,7 +8,7 @@ 宿主必须在 initialize 中提供 `capabilities.experimental.litheLogging.versions: [0]`,SDK 回复 `capabilities.experimental.litheLogging.version: 0`。缺少协议时,SDK 拒绝初始化;不自动退回其他日志方式。初始化尚未协商时的失败只通过原有 RPC 错误与宿主进程生命周期记录,不能提前发送未协商的日志通知。 -本文的 API 由 Node.js SDK 0.5.0、Java SDK 0.5.0、Rust SDK 0.4.0 和 Go SDK 提供,前三个的发布标签分别为 `sdk-node-v0.5.0`、`sdk-java-v0.5.0` 和 `sdk-rust-v0.4.0`;Go SDK 的版本是模块标签 `shared/plugins/sdk/go/v<版本>`,目前还没有打过标签。插件在构建输入中锁定对应的 release tag 与 SHA-256(Go 由 `go.sum` 锁定),不要引用开发机的绝对 path 依赖。这些 SDK 要求宿主提供 `litheLogging` 0;在提供它的 Lithe 稳定版发布之前,用这些 SDK 构建的插件把 GitHub Release 标为预发布。 +本文的 API 由 Node.js SDK 0.5.0、Java SDK 0.5.0、Rust SDK 0.4.0 和 Go SDK 提供,Node.js 和 Rust 的发布标签分别为 `sdk-node-v0.5.0` 和 `sdk-rust-v0.4.0`;Java SDK [固定 Core commit 引入源码](../sdk/java/README.md#getting-the-sdk);Go SDK 的版本是模块标签 `shared/plugins/sdk/go/v<版本>`,目前还没有打过标签。插件在构建输入中锁定对应的 release tag 与 SHA-256(Java 源码用 `sdk.lock.json` 固定 Core commit 和逐文件哈希,Go 由 `go.sum` 锁定),不要引用开发机的绝对 path 依赖。这些 SDK 要求宿主提供 `litheLogging` 0;在提供它的 Lithe 稳定版发布之前,用这些 SDK 构建的插件把 GitHub Release 标为预发布。 ### 每种事实与级别 @@ -104,7 +104,7 @@ Plugins use `litheLogging` 0 and `lithe/log` to send restricted operation facts. The host must offer `capabilities.experimental.litheLogging.versions: [0]` in initialize, and the SDK replies with `capabilities.experimental.litheLogging.version: 0`. When the protocol is missing, the SDK refuses to initialize; it does not fall back to another logging path. A failure before initialization has negotiated logging is recorded only through the existing RPC error and the host's process lifecycle; the plugin must not send a log notification before negotiation. -The APIs in this guide are provided by Node.js SDK 0.5.0, Java SDK 0.5.0, Rust SDK 0.4.0, and the Go SDK. The first three have release tags `sdk-node-v0.5.0`, `sdk-java-v0.5.0`, and `sdk-rust-v0.4.0`; the Go SDK's versions are the module tags `shared/plugins/sdk/go/v`, and none has been pushed yet. Pin the matching release tag and SHA-256 in your build inputs (for Go, `go.sum` pins it); do not depend on an absolute path on a development machine. These SDKs require the host to offer `litheLogging` 0; until a stable Lithe release offers it, mark the GitHub Release of a plugin built with these SDKs as a prerelease. +The APIs in this guide are provided by Node.js SDK 0.5.0, Java SDK 0.5.0, Rust SDK 0.4.0, and the Go SDK. Node.js and Rust have release tags `sdk-node-v0.5.0` and `sdk-rust-v0.4.0`; Java uses [sources from a pinned Core commit](../sdk/java/README.md#getting-the-sdk); the Go SDK's versions are the module tags `shared/plugins/sdk/go/v`, and none has been pushed yet. Pin the matching release tag and SHA-256 in your build inputs (for Java sources, `sdk.lock.json` pins the Core commit and per-file hashes; for Go, `go.sum` pins it); do not depend on an absolute path on a development machine. These SDKs require the host to offer `litheLogging` 0; until a stable Lithe release offers it, mark the GitHub Release of a plugin built with these SDKs as a prerelease. ### Facts and levels diff --git a/shared/plugins/reference/capabilities-and-versions.md b/shared/plugins/reference/capabilities-and-versions.md index b2ac6d54..8c9d4a6c 100644 --- a/shared/plugins/reference/capabilities-and-versions.md +++ b/shared/plugins/reference/capabilities-and-versions.md @@ -116,7 +116,7 @@ Core 列以本仓库 `main` 上的 Core 源码为准([`capabilities.rs`](https ### 官方 SDK -Node.js SDK 0.5.0、Java SDK 0.5.0、Rust SDK 0.4.0 和还没发布的 Go SDK 说的是版本 `0` 的协议;`main` 上的 Node.js 和 Java SDK 源码另外支持 `litheBuild` `1`(`lithe/build/runEntrypoints`),`main` 上的 Rust SDK 源码新增了 `litheBuild` `0` 和 `1`,都回答宿主提供的最新版本,随下一次 SDK 发布提供;各 SDK 封装哪些协议见契约的 [Official backend SDK](../contract/v1/README.md#official-backend-sdk) 和各自的 [Node.js](../sdk/node/README.md)、[Java](../sdk/java/README.md)、[Rust](../sdk/rust/README.md)、[Go](../sdk/go/README.md) README。Node.js、Java、Rust 的下载地址在 [Lithe-core-rust 的 Releases](https://github.com/Lithe-IDEA/Lithe-core-rust/releases);Go SDK 不放 Releases,用 `go get` 按模块标签 `shared/plugins/sdk/go/v<版本>` 获取。新插件优先用 Rust 或 Go SDK,理由见[插件开发总览](../README.md)。 +Node.js SDK 0.5.0、Java SDK 0.5.0、Rust SDK 0.4.0 和还没发布的 Go SDK 说的是版本 `0` 的协议;`main` 上的 Node.js 和 Java SDK 源码另外支持 `litheBuild` `1`(`lithe/build/runEntrypoints`),`main` 上的 Rust SDK 源码新增了 `litheBuild` `0` 和 `1`,都回答宿主提供的最新版本,随下一次 SDK 发布提供;各 SDK 封装哪些协议见契约的 [Official backend SDK](../contract/v1/README.md#official-backend-sdk) 和各自的 [Node.js](../sdk/node/README.md)、[Java](../sdk/java/README.md)、[Rust](../sdk/rust/README.md)、[Go](../sdk/go/README.md) README。Node.js、Rust 的发布入口在 [Lithe-core-rust 的 Releases](https://github.com/Lithe-IDEA/Lithe-core-rust/releases);Java SDK 按[获取说明](../sdk/java/README.md#getting-the-sdk)固定 Core commit 引入源码;Go SDK 不放 Releases,用 `go get` 按模块标签 `shared/plugins/sdk/go/v<版本>` 获取。新插件优先用 Rust 或 Go SDK,理由见[插件开发总览](../README.md)。 --- @@ -234,4 +234,4 @@ The `version` of an exported or called plugin function (1 to 1000) is not a cont ### Official SDKs -Node.js SDK 0.5.0, Java SDK 0.5.0, Rust SDK 0.4.0, and the unreleased Go SDK speak the version `0` protocols; the Node.js and Java SDK sources on `main` also speak `litheBuild` `1` (`lithe/build/runEntrypoints`), and the Rust SDK source on `main` adds `litheBuild` `0` and `1`; each answers the newest version the host offers, which the next SDK release ships; which protocols each SDK wraps is in the contract's [Official backend SDK](../contract/v1/README.md#official-backend-sdk) and in the [Node.js](../sdk/node/README.md), [Java](../sdk/java/README.md), [Rust](../sdk/rust/README.md), and [Go](../sdk/go/README.md) READMEs. Node.js, Java, and Rust downloads are on the [Lithe-core-rust Releases](https://github.com/Lithe-IDEA/Lithe-core-rust/releases) page; the Go SDK is not on Releases and is fetched with `go get` by module tag `shared/plugins/sdk/go/v`. New plugins should prefer the Rust or Go SDK; see the [plugin overview](../README.md) for why. +Node.js SDK 0.5.0, Java SDK 0.5.0, Rust SDK 0.4.0, and the unreleased Go SDK speak the version `0` protocols; the Node.js and Java SDK sources on `main` also speak `litheBuild` `1` (`lithe/build/runEntrypoints`), and the Rust SDK source on `main` adds `litheBuild` `0` and `1`; each answers the newest version the host offers, which the next SDK release ships; which protocols each SDK wraps is in the contract's [Official backend SDK](../contract/v1/README.md#official-backend-sdk) and in the [Node.js](../sdk/node/README.md), [Java](../sdk/java/README.md), [Rust](../sdk/rust/README.md), and [Go](../sdk/go/README.md) READMEs. Node.js and Rust use the [Lithe-core-rust Releases](https://github.com/Lithe-IDEA/Lithe-core-rust/releases) page; Java uses [sources from a pinned Core commit](../sdk/java/README.md#getting-the-sdk); the Go SDK is not on Releases and is fetched with `go get` by module tag `shared/plugins/sdk/go/v`. New plugins should prefer the Rust or Go SDK; see the [plugin overview](../README.md) for why. diff --git a/shared/plugins/reference/domains/backend.md b/shared/plugins/reference/domains/backend.md index 6b0d07ef..ad17a41b 100644 --- a/shared/plugins/reference/domains/backend.md +++ b/shared/plugins/reference/domains/backend.md @@ -20,7 +20,7 @@ | API 编号 | API-01、04、05、06、07、08、20、21、22、23、24、35、37、40、41,见 [API 总表](../api-catalog.md#现在能用的-api) | | 权限 | `backend.launch`;宿主服务按方法另加权限(`credentials.store`、`workspace.metadata`、`workspace.files.read`、`workspace.files.watch`、`workspace.search`、`terminal.create`、`run.start` 等),见[已公开的宿主方法](../api-catalog.md#已公开的宿主方法)。跨插件调用没有清单权限:调用方的 `calls` 和被调方的 `exports` 就是双方的同意 | | 激活事件 | 至少要有一种启动方式:网页工具窗口第一次调用 `functions.*`;`ui.commands[]` 的命令(`onCommand:`);可选的 `onWorkspaceOpen`;或宿主查询的提供者(工具链或快捷键导入提供者,以及 `launch.kind: "backend"` 的语言服务器)。都没有是 `plugin.manifest.invalid`。只导出函数的插件不需要网页、命令或 `onWorkspaceOpen`,被调用时启动后端;只调用的插件仍要有其中一种 | -| 官方 SDK | [Node.js 0.5.0](../../sdk/node/README.md)、[Java 0.5.0](../../sdk/java/README.md)、[Rust 0.4.0](../../sdk/rust/README.md)、[Go](../../sdk/go/README.md)(未发布),发布标签 `sdk-node-v0.5.0`、`sdk-java-v0.5.0`、`sdk-rust-v0.4.0`,Go 用模块标签 `shared/plugins/sdk/go/v<版本>`(还没有推送),见[官方 SDK](../capabilities-and-versions.md#官方-sdk)。四个 SDK 都实现函数协议,封装凭据、工作区、文档与编辑器(含 `editor/registerActions`)、预览、浏览器、窗口消息、`functions/providers` 和 `functions/invoke`,被调函数能读到 `caller`,用法见各 SDK 的 README;`parentOperationID` 不传时,SDK 取正在处理的 `lithe/function/invoke` 的 `operationID`。`run/*`、`debug/start`、`languageServer/*`、`documents/registerContentProvider` 和 `editor/registerProviders` 没有专门的封装,用 SDK 的通用宿主请求(`request`,Go 是 `Request`)调用。原生终端有封装,见[从插件打开原生终端](../../guides/native-terminals.md) | +| 官方 SDK | [Node.js 0.5.0](../../sdk/node/README.md)、[Java 0.5.0](../../sdk/java/README.md)、[Rust 0.4.0](../../sdk/rust/README.md)、[Go](../../sdk/go/README.md)(未发布),Node.js 和 Rust 的发布标签为 `sdk-node-v0.5.0`、`sdk-rust-v0.4.0`;Java 按[获取说明](../../sdk/java/README.md#getting-the-sdk)固定 Core commit 引入源码,Go 用模块标签 `shared/plugins/sdk/go/v<版本>`(还没有推送),见[官方 SDK](../capabilities-and-versions.md#官方-sdk)。四个 SDK 都实现函数协议,封装凭据、工作区、文档与编辑器(含 `editor/registerActions`)、预览、浏览器、窗口消息、`functions/providers` 和 `functions/invoke`,被调函数能读到 `caller`,用法见各 SDK 的 README;`parentOperationID` 不传时,SDK 取正在处理的 `lithe/function/invoke` 的 `operationID`。`run/*`、`debug/start`、`languageServer/*`、`documents/registerContentProvider` 和 `editor/registerProviders` 没有专门的封装,用 SDK 的通用宿主请求(`request`,Go 是 `Request`)调用。原生终端有封装,见[从插件打开原生终端](../../guides/native-terminals.md) | ### 后端的启动与工作区 @@ -241,7 +241,7 @@ A plugin backend is the plugin's own long-lived process. It runs what a web page | API IDs | API-01, 04, 05, 06, 07, 08, 20, 21, 22, 23, 24, 35, 37, 40, 41; see the [API catalog](../api-catalog.md#apis-usable-now) | | Permissions | `backend.launch`; host services need their own permission per method (`credentials.store`, `workspace.metadata`, `workspace.files.read`, `workspace.files.watch`, `workspace.search`, `terminal.create`, `run.start`, …); see [public host methods](../api-catalog.md#public-host-methods). Cross-plugin calls have no manifest permission: the caller's `calls` and the provider's `exports` are the consent of the two sides | | Activation | At least one way to start is required: a web tool window's first `functions.*` call; a `ui.commands[]` command (`onCommand:`); the optional `onWorkspaceOpen`; or a provider the host queries (a toolchain or keymap import provider, or a language server with `launch.kind: "backend"`). None of them is `plugin.manifest.invalid`. A plugin that only exports functions needs no page, command, or `onWorkspaceOpen`: a call starts its backend; a plugin that only calls still needs one of them | -| Official SDKs | [Node.js 0.5.0](../../sdk/node/README.md), [Java 0.5.0](../../sdk/java/README.md), [Rust 0.4.0](../../sdk/rust/README.md), [Go](../../sdk/go/README.md) (unreleased), released as `sdk-node-v0.5.0`, `sdk-java-v0.5.0`, and `sdk-rust-v0.4.0`, with Go on module tags `shared/plugins/sdk/go/v` (none pushed yet); see [official SDKs](../capabilities-and-versions.md#official-sdks). All four implement the function protocol and wrap credentials, workspaces, documents and editors (including `editor/registerActions`), preview, browser, window messages, `functions/providers`, and `functions/invoke`; a called function can read `caller`; see each SDK's README for usage. When `parentOperationID` is omitted, the SDK uses the `operationID` of the `lithe/function/invoke` being handled. `run/*`, `debug/start`, `languageServer/*`, `documents/registerContentProvider`, and `editor/registerProviders` have no dedicated wrappers; call them through the SDK's generic host request (`request`, `Request` in Go). Native terminals are wrapped; see [Open a native Lithe terminal from a plugin](../../guides/native-terminals.md) | +| Official SDKs | [Node.js 0.5.0](../../sdk/node/README.md), [Java 0.5.0](../../sdk/java/README.md), [Rust 0.4.0](../../sdk/rust/README.md), [Go](../../sdk/go/README.md) (unreleased). Node.js and Rust use release tags `sdk-node-v0.5.0` and `sdk-rust-v0.4.0`; Java uses [sources from a pinned Core commit](../../sdk/java/README.md#getting-the-sdk); Go uses module tags `shared/plugins/sdk/go/v` (none pushed yet); see [official SDKs](../capabilities-and-versions.md#official-sdks). All four implement the function protocol and wrap credentials, workspaces, documents and editors (including `editor/registerActions`), preview, browser, window messages, `functions/providers`, and `functions/invoke`; a called function can read `caller`; see each SDK's README for usage. When `parentOperationID` is omitted, the SDK uses the `operationID` of the `lithe/function/invoke` being handled. `run/*`, `debug/start`, `languageServer/*`, `documents/registerContentProvider`, and `editor/registerProviders` have no dedicated wrappers; call them through the SDK's generic host request (`request`, `Request` in Go). Native terminals are wrapped; see [Open a native Lithe terminal from a plugin](../../guides/native-terminals.md) | ### Backend start and workspaces diff --git a/shared/plugins/reference/domains/build-providers.md b/shared/plugins/reference/domains/build-providers.md index 820c9bc5..83658199 100644 --- a/shared/plugins/reference/domains/build-providers.md +++ b/shared/plugins/reference/domains/build-providers.md @@ -19,7 +19,7 @@ | API 编号 | [API-29](../api-catalog.md#现在能用的-api):构建、任务、测试、运行准备 | | 权限 | `process.build`;自有进程的提供者加 `languageServer.launch`;原生调试准备加 `debug.launch` | | 激活事件 | `onBuildSystem:`;提供者在第一次由用户操作触发的构建请求时启动 | -| 官方 SDK | [Node.js 0.5.0](../../sdk/node/README.md) 和 [Java 0.5.0](../../sdk/java/README.md) 有 `litheBuild` 的类型化处理器:模型、依赖、任务执行、测试执行、测试发现、运行准备、调试准备;原生配置(`lithe/build/configuration`、`editConfiguration`)没有类型化处理器。[Rust 0.4.0](../../sdk/rust/README.md) 没有构建提供者接口;`main` 上的 Rust SDK 源码有同样的类型化处理器(另含运行入口),随下一次 Rust SDK 发布提供。发布标签 `sdk-node-v0.5.0`、`sdk-java-v0.5.0`、`sdk-rust-v0.4.0`,见[官方 SDK](../capabilities-and-versions.md#官方-sdk) | +| 官方 SDK | [Node.js 0.5.0](../../sdk/node/README.md) 和 [Java 0.5.0](../../sdk/java/README.md) 有 `litheBuild` 的类型化处理器:模型、依赖、任务执行、测试执行、测试发现、运行准备、调试准备;原生配置(`lithe/build/configuration`、`editConfiguration`)没有类型化处理器。[Rust 0.4.0](../../sdk/rust/README.md) 没有构建提供者接口;`main` 上的 Rust SDK 源码有同样的类型化处理器(另含运行入口),随下一次 Rust SDK 发布提供。Node.js 和 Rust 的发布标签为 `sdk-node-v0.5.0`、`sdk-rust-v0.4.0`;Java 按[获取说明](../../sdk/java/README.md#getting-the-sdk)固定 Core commit 引入源码,见[官方 SDK](../capabilities-and-versions.md#官方-sdk) | ### 两种形式 @@ -139,7 +139,7 @@ Some build tools expose their project model only through their own API (the Grad | API IDs | [API-29](../api-catalog.md#apis-usable-now): build, tasks, tests, run preparation | | Permissions | `process.build`; `languageServer.launch` for an own-process provider; `debug.launch` for native debug preparation | | Activation events | `onBuildSystem:`; a provider starts on the first build request, which only a user action sends | -| Official SDKs | [Node.js 0.5.0](../../sdk/node/README.md) and [Java 0.5.0](../../sdk/java/README.md) have typed `litheBuild` handlers: model, dependencies, task execution, test execution, test discovery, run preparation, and debug preparation; native configuration (`lithe/build/configuration`, `editConfiguration`) has no typed handler. [Rust 0.4.0](../../sdk/rust/README.md) has no build-provider interface; the Rust SDK source on `main` has the same typed handlers (plus run entrypoints), shipping in the next Rust SDK release. Released as `sdk-node-v0.5.0`, `sdk-java-v0.5.0`, and `sdk-rust-v0.4.0`; see [official SDKs](../capabilities-and-versions.md#official-sdks) | +| Official SDKs | [Node.js 0.5.0](../../sdk/node/README.md) and [Java 0.5.0](../../sdk/java/README.md) have typed `litheBuild` handlers: model, dependencies, task execution, test execution, test discovery, run preparation, and debug preparation; native configuration (`lithe/build/configuration`, `editConfiguration`) has no typed handler. [Rust 0.4.0](../../sdk/rust/README.md) has no build-provider interface; the Rust SDK source on `main` has the same typed handlers (plus run entrypoints), shipping in the next Rust SDK release. Node.js and Rust use release tags `sdk-node-v0.5.0` and `sdk-rust-v0.4.0`; Java uses [sources from a pinned Core commit](../../sdk/java/README.md#getting-the-sdk); see [official SDKs](../capabilities-and-versions.md#official-sdks) | ### Two forms diff --git a/shared/plugins/sdk/java/README.md b/shared/plugins/sdk/java/README.md index b65ddc35..4501f4f2 100644 --- a/shared/plugins/sdk/java/README.md +++ b/shared/plugins/sdk/java/README.md @@ -135,16 +135,41 @@ backend.view("explorer.draw", (event, context) -> { ## Getting the SDK -The SDK is released from this repository, tagged `sdk-java-v`; the -current release is -[0.5.0](https://github.com/Lithe-IDEA/Lithe-core-rust/releases/tag/sdk-java-v0.5.0). -A release ships `lithe-plugin-sdk-java-.jar` and a `.sha256` file -holding the JAR's SHA-256. The SDK is not published to a Maven repository. Use -it like this: - -1. Download the JAR during your plugin's build, never at runtime. -2. Check the JAR against the SHA-256 you pinned in your repository. -3. Shade it into your backend JAR, as the sample's `pom.xml` does. +Use the SDK sources from a pinned commit of this repository. The `0.5.0` in +[`pom.xml`](pom.xml) is the source version; there is no corresponding +`sdk-java-v0.5.0` release to download. The SDK is not published to a Maven +repository. + +Vendor the SDK in your plugin repository: + +1. Check out the reviewed **full Core commit SHA**, rather than a moving + branch such as `main`. Copy the production sources from + [`plugin-sdk/src/main/java`](plugin-sdk/src/main/java) into + `vendor/lithe-plugin-sdk-java/src/main/java` in your plugin. Copy + [`shared/plugins/LICENSE`](../../LICENSE) to `vendor/LICENSE` as well. +2. Record the inputs in `sdk.lock.json`: `schemaVersion: 1`, + `source.repository: "https://github.com/Lithe-IDEA/Lithe-core-rust"`, + `source.revision` containing that full commit SHA, and a `files` array + containing every copied file, including the license. Each entry records its + `upstream` path in Core, its `path` in your plugin, and the `sha256` of + the exact file bytes. Commit the sources, license, and lock together. +3. Before compiling, verify every vendored file against the lock. Fail the + build on missing, changed, duplicate, or unpinned files. Normal builds + check the recorded hashes; they must not regenerate them. An SDK upgrade + deliberately updates the reviewed commit, copied files, and lock together, + removing files that the new revision no longer supplies. +4. Compile the vendored sources together with your backend, targeting Java 8 + (for example, `javac --release 8` with a newer JDK), and package all the + classes in the backend JAR. Include the SDK license in your plugin package. + If your build compiles the SDK as a separate local JAR, shade it into the + backend as [`examples/sample-build/pom.xml`](examples/sample-build/pom.xml) + does. + +The [Maven plugin's lock](https://github.com/Lithe-IDEA/lithe-plugin-maven/blob/d94e862198deca36e51eb3cbdfe4a2133ee887ae/sdk.lock.json) +and [hash verifier](https://github.com/Lithe-IDEA/lithe-plugin-maven/blob/d94e862198deca36e51eb3cbdfe4a2133ee887ae/scripts/sdk/verify-sdk.mjs) +show the lock format and build-time check. The +[Tomcat plugin's packaging script](https://github.com/Lithe-IDEA/lithe-plugin-tomcat/blob/36c5b7ece9c6ec185f3ba16ac543e132bb4f0cf1/scripts/package.mjs) +shows how to compile the vendored sources and include the SDK license. A plugin package is installed read-only and must run offline, so the backend JAR it starts must hold everything it loads.