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
22 changes: 10 additions & 12 deletions rust/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

73 changes: 49 additions & 24 deletions rust/contracts/rust-core-api.md
Original file line number Diff line number Diff line change
Expand Up @@ -445,7 +445,7 @@ or removing a command fails until the table changes in the same commit.
| `ai.inlineEdit.plan` | Plan a credential-free inline edit request |
| `ai.inlineEdit.decode` | Decode the replacement text of an inline edit response |
| `plugins.declarative.validate` | Validate and normalize a declarative plugin manifest |
| `plugins.nativeUI.validateData` | Validate native plugin UI data with declaration identity and node budgets |
| `plugins.ui.applyResult` | Check a backend result for a plugin view and return the whole view to draw |
| `plugins.web.open` | Register a plugin page for a web tool window |
| `plugins.web.close` | Forget a plugin page and lists its calls to cancel |
| `plugins.web.resource` | Decide how a plugin page request is served |
Expand Down Expand Up @@ -4953,6 +4953,12 @@ Success returns `{ status: "ok", state }`. The state contains:
the manifest's section title (the empty heading first), so a translation
changes only the shown `title`. References are zero-based indices
into `rows` and `actions`; declaration order is retained within each section.
- `region`: present when the plugin placed a settings region on its own
Settings tab: `{ id, keywords, view? }`. `keywords` are the manifest
keywords followed by the translated ones that differ, so both languages
find the page. `view` is `{ function }`; the host calls it and draws each
result through `plugins.ui.applyResult`. Each entry of `pages` carries the
region placed on that page in the same shape.
- `editors`: `{ global, project }`, each an array in exactly `rows` order.
Every entry contains `value`, `resetValue`, `source`, `editable`, `overridden`
and `invalidStored`, plus `input`/`resetInput` native-control projections.
Expand Down Expand Up @@ -6224,21 +6230,33 @@ registered in Core for their lifetime:
`build.runChanged` and returns `{ message }`, `null` when the page is
closed or the progress is for a call that ended or has no page ID.

### Native plugin UI data

`plugins.nativeUI.validateData` accepts `{ ui, data }`, where `ui` is the
validated native declaration (`schemaVersion` 0) and `data` is a provider's `{ nodes }`
reply. It returns `{ status: "ok", nodes }` or
`{ status: "rejected", error: { code: "plugin.ui.invalidData", message } }`.
Malformed envelopes remain Core `invalid_request` failures. The operation uses
the same identity, literal label, nesting and node budgets as manifest validation
and rejects data above 1 MiB. Form declarations validate bounded input/select/checkbox
controls (including search/editor/segmented/stepper), typed scalar defaults, choices,
info, button action references/width policies and onCommit references; form source replies
require empty nodes. Hosts inject this typed operation into their
presentation feature; views never call the C ABI. Windows can reuse validation
when it later adds a native renderer; Core support does not make Windows
advertise native plugin content.
### Plugin views

`plugins.ui.applyResult` accepts `{ manifest, surface, view?, result }`.
`surface` names exactly one declared place that draws a view:
`{ toolWindowID }` for a tool window whose body is `view`, or
`{ settingRegionID }` for a settings region with a `view`. `view` is the
view the host drew last and is absent before the first result. `result` is
what the plugin's view function returned: `{ view }` (a whole view),
`{ patches }` (edits to `view`) or `{}` (nothing changed).

It returns `{ status: "ok", view: { view, changed } }`, where `view` is the
complete checked view to draw and `changed` tells whether it differs from
the one drawn, or `{ status: "rejected", error: { code:
"plugin.ui.invalidView", message, field } }`, where `field` is the JSON path
of the first problem (`result.view[0].type`, `result.patches[1].id`, or
`view[...]` for a patched view). After a refusal the host keeps drawing the
previous view. Malformed envelopes remain Core `invalid_request` failures.

Core checks the node vocabulary, the budgets, which nodes each surface
allows, and every reference to the manifest: bound controls and setting rows
name declared settings of a type the control edits, setting-action buttons
name declared setting actions, and tool rows name tools the plugin defines
or requires. Patches apply in order to a copy of `view`; a patch whose target
is missing refuses the whole result. Hosts call this operation for every
result and only render; they keep no second validator or patch engine. The
vocabulary and budgets are in the plugin contract README and
`plugin-ui.schema.json`.

### Workspace indexing policy

Expand Down Expand Up @@ -7186,16 +7204,23 @@ This is an internal desktop command, not a new public plugin host method.

