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
51 changes: 13 additions & 38 deletions rust/contracts/application-boundary.md
Original file line number Diff line number Diff line change
Expand Up @@ -535,44 +535,19 @@ application DOM as executable markup. Rendering and resizable layout are owned
by the platform. The behavior fixture is
[`svg-preview-v1.json`](../fixtures/editor/svg-preview-v1.json).

### Optional PHP support

PHP plugin installation is explicit. The base application ships neither a PHP
package nor Node/Bun/Intelephense. macOS installs the Lithe Store package
`io.github.lithe-idea.php-support` through plugin management; the package does not
bundle Intelephense, which the user installs, and its tools are user-owned and
never deleted by Lithe.
Windows installs language tools only on an explicit install/repair action; its
managed tool cache is removed on uninstall without touching global tools. PHP
run/test discovery and launch require enabled support. Disable cancels installation,
stops in-flight and active owned processes, and unregisters providers; closing a
workspace stops that workspace's PHP Run sessions. Shared lexical PHP recognition
may remain available without spawning processes or downloading dependencies.

Windows optional language implementations are single-module worker packages
(`lithe-worker-plugin`, format version 1). PHP configuration and Composer/PHPUnit
plan generation live in `Plugins/win/Official/PhpSupport`; application builds must
not import that implementation, even through a dynamic import. The inert optional
language catalog may identify package ownership without carrying executable code.

A user imports a `.lithe-extension` file through extension management. The package
contains a validated manifest and ESM source (maximum 256 KiB), stored atomically in
the WebView user profile under `lithe.worker-package:<id>`. Import installs language
tools but leaves the plugin disabled; enabling starts the existing worker host.
Incomplete installation is not restored on restart. Uninstall removes the source,
parser cache and owned tools; the application installation directory stays read-only.
Local packages are user-selected code, not authenticated official downloads.

The v1 language package accepts `languages`, `lsp`, and `runActions` declarations;
other host permissions and contributions are not granted. `lsp.requiredExecutables`
is passed to the native tool adapter for PATH validation. `runActions.manifestFiles`
contains at most 16 root-level file names; `executables` names allowed PATH commands.
The worker's `api.runActions.register` receives file contents and returns bounded
plans (`id`, `name`, `sourceLabel`, optional `description`, `executable`, `arguments`).
Only a user click launches a validated plan through the host Run service after saving
the workspace. Workers never own the native process handles; the host tracks both
extension ID and workspace ID, stops pending and active runs on disable/close, and
rejects stale discovery results. Remote/WSL projects do not use these local plans.
## Plugin installation and lifecycle

