Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 21 additions & 4 deletions shared/plugins/contract/v1/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5245,24 +5245,34 @@ A canvas draws its `nodes` in order, in `viewBox` coordinates
tall (1–2000). `label` is the scene's accessible name. `pan` lets the user
drag the empty area, and `zoom` is the `[minimum, maximum]` range around 1
(0.05–20); the host draws the zoom buttons. The scroll wheel scrolls the page;
⌘ or Ctrl with the wheel, or a pinch, zooms.
⌘ or Ctrl with the wheel zooms, and so does a pinch on a host that reports one.

| `type` | Fields |
| --- | --- |
| `rect` | `x`, `y`, `w`, `h`, `radius`, `fill`, `stroke`, `width`, `dash`, `shadow`, `opacity` |
| `path` | `d` (SVG path data, at most 8192 bytes), `bounds` `[x, y, width, height]`, `fill`, `stroke`, `width`, `dash`, `cap`, `rule` (`nonzero`, `evenodd`), `opacity` |
| `text` | `x`, `y`, `text` or up to 64 `runs` `{text, color}`, `style` (`title`, `strong`, `body`, `caption`, `display`, `mono`, `monoSmall`), `align`, `color`, `maxWidth`, `opacity` |
| `image` | `x`, `y`, `w`, `h`, `src`: a PNG path inside the plugin package |
| `image` | `x`, `y`, `w`, `h`, `src`: a PNG path inside the plugin package, `opacity` |
| `group` | `x`, `y`, `scale`, `w`, `h`, `radius`, `clip`, `children`, `on` (`click`), `label`, `tooltip`, `states` (`hover`, `pressed`, `selected`), `selected`, `opacity`, `shadow`, `hidden` |