Internal desktop commands reuse the validated settings manifest. They do not
add plugin RPCs or admit capabilities. `plugins.settings.catalog` accepts up to
64 `{manifest, owner: {pluginID, version}, enabled}` records. It validates all
64 `{manifest, owner: {pluginID, version}, enabled, localizations?}` records
and an optional `language`. It validates all
identities, rejects duplicates and returns deterministic `pages` (up to 512),
with stable `key`, `kind` (`language` or `buildSystem`), opaque `id`, display
`title`, and plugin-ID ordered `contributors` (`pluginID`, `version`, `title`,
`sections`). Sections reference indices in the complete settingsState rows and
actions. Only enabled contributors create pages; action-only pages are valid.
with stable `key`, `kind` (`language`, `buildSystem` or `compiler`), opaque
`id`, display `title`, and plugin-ID ordered `contributors` (`pluginID`,
`version`, `title`, `sections`, `region?`, `localization?`). Sections reference
indices in the complete settingsState rows and actions. Only enabled
contributors create pages; action-only and region-only pages are valid.
Names come from enabled language/build declarations, with opaque ID fallback.
`settingsState.pages` supplies the same per-plugin placement projections, with
section titles translated when the state is. Catalog contributor sections keep
the manifest headings.
`settingsState.pages` supplies the same per-plugin placement projections.
`region` is the settings region the contributor placed on the page
(`{ id, keywords, view? }`, as in settingsState); hosts add its keywords to
the page's search terms. With `language`, each record's `localizations`
follows the settingsState rules: section titles are translated, translated
region keywords are appended, and `localization` is that plugin's report.
Without `language`, sections keep the manifest headings and no report is
returned.

`plugins.settings.navigation` accepts at most 576 `items` (512 contributed pages plus 64 host entries), up to three levels
deep, with stable `id`, `title`, nullable `parent`, `group`, `expanded` and optional `keywords`, plus `query` (at
Expand Down
2 changes: 1 addition & 1 deletion rust/crates/core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ lithe-plugin-manifest = { path = "../plugin-manifest" }
lithe-plugin-lifecycle = { path = "../plugin-lifecycle" }
lithe-plugin-marketplace = { path = "../plugin-marketplace" }
lithe-plugin-model = { path = "../plugin-model" }
lithe-plugin-native-ui = { path = "../plugin-native-ui" }
lithe-plugin-ui = { path = "../plugin-ui" }
lithe-plugin-output-links = { path = "../plugin-output-links" }
lithe-plugin-rpc = { path = "../plugin-rpc" }
lithe-plugin-web-content = { path = "../plugin-web-content" }
Expand Down
10 changes: 4 additions & 6 deletions rust/crates/core/src/protocol/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ pub enum CoreCommand {
SearchActions,
/// AI commit, pull request and inline edit planning run by `lithe-ai` (`ai.*`).
Ai(AiCommand),
/// Plugin manifests, native UI and web content, plugin settings, installed
/// Plugin manifests, plugin views and web content, plugin settings, installed
/// plugins and the marketplace (`plugins.*`).
Plugins(PluginsCommand),
/// Debug adapters, transports, sessions, breakpoints and inspection (`debug.*`).
Expand Down Expand Up @@ -206,8 +206,8 @@ pub enum AiCommand {
pub enum PluginsCommand {
/// Validates and normalizes a declarative plugin manifest (`plugins.declarative.validate`).
DeclarativeValidate,
/// Validates native plugin UI data with declaration identity and node budgets.
NativeUIValidateData,
/// Checks what a backend returned for a plugin view and gives the whole view to draw (`plugins.ui.applyResult`).
UIApplyResult,
/// Registers a plugin page for a web tool window (`plugins.web.open`).
WebOpen,
/// Forgets a plugin page and lists its calls to cancel (`plugins.web.close`).
Expand Down Expand Up @@ -1040,9 +1040,7 @@ impl CoreCommand {
"plugins.declarative.validate" => {
Some(Self::Plugins(PluginsCommand::DeclarativeValidate))
}
"plugins.nativeUI.validateData" => {
Some(Self::Plugins(PluginsCommand::NativeUIValidateData))
}
"plugins.ui.applyResult" => Some(Self::Plugins(PluginsCommand::UIApplyResult)),
"plugins.web.open" => Some(Self::Plugins(PluginsCommand::WebOpen)),
"plugins.web.close" => Some(Self::Plugins(PluginsCommand::WebClose)),
"plugins.web.resource" => Some(Self::Plugins(PluginsCommand::WebResource)),
Expand Down
6 changes: 3 additions & 3 deletions rust/crates/core/src/runtime/dispatcher/plugins.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//! `plugins.*` commands: plugin manifests, native UI and web content, plugin settings,
//! `plugins.*` commands: plugin manifests, plugin views and web content, plugin settings,
//! installed plugins and the marketplace.

use super::plugin_response;
Expand All @@ -12,8 +12,8 @@ pub(super) fn dispatch(
payload: Value,
) -> CoreResponse {
match command {
PluginsCommand::NativeUIValidateData => {
plugin_response(id, payload, lithe_plugin_native_ui::validate_data_command)
PluginsCommand::UIApplyResult => {
plugin_response(id, payload, lithe_plugin_manifest::apply_result_command)
}
PluginsCommand::WebOpen => {
plugin_response(id, payload, lithe_plugin_web_content::open_command)
Expand Down
Loading
Loading