Plugin installation is subject to explicit user approval. Installed packages
are read-only. The host activates extensions from enabled plugins and applies
the permission and workspace trust rules in the
[plugin contract](../../shared/plugins/contract/v1/README.md#workspace-trust).

The host manages plugin sessions and processes. Disabling a plugin withdraws
its contributions and stops its sessions. Closing a workspace stops the
sessions scoped to it. Uninstall deactivates the plugin before removing its
package and host-managed plugin state. Tools installed and owned by the user
stay in place. See the
[plugin lifecycle guide](../../shared/plugins/guides/lsp-plugin-lifecycle.md#7-treat-stop-failure-and-uninstall-as-acceptance-criteria).

## Text content and language selection

Expand Down
78 changes: 34 additions & 44 deletions rust/contracts/vcs-provider-v1.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,13 @@ This contract defines one VCS-neutral model for the features every version
control system has: roots, file status, base content, history, annotation,
check-in, rollback, and update. A **provider** implements it for one VCS as a
plugin process speaking the LSP base protocol, the same process kind as
[build providers](../../shared/plugins/contract/v1/README.md#build-providers). Subversion is the
first provider.
[build providers](../../shared/plugins/contract/v1/README.md#build-providers).
The examples below use a fictional provider named Sample VCS.

Git is not part of this layer yet. Core recognizes `.git` markers so a nested
working copy is assigned to the right root, and the `git.*` commands keep
serving Git roots unchanged. Features that only exist in one VCS (Git log
graph, rebase, worktrees, stash; Subversion locks, properties, relocate) are
not modeled here.
serving Git roots unchanged. VCS-specific operations are outside the shared
model.

## Shared rules

Expand All @@ -42,15 +41,15 @@ not modeled here.
"requires": { "vcsProviders": 0 },
"requiresTools": ["node"],
"permissions": ["languageServer.launch", "process.vcs"],
"activationEvents": ["onVcsRoot:svn"],
"activationEvents": ["onVcsRoot:sample-vcs"],
"vcsProviders": [
{
"id": "svn",
"displayName": "Subversion",
"detection": { "markers": [{ "name": ".svn", "type": "directory" }] },
"metadataPaths": [".svn/wc.db"],
"tool": { "commands": ["svn"], "validationArguments": ["--version", "--quiet"] },
"launch": { "kind": "runtime", "tool": "node", "minimumVersion": "20.3", "entry": "provider/main.mjs" },
"id": "sample-vcs",
"displayName": "Sample VCS",
"detection": { "markers": [{ "name": ".sample-vcs", "type": "directory" }] },
"metadataPaths": [".sample-vcs/index"],
"tool": { "commands": ["sample-vcs"], "validationArguments": ["--version"] },
"launch": { "kind": "runtime", "tool": "node", "minimumVersion": "22.0", "entry": "provider/main.mjs" },
"arguments": ["--stdio"],
"mayUseNetwork": true
}
Expand Down Expand Up @@ -88,12 +87,12 @@ the process and adds `vcsProvider`, the descriptor below.

```json
{
"vcs": "svn",
"displayName": "Subversion",
"origin": { "kind": "plugin", "pluginID": "io.github.lithe-idea.svn-support" },
"markers": [{ "name": ".svn", "type": "directory" }],
"metadataPaths": [".svn/wc.db"],
"tool": { "commands": ["svn"], "validationArguments": ["--version", "--quiet"] },
"vcs": "sample-vcs",
"displayName": "Sample VCS",
"origin": { "kind": "plugin", "pluginID": "dev.lithe.test.sample-vcs" },
"markers": [{ "name": ".sample-vcs", "type": "directory" }],
"metadataPaths": [".sample-vcs/index"],
"tool": { "commands": ["sample-vcs"], "validationArguments": ["--version"] },
"mayUseNetwork": true
}
```
Expand All @@ -116,7 +115,7 @@ The built-in Git entry is `{ vcs: "git", displayName: "Git", origin: { kind:
{
"workspaceRoot": "/abs/workspace",
"plugins": [{ "manifest": { } }],
"mappings": [{ "id": "mixed", "vcs": "svn" }]
"mappings": [{ "id": "mixed", "vcs": "sample-vcs" }]
}
```

Expand All @@ -131,8 +130,8 @@ call.
"status": "ok",
"detection": {
"providers": [ ],
"roots": [{ "id": "services/legacy", "vcs": "svn", "path": "/abs/workspace/services/legacy", "mapped": false }],
"ambiguous": [{ "id": "mixed", "vcs": ["git", "svn"] }],
"roots": [{ "id": "services/legacy", "vcs": "sample-vcs", "path": "/abs/workspace/services/legacy", "mapped": false }],
"ambiguous": [{ "id": "mixed", "vcs": ["git", "sample-vcs"] }],
"unusedMappings": [],
"truncated": false,
"rejected": [],
Expand All @@ -143,13 +142,13 @@ call.

Roots come from static markers; detection never starts a process. One
breadth-first walk reads the markers directly inside each directory down to
eight levels below the workspace, at most 20,000 directories. It never enters a
marker directory (`.git`, `.svn`), a symbolic link, or a folder the default
visibility rules hide: Core's `.worktree` and `.worktrees` and the folder names
enabled plugins declare through `workspace.configureVisibility`, such as a build
system's `target`. When the workspace
itself has no marker, its ancestors are checked, because a Subversion working
copy has one `.svn` at its top; the enclosing root's `id` is `..`, `../..`, ….
eight levels below the workspace, at most 20,000 directories. It skips marker
directories, symbolic links, and folders the default visibility rules hide.
These include Core's `.worktree` and `.worktrees` and folders enabled plugins
declare through `workspace.configureVisibility`, such as a build system's
`target`. When the workspace itself has no marker, Core also checks its
ancestors for a working copy that encloses the workspace. The enclosing root's
`id` is `..`, `../..`, ….
`truncated` is `true` only when the directory budget ran out, so a root may be
missing.

Expand All @@ -175,11 +174,11 @@ directory it belongs to no root (`null`), not to an enclosing one. At most
{
"sessionId": "…",
"operationId": "…",
"vcs": "svn",
"vcs": "sample-vcs",
"operation": "checkin",
"root": "/abs/workspace/services/legacy",
"tool": "/opt/homebrew/bin/svn",
"arguments": { "paths": ["src/Main.java"], "message": "Fix" },
"tool": "/usr/local/bin/sample-vcs",
"arguments": { "paths": ["src/main.txt"], "message": "Fix" },
"timeoutMilliseconds": 600000
}
```
Expand Down Expand Up @@ -217,7 +216,7 @@ Core adds `root: { path }` and `tool: { executable } | null` to the params.
The provider receives, for example:

```json
{ "paths": ["src/Main.java"], "message": "Fix", "root": { "path": "/abs/…/legacy" }, "tool": { "executable": "/opt/homebrew/bin/svn" } }
{ "paths": ["src/main.txt"], "message": "Fix", "root": { "path": "/abs/workspace/services/legacy" }, "tool": { "executable": "/usr/local/bin/sample-vcs" } }
```

### `vcs.decodeReply`
Expand All @@ -238,7 +237,7 @@ The host offers `capabilities.experimental.litheVcs: { "versions": [0] }` in
`vcsProviders` capability version. The provider answers:

```json
{ "litheVcs": { "version": 0, "vcs": "svn", "capabilities": { "status": 0, "baseContent": 0, "checkin": 0, "rollback": 0, "update": 0 } } }
{ "litheVcs": { "version": 0, "vcs": "sample-vcs", "capabilities": { "status": 0, "baseContent": 0, "checkin": 0, "rollback": 0, "update": 0 } } }
```

A session is a provider only when the answer names an offered version, a valid
Expand Down Expand Up @@ -287,9 +286,9 @@ unchanged.

```json
{
"head": { "revision": { "id": "1234", "display": "r1234", "kind": "number" }, "branch": null, "location": "https://svn.example.invalid/repo/trunk" },
"head": { "revision": { "id": "1234", "display": "r1234", "kind": "number" }, "branch": null, "location": "https://vcs.example.invalid/repo/trunk" },
"changes": [
{ "path": "src/Main.java", "oldPath": null, "status": "modified", "flags": ["locked", "propertiesModified"] }
{ "path": "src/main.txt", "oldPath": null, "status": "modified", "flags": ["locked", "propertiesModified"] }
],
"truncated": false
}
Expand Down Expand Up @@ -358,12 +357,3 @@ A provider reports its code in the JSON-RPC `error.data.code`. Core keeps only
the provider codes listed here; any other code, including Core's own, becomes
`vcs.provider.failed`. The provider's message (at most 4 KiB) is passed on and
must not contain credentials.

## Subversion provider notes

Subversion is provided by the plugin
[lithe-plugin-svn](https://github.com/Lithe-IDEA/lithe-plugin-svn)
(`io.github.lithe-idea.svn-support`), released independently of Lithe. It calls
the user's `svn` client, 1.8 or newer, and parses its `--xml` output. Its README
documents how each operation maps to svn and how svn errors map to contract
codes; its tests check those replies against a pinned Lithe Core.
4 changes: 2 additions & 2 deletions rust/crates/plugin-model/src/names.rs
Original file line number Diff line number Diff line change
Expand Up @@ -171,8 +171,8 @@ mod tests {
#[test]
fn github_repository_accepts_only_owner_and_name_urls() {
assert_eq!(
github_repository("https://github.com/Lithe-IDEA/lithe-plugin-java"),
Some(("Lithe-IDEA", "lithe-plugin-java"))
github_repository("https://github.com/Fixture-Owner/synthetic-repository"),
Some(("Fixture-Owner", "synthetic-repository"))
);
assert_eq!(
github_repository("https://github.com/a.b/c_d/"),
Expand Down
4 changes: 2 additions & 2 deletions shared/plugins/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ SDK 与插件后端在构建时下载,并按锁定的 SHA-256(或 Git commit
| --- | --- |
| [Lua](https://github.com/Lithe-IDEA/lithe-plugin-lua) | **模板**;随包附带语言服务器(LuaLS),运行当前文件 |
| [Go](https://github.com/Lithe-IDEA/lithe-plugin-go) | 使用用户自己安装的 gopls,运行 main 包和 `go test` |
| [PHP](https://github.com/Lithe-IDEA/lithe-plugin-php) | 使用用户自己安装的 Intelephense(许可证不允许随包分发),PHPUnit |
| [PHP](https://github.com/Lithe-IDEA/lithe-plugin-php) | 通过系统命令启动语言服务器,声明式运行和测试 |
| [Gradle](https://github.com/Lithe-IDEA/lithe-plugin-gradle) | 纯声明式构建系统,不需要后端 |
| [Maven](https://github.com/Lithe-IDEA/lithe-plugin-maven) | 用 Java SDK 写的构建后端 |
| [Cargo](https://github.com/Lithe-IDEA/lithe-plugin-cargo) | 用 Node.js SDK 写的构建后端和插件设置 |
Expand Down Expand Up @@ -362,7 +362,7 @@ The [Maven plugin](https://github.com/Lithe-IDEA/lithe-plugin-maven)'s `sdk.lock
| --- | --- |
| [Lua](https://github.com/Lithe-IDEA/lithe-plugin-lua) | **Template**; a packaged language server (LuaLS) and running the current file |
| [Go](https://github.com/Lithe-IDEA/lithe-plugin-go) | The user's own gopls installation, running the main package and `go test` |
| [PHP](https://github.com/Lithe-IDEA/lithe-plugin-php) | The user's own Intelephense installation (its license forbids bundling), PHPUnit |
| [PHP](https://github.com/Lithe-IDEA/lithe-plugin-php) | A system-command language server and declarative run and test actions |
| [Gradle](https://github.com/Lithe-IDEA/lithe-plugin-gradle) | A purely declarative build system with no backend |
| [Maven](https://github.com/Lithe-IDEA/lithe-plugin-maven) | A build backend written with the Java SDK |
| [Cargo](https://github.com/Lithe-IDEA/lithe-plugin-cargo) | A build backend and plugin settings written with the Node.js SDK |
Expand Down
Loading
Loading