- Text uses the host's interface and monospace fonts at the named style; a
plugin cannot choose a font. Text longer than `maxWidth` ends with an ellipsis.
- Text is one line with its baseline at `y`. `align` puts the line's start
(the default), middle, or end at `x`. Text uses the host's interface and
monospace fonts at the named style; a plugin cannot choose a font. Text
longer than `maxWidth` ends with an ellipsis.
- A color is `#RRGGBB`, `#RRGGBBAA`, a theme token (`$text`, `$textSecondary`,
`$textMuted`, `$accent`, `$success`, `$warning`, `$error`, `$surface`,
`$background`, `$sidebar`, `$line`, `$hover`, `$selection`, `$badge`), a
`{light, dark}` pair, or `{linear: [[offset, color], …], angle}` with 2–8
stops. Tokens and pairs follow the theme; a fixed color is for content that
shows a color itself, such as a color-scheme preview.
- A gradient's `angle` is in degrees clockwise from pointing up, as in CSS
`linear-gradient`: 0 runs upward, 90 to the right, and 180, the default,
downward. Its line passes through the middle of the shape (a path's
`bounds`, or the box of its points) and is as long as it takes for the
corners the angle points at to take the first and the last stop.
- A group's `x` and `y` place its origin, and `scale` scales what is inside
it: its `children`, `w`, `h`, and `radius` are in the group's own
coordinates.
- A group with `on: ["click"]` is a control and needs `id`, `w` and `h` (its
hit area), and `label`, read by screen readers. Tab moves between clickable
groups. The host draws `states` without a round trip: `fill`, `stroke`,
Expand All @@ -5272,6 +5282,12 @@ drag the empty area, and `zoom` is the `[minimum, maximum]` range around 1
and sizes are within ±1,000,000. Blur, filters, blend modes, radial
gradients, custom fonts, animation, and text input are not part of a canvas;
input uses host controls beside it.
- An `image` is read from the installed package the way its icons are: the
path stays inside the package, through real directories, to a regular PNG
file within the limits below. The host loads it off the window thread the
first time a scene draws it and keeps it until the view closes. Until then,
and for a file that is missing, too large, or cannot be decoded, the scene
draws without it; the host logs a failure once.
- Canvas text is not searched. A settings region names its words in
[`keywords`](#settings-regions).

Expand All @@ -5286,6 +5302,7 @@ drag the empty area, and `zoom` is the `[minimum, maximum]` range around 1
| Canvases of one view | 8 |
| Nodes of one canvas | 2000 |
| One canvas scene, as JSON | 256 KiB |
| One canvas image file | 256 KiB, at most 1024 × 1024 pixels |
| Patches of one result | 512 |

Node, tree item, and canvas node IDs are 1–64 letters, digits, `.`, `_`, or
Expand Down
2 changes: 1 addition & 1 deletion shared/plugins/contract/v1/fixtures/ui/view-results.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
{"type": "rect", "x": 0, "y": 0, "w": 320, "h": 160, "radius": 8, "fill": "$surface"},
{"type": "group", "id": "node.core", "x": 20, "y": 20, "w": 120, "h": 40, "radius": 6,
"on": ["click"], "label": "core module", "states": {"hover": {"fill": "$hover"}}, "children": [
{"type": "text", "x": 60, "y": 20, "text": "core", "style": "strong", "align": "center"}
{"type": "text", "x": 60, "y": 25, "text": "core", "style": "strong", "align": "center"}
]}
]}
]
Expand Down
2 changes: 0 additions & 2 deletions shared/plugins/reference/capabilities-and-versions.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@ Core 列以本仓库 `main` 上的 Core 源码为准([`capabilities.rs`](https
- 构建提供者的调试准备、模型输入、原生配置、内联测试报告和运行期调试;构建系统的实例选项和任务准备。
- 插件声明的运行配置类型只能运行,不能调试。
- 不属于任何工具窗口的 `ui` 命令。
- 工具窗口和设置区域里的[插件视图](../contract/v1/README.md#plugin-views),以及 `settingRegions` 的搜索关键词。
- VCS 提供者的逐行追溯(annotation)、文件历史、文件操作、元数据监听、认证、历史提交差异、项目树与编辑器行号栏状态,以及 `lithe/vcs/execution` 控制台输出。
- 后端宿主服务:工作区文件与搜索(`workspace/readDirectory`、`stat`、`readFile`、`watch`、`findFiles`、`findText`)和 `preview/openHTML` 尚未注册,请求这些权限的插件被拒绝。运行期以 `lithe/host/getCapabilities` 的返回为准,见 [API 总表](api-catalog.md)。

Expand Down Expand Up @@ -188,7 +187,6 @@ Each row is one capability. `requires` lists **exactly** the capabilities a mani
- For build providers: debug preparation, model inputs, native configuration, inline test reports, and runtime debugging; for build systems: instance options and task preparations.
- Run configuration types a plugin declares run but cannot be debugged.
- `ui` commands that belong to no tool window.
- [Plugin views](../contract/v1/README.md#plugin-views) in tool windows and settings regions, and the search keywords of `settingRegions`.
- For VCS providers: annotation, file history, file operations, metadata watching, authentication, history entry diffs, status in the project tree and the editor gutter, and `lithe/vcs/execution` console output.
- Backend host services: the workspace file and search methods (`workspace/readDirectory`, `stat`, `readFile`, `watch`, `findFiles`, `findText`) and `preview/openHTML` are not registered, so a plugin that asks for one of those permissions is refused. At runtime, the reply of `lithe/host/getCapabilities` is authoritative; see the [API catalog](api-catalog.md).

Expand Down
4 changes: 2 additions & 2 deletions shared/plugins/reference/domains/settings.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
| API 编号 | [API-19](../api-catalog.md#现在能用的-api):声明式设置和设置区域。运行期读取、查看来源、修改设置和变化事件仍在计划中。[API-37](../api-catalog.md#现在能用的-api):设置文字的包内翻译 |
| 权限 | 不需要额外权限。设置不会改变运行的程序,所以不进入安装审查的程序列表 |
| 激活事件 | 不需要。值按设置的 `effect` 在下一次启动、模型重载、下一次运行或 `immediate` 推送时生效 |
| 桌面端 | 已声明 `settings`:按语言和构建系统分页、分组、全部控件类型、项目层、生效方式和页面按钮都已呈现。还没有读取包内翻译 `l10n/`,始终显示清单原文;还没有呈现设置区域 `settingRegions` |
| 桌面端 | 已声明 `settings`:按语言和构建系统分页、分组、全部控件类型、项目层、生效方式、页面按钮和设置区域 `settingRegions`(搜索关键词和插件视图)都已呈现,并按界面语言显示包内翻译 `l10n/` |

### 设置类型

Expand Down Expand Up @@ -166,7 +166,7 @@ A plugin declares, in its manifest, the options a user may change. The host draw
| API IDs | [API-19](../api-catalog.md#apis-usable-now): declarative settings and settings regions. Runtime reads, source inspection, writes, and change events are still planned. [API-37](../api-catalog.md#apis-usable-now): packaged translations of settings text |
| Permissions | None. Settings never change which program runs, so they are not in the install review's program list |
| Activation | Not needed. Values take effect according to the setting's `effect`: at the next start, a model reload, the next run, or an `immediate` push |
| Desktop | Declares `settings`: pages per language and build system, sections, every control type, the project layer, effects, and page buttons are presented. It does not read packaged translations `l10n/` yet and always shows the manifest text, and does not present settings regions `settingRegions` yet |
| Desktop | Declares `settings`: pages per language and build system, sections, every control type, the project layer, effects, page buttons, and settings regions `settingRegions` (search keywords and plugin views) are presented, in the interface language from the packaged translations `l10n/` |

### Setting types

Expand Down
4 changes: 2 additions & 2 deletions shared/plugins/reference/domains/ui.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
| API 编号 | API-02、03、13、14、17,见 [API 总表](../api-catalog.md#现在能用的-api) |
| 权限 | `ui.contribute`;网页加 `ui.web`;没有窗口的命令加 `backend.launch`;后端弹出消息用 `window.messages` |
| 激活事件 | 每个窗口 `onView:<window-id>`,每个命令 `onCommand:<command-id>` |
| Lithe 桌面端 | 声明 `ui` 0,呈现文本和网页工具窗口,以及打开工具窗口的命令;插件视图的桌面绘制在后续桌面端 PR 中接入。不呈现不属于任何工具窗口的命令:这类包照常安装,但这些命令没有入口 |
| Lithe 桌面端 | 声明 `ui` 0,呈现文本、网页和插件视图工具窗口,以及打开工具窗口的命令;插件视图用 Viva 原生绘制宿主控件、树和画布。不呈现不属于任何工具窗口的命令:这类包照常安装,但这些命令没有入口 |

### 规则

Expand Down Expand Up @@ -70,7 +70,7 @@ A plugin can place tool windows and commands in the workbench. The window shell
| API IDs | API-02, 03, 13, 14, 17; see the [API catalog](../api-catalog.md#apis-usable-now) |
| Permissions | `ui.contribute`; `ui.web` for web pages; `backend.launch` for a command without a window; `window.messages` for messages shown by the backend |
| Activation events | `onView:<window-id>` per window, `onCommand:<command-id>` per command |
| Lithe desktop | Declares `ui` 0 and presents text and web tool windows, and commands that open a tool window; desktop drawing of plugin views lands in a later desktop PR. It does not present commands that belong to no tool window: such packages install, but those commands have no entry point |
| Lithe desktop | Declares `ui` 0 and presents text, web, and plugin view tool windows, and commands that open a tool window; plugin views draw their host controls, trees, and canvases natively with Viva. It does not present commands that belong to no tool window: such packages install, but those commands have no entry point |

### Rules

Expand Down
5 changes: 3 additions & 2 deletions shared/plugins/reference/protocol-changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

## 待合入

目前没有。
- `ui` 0、`settings` 0 内的说明补充(API-13、API-19):契约 README 写明画布 `image` 节点怎样读取:路径留在插件包内、经过真实目录、指向普通 PNG 文件,单个文件最多 256 KiB、每边最多 1024 像素(预算表新增一行);宿主在场景第一次画到它时于窗口线程外读取,保留到视图关闭,读到之前或读取失败时场景不画它,失败只记一次日志。`image` 节点的字段表补上 `opacity`。文字是一行,基线在 `y`,`align` 把行首(默认)、中点或行尾放在 `x`;渐变 `angle` 与 CSS `linear-gradient` 一致(0 向上、90 向右、默认 180 向下),渐变线穿过形状中心;分组的 `x`、`y` 放置原点,`scale` 缩放内部,`children`、`w`、`h`、`radius` 都在分组自己的坐标里;捏合缩放只在宿主能上报捏合时可用。fixture `fixtures/ui/view-results.json` 的文字基线移到卡片中间。[能力与协议版本对照](capabilities-and-versions.md)删掉“插件视图尚未在桌面端绘制”的脚注,`domains/ui.md`、`domains/settings.md` 的桌面端一行改为已呈现插件视图、设置区域和包内翻译 `l10n/`([1lck/Lithe-IDEA#2181](https://github.com/1lck/Lithe-IDEA/issues/2181))。没有新增版本号、宿主方法、通知或 SDK 版本。实现见 [#105](https://github.com/Lithe-IDEA/Lithe-core-rust/pull/105)。

## 按协议查首次出现

Expand All @@ -27,7 +27,7 @@
| 插件 API 版本 `pluginAPIVersion` | 0 | 2026-11-11 | [#17](https://github.com/Lithe-IDEA/Lithe-core-rust/pull/17) |
| 插件清单 `schemaVersion` | 0 | 2026-11-11 | [#17](https://github.com/Lithe-IDEA/Lithe-core-rust/pull/17) |
| 市场索引 `schemaVersion` | 0 | 2026-11-11 | [#17](https://github.com/Lithe-IDEA/Lithe-core-rust/pull/17) |
| 原生 UI 文档 `schemaVersion`(已删除:`ui` 0 内改为插件视图,视图结果不带版本号,见待合入) | 0 | 2026-11-11 | [#17](https://github.com/Lithe-IDEA/Lithe-core-rust/pull/17) |
| 原生 UI 文档 `schemaVersion`(已删除:`ui` 0 内改为插件视图,视图结果不带版本号,见 [#104](https://github.com/Lithe-IDEA/Lithe-core-rust/pull/104)) | 0 | 2026-11-11 | [#17](https://github.com/Lithe-IDEA/Lithe-core-rust/pull/17) |
| `litheBuildModel`、`litheDependencies`、`litheTestResults`、`litheTestDiscovery`、`litheBuildConfiguration`、`litheConfigurationEdit` 和 `modelInputs` 快照的 `version` | 0 | 2026-11-11 | [#17](https://github.com/Lithe-IDEA/Lithe-core-rust/pull/17) |
| `plugins.editorActions.decode` 请求的 `version` | 0 | 2026-11-11 | [#17](https://github.com/Lithe-IDEA/Lithe-core-rust/pull/17) |
| 插件网页桥 `window.lithe.version` | 0 | 2026-11-11 | [#17](https://github.com/Lithe-IDEA/Lithe-core-rust/pull/17) |
Expand Down Expand Up @@ -148,6 +148,7 @@

| PR | 修改人 | API 编号 | 协议 / 能力 | 改了什么 |
| --- | --- | --- | --- | --- |
| [#104](https://github.com/Lithe-IDEA/Lithe-core-rust/pull/104) | [@xiaoyumuxi](https://github.com/xiaoyumuxi) | API-13、API-19、API-37 | `ui` 0、`settings` 0 内的替换 | 插件视图取代宿主绘制的原生 UI 文档。插件后端的视图函数(经已有的 `lithe/function/invoke` 调用)按事件(`open`、`close`、`click`、`change`、`select`、`activate`、`viewport`、`settings`)返回界面树或补丁:宿主控件(行、分区、文字、输入框、下拉、分段、开关、按钮、键值、表格、横幅、绑定设置的设置行、显示插件工具解析结果的工具行)、树和画布节点(可带圆角的矩形、路径、文字、图片、可点击分组及悬停/按下/选中状态),新 schema [`plugin-ui.schema.json`](../contract/v1/plugin-ui.schema.json) 取代 `native-ui.schema.json`,原生 UI 文档的 `schemaVersion` 一并删除。Core 新增命令 `plugins.ui.applyResult`:按清单、界面(工具窗口或设置区域)和上一版视图校验每个结果,返回新视图和是否变化,超出预算或违反界面规则以 `plugin.ui.invalidView`(带 `field`)拒绝。清单新增 `settingRegions`(最多 16 个):插件在语言、构建系统或编译器页(不写 `page` 时为插件自己的设置标签)放搜索关键词、插件视图或两者,设置搜索按关键词找到页面;`l10n/<语言>.json` 新增 `settingRegions.<id>.keywords`,翻译的关键词追加在声明的后面、忽略大小写去重。fixture `fixtures/ui/view-panel.plugin.json`、`fixtures/ui/view-results.json`,`fixtures/settings/` 补设置区域与中文关键词。Node、Rust、Java 三个 SDK 新增 `view(id, handler)`:把参数读成视图事件(不合法时 `sdk.view.invalidEvent`,处理函数不会运行),把返回的整个视图、补丁或“没有变化”写成结果;Node SDK 的 `index.d.ts` 给出界面节点、画布节点和补丁的类型。没有新增版本号、宿主方法、通知或 SDK 版本;这一版插件不能主动推送视图。 |
| [#102](https://github.com/Lithe-IDEA/Lithe-core-rust/pull/102) | [@xiaoyumuxi](https://github.com/xiaoyumuxi) | API-23、API-19 | `toolDefinitions` 1 内的补充 | `toolchains.settingsView` 的 `issues` 每项改为 `{index,status,group?}`:查询分组时 `group` 是工具所在分组的键,宿主从问题列表打开这个工具时可以一并展开它的分组,不必自己拼分组键;契约 README 同时写明 `issues` 一直不受查询影响、先错误后警告并各按名称排序。没有新增版本号、宿主方法、通知或 SDK 版本。 |
| [#99](https://github.com/Lithe-IDEA/Lithe-core-rust/pull/99) | [@xiaoyumuxi](https://github.com/xiaoyumuxi) | API-23、API-19 | **`toolDefinitions` 1** | 工具定义新增只影响显示位置的 `category`(`runtime`、`build`、`package`、`debug`、`lint`、`other`,默认 `other`)和 `audience`(`user` 默认,`plugin` 表示插件自用的运行时);用到任一字段的插件声明 `toolDefinitions: 1`,只支持 0 的宿主不会安装,其他插件继续写 0。新增 Core 命令 `toolchains.settingsView`:按宿主已有的解析原因、固定和未应用状态给设置页工具列表分类(`error`、`warning`、`ok`)、筛选、分组、折叠和计数,最多 20,000 个工具。`plugins.settings.navigation` 支持三级、每项可选 `limit`(超出的子项折叠成一行“全部 N 个”)以及每行的 `matched` 与 `path`。清单 schema 的 `requires.buildProviders` 补上 #89 已支持的版本 1。没有新增宿主方法、通知或 SDK 版本。宿主须先声明 `toolDefinitions` 1,插件才可要求它。 |
| [#97](https://github.com/Lithe-IDEA/Lithe-core-rust/pull/97) | [@xiaoyumuxi](https://github.com/xiaoyumuxi) | API-29 | **`beforeLaunchTasks` 0** | 运行配置“启动前”的插件任务(对标 IntelliJ IDEA 的“添加新任务”,[1lck/Lithe-IDEA#2100](https://github.com/1lck/Lithe-IDEA/issues/2100)):构建系统新增 `beforeLaunchTasks`(最多 16 个),声明方式和 `runConfigurationTypes` 相同(`id`、`displayName`、可选 `description`、`icon`、最多 16 个 `fields` 和 `arguments` 模板),但任务总是运行到结束,不能写 `execution`,`arguments` 不能用 `${userArguments}`;任务 ID 与类型 ID 各自唯一。运行配置的 `beforeLaunch` 步骤除 `{configuration}` 外新增 `{task: {pluginID, buildSystemID, type, values}}`,任务在拥有这个步骤列表的配置的工作目录里运行,不带程序参数和环境变量;步骤对象不允许出现别的键。Core 新增命令 `runConfig.checkBeforeLaunchTask`(校验“添加新任务”小表单的值,返回要放进字段值的步骤)、`runConfig.beforeLaunchField`(给不用 `runConfig.editorForm` 的编辑器,例如构建运行的编辑器,返回已保存配置的 `beforeLaunch` 字段)和 `build.beforeLaunchTaskPlan`(把任务步骤展开成 argv 计划);`runConfig.editorForm` 的 `beforeLaunch` 字段新增 `tasks`(已安装插件声明的任务种类及其表单),字段值里的任务步骤是 `{task, name, summary, values}`,插件已卸载的是 `{task, name, summary, missing: true}`;`runConfig.beforeLaunch`、`runConfig.updateOptions`、`runConfig.saveEditorChanges` 新增请求字段 `runTypePlugins`,`runConfig.beforeLaunch` 的任务步骤返回 `{task, name, summary, workingDirectory}`,拒绝码新增 `taskNotDeclared` 和 `invalidTaskValues`(带 `task`),确认指纹也覆盖任务及其值和工作目录。`runConfigurationTypes` 的必填 `arguments` 字段留空现在会被拒绝(以前没有执行 `required`)。语言文件新增 `beforeLaunchTasks.<构建系统 ID>.<任务 ID>`;保存的值不合法时是 `plugin.build.invalidBeforeLaunchTask`(字段 `values.<id>`)。新增 fixture `before-launch-tasks/`。用到它的插件声明 `beforeLaunchTasks: 0`,不认识它的宿主不会安装。没有新增宿主方法或通知。 |
Expand Down
Loading