From de3d3ac187f7af7c6df63a378b8be4d51ab35c10 Mon Sep 17 00:00:00 2001 From: Yao Jingxi <23722032@bjtu.edu.cn> Date: Wed, 11 Nov 2026 20:09:51 +0800 Subject: [PATCH 1/2] =?UTF-8?q?feat(plugins):=20=E6=8F=92=E4=BB=B6?= =?UTF-8?q?=E5=A5=91=E7=BA=A6=E7=BB=9F=E4=B8=80=E5=9F=BA=E7=BA=BF=200?= =?UTF-8?q?=EF=BC=8C=E5=A5=91=E7=BA=A6=E4=B8=8E=E5=BC=80=E5=8F=91=E8=B5=84?= =?UTF-8?q?=E6=96=99=E5=8F=AA=E5=9C=A8=20Rust=20Core?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 桌面端插件宿主、市场、工具链、新建项目和测试按基线 0 适配:pluginAPIVersion、requires 和宿主能力表都只用 0,runtimeTooOld 并入 toolTooOld - 删除 shared/contracts/plugins 副本;测试通过新增的 internal/contractfixture 读取正在链接的 Core 检出里的契约 fixture - desktop-go.sh 导出 LITHE_PLUGIN_CONTRACT_DIR;PINNED_CORE_REVISION 指向 Core 的 feature/plugin-api-single-baseline - AGENTS.md 改为“插件契约只在 Rust Core”,PR 模板、develop-lithe 与 create-lithe-plugin Skill 同步;lithe-plugin-docs 和契约副本引用改指 Core shared/plugins - 新增 Note:插件契约从统一基线 0 开始、插件契约与开发资料只在 Rust Core;归档“按能力分版本”和“契约发布到 lithe-plugin-docs”两篇 - 平台功能矩阵的证据路径改到 Core 契约 --- .../2026-10-17-plugin-capability-versions.md | 6 +- .../2026-10-23-plugin-contract-publishing.md | 20 +- ...09-30-lsp-plugin-build-and-distribution.md | 2 +- ...2026-10-12-declarative-language-plugins.md | 8 +- .../2026-10-12-workbench-ui-contributions.md | 2 +- ...a-language-server-as-declarative-plugin.md | 4 +- ...2026-10-17-build-system-plugin-contract.md | 8 +- ...0-18-plugin-web-content-in-host-windows.md | 4 +- ...6-10-20-host-plugin-function-invocation.md | 8 +- .../2026-10-20-plugin-backend-sdk.md | 33 +- .../2026-10-20-plugin-function-contract.md | 6 +- .../2026-10-21-plugin-settings-surfaces.md | 4 +- ...6-10-22-windows-declarative-plugin-host.md | 2 +- .../2026-10-24-database-provider-plugin.md | 8 +- ...-25-java-plugin-distribution-foundation.md | 2 +- ...026-10-26-build-provider-task-execution.md | 38 +- .../2026-10-26-plugin-live-activation.md | 4 +- ...-10-30-plugin-backend-workspace-context.md | 6 +- ...10-30-plugin-host-open-preview-services.md | 2 +- ...plugin-capability-and-domain-boundaries.md | 2 +- ...2026-10-31-plugin-editor-extension-apis.md | 2 +- ...026-11-02-plugin-owned-native-terminals.md | 2 +- ...4-plugin-owned-language-server-sessions.md | 2 +- .../2026-11-08-viva-plugin-backend-bridge.md | 4 +- ...6-11-11-plugin-contract-single-baseline.md | 79 + ...1-plugin-contract-single-source-in-core.md | 92 + .../feature/2026-10-12-plugin-marketplace.md | 4 +- .../2026-10-14-declarative-plugin-settings.md | 4 +- ...2026-10-21-declarative-native-plugin-ui.md | 6 +- .../2026-10-23-plugin-project-generators.md | 6 +- ...-10-26-debug-adapter-executable-setting.md | 4 +- ...-26-debug-console-prompt-and-completion.md | 8 +- ...-10-31-macos-ide-editor-settings-import.md | 2 +- ...lic-extension-contract-and-provider-api.md | 10 +- ...6-10-16-unified-child-process-lifecycle.md | 6 +- .../2026-10-17-build-system-provider-api.md | 6 +- .../2026-10-22-unified-vcs-provider-model.md | 14 +- ...4-java-support-independent-distribution.md | 6 +- ...6-10-25-plugin-dependencies-and-exports.md | 10 +- ...ified-debug-engine-and-adapter-registry.md | 16 +- ...0-26-maven-java-domain-plugin-migration.md | 10 +- ...7-debug-network-paths-and-tcp-lifecycle.md | 2 +- ...026-10-27-remote-debug-adapter-over-ssh.md | 6 +- .../2026-10-31-plugin-injected-toolchains.md | 6 +- ...4-java-extraction-generic-apis-and-gate.md | 17 +- .agents/skills/create-lithe-plugin/SKILL.md | 22 +- .agents/skills/develop-lithe/SKILL.md | 2 +- .github/pull_request_template.md | 15 +- AGENTS.md | 60 +- README.md | 5 +- README.zh-CN.md | 5 +- .../buildprovider/buildprovider_test.go | 10 +- .../contractfixture/contractfixture.go | 24 + desktop/internal/core/build_test.go | 8 +- desktop/internal/core/marketplace_test.go | 6 +- desktop/internal/core/output_links_test.go | 4 +- desktop/internal/core/plugin_session.go | 7 +- desktop/internal/core/plugin_session_test.go | 40 +- .../core/plugin_setting_actions_test.go | 4 +- desktop/internal/core/plugin_settings_test.go | 6 +- desktop/internal/core/project_generators.go | 20 - .../internal/core/project_generators_test.go | 9 +- desktop/internal/core/run_start_test.go | 3 +- desktop/internal/core/test_test.go | 6 +- .../marketplace/lithe-official-index.json | 2 +- .../marketplace/lithe-store-index.json | 379 +- desktop/internal/i18n/shared.generated.go | 2 - desktop/internal/marketplace/service_test.go | 7 +- .../internal/pluginbackend/pluginbackend.go | 2 +- desktop/internal/pluginhost/pluginhost.go | 176 +- .../internal/pluginhost/pluginhost_test.go | 71 +- .../internal/pluginservice/backendlaunch.go | 2 +- desktop/internal/pluginservice/backends.go | 2 +- desktop/internal/pluginservice/builds_test.go | 13 +- .../pluginservice/debug_start_test.go | 3 +- .../pluginservice/pluginservice_test.go | 4 +- desktop/internal/pluginservice/runs_test.go | 3 +- .../pluginservice/settings_actions_test.go | 13 +- .../pluginservice/settings_start_test.go | 5 +- desktop/internal/pluginweb/page_test.go | 5 +- .../projectgen/maven_integration_test.go | 14 +- desktop/internal/projectgen/run.go | 2 +- .../toolchain/testdata/compiler.plugin.json | 9 +- .../toolchain/testdata/conflict-b.plugin.json | 9 +- .../toolchain/testdata/conflict.plugin.json | 9 +- .../toolchain/testdata/runtime.plugin.json | 9 +- .../internal/workbench/build_settings_test.go | 7 +- .../internal/workbench/debug_launch_test.go | 4 +- .../workbench/debug_native_e2e_test.go | 2 +- desktop/internal/workbench/debug_tcp_test.go | 12 +- desktop/internal/workbench/debug_test.go | 8 +- desktop/internal/workbench/new_project.go | 9 - .../internal/workbench/new_project_form.go | 36 +- .../internal/workbench/new_project_test.go | 10 +- .../internal/workbench/new_project_view.go | 4 +- .../internal/workbench/outputlinks_test.go | 6 +- .../internal/workbench/pluginsync_e2e_test.go | 4 +- .../internal/workbench/plugintools_test.go | 3 +- .../workbench/settings_plugin_actions_test.go | 2 +- .../internal/workbench/tests_provider_test.go | 10 +- desktop/internal/workbench/tests_test.go | 6 +- docs/ci-builds.md | 7 +- ...ue-1495-plugin-migration-remaining-plan.md | 14 +- docs/development/macos-plugin-api-plan.md | 32 +- .../development/windows-plugin-parity-plan.md | 6 +- scripts/desktop/build-desktop-core.sh | 10 +- scripts/desktop/desktop-go.sh | 8 + shared/contracts/plugins/v1/README.md | 4555 ----------------- .../backend/backend-workspace.plugin.json | 34 - .../v1/fixtures/backend/backend.plugin.json | 49 - .../backend/command-backend.plugin.json | 50 - .../fixtures/backend/function-protocol.json | 751 --- .../plugin-functions-caller.plugin.json | 17 - .../plugin-functions-exporter.plugin.json | 17 - .../v1/fixtures/backend/plugin-logging.json | 28 - .../backend/terminal-backend.plugin.json | 35 - .../build-providers/build-configuration.json | 34 - .../build-connection-debug-options.json | 46 - .../build-debug-preparation.json | 28 - .../build-execution-protocol.json | 51 - .../build-provider-configuration.plugin.json | 178 - ...ild-provider-debug-preparation.plugin.json | 254 - .../build-provider-execution.plugin.json | 175 - ...build-provider-language-server.plugin.json | 71 - .../build-provider-preparation.plugin.json | 186 - .../build-provider-reports.plugin.json | 192 - .../build-provider-run-options.plugin.json | 209 - ...build-provider-run-preparation.plugin.json | 208 - .../build-provider-selectors.plugin.json | 195 - .../build-provider-tests.plugin.json | 195 - .../build-provider.plugin.json | 122 - .../build-providers/build-run-options.json | 37 - .../build-run-preparation.json | 39 - .../build-providers/build-test-discovery.json | 24 - .../build-providers/build-test-durations.json | 45 - .../build-providers/build-test-protocol.json | 48 - .../build-command-output-file.plugin.json | 168 - .../build-command-stdout.plugin.json | 145 - .../build-instance-options.plugin.json | 312 -- .../build-model-consumer.plugin.json | 170 - .../build-model-producer.plugin.json | 158 - .../fixtures/build-systems/build-plans.json | 1981 ------- .../build-static-file.plugin.json | 143 - .../build-systems/build-tool-path.plugin.json | 74 - .../build-toolchains.plugin.json | 329 -- .../debug-adapter-features.plugin.json | 68 - .../debug-adapter-language-server.plugin.json | 51 - .../debug-adapter-rejections.json | 517 -- .../debug-adapter-remote-attach.plugin.json | 184 - .../debug-adapters/debug-adapter.plugin.json | 96 - .../fixtures/debug-adapters/debug-start.json | 117 - .../v1/fixtures/editor/editor-actions-v2.json | 118 - .../editor/editor-actions.plugin.json | 36 - .../v1/fixtures/editor/editor-providers.json | 132 - .../editor/editor-providers.plugin.json | 36 - .../keymap-import-provider.plugin.json | 18 - .../v1/fixtures/languages/command-plans.json | 709 --- .../languages/grammars/http.tmLanguage.json | 61 - .../languages/language-grammar.plugin.json | 43 - .../language-packaged-server.plugin.json | 99 - ...language-server-backend-launch.plugin.json | 116 - .../language-server-launch-resolution.json | 491 -- .../language-system-command.plugin.json | 114 - .../languages/node-runtime.plugin.json | 94 - .../fixtures/languages/runtime-versions.json | 16 - .../fixtures/manifest/hello-lithe.plugin.json | 50 - .../fixtures/manifest/invalid-manifests.json | 1005 ---- .../v1/fixtures/marketplace/index-cases.json | 105 - .../v1/fixtures/marketplace/index.json | 176 - .../fixtures/marketplace/install-reviews.json | 434 -- .../marketplace/invalid-index-entries.json | 30 - .../v1/fixtures/marketplace/source-urls.json | 17 - .../publisher-bundled.plugin.json | 22 - .../package-trust/signature-vectors.json | 40 - .../project-generator-tool-field.plugin.json | 45 - .../project-generator.plugin.json | 83 - .../project-generators/project-plans.json | 726 --- .../templates/.gitattributes | 2 - .../templates/app/README.md | 3 - .../templates/app/dot-gitignore | 0 .../templates/main/Main.java | 3 - .../templates/tool-field/README.md | 4 - .../v1/fixtures/run/output-link-matchers.json | 192 - .../plugins/v1/fixtures/run/run-start.json | 284 - .../run/tool-reference-launch.plugin.json | 105 - .../fixtures/settings/settings-v2.plugin.json | 190 - .../toolchains/tool-definition.plugin.json | 159 - .../toolchains/toolchain-provider.plugin.json | 69 - .../fixtures/ui/native-controls.plugin.json | 407 -- .../v1/fixtures/ui/native-form.plugin.json | 157 - .../v1/fixtures/ui/native-panel.plugin.json | 137 - .../v1/fixtures/ui/web-panel.plugin.json | 57 - .../v1/fixtures/vcs/vcs-provider.plugin.json | 43 - .../plugins/v1/native-ui.schema.json | 781 --- .../plugins/v1/plugin-index.schema.json | 75 - .../plugins/v1/plugin-manifest.schema.json | 4005 --------------- .../contracts/plugins/v1/toolchains/README.md | 424 -- shared/contracts/rust-core-api.md | 233 +- shared/contracts/vcs-provider-v1.md | 47 +- .../keymap/provider-negotiation-v1.json | 18 +- .../fixtures/plugins/language-support-v1.json | 44 - shared/fixtures/plugins/official-v1.json | 6 - shared/fixtures/plugins/settings-actions.json | 24 +- .../fixtures/plugins/settings-documents.json | 11 +- .../fixtures/plugins/settings-surfaces.json | 162 +- shared/fixtures/vcs/model-v1.json | 54 +- shared/i18n/locales/en-US.json | 1 - shared/i18n/locales/zh-CN.json | 1 - shared/i18n/messages.json | 7 - .../build-provider-readonly-model-inputs.json | 2 +- .../declarative-native-plugin-ui.json | 2 +- .../features/declarative-plugin-contract.json | 2 - .../features/declarative-plugin-settings.json | 2 +- .../features/php-run-test.json | 2 +- .../plugin-cross-plugin-function-calls.json | 2 +- .../features/plugin-editor-actions.json | 2 +- .../features/plugin-editor-grammars.json | 6 +- .../features/plugin-functions.json | 8 +- .../features/plugin-native-terminals.json | 2 +- .../features/plugin-project-generators.json | 2 +- .../plugin-registered-settings-pages.json | 4 +- .../vcs-subversion-and-plugin-providers.json | 2 +- 222 files changed, 1263 insertions(+), 25372 deletions(-) rename .agents/notes/{implemented => archived}/architecture/2026-10-17-plugin-capability-versions.md (98%) rename .agents/notes/{implemented => archived}/architecture/2026-10-23-plugin-contract-publishing.md (89%) create mode 100644 .agents/notes/implemented/architecture/2026-11-11-plugin-contract-single-baseline.md create mode 100644 .agents/notes/implemented/architecture/2026-11-11-plugin-contract-single-source-in-core.md create mode 100644 desktop/internal/contractfixture/contractfixture.go delete mode 100644 shared/contracts/plugins/v1/README.md delete mode 100644 shared/contracts/plugins/v1/fixtures/backend/backend-workspace.plugin.json delete mode 100644 shared/contracts/plugins/v1/fixtures/backend/backend.plugin.json delete mode 100644 shared/contracts/plugins/v1/fixtures/backend/command-backend.plugin.json delete mode 100644 shared/contracts/plugins/v1/fixtures/backend/function-protocol.json delete mode 100644 shared/contracts/plugins/v1/fixtures/backend/plugin-functions-caller.plugin.json delete mode 100644 shared/contracts/plugins/v1/fixtures/backend/plugin-functions-exporter.plugin.json delete mode 100644 shared/contracts/plugins/v1/fixtures/backend/plugin-logging.json delete mode 100644 shared/contracts/plugins/v1/fixtures/backend/terminal-backend.plugin.json delete mode 100644 shared/contracts/plugins/v1/fixtures/build-providers/build-configuration.json delete mode 100644 shared/contracts/plugins/v1/fixtures/build-providers/build-connection-debug-options.json delete mode 100644 shared/contracts/plugins/v1/fixtures/build-providers/build-debug-preparation.json delete mode 100644 shared/contracts/plugins/v1/fixtures/build-providers/build-execution-protocol.json delete mode 100644 shared/contracts/plugins/v1/fixtures/build-providers/build-provider-configuration.plugin.json delete mode 100644 shared/contracts/plugins/v1/fixtures/build-providers/build-provider-debug-preparation.plugin.json delete mode 100644 shared/contracts/plugins/v1/fixtures/build-providers/build-provider-execution.plugin.json delete mode 100644 shared/contracts/plugins/v1/fixtures/build-providers/build-provider-language-server.plugin.json delete mode 100644 shared/contracts/plugins/v1/fixtures/build-providers/build-provider-preparation.plugin.json delete mode 100644 shared/contracts/plugins/v1/fixtures/build-providers/build-provider-reports.plugin.json delete mode 100644 shared/contracts/plugins/v1/fixtures/build-providers/build-provider-run-options.plugin.json delete mode 100644 shared/contracts/plugins/v1/fixtures/build-providers/build-provider-run-preparation.plugin.json delete mode 100644 shared/contracts/plugins/v1/fixtures/build-providers/build-provider-selectors.plugin.json delete mode 100644 shared/contracts/plugins/v1/fixtures/build-providers/build-provider-tests.plugin.json delete mode 100644 shared/contracts/plugins/v1/fixtures/build-providers/build-provider.plugin.json delete mode 100644 shared/contracts/plugins/v1/fixtures/build-providers/build-run-options.json delete mode 100644 shared/contracts/plugins/v1/fixtures/build-providers/build-run-preparation.json delete mode 100644 shared/contracts/plugins/v1/fixtures/build-providers/build-test-discovery.json delete mode 100644 shared/contracts/plugins/v1/fixtures/build-providers/build-test-durations.json delete mode 100644 shared/contracts/plugins/v1/fixtures/build-providers/build-test-protocol.json delete mode 100644 shared/contracts/plugins/v1/fixtures/build-systems/build-command-output-file.plugin.json delete mode 100644 shared/contracts/plugins/v1/fixtures/build-systems/build-command-stdout.plugin.json delete mode 100644 shared/contracts/plugins/v1/fixtures/build-systems/build-instance-options.plugin.json delete mode 100644 shared/contracts/plugins/v1/fixtures/build-systems/build-model-consumer.plugin.json delete mode 100644 shared/contracts/plugins/v1/fixtures/build-systems/build-model-producer.plugin.json delete mode 100644 shared/contracts/plugins/v1/fixtures/build-systems/build-plans.json delete mode 100644 shared/contracts/plugins/v1/fixtures/build-systems/build-static-file.plugin.json delete mode 100644 shared/contracts/plugins/v1/fixtures/build-systems/build-tool-path.plugin.json delete mode 100644 shared/contracts/plugins/v1/fixtures/build-systems/build-toolchains.plugin.json delete mode 100644 shared/contracts/plugins/v1/fixtures/debug-adapters/debug-adapter-features.plugin.json delete mode 100644 shared/contracts/plugins/v1/fixtures/debug-adapters/debug-adapter-language-server.plugin.json delete mode 100644 shared/contracts/plugins/v1/fixtures/debug-adapters/debug-adapter-rejections.json delete mode 100644 shared/contracts/plugins/v1/fixtures/debug-adapters/debug-adapter-remote-attach.plugin.json delete mode 100644 shared/contracts/plugins/v1/fixtures/debug-adapters/debug-adapter.plugin.json delete mode 100644 shared/contracts/plugins/v1/fixtures/debug-adapters/debug-start.json delete mode 100644 shared/contracts/plugins/v1/fixtures/editor/editor-actions-v2.json delete mode 100644 shared/contracts/plugins/v1/fixtures/editor/editor-actions.plugin.json delete mode 100644 shared/contracts/plugins/v1/fixtures/editor/editor-providers.json delete mode 100644 shared/contracts/plugins/v1/fixtures/editor/editor-providers.plugin.json delete mode 100644 shared/contracts/plugins/v1/fixtures/keymap-import/keymap-import-provider.plugin.json delete mode 100644 shared/contracts/plugins/v1/fixtures/languages/command-plans.json delete mode 100644 shared/contracts/plugins/v1/fixtures/languages/grammars/http.tmLanguage.json delete mode 100644 shared/contracts/plugins/v1/fixtures/languages/language-grammar.plugin.json delete mode 100644 shared/contracts/plugins/v1/fixtures/languages/language-packaged-server.plugin.json delete mode 100644 shared/contracts/plugins/v1/fixtures/languages/language-server-backend-launch.plugin.json delete mode 100644 shared/contracts/plugins/v1/fixtures/languages/language-server-launch-resolution.json delete mode 100644 shared/contracts/plugins/v1/fixtures/languages/language-system-command.plugin.json delete mode 100644 shared/contracts/plugins/v1/fixtures/languages/node-runtime.plugin.json delete mode 100644 shared/contracts/plugins/v1/fixtures/languages/runtime-versions.json delete mode 100644 shared/contracts/plugins/v1/fixtures/manifest/hello-lithe.plugin.json delete mode 100644 shared/contracts/plugins/v1/fixtures/manifest/invalid-manifests.json delete mode 100644 shared/contracts/plugins/v1/fixtures/marketplace/index-cases.json delete mode 100644 shared/contracts/plugins/v1/fixtures/marketplace/index.json delete mode 100644 shared/contracts/plugins/v1/fixtures/marketplace/install-reviews.json delete mode 100644 shared/contracts/plugins/v1/fixtures/marketplace/invalid-index-entries.json delete mode 100644 shared/contracts/plugins/v1/fixtures/marketplace/source-urls.json delete mode 100644 shared/contracts/plugins/v1/fixtures/package-trust/publisher-bundled.plugin.json delete mode 100644 shared/contracts/plugins/v1/fixtures/package-trust/signature-vectors.json delete mode 100644 shared/contracts/plugins/v1/fixtures/project-generators/project-generator-tool-field.plugin.json delete mode 100644 shared/contracts/plugins/v1/fixtures/project-generators/project-generator.plugin.json delete mode 100644 shared/contracts/plugins/v1/fixtures/project-generators/project-plans.json delete mode 100644 shared/contracts/plugins/v1/fixtures/project-generators/templates/.gitattributes delete mode 100644 shared/contracts/plugins/v1/fixtures/project-generators/templates/app/README.md delete mode 100644 shared/contracts/plugins/v1/fixtures/project-generators/templates/app/dot-gitignore delete mode 100644 shared/contracts/plugins/v1/fixtures/project-generators/templates/main/Main.java delete mode 100644 shared/contracts/plugins/v1/fixtures/project-generators/templates/tool-field/README.md delete mode 100644 shared/contracts/plugins/v1/fixtures/run/output-link-matchers.json delete mode 100644 shared/contracts/plugins/v1/fixtures/run/run-start.json delete mode 100644 shared/contracts/plugins/v1/fixtures/run/tool-reference-launch.plugin.json delete mode 100644 shared/contracts/plugins/v1/fixtures/settings/settings-v2.plugin.json delete mode 100644 shared/contracts/plugins/v1/fixtures/toolchains/tool-definition.plugin.json delete mode 100644 shared/contracts/plugins/v1/fixtures/toolchains/toolchain-provider.plugin.json delete mode 100644 shared/contracts/plugins/v1/fixtures/ui/native-controls.plugin.json delete mode 100644 shared/contracts/plugins/v1/fixtures/ui/native-form.plugin.json delete mode 100644 shared/contracts/plugins/v1/fixtures/ui/native-panel.plugin.json delete mode 100644 shared/contracts/plugins/v1/fixtures/ui/web-panel.plugin.json delete mode 100644 shared/contracts/plugins/v1/fixtures/vcs/vcs-provider.plugin.json delete mode 100644 shared/contracts/plugins/v1/native-ui.schema.json delete mode 100644 shared/contracts/plugins/v1/plugin-index.schema.json delete mode 100644 shared/contracts/plugins/v1/plugin-manifest.schema.json delete mode 100644 shared/contracts/plugins/v1/toolchains/README.md delete mode 100644 shared/fixtures/plugins/language-support-v1.json delete mode 100644 shared/fixtures/plugins/official-v1.json diff --git a/.agents/notes/implemented/architecture/2026-10-17-plugin-capability-versions.md b/.agents/notes/archived/architecture/2026-10-17-plugin-capability-versions.md similarity index 98% rename from .agents/notes/implemented/architecture/2026-10-17-plugin-capability-versions.md rename to .agents/notes/archived/architecture/2026-10-17-plugin-capability-versions.md index f61e39a1b1..9aef77836b 100644 --- a/.agents/notes/implemented/architecture/2026-10-17-plugin-capability-versions.md +++ b/.agents/notes/archived/architecture/2026-10-17-plugin-capability-versions.md @@ -2,6 +2,10 @@ 状态:已实现 +归档日期:2026-11-11 + +> 已被[插件契约从统一基线 0 开始](../../implemented/architecture/2026-11-11-plugin-contract-single-baseline.md)取代。 + > Viva 迁移状态:能力版本规则存在于固定修订的 Rust Core 和共享插件契约;当前桌面端已有市场索引校验与后端桥接,尚未完成插件安装和各能力的产品接入。下文的旧客户端验收不代表 Viva 已支持所有列出的能力;历史验证入口见[迁移前笔记](https://github.com/1lck/Lithe-IDEA/blob/5a54c41aa37a4e6e6b68918a4b05765b9dd07a36/.agents/notes/implemented/architecture/2026-10-17-plugin-capability-versions.md)。 ## 先说结论 @@ -162,7 +166,7 @@ backend 模块,不增加第二个开关。正确做法是让纯定义插件通 - Lithe-core-rust 锁定修订:[rust/lithe-core/src/plugins/capabilities.rs](https://github.com/Lithe-IDEA/Lithe-core-rust/blob/0ffd327b4329261e393b08ed76fbd134b4dd17e9/rust/lithe-core/src/plugins/capabilities.rs) - Lithe-core-rust 锁定修订:[rust/lithe-core/src/plugins/declarative.rs](https://github.com/Lithe-IDEA/Lithe-core-rust/blob/0ffd327b4329261e393b08ed76fbd134b4dd17e9/rust/lithe-core/src/plugins/declarative.rs) - Lithe-core-rust 锁定修订:[rust/lithe-core/src/plugins/marketplace.rs](https://github.com/Lithe-IDEA/Lithe-core-rust/blob/0ffd327b4329261e393b08ed76fbd134b4dd17e9/rust/lithe-core/src/plugins/marketplace.rs) -- `shared/contracts/plugins/v1/` +- `https://github.com/Lithe-IDEA/Lithe-core-rust/blob/main/shared/plugins/contract/v1/` - `shared/contracts/rust-core-api.md` - `desktop/internal/core/plugin_session.go` - `desktop/internal/marketplace/` diff --git a/.agents/notes/implemented/architecture/2026-10-23-plugin-contract-publishing.md b/.agents/notes/archived/architecture/2026-10-23-plugin-contract-publishing.md similarity index 89% rename from .agents/notes/implemented/architecture/2026-10-23-plugin-contract-publishing.md rename to .agents/notes/archived/architecture/2026-10-23-plugin-contract-publishing.md index bcd6679d60..929d9bf258 100644 --- a/.agents/notes/implemented/architecture/2026-10-23-plugin-contract-publishing.md +++ b/.agents/notes/archived/architecture/2026-10-23-plugin-contract-publishing.md @@ -2,9 +2,13 @@ 状态:已实现 +归档日期:2026-11-11 + +> 已被[插件契约与开发资料只在 Rust Core](../../implemented/architecture/2026-11-11-plugin-contract-single-source-in-core.md)取代:Rust Core 拆成独立仓库后,契约、开发资料和 SDK 都并入 Core 的 `shared/plugins/`,lithe-plugin-docs 停止维护。 + ## 先说结论 -插件契约(`shared/contracts/plugins/v1/`,规定 `plugin.json` 每个字段的含义、错误码和标准答案用例)仍然在主仓库定义,由 Rust Core 执行。公开仓库 `Lithe-IDEA/lithe-plugin-docs` 的 `contract/v1/` 保存这个目录的**完整逐字节副本**,另外放开发指南、从 Lithe Store 搬过来的两篇教程、两个官方 SDK(源码、发版和端到端测试)和示例插件列表。插件开发者只看 lithe-plugin-docs 就能开发,写插件、发布插件都不需要克隆主仓库,也不需要给主仓库提 PR。 +插件契约(`Lithe-core-rust/shared/plugins/contract/v1/`,规定 `plugin.json` 每个字段的含义、错误码和标准答案用例)仍然在主仓库定义,由 Rust Core 执行。公开仓库 `Lithe-IDEA/lithe-plugin-docs` 的 `contract/v1/` 保存这个目录的**完整逐字节副本**,另外放开发指南、从 Lithe Store 搬过来的两篇教程、两个官方 SDK(源码、发版和端到端测试)和示例插件列表。插件开发者只看 lithe-plugin-docs 就能开发,写插件、发布插件都不需要克隆主仓库,也不需要给主仓库提 PR。 日常开发要记住四件事: @@ -38,7 +42,7 @@ - `README.md`:中文开发指南,讲插件结构、API 等级怎么选、编辑器校验、后端 SDK 和示例插件。 - `guides/`:从 Lithe Store 搬来的《LSP 插件完整生命周期》和《构建、运行与测试接入》。契约链接改为本仓库的 `contract/v1/`,发布相关链接指向 Store。 -- `contract/v1/`:主仓库 `shared/contracts/plugins/v1/` 整个目录的逐字节副本,包括 README、两份 schema 和全部 fixture。 +- `contract/v1/`:主仓库 `Lithe-core-rust/shared/plugins/contract/v1/` 整个目录的逐字节副本,包括 README、两份 schema 和全部 fixture。 - `contract.lock.json`:记录来源仓库、来源目录、commit 和每个文件的 SHA-256,格式与 Cargo 插件的 `sdk.lock.json` 相同。 - `sdk/node`、`sdk/java`:两个官方 SDK 和各自的示例插件;`sdk/e2e`:两个示例共用的端到端场景(Rust 测试文件)。 - `scripts/contract.mjs` 提供四个命令: @@ -61,7 +65,7 @@ Store 的 `validate-index.mjs` 仍然实现索引规则。它的 CI 原来比较 ### Schema 地址固定为 docs 仓库的 raw 地址 契约目录里每份 schema(包括子目录里的)的 `$id` 是它在 docs 仓库里的地址: -`https://raw.githubusercontent.com/Lithe-IDEA/lithe-plugin-docs/main/contract/v1/<目录内路径>`。 +`https://raw.githubusercontent.com/Lithe-IDEA/Lithe-core-rust/main/shared/plugins/contract/v1/<目录内路径>`。 两边都对这个地址做严格检查: @@ -100,7 +104,7 @@ Core 解析清单时拒绝未知字段(serde `deny_unknown_fields`),schema ### fixture 按能力命名 -`shared/contracts/plugins/v1/fixtures/` 中的 fixture 改为按演示的能力命名,ID 同步改成 `dev.lithe.fixture.<新名字>`: +`Lithe-core-rust/shared/plugins/contract/v1/fixtures/` 中的 fixture 改为按演示的能力命名,ID 同步改成 `dev.lithe.fixture.<新名字>`: | 原名 | 新名 | 演示什么 | | --- | --- | --- | @@ -116,13 +120,13 @@ Core 解析清单时拒绝未知字段(serde `deny_unknown_fields`),schema fixture 的内容仍然用 Cargo、Go、Gradle、Maven 作为真实输入,契约 README 写明“它们不是这些插件”。macOS 测试中同 ID 的展示用副本(`macos/Tests/LitheTests/Fixtures/BuildSystems/`)一起改名。 -`shared/fixtures/plugins/language-support-v1.json` 保留旧 ID `dev.lithe.fixture.go-support`。它是已退役的 schema 1 格式,只被 `rust/lithe-core/src/tests/plugins.rs` 的旧格式测试读取,与声明式契约无关。 +`shared/fixtures/plugins/` 不再保存旧格式的插件清单 fixture。声明式插件的清单 fixture 只有 `Lithe-core-rust/shared/plugins/contract/v1/fixtures/` 这一套。 ### SDK 整体移到 lithe-plugin-docs SDK 是给插件开发者用的库,不是契约。开发者要读它的 README、看示例、提问题、下载发布包,这些都应该在 lithe-plugin-docs 完成,所以 `sdk/`、SDK 端到端测试和两个发版工作流都从主仓库移走,主仓库只保留契约。 -- **发版**:lithe-plugin-docs 打 `sdk-node-v<版本>` 或 `sdk-java-v<版本>` 标签,`release-node-sdk.yml`、`release-java-sdk.yml` 发布包和 `.sha256`。具体规则见 [官方插件后端 SDK](2026-10-20-plugin-backend-sdk.md)。Java SDK 0.1.0 是迁移前从主仓库发布的,那个 Release 保留,Maven 插件锁定的下载地址不变。 +- **发版**:lithe-plugin-docs 打 `sdk-node-v<版本>` 或 `sdk-java-v<版本>` 标签,`release-node-sdk.yml`、`release-java-sdk.yml` 发布包和 `.sha256`。具体规则见 [官方插件后端 SDK](../../implemented/architecture/2026-10-20-plugin-backend-sdk.md)。Java SDK 0.1.0 是迁移前从主仓库发布的,那个 Release 保留,Maven 插件锁定的下载地址不变。 - **单元测试**:SDK 自己的测试读 `contract/v1/fixtures/backend/function-protocol.json`,也就是契约副本,不再读主仓库。 - **端到端测试**:场景仍是 Rust 测试,要链接 Rust Core。`sdk-e2e.mjs` 把锁文件记录的主仓库 commit 稀疏检出到 `.artifacts/lithe`(只取 `rust/` 和 `shared/`),把 `sdk/e2e` 复制进它的 `rust/lithe-core/tests/`,再用 `cargo test --locked` 运行。`LITHE_PLUGIN_SDK_ROOT` 告诉测试示例插件在哪里。这和 Cargo 插件测 Core 的方式相同。 - **两个版本的 Core**:每次提交测契约副本锁定的那个 commit,保证 SDK、契约副本和 Core 是同一个版本;每周再用 `--ref preview` 测主仓库 `preview` 分支的最新 Core,提前发现 Core 的改动破坏了 SDK。 @@ -131,7 +135,7 @@ SDK 是给插件开发者用的库,不是契约。开发者要读它的 README ### 正确做法 -- 修改契约:在同一个 PR 里改 `shared/contracts/plugins/v1/`、Core 和测试。合并后,在 lithe-plugin-docs 运行 `node scripts/contract.mjs sync --revision <合并后的 preview commit>`,然后提交。 +- 修改契约:在同一个 PR 里改 `Lithe-core-rust/shared/plugins/contract/v1/`、Core 和测试。合并后,在 lithe-plugin-docs 运行 `node scripts/contract.mjs sync --revision <合并后的 preview commit>`,然后提交。 - 改了 `plugin-index.schema.json`:同步 docs 仓库之后,Lithe Store 的 CI 会失败,按 Store 的 `docs/maintainers.md` 更新索引校验和记录的哈希。 - 在契约 README 里引用目录外的文件:写 `https://github.com/1lck/Lithe-IDEA/blob/preview/<路径>`。 - 新增 fixture:按演示的能力命名,例如 `build-command-stdout.plugin.json`,ID 使用 `dev.lithe.fixture.` 前缀。 @@ -209,7 +213,7 @@ npm 是 Node 开发者最熟悉的方式。但插件包安装后没有 `npm inst ## 适用范围 - `AGENTS.md` -- `shared/contracts/plugins/v1/` +- `https://github.com/Lithe-IDEA/Lithe-core-rust/blob/main/shared/plugins/contract/v1/` - ~~scripts/architecture/verify-shared-contracts.sh~~(脚本已随旧客户端移除) - ~~`scripts/plugins/plugin-settings-schema.test.mjs`~~(已随 #1794 移除) - ~~`scripts/rust-core/verify-rust-core-crates.sh`~~(已随 #1794 移除) diff --git a/.agents/notes/implemented/architecture/2026-09-30-lsp-plugin-build-and-distribution.md b/.agents/notes/implemented/architecture/2026-09-30-lsp-plugin-build-and-distribution.md index 92999ae7c6..65849ce81e 100644 --- a/.agents/notes/implemented/architecture/2026-09-30-lsp-plugin-build-and-distribution.md +++ b/.agents/notes/implemented/architecture/2026-09-30-lsp-plugin-build-and-distribution.md @@ -68,7 +68,7 @@ LSP 控制中心和语言工具发现沿用现有 Rust Core LSP 会话。组合 ### 6. 跨平台实现保持相同边界 -macOS 使用声明式插件包和 publisher Ed25519 包签名;Windows 使用自己的 Tauri 插件包和平台签名、缓存适配器,接入共享契约 `shared/contracts/plugins/v1/` 时复用同一份声明语义。Windows 不得因为跨平台而把 macOS 的目录或构建脚本复制到 Windows。两端都必须满足:插件自有资源、构建时校验、运行时只读安装目录、禁用和卸载可清理自有资源。 +macOS 使用声明式插件包和 publisher Ed25519 包签名;Windows 使用自己的 Tauri 插件包和平台签名、缓存适配器,接入共享契约 `Lithe-core-rust/shared/plugins/contract/v1/` 时复用同一份声明语义。Windows 不得因为跨平台而把 macOS 的目录或构建脚本复制到 Windows。两端都必须满足:插件自有资源、构建时校验、运行时只读安装目录、禁用和卸载可清理自有资源。 ## 考虑过的备选方案 diff --git a/.agents/notes/implemented/architecture/2026-10-12-declarative-language-plugins.md b/.agents/notes/implemented/architecture/2026-10-12-declarative-language-plugins.md index 53b0f73c8e..87440288f5 100644 --- a/.agents/notes/implemented/architecture/2026-10-12-declarative-language-plugins.md +++ b/.agents/notes/implemented/architecture/2026-10-12-declarative-language-plugins.md @@ -8,7 +8,7 @@ 官方语言插件(Go、PHP)不再是"在 Lithe 进程里加载的 Swift Bundle",而是声明式插件包:包里只有 `plugin.json` 和它声明的资源(例如打包好的 Intelephense)。Lithe 读取声明,由 Rust Core 校验并展开运行/测试命令,再由宿主自己启动语言服务器和运行进程。插件不在宿主进程内执行任何代码,所以插件包不再依赖宿主二进制,Lithe 每次发版也不用重新编译插件,之后可以把插件拆到独立仓库维护。Go 和 PHP 后来确实拆成了 Lithe Store 社区插件,见 [Go 与 PHP 改为 Lithe Store 社区插件](2026-10-20-go-php-community-plugins.md)。 -对日常开发的直接影响:新增语言插件时写 `plugin.json`,不要写 Swift 入口类;声明格式和语义以 `shared/contracts/plugins/v1/` 为准,校验与命令模板展开只在 `rust/lithe-core/src/plugins/declarative.rs` 实现一次。 +对日常开发的直接影响:新增语言插件时写 `plugin.json`,不要写 Swift 入口类;声明格式和语义以 `Lithe-core-rust/shared/plugins/contract/v1/` 为准,校验与命令模板展开只在 `rust/lithe-core/src/plugins/declarative.rs` 实现一次。 通用工作台 UI 已通过 API level 2 扩展,见 [宿主管理的工作台 UI 贡献](2026-10-12-workbench-ui-contributions.md)。语言插件的 API level 1 和进程归属保持兼容。 @@ -24,8 +24,8 @@ ### 1. 契约放在 shared,执行放在 Rust Core -- `shared/contracts/plugins/v1/` 定义 `plugin.json`(`schemaVersion: 2`)的字段、权限、激活事件、命令模板变量、错误码和状态语义,并提供合法样例、非法样例(附期望错误码)和命令展开的标准答案。schema 1 是已退役的 macOS 原生清单。 -- 兼容性只看 `pluginAPIVersion`(声明式插件 API 级别),不再用写死的 `BuiltInPluginCatalog.hostVersion = 0.3.0` 冒充宿主版本。级别 3 起清单还按能力分版本,见[声明式插件按能力分版本](2026-10-17-plugin-capability-versions.md)。 +- `Lithe-core-rust/shared/plugins/contract/v1/` 定义 `plugin.json`(`schemaVersion: 2`)的字段、权限、激活事件、命令模板变量、错误码和状态语义,并提供合法样例、非法样例(附期望错误码)和命令展开的标准答案。schema 1 是已退役的 macOS 原生清单。 +- 兼容性只看 `pluginAPIVersion`(声明式插件 API 级别),不再用写死的 `BuiltInPluginCatalog.hostVersion = 0.3.0` 冒充宿主版本。级别 3 起清单还按能力分版本,见[插件契约从统一基线 0 开始](2026-11-11-plugin-contract-single-baseline.md)。 - 校验和模板展开是两端共享的确定性逻辑,按仓库规则放进 Rust Core,通过 `plugins.declarative.validate`、`runPlan`、`discoverTests`、`testPlan` 四个命令暴露。命令是纯函数:宿主每次把清单和请求传进去,Core 不读包、不读工作区。清单内容问题以 `{status: "rejected", error: {code}}` 返回稳定的 `plugin.*` 错误码;只有请求格式错误才是 Core 失败。 - Windows 现有扩展清单暂未改造,契约 README 给出字段对照;Windows 接入时必须通过同一组 fixture。 @@ -108,7 +108,7 @@ gopls 把 `fmt.Println` 的定义指向 `GOROOT/src/fmt/print.go`,Intelephense ## 适用范围 -- `shared/contracts/plugins/v1/` +- `https://github.com/Lithe-IDEA/Lithe-core-rust/blob/main/shared/plugins/contract/v1/` - Lithe-core-rust 锁定修订:[rust/lithe-core/src/plugins/declarative.rs](https://github.com/Lithe-IDEA/Lithe-core-rust/blob/0ffd327b4329261e393b08ed76fbd134b4dd17e9/rust/lithe-core/src/plugins/declarative.rs) - ~~`macos/Sources/Lithe/Core/Rust/RustDeclarativePluginOperations.swift`~~(已随 #1794 移除) - ~~`macos/Sources/LitheCoreContracts/Plugins/DeclarativePluginContracts.swift`~~(已随 #1794 移除) diff --git a/.agents/notes/implemented/architecture/2026-10-12-workbench-ui-contributions.md b/.agents/notes/implemented/architecture/2026-10-12-workbench-ui-contributions.md index 5ed63062c3..60415876ce 100644 --- a/.agents/notes/implemented/architecture/2026-10-12-workbench-ui-contributions.md +++ b/.agents/notes/implemented/architecture/2026-10-12-workbench-ui-contributions.md @@ -80,4 +80,4 @@ Agent 的配置入口由同一个目录补齐,移动到任何已有停靠区 - ~~`macos/Sources/LitheCoreContracts/Plugins/DeclarativePluginContracts.swift`~~(已随 #1794 移除) - ~~`macos/Sources/Lithe/Views/Workbench/`~~(已随 #1794 移除) - ~~`macos/Sources/Lithe/Application/Features/WorkbenchFeatureModel.swift`~~(已随 #1794 移除) -- `shared/contracts/plugins/v1/` +- `https://github.com/Lithe-IDEA/Lithe-core-rust/blob/main/shared/plugins/contract/v1/` diff --git a/.agents/notes/implemented/architecture/2026-10-13-java-language-server-as-declarative-plugin.md b/.agents/notes/implemented/architecture/2026-10-13-java-language-server-as-declarative-plugin.md index 54411198c0..c8c7735237 100644 --- a/.agents/notes/implemented/architecture/2026-10-13-java-language-server-as-declarative-plugin.md +++ b/.agents/notes/implemented/architecture/2026-10-13-java-language-server-as-declarative-plugin.md @@ -39,7 +39,7 @@ Java 的语言服务器 JDT LS(Eclipse 的 Java 语言服务器,提供补全 | 插件资源 | 集成要读的文件 | `hostIntegration.resources`,由插件声明包内路径 | | 宿主能力 | 仍由宿主内置实现提供的运行、测试、调试 | `hostIntegration.capabilities`,由插件逐项声明 | -字段语义以 `shared/contracts/plugins/v1/README.md` 为准,校验和模板展开只在 `rust/lithe-core/src/plugins/declarative.rs` 实现一次。 +字段语义以 `Lithe-core-rust/shared/plugins/contract/v1/README.md` 为准,校验和模板展开只在 `rust/lithe-core/src/plugins/declarative.rs` 实现一次。 ### 2. 契约 API 2 增加的内容 @@ -219,7 +219,7 @@ dev.lithe.plugin.java-support/ ## 适用范围 -- `shared/contracts/plugins/v1/` +- `https://github.com/Lithe-IDEA/Lithe-core-rust/blob/main/shared/plugins/contract/v1/` - Lithe-core-rust 锁定修订:[rust/lithe-core/src/plugins/declarative.rs](https://github.com/Lithe-IDEA/Lithe-core-rust/blob/0ffd327b4329261e393b08ed76fbd134b4dd17e9/rust/lithe-core/src/plugins/declarative.rs) - 已迁出:原 `Plugins/mac/Official/JavaSupport/`。官方插件的源码、组装与发布已移出本仓库(#1495),改由各插件仓库自行构建发布([lithe-plugin-java](https://github.com/Lithe-IDEA/lithe-plugin-java)、[lithe-plugin-maven](https://github.com/Lithe-IDEA/lithe-plugin-maven)、[lithe-plugin-gradle](https://github.com/Lithe-IDEA/lithe-plugin-gradle)),Store 索引由 Lithe Store 维护。 - 已迁出:原 `scripts/plugins/build-official-plugins.sh`。官方插件的源码、组装与发布已移出本仓库(#1495),改由各插件仓库自行构建发布([lithe-plugin-java](https://github.com/Lithe-IDEA/lithe-plugin-java)、[lithe-plugin-maven](https://github.com/Lithe-IDEA/lithe-plugin-maven)、[lithe-plugin-gradle](https://github.com/Lithe-IDEA/lithe-plugin-gradle)),Store 索引由 Lithe Store 维护。 diff --git a/.agents/notes/implemented/architecture/2026-10-17-build-system-plugin-contract.md b/.agents/notes/implemented/architecture/2026-10-17-build-system-plugin-contract.md index 7c80cf64ba..9c6ec6785d 100644 --- a/.agents/notes/implemented/architecture/2026-10-17-build-system-plugin-contract.md +++ b/.agents/notes/implemented/architecture/2026-10-17-build-system-plugin-contract.md @@ -10,7 +10,7 @@ Rust Core 负责校验声明、识别工程、展开每一条命令行,并把 映射(`map`)只从解码后的文档里挑值。挑值以外的逻辑由插件自己处理:读 JSON、YAML 清单,从工具读任务,计算父子关系,这些都交给插件自带的脚本输出规范格式(第 6 节)。声明和规范格式都表达不了的工具(Gradle Tooling API 等),由插件自带的 Provider 进程回答。Provider 就是语言服务器那种进程:共用启动字段、校验和启动计划,只多回答 `lithe/build/model`、`lithe/build/dependencies`,回复仍由 Core 解码(第 9 节)。 -目前落地的是 Core、共享契约和 macOS 宿主(第 10 节)。macOS 为每个启用的构建系统各开一个工具窗口,向 Core 声明 `buildSystems: [1]` 和 `buildProviders: [1]`,并在用户点击加载模型或依赖时启动 Provider、发送 `lithe/build/*`;Windows 宿主还没有接入。API 3 的清单按能力分版本,声明式构建系统使用 `buildSystems`,两种写法的 Provider 都额外使用 `buildProviders: 1`;插件市场只在宿主声明支持对应能力时才列出 API 3 的版本,见[声明式插件按能力分版本](2026-10-17-plugin-capability-versions.md)。宿主接入和 Maven 迁移的计划见[构建系统 Provider 提案](../../proposed/architecture/2026-10-17-build-system-provider-api.md)。 +目前落地的是 Core、共享契约和 macOS 宿主(第 10 节)。macOS 为每个启用的构建系统各开一个工具窗口,向 Core 声明 `buildSystems: [1]` 和 `buildProviders: [1]`,并在用户点击加载模型或依赖时启动 Provider、发送 `lithe/build/*`;Windows 宿主还没有接入。API 3 的清单按能力分版本,声明式构建系统使用 `buildSystems`,两种写法的 Provider 都额外使用 `buildProviders: 1`;插件市场只在宿主声明支持对应能力时才列出 API 3 的版本,见[插件契约从统一基线 0 开始](2026-11-11-plugin-contract-single-baseline.md)。宿主接入和 Maven 迁移的计划见[构建系统 Provider 提案](../../proposed/architecture/2026-10-17-build-system-provider-api.md)。 ### 当前实现范围与删除条件 @@ -66,7 +66,7 @@ Rust Core 负责校验声明、识别工程、展开每一条命令行,并把 `build.detect` 对普通文件根或不存在的根保留空实例结果,这属于检测入口的既有兼容边界。共用工作区扫描器后仍在此入口区分根的类型;真实目录的读取、权限或扫描失败继续返回拒绝,不能把所有 I/O 错误当作“未检测到项目”。不要为了修复某个平台的非目录错误而放宽共用扫描器,也不要让宿主按操作系统错误码猜测空结果。回归见 `detection_returns_empty_for_non_directory_and_missing_workspace_roots`。 -字段全集只写在 `shared/contracts/plugins/v1/README.md` 的 “API level 3: build systems” 一节和 `plugin-manifest.schema.json` 里,本 Note 不重复。四个 fixture 各示范一种模型来源,按能力命名而不是按真实插件命名:`build-static-file`(读项目文件,内容用 Cargo)、`build-command-stdout`(解码命令输出,内容用 Go)、`build-command-output-file`(解码命令写出的文件,内容用 Gradle)、`build-host-integration`(交给宿主集成,内容用 Maven)。`build-provider`、`build-provider-language-server` 分别示范 Provider 的两种写法。 +字段全集只写在 `Lithe-core-rust/shared/plugins/contract/v1/README.md` 的 “API level 3: build systems” 一节和 `plugin-manifest.schema.json` 里,本 Note 不重复。四个 fixture 各示范一种模型来源,按能力命名而不是按真实插件命名:`build-static-file`(读项目文件,内容用 Cargo)、`build-command-stdout`(解码命令输出,内容用 Go)、`build-command-output-file`(解码命令写出的文件,内容用 Gradle)、`build-host-integration`(交给宿主集成,内容用 Maven)。`build-provider`、`build-provider-language-server` 分别示范 Provider 的两种写法。 ### 2. Core 与宿主的分工 @@ -108,7 +108,7 @@ Rust Core 负责校验声明、识别工程、展开每一条命令行,并把 - **运行时**:`java`、`node`、`go` 由宿主管理,只写 ID 和最低版本,按用户的运行时设置发现。Core 提供 Java 的 `-version`、Node 的 `--version`、Go 的 `version` 探测参数,宿主合并标准输出与错误输出再交回 Core 校验;Java 8 不支持 `--version`,且版本信息通常写到错误输出,不能据此误判为不可用。其他任何 ID 都由插件自己写可执行文件候选和版本探测,所以运行时列表是开放的。 - **自带逻辑**:插件附带的脚本(例如 Gradle 的 init script,即初始化脚本)可以直接输出规范格式,不必写选择器映射。规范格式有 `litheBuildModel`、`litheTestResults`、`litheDependencies`、`litheDiagnostics`。规范文档里的未知字段会被忽略,所以新脚本配旧宿主也能用。插件自带的常驻 Provider 进程也用这几种格式回复(第 9 节)。 -固定词汇(要扩展就给对应能力加一个新版本,见[声明式插件按能力分版本](2026-10-17-plugin-capability-versions.md)): +固定词汇(要扩展就给对应能力加一个新版本,见[插件契约从统一基线 0 开始](2026-11-11-plugin-contract-single-baseline.md)): - 权限只新增一个 `process.build`;激活事件是 `onBuildSystem:`。 - 模板变量和参数条件。 @@ -395,7 +395,7 @@ macOS 接入规则(2026-10-18): - ~~`macos/Sources/Lithe/Views/Run/BuildOutputView.swift`~~(已随 #1794 移除) - Lithe-core-rust 锁定修订:[rust/lithe-core/src/runtime/dispatcher.rs](https://github.com/Lithe-IDEA/Lithe-core-rust/blob/0ffd327b4329261e393b08ed76fbd134b4dd17e9/rust/lithe-core/src/runtime/dispatcher.rs) - Lithe-core-rust 锁定修订:[rust/lithe-core/src/tests/build_systems.rs](https://github.com/Lithe-IDEA/Lithe-core-rust/blob/0ffd327b4329261e393b08ed76fbd134b4dd17e9/rust/lithe-core/src/tests/build_systems.rs) -- `shared/contracts/plugins/v1/` +- `https://github.com/Lithe-IDEA/Lithe-core-rust/blob/main/shared/plugins/contract/v1/` - `shared/contracts/rust-core-api.md` - ~~scripts/architecture/verify-shared-contracts.sh~~(脚本已随旧客户端移除) diff --git a/.agents/notes/implemented/architecture/2026-10-18-plugin-web-content-in-host-windows.md b/.agents/notes/implemented/architecture/2026-10-18-plugin-web-content-in-host-windows.md index 71ef85d7e7..8b3621c87e 100644 --- a/.agents/notes/implemented/architecture/2026-10-18-plugin-web-content-in-host-windows.md +++ b/.agents/notes/implemented/architecture/2026-10-18-plugin-web-content-in-host-windows.md @@ -33,7 +33,7 @@ ### 桥接对象 -宿主在页面脚本执行前注入 `window.lithe`(当前第 2 版,`lithe.version` 给出版本号):`context`、`request(method, params)` 和 `on(event, listener)`。方法和事件的全集写在 `shared/contracts/plugins/v1/README.md` 的 “Web content (`ui` 2)” 一节,这里只记录边界: +宿主在页面脚本执行前注入 `window.lithe`(当前第 2 版,`lithe.version` 给出版本号):`context`、`request(method, params)` 和 `on(event, listener)`。方法和事件的全集写在 `Lithe-core-rust/shared/plugins/contract/v1/README.md` 的 “Web content (`ui` 2)” 一节,这里只记录边界: - 页面只能操作本插件声明的构建系统和当前工作区,越界返回 `plugin.web.forbidden`。 - 凡是会启动进程的请求(刷新模型、跑任务、跑测试),都要经过与宿主自身按钮相同的信任和同意流程,输出进入宿主的 Build Output。页面不能提交或修改进程 argv,也不能自己拼命令;模型保留 Core 返回的声明运行项 `run` 和任务 `category` 供展示,执行入口仍只有宿主校验过的任务与测试。 @@ -132,7 +132,7 @@ Viva 的 Web 视图目前有四处达不到契约,已记录为上游缺口, ## 适用范围 -- `shared/contracts/plugins/v1/` +- `https://github.com/Lithe-IDEA/Lithe-core-rust/blob/main/shared/plugins/contract/v1/` - Lithe-core-rust:`rust/lithe-core/src/plugins/web_content.rs`(Lithe-IDEA/Lithe-core-rust#9) - `desktop/internal/pluginweb/` - `desktop/internal/workbench/pluginpages.go`、`desktop/internal/workbench/plugintools.go` diff --git a/.agents/notes/implemented/architecture/2026-10-20-host-plugin-function-invocation.md b/.agents/notes/implemented/architecture/2026-10-20-host-plugin-function-invocation.md index 956c96e806..abffe87dc3 100644 --- a/.agents/notes/implemented/architecture/2026-10-20-host-plugin-function-invocation.md +++ b/.agents/notes/implemented/architecture/2026-10-20-host-plugin-function-invocation.md @@ -2,7 +2,7 @@ 状态:已实现 -> Viva 迁移状态:下文的网页和设置入口、权限同意及进程清理是旧 macOS 客户端的历史实现。Viva 已具备通用 Core 会话及函数调用的基础桥接,尚未接入插件安装、权限审查、网页或设置入口。本文当时暂缓宿主方法的决定不等于现行协议不支持宿主方法;其当前契约及授权要求以 `shared/contracts/plugins/v1/README.md` 为准。 +> Viva 迁移状态:下文的网页和设置入口、权限同意及进程清理是旧 macOS 客户端的历史实现。Viva 已具备通用 Core 会话及函数调用的基础桥接,尚未接入插件安装、权限审查、网页或设置入口。本文当时暂缓宿主方法的决定不等于现行协议不支持宿主方法;其当前契约及授权要求以 `Lithe-core-rust/shared/plugins/contract/v1/README.md` 为准。 ## 先说结论 @@ -150,13 +150,13 @@ if pluginID == "dev.lithe.maven" { 启动带函数的会话 } // 宿主按插 - 每个 Provider 带独有的 `LITHE_PLUGIN_BACKEND_SCOPE`,会话结束后宿主按该标记优雅结束遗留进程。 - `./scripts/macos/verify/verify-runtime-bundle-immutability.sh`:确认没有新增写入 bundle 的路径。 - macOS 原生验收(2026-10-20,PR #1366 合并 PR #1365 后的 debug 应用): - - 环境:Node SDK 的示例插件 `sdk/node/examples/sample-build`(当时在主仓库,现位于 lithe-plugin-docs)加一个只用于验收的网页窗口,作为开发包从磁盘安装;另装一个带自己构建系统和网页窗口的验收插件;示例工作区含成功、失败(退出码 3)和长时间运行三个项目。页面把每一步结果写进 `ui.setState`,验收读取 Application Support 中的状态文件核对。 + - 环境:Node SDK 的示例插件 `sdk/node/examples/sample-build`(当时在主仓库,现位于 Core 仓库的 `shared/plugins/sdk/node/examples/sample-build`)加一个只用于验收的网页窗口,作为开发包从磁盘安装;另装一个带自己构建系统和网页窗口的验收插件;示例工作区含成功、失败(退出码 3)和长时间运行三个项目。页面把每一步结果写进 `ui.setState`,验收读取 Application Support 中的状态文件核对。 - `functions.list` 返回 `snapshot.read`、`workspace.build`;一次成功构建后再列出,多了运行时注册的 `snapshot.clear`。 - `functions.invoke` 带 `call` 时,页面依次收到 `Preparing`、`Building app`、`Done` 三个 `functions.progress`,结果作为 `{ value }` 到达;失败项目返回 `plugin.function.failed`,并带上插件自己的 `pluginErrorCode: sample.buildFailed`。 - `functions.cancel` 后调用以 `requestCancelled` 结束;构建子进程在取消后立刻退出(采样中最后一次出现早于取消约 0.1 秒)。对已结束的 `call` 再取消返回 `{}`。未注册的函数返回 `plugin.function.unknown`,`params` 不是对象返回 `plugin.web.invalidRequest`。 - 另一个插件的页面用 `sample:.` 调用 `functions.list` / `functions.invoke` 都得到 `plugin.web.forbidden`,并且在弹同意框之前就被拒绝;它调用自己实例上的 `snapshot.read` 得到 `plugin.function.unknown`,说明函数按进程隔离。 - 进程清理:调用进行中关闭项目、或在设置里停用插件,Provider 及其构建子进程都会退出(`ps`/`pgrep` 确认);从磁盘替换插件包时旧 Provider 也会停止;退出应用后没有任何 Lithe 或插件进程残留。重启应用后 `snapshot.read` 返回上次会话的快照。 - - 验收发现示例的路径检查在宿主 `rootUri` 带尾部斜杠时拒绝所有路径(macOS 传的是目录 URL 的 `absoluteString`),所有构建都报 `sample.config`。已在示例里用 `path.resolve` 规范化根目录,并让当时主仓库的 `rust/lithe-core/tests/plugin_sdk_node.rs`(现为 lithe-plugin-docs 的 `sdk/e2e/plugin_sdk_node.rs`)用带尾部斜杠的 `rootUri`;未修复时该测试失败,修复后通过。 + - 验收发现示例的路径检查在宿主 `rootUri` 带尾部斜杠时拒绝所有路径(macOS 传的是目录 URL 的 `absoluteString`),所有构建都报 `sample.config`。已在示例里用 `path.resolve` 规范化根目录,并让当时主仓库的 `rust/lithe-core/tests/plugin_sdk_node.rs`(现为 Core 仓库的 `shared/plugins/sdk/e2e/plugin_sdk_node.rs`)用带尾部斜杠的 `rootUri`;未修复时该测试失败,修复后通过。 - `./scripts/platform-feature-matrix/verify-platform-feature-matrix.sh`:`plugin-functions` 的 macOS 证据已更新。 ## 适用范围 @@ -165,4 +165,4 @@ if pluginID == "dev.lithe.maven" { 启动带函数的会话 } // 宿主按插 - `desktop/internal/core/plugin_session_test.go` - `shared/platform-feature-matrix/features/plugin-functions.json` - [旧版实现、验证与原适用范围](https://github.com/1lck/Lithe-IDEA/blob/5a54c41aa37a4e6e6b68918a4b05765b9dd07a36/.agents/notes/implemented/architecture/2026-10-20-host-plugin-function-invocation.md) -- `shared/contracts/plugins/v1/README.md` +- `https://github.com/Lithe-IDEA/Lithe-core-rust/blob/main/shared/plugins/contract/v1/README.md` diff --git a/.agents/notes/implemented/architecture/2026-10-20-plugin-backend-sdk.md b/.agents/notes/implemented/architecture/2026-10-20-plugin-backend-sdk.md index 08b84e28a7..77c0dacbfb 100644 --- a/.agents/notes/implemented/architecture/2026-10-20-plugin-backend-sdk.md +++ b/.agents/notes/implemented/architecture/2026-10-20-plugin-backend-sdk.md @@ -2,17 +2,17 @@ 状态:已实现 -> 当前边界:SDK 源码与发布由 [lithe-plugin-docs](https://github.com/Lithe-IDEA/lithe-plugin-docs) 持有,其 `sdk/` 现有 Node、Java 和 Rust 三套实现;下文记录最初 Node/Java 两套 SDK 的决策和历史验证。Viva 的 Core 后端会话桥接已有测试,但插件安装和面向用户的完整宿主工作流仍未接入,不能把 SDK 或 Core 的存在当作端到端验收。 +> 当前边界:SDK 源码与发布由 Rust Core 仓库 [Lithe-core-rust](https://github.com/Lithe-IDEA/Lithe-core-rust/tree/main/shared/plugins/sdk) 的 `shared/plugins/sdk/` 持有,现有 Node、Java 和 Rust 三套实现;下文记录最初 Node/Java 两套 SDK 的决策和历史验证。Viva 的 Core 后端会话桥接已有测试,但插件安装和面向用户的完整宿主工作流仍未接入,不能把 SDK 或 Core 的存在当作端到端验收。 ## 先说结论 最初提供的两个官方插件后端 SDK 是 `sdk/node`(包名 `@lithe/plugin-sdk`)和 `sdk/java`(`lithe-plugin-sdk-java`,Java 8 起可用)。插件作者只写处理器(handler,收到一次请求后执行的函数);JSON-RPC 帧、`litheBuild` 和 `litheFunctions` 协商、取消、进程清理、错误映射都由 SDK 负责。这两个 SDK 的规则和错误语义相同。 -SDK 只**实现**契约,不**定义**契约。协议仍以 `shared/contracts/plugins/v1/README.md` 为准,SDK 不新增任何线上字段;不用 SDK 手写的后端同样合法。SDK 的价值是把“不能破坏 Lithe 统一管理”的规则变成默认行为:不发 `lithe/*` 回调、stdout 只走协议、状态只写宿主给的目录、调用结束时进程树一起结束。 +SDK 只**实现**契约,不**定义**契约。协议仍以 `Lithe-core-rust/shared/plugins/contract/v1/README.md` 为准,SDK 不新增任何线上字段;不用 SDK 手写的后端同样合法。SDK 的价值是把“不能破坏 Lithe 统一管理”的规则变成默认行为:不发 `lithe/*` 回调、stdout 只走协议、状态只写宿主给的目录、调用结束时进程树一起结束。 两个 SDK 各有一个示例插件(`sdk/*/examples/sample-build`),经真实 Core 会话跑**同一套**端到端场景(`sdk/e2e/plugin_sdk/mod.rs`)。所以任一 SDK 与契约或另一个 SDK 的行为出现分叉时,测试都会失败。 -2026-10-23 起,两个 SDK 的源码、发版和端到端测试都在 [lithe-plugin-docs](https://github.com/Lithe-IDEA/lithe-plugin-docs) 的 `sdk/` 下,主仓库不再保存 SDK。插件开发者只看那个仓库就能拿到契约副本、SDK 和教程。迁移原因见 [插件契约、SDK 与开发者资料的发布](2026-10-23-plugin-contract-publishing.md);下文出现的 `sdk/...` 路径都指 lithe-plugin-docs。 +2026-10-23 起,SDK 的源码、发版和端到端测试不再放在主仓库,先移到已退役的 lithe-plugin-docs 的 `sdk/` 下,之后连同契约并入 Core 仓库。现在这些内容都在 Core 仓库的 `shared/plugins/` 下,主仓库不保存 SDK。插件开发者只看 Core 仓库的 `shared/plugins/` 就能拿到契约、SDK 和教程。移出主仓库的原因见 [插件契约与开发资料只在 Rust Core](../../implemented/architecture/2026-11-11-plugin-contract-single-source-in-core.md);下文出现的 `sdk/...`、`contract/...`、`scripts/...` 路径都相对 Core 仓库的 `shared/plugins/`。 ## 问题 @@ -29,13 +29,13 @@ Issue #1351 的目标是给插件开发者开放官方 SDK,同时“保留创 ### 1. 先做 Node,SDK 单独成一个目录 -Lithe 的 `runtime` 启动方式已支持 `node` 和 `java`。Node 无需编译、单文件即可分发、启动快,最适合作为第一个 SDK。SDK 与 `shared/`(契约)、`Plugins/`(具体插件包)分开:它是可被插件复制使用的库代码,不属于任何一个平台,也不是契约本身。最初放在主仓库根目录 `sdk/`,后来整体移到 lithe-plugin-docs 的 `sdk/`。 +Lithe 的 `runtime` 启动方式已支持 `node` 和 `java`。Node 无需编译、单文件即可分发、启动快,最适合作为第一个 SDK。SDK 与契约、`Plugins/`(具体插件包)分开:它是可被插件复制使用的库代码,不属于任何一个平台,也不是契约本身。最初放在主仓库根目录 `sdk/`,后来整体移到 lithe-plugin-docs 的 `sdk/`,现在与契约一起在 Core 仓库的 `shared/plugins/sdk/`。 ### 2. 零依赖、复制进插件包使用 插件包安装后只读、没有 `npm install` 步骤、必须能离线运行。所以 SDK 不依赖任何 npm 包,插件作者把 SDK 复制到包内用相对路径导入。 -发布方式和 Java SDK 相同:lithe-plugin-docs 打 `sdk-node-v<版本>` 标签,它的 `.github/workflows/release-node-sdk.yml` 先在 Node 20 上跑 SDK 测试,再用 `npm pack` 生成 `lithe-plugin-sdk-node-<版本>.tgz` 和 `.sha256`,附在 GitHub Release 上。插件仓库在构建时按固定版本和 SHA-256 下载、校验并解开,把 `package/` 目录放进插件包;运行时不下载任何东西。这样外部开发者不用克隆主仓库,也不用给主仓库提 PR。`package.json` 仍标 `private: true`,`npm pack` 不受影响,但 SDK 不会被误发到 npm;等 API 稳定后再决定是否发布到 npm。 +发布方式和 Java SDK 相同:Core 仓库打 `sdk-node-v<版本>` 标签,它的 `.github/workflows/plugins-release-node-sdk.yml` 先在 Node 20 上跑 SDK 测试,再用 `npm pack` 生成 `lithe-plugin-sdk-node-<版本>.tgz` 和 `.sha256`,附在 GitHub Release 上。插件仓库在构建时按固定版本和 SHA-256 下载、校验并解开,把 `package/` 目录放进插件包;运行时不下载任何东西。0.4.x 及更早的 SDK 发布于已退役的 lithe-plugin-docs,0.5.0 起从 Core 仓库发布。这样外部开发者不用克隆主仓库,也不用给主仓库提 PR。`package.json` 仍标 `private: true`,`npm pack` 不受影响,但 SDK 不会被误发到 npm;等 API 稳定后再决定是否发布到 npm。 ### 3. 规则变成默认行为,而不是文档里的建议 @@ -63,7 +63,7 @@ Maven、Gradle 这类插件需要在后端里调用 JVM 生态的工具,并长 - **最低 Java 8。** 很多企业项目仍在 Java 8 上构建,后端最好能直接用项目那个 JDK 启动。代价是 SDK 只能用 Java 8 的 API。 - **零运行时依赖,自带最小 JSON 读写(`Json`)。** 插件要把 SDK shade(打进同一个 JAR)到自己的后端里。如果 SDK 依赖 Gson 或 lsp4j,就会和插件自己的同名依赖冲突,许可证审查范围也会变大。 -- **发布方式:打 `sdk-java-v<版本>` 标签,Release 附带 JAR 和 `.sha256`。** 0.1.0 是从主仓库发布的,已锁定它的插件不用改;之后的版本由 lithe-plugin-docs 的 `.github/workflows/release-java-sdk.yml` 发布。暂不发到 Maven 仓库。插件仓库在构建时按固定版本和 SHA-256 下载并校验,再 shade 进后端 JAR,运行时不下载任何东西。 +- **发布方式:打 `sdk-java-v<版本>` 标签,Release 附带 JAR 和 `.sha256`。** 0.1.0 是从主仓库发布的,已锁定它的插件不用改;之后的版本先由 lithe-plugin-docs 的 `release-java-sdk.yml` 发布,0.5.0 起由 Core 仓库的 `.github/workflows/plugins-release-java-sdk.yml` 发布。暂不发到 Maven 仓库。插件仓库在构建时按固定版本和 SHA-256 下载并校验,再 shade 进后端 JAR,运行时不下载任何东西。 - **处理器各自跑在守护线程池上,读循环只负责分帧和派发。** 取消不打断(interrupt)线程,只置位取消令牌,并结束该调用启动的进程。这是因为中断会让处理器里正在进行的文件写入半途失败。 - **进程按调用清理,用进程组,与 Node SDK 一致。** 常驻后端不会因为一次调用结束而退出,宿主按 `LITHE_PLUGIN_BACKEND_SCOPE` 的清理要等会话结束才发生,所以 SDK 必须在调用结束或取消时自己结束工具留下的进程。Java 没有进程组 API,macOS 和 Linux 上 SDK 通过系统 `perl`(`setpgrp(0, 0)` 后 `exec` 成工具,PID 不变)让每个工具成为自己进程组的组长:取消时先给整组发 SIGTERM,宽限期后发 SIGKILL;工具正常退出后立即对整组发 SIGKILL,结束它留下的后台进程。信号经 `/bin/kill -- -` 发出,因此 Java 8 和 Java 9+ 行为相同;只要组里还有成员,组 ID 就不会被复用,所以不会误伤其他并发调用。`PERL5OPT` 会让 perl 启动时加载模块,SDK 先从 perl 的环境里拿掉,再在 `exec` 前还给工具。启动失败时 launcher 以 127 退出并带固定前缀,SDK 仍抛 `IOException`,与 `ProcessBuilder` 一致。Windows 或没有 `perl` 时退回 `ProcessHandle.descendants()`(Java 9+,Windows 不会重挂父进程,工具退出后仍能找到子孙);Java 8 只能结束直接子进程。用 `setsid` 脱离进程组的进程,以及退回路径够不到的进程,仍由宿主按后端标记在会话结束时兜底。 - **取消监听器互相隔离。** 一个 `onCancel` 回调抛异常只记录到 stderr,不影响其余回调;调用收尾放在 `finally` 里,保证请求一定回复,宿主不会只等到超时。 @@ -107,30 +107,29 @@ Maven、Gradle 这类插件需要在后端里调用 JVM 生态的工具,并长 ### 让 SDK 增加便利字段(如函数描述、参数 schema) -被否:SDK 不能定义协议。需要的字段应先进入 `shared/contracts/plugins/` 的新协议版本,再由 SDK 实现,否则用 SDK 的插件和手写后端的行为会分叉。 +被否:SDK 不能定义协议。需要的字段应先进入 `Lithe-core-rust/shared/plugins/contract/v1/` 的新协议版本,再由 SDK 实现,否则用 SDK 的插件和手写后端的行为会分叉。 ## 后果 - 收益:插件作者只写处理器;取消、清理、错误映射和状态存储默认正确,Lithe 的统一管理规则不依赖作者自觉。 -- 收益:示例插件经过真实 Core 会话验证。lithe-plugin-docs 每次提交都用契约副本锁定的那个主仓库 commit 跑端到端测试,每周再用主仓库 `preview` 分支的最新 Core 跑一次,Core 改动破坏 SDK 时会在这里失败。 +- 收益:示例插件经过真实 Core 会话验证。SDK 与 Core 在同一仓库,改动 Core 或 SDK 的 PR 都由 `plugins-verify.yml` 对同一提交的 Core 跑端到端测试,Core 改动破坏 SDK 时在合并前就会失败。 - 代价:Node SDK 以复制源码方式分发,Java SDK 被 shade 进插件 JAR,插件里的副本都不会自动升级;修复安全问题时需要插件重新发布。 -- 代价:SDK 移出主仓库后,主仓库的 PR 不再当场发现“Core 改动破坏 SDK”,最晚由 lithe-plugin-docs 的每周检查发现。改 Core 的插件后端协议时,应在合并前用 lithe-plugin-docs 的 `node scripts/sdk-e2e.mjs --source <本地主仓库> --ref <分支>` 手动跑一次。 -- 代价:lithe-plugin-docs 的端到端测试需要 Rust、Node、JDK 和 Maven,每次都要编译一遍 Core;CI 用 Java 8 运行时跑 Java SDK 测试和示例后端,用 JDK 21 编译。 +- 代价:SDK 不在主仓库,主仓库的 PR 不会运行 SDK 端到端测试。插件后端协议由 Core 持有,改动它的 PR 在 Core 仓库验证;本地复现时,在 Core 仓库根目录运行 `node shared/plugins/scripts/sdk-e2e.mjs`,它测试当前工作树的 Core。 +- 代价:端到端测试需要 Rust、Node、JDK 和 Maven,每次都要编译一遍 Core;CI 用 Java 8 运行时跑 Java SDK 测试和示例后端,用 JDK 21 编译。 - 代价:宿主还没有调用函数的界面入口,也没有宿主能力(`lithe/host/*`);Windows 没有插件后端宿主。SDK 目前对用户不可见,只给开发者和后续 PR 使用。 ## 验证 -以下命令都在 lithe-plugin-docs 中运行: +以下命令都在 Core 仓库根目录运行: -- `node --test sdk/node/test/*.test.mjs`:协商、ID 规则(对照 `contract/v1/fixtures/backend/function-protocol.json`)、保留方法、调用/进度/错误/取消、运行时注册、构建结果、生命周期和退出码、分帧、进程树取消、状态存储与只读包拒绝、类型声明与运行时导出一致。 -- `mvn -B -f sdk/java/pom.xml verify [-Djvm=]`:Java SDK 的 JUnit 测试,覆盖与 Node 测试相同的协议场景,另含 JSON、分帧、进程树取消和状态存储。 -- `node scripts/sdk-e2e.mjs`:把 `sdk/e2e` 复制进锁定版本主仓库的 `rust/lithe-core/tests/`,运行 `plugin_sdk_node` 和 `plugin_sdk_java`。Node 示例经 Core 校验、启动计划、版本检查、构建模型/依赖、函数结果/进度/失败/取消、重启后状态恢复,最后确认插件包文件清单不变;Java 示例按插件实际打包方式(`plugin.json` + shade 后的 JAR)装进临时包目录,跑同一套场景。设置 `LITHE_PLUGIN_SDK_JAVA_RUNTIME` 时,Java 示例在该运行时(CI 为 Java 8)上运行。 -- `node scripts/sdk-e2e.mjs --ref preview`:同上,换成主仓库 `preview` 分支的最新 Core;CI 每周运行。 +- `node --test shared/plugins/sdk/node/test/*.test.mjs`:协商、ID 规则(对照 `shared/plugins/contract/v1/fixtures/backend/function-protocol.json`)、保留方法、调用/进度/错误/取消、运行时注册、构建结果、生命周期和退出码、分帧、进程树取消、状态存储与只读包拒绝、类型声明与运行时导出一致。 +- `mvn -B -f shared/plugins/sdk/java/pom.xml verify [-Djvm=]`:Java SDK 的 JUnit 测试,覆盖与 Node 测试相同的协议场景,另含 JSON、分帧、进程树取消和状态存储。 +- `node shared/plugins/scripts/sdk-e2e.mjs`:对当前工作树的 Core 运行 `shared/plugins/sdk/e2e` 里的场景,即 `plugin_sdk_node` 和 `plugin_sdk_java` 等集成测试。Node 示例经 Core 校验、启动计划、版本检查、构建模型/依赖、函数结果/进度/失败/取消、重启后状态恢复,最后确认插件包文件清单不变;Java 示例按插件实际打包方式(`plugin.json` + shade 后的 JAR)装进临时包目录,跑同一套场景。设置 `LITHE_PLUGIN_SDK_JAVA_RUNTIME` 时,Java 示例在该运行时(CI 为 Java 8)上运行。 ## 适用范围 -- `https://github.com/Lithe-IDEA/lithe-plugin-docs` +- `https://github.com/Lithe-IDEA/Lithe-core-rust/tree/main/shared/plugins/sdk` - Lithe-core-rust 锁定修订:[rust/lithe-core/src/plugins/declarative.rs](https://github.com/Lithe-IDEA/Lithe-core-rust/blob/0ffd327b4329261e393b08ed76fbd134b4dd17e9/rust/lithe-core/src/plugins/declarative.rs)(运行时启动计划的版本探测参数) -- `shared/contracts/plugins/v1/README.md` +- `https://github.com/Lithe-IDEA/Lithe-core-rust/blob/main/shared/plugins/contract/v1/README.md` - `desktop/internal/core/plugin_session.go` - `desktop/internal/core/plugin_session_test.go` diff --git a/.agents/notes/implemented/architecture/2026-10-20-plugin-function-contract.md b/.agents/notes/implemented/architecture/2026-10-20-plugin-function-contract.md index 1ea5aeb6c9..bdf27e93b6 100644 --- a/.agents/notes/implemented/architecture/2026-10-20-plugin-function-contract.md +++ b/.agents/notes/implemented/architecture/2026-10-20-plugin-function-contract.md @@ -4,7 +4,7 @@ ## 先说结论 -插件后端进程(语言服务器或构建 Provider,插件自己启动、用 JSON-RPC 通信的进程)现在可以提供**插件函数**(Plugin Function):只属于这个插件、参数和结果都可序列化的动作,例如插件自己窗口里一个按钮背后的步骤。协议名是 `litheFunctions` 版本 1,在 `initialize` 里协商,与 `litheBuild` 互不依赖;契约写在 `shared/contracts/plugins/v1/README.md` 的 “Plugin functions” 一节,标准答案在 `fixtures/backend/function-protocol.json`。 +插件后端进程(语言服务器或构建 Provider,插件自己启动、用 JSON-RPC 通信的进程)现在可以提供**插件函数**(Plugin Function):只属于这个插件、参数和结果都可序列化的动作,例如插件自己窗口里一个按钮背后的步骤。协议名是 `litheFunctions` 版本 1,在 `initialize` 里协商,与 `litheBuild` 互不依赖;契约写在 `Lithe-core-rust/shared/plugins/contract/v1/README.md` 的 “Plugin functions” 一节,标准答案在 `fixtures/backend/function-protocol.json`。 这次同时定下了能力的三个方向:插件提供**领域能力**(构建模型、依赖树,契约归 Lithe)、插件提供**插件函数**(契约归插件)、插件调用**宿主能力**(契约归宿主)。领域操作仍走类型化的 `lithe/build/*`,插件函数不能代替它;后端也不能请宿主再派发领域操作或函数,避免处理器绕回自己。 @@ -200,7 +200,7 @@ Maven 插件窗口的“刷新快照”按钮 - Lithe-core-rust 锁定修订:[rust/lithe-core/src/lsp/interface/engine.rs](https://github.com/Lithe-IDEA/Lithe-core-rust/blob/0ffd327b4329261e393b08ed76fbd134b4dd17e9/rust/lithe-core/src/lsp/interface/engine.rs) - Lithe-core-rust 锁定修订:[rust/lithe-core/src/protocol/command.rs](https://github.com/Lithe-IDEA/Lithe-core-rust/blob/0ffd327b4329261e393b08ed76fbd134b4dd17e9/rust/lithe-core/src/protocol/command.rs) - Lithe-core-rust 锁定修订:[rust/lithe-core/src/runtime/dispatcher.rs](https://github.com/Lithe-IDEA/Lithe-core-rust/blob/0ffd327b4329261e393b08ed76fbd134b4dd17e9/rust/lithe-core/src/runtime/dispatcher.rs) -- `shared/contracts/plugins/v1/README.md` -- `shared/contracts/plugins/v1/fixtures/backend/function-protocol.json` +- `https://github.com/Lithe-IDEA/Lithe-core-rust/blob/main/shared/plugins/contract/v1/README.md` +- `https://github.com/Lithe-IDEA/Lithe-core-rust/blob/main/shared/plugins/contract/v1/fixtures/backend/function-protocol.json` - `shared/contracts/rust-core-api.md` - ~~scripts/architecture/verify-shared-contracts.sh~~(脚本已随旧客户端移除) diff --git a/.agents/notes/implemented/architecture/2026-10-21-plugin-settings-surfaces.md b/.agents/notes/implemented/architecture/2026-10-21-plugin-settings-surfaces.md index 993442c596..775f6ede8b 100644 --- a/.agents/notes/implemented/architecture/2026-10-21-plugin-settings-surfaces.md +++ b/.agents/notes/implemented/architecture/2026-10-21-plugin-settings-surfaces.md @@ -176,7 +176,7 @@ Swift 和 Windows 各写一遍合并规则最直接,但两边一旦有细微 - ~~./scripts/macos/test/test-macos.sh --filter SettingsSidebarLayoutTests~~(随旧客户端移除):静态页面仍各归一个分组。 - ~~./scripts/macos/test/test-macos.sh --filter PluginSettingsLayoutTests~~(随旧客户端移除):480、640、900 点宽的深浅主题下,路径输入框和完整选择按钮都在容器内,按钮可调用选择器并写入所选路径。 - ~~./scripts/macos/test/test-macos.sh --filter PluginDetailLayoutTests~~(随旧客户端移除):实际 Java 插件表单在深浅主题中往返缩放,详情边界始终跟随分隔条,窄面板下右侧设置可经原生横向滚动到达。 -- 共享夹具:`shared/contracts/plugins/v1/fixtures/settings/settings-v2.plugin.json`。 +- 共享夹具:`Lithe-core-rust/shared/plugins/contract/v1/fixtures/settings/settings.plugin.json`。 ## 适用范围 @@ -189,4 +189,4 @@ Swift 和 Windows 各写一遍合并规则最直接,但两边一旦有细微 - ~~`macos/Sources/Lithe/Views/App/PluginSettingsSection.swift`~~(已随 #1794 移除) - ~~`macos/Sources/Lithe/Views/Components/LitheSettingsControls.swift`~~(已随 #1794 移除) - ~~`macos/Sources/Lithe/Views/App/ContributedSettingsPageView.swift`~~(已随 #1794 移除) -- `shared/contracts/plugins/v1/README.md` +- `https://github.com/Lithe-IDEA/Lithe-core-rust/blob/main/shared/plugins/contract/v1/README.md` diff --git a/.agents/notes/implemented/architecture/2026-10-22-windows-declarative-plugin-host.md b/.agents/notes/implemented/architecture/2026-10-22-windows-declarative-plugin-host.md index cf07b4caf2..93611fb739 100644 --- a/.agents/notes/implemented/architecture/2026-10-22-windows-declarative-plugin-host.md +++ b/.agents/notes/implemented/architecture/2026-10-22-windows-declarative-plugin-host.md @@ -125,7 +125,7 @@ M1 包存储 + 启动校验 + 语言注册 + LSP 启动(已落地);M2 磁 - M4 Web 工具窗口:`plugin_host/web.rs` 测试覆盖包路径规范化(`..`、编码分隔符、空段拒绝)、CSP 内容断言(default-src none、无 wasm-unsafe-eval、frame-ancestors none)、桥脚本冻结与作用域、状态键隔离;web-panel fixture 随 `ui:[1,2]` 声明提升转为被宿主接受(能力门控测试同步)。桥 v0 的 build.*/functions.* 返回 `plugin.web.unknownMethod`,等构建系统能力接入。 -- M3 设置链路:`settings_tests`(`plugin_host/tests.rs`)覆盖项目覆盖往返、其他插件条目保留、损坏 store 报错不重置;能力门控测试随声明提升更新(settings-v2 fixture 被接受)。设置编辑 UI(`declarative-plugin-settings-editor.tsx`)按声明的 scope/effect 渲染并显示值来源徽标。 +- M3 设置链路:`settings_tests`(`plugin_host/tests.rs`)覆盖项目覆盖往返、其他插件条目保留、损坏 store 报错不重置;能力门控测试随声明提升更新(settings fixture 被接受)。设置编辑 UI(`declarative-plugin-settings-editor.tsx`)按声明的 scope/effect 渲染并显示值来源徽标。 - M3 运行计划:契约 PHP 包端到端测试(`bundled_php_contract_package_expands_plans`)走真实 Core 命令验证 validate、runPlan(`${file}`/`${userArguments}` 展开)、testPlan(workspace scope + 项目标记)、resolveSettings。 diff --git a/.agents/notes/implemented/architecture/2026-10-24-database-provider-plugin.md b/.agents/notes/implemented/architecture/2026-10-24-database-provider-plugin.md index 693227b306..111638ecfe 100644 --- a/.agents/notes/implemented/architecture/2026-10-24-database-provider-plugin.md +++ b/.agents/notes/implemented/architecture/2026-10-24-database-provider-plugin.md @@ -81,7 +81,7 @@ | 主仓库 | 只保留通用能力:契约、Rust Core 校验、两端宿主实现、Rust 后端 SDK 的契约测试 | | 主仓库最终删除 | `macos/Sources/LitheDatabaseModule/`、`macos/Sources/Lithe/Views/Database/`、`rust/lithe-db-sidecar/`、`rust/lithe-db-mcp/`、`windows/tauri/src/features/database/` 及打包脚本中的数据库部分 | -插件仓库只依赖公开契约:`lithe-plugin-docs` 中锁定的契约副本加官方 SDK,和 Cargo、SVN 插件的做法相同。主仓库不再按“数据库”写任何分支。 +插件仓库只依赖公开契约:Core 仓库 `shared/plugins/contract/v1/` 的契约加官方 SDK(同在 Core 仓库的 `shared/plugins/sdk/`),和 Cargo、SVN 插件的做法相同。主仓库不再按“数据库”写任何分支。 ### 三、插件身份与分发 @@ -104,7 +104,7 @@ 2. **宿主凭据存储(插件函数协议 v2,已在契约中实现)。** v2 是第一个提供宿主服务的协议版本:`lithe/host/credentials/{get,set,delete}`,需要 `credentials.store` 权限(没有后端时声明即无效)。Core 在宿主看到请求前校验协议版本、授权和参数(key 只允许 `[A-Za-z0-9._:-]` 且不超过 128 字节,secret 不超过 16 KiB,拒绝未知字段以便后续版本扩展),通过 `hostRequest` 事件交给宿主,宿主用 `lsp.hostResponse` 应答;每个会话最多 16 个未应答请求。macOS 使用 Keychain,按插件 ID 划分命名空间;插件读不到别的插件或宿主自身的凭据。生命周期:停用和更新时保留,卸载时与 `${stateDir}` 一起删除。 3. **Agent 工具经由 `lithe` MCP(后续)。** 不新增“插件声明 MCP 服务”的契约,也不保留独立的 `lithe-db-mcp` 进程。之后由插件以插件函数的形式提供 Agent 工具,IDE 宿主把它们登记进现有 `lithe` MCP 的能力目录,沿用其项目授权;插件停用时工具随之消失。这一项在数据库插件上线后单独设计,不阻塞第 1 到第 5 期。 4. **按平台的可执行文件:不改契约。** 每个平台单独出下载包,可执行文件放在包内固定路径(例如 `bin/backend`),macOS 包可以是 universal 二进制。`${arch}` 本来就不能用于 `packaged` 路径,这样也不需要。Windows 的 `.exe` 等 Windows 宿主就绪时再定。 -5. **Rust 后端 SDK。** 在 `lithe-plugin-docs` 中新增 `sdk/rust`,实现插件函数协议和宿主能力,并补端到端样例,和 Node、Java SDK 对齐。 +5. **Rust 后端 SDK。** 新增 `sdk/rust`,实现插件函数协议和宿主能力,并补端到端样例,和 Node、Java SDK 对齐。它当时放在 lithe-plugin-docs,现在和另外两个 SDK 一起在 Core 仓库的 `shared/plugins/sdk/rust`。 ### 五、规则只保留一份 @@ -134,7 +134,7 @@ | --- | --- | --- | | 1 | Windows 矩阵、`.db` 拦截、README 修正;修复 `WHERE` 误判,让 sidecar 与界面使用一致的词法判断,并让 macOS 处理 `confirmation_required` | 无 | | 2 | 契约:插件后端、函数协议 v2 凭据宿主服务;Rust Core 校验与样例 | 无 | -| 3 | macOS 宿主实现第 2 期能力;`lithe-plugin-docs` 新增 Rust SDK | 第 2 期 | +| 3 | macOS 宿主实现第 2 期能力;新增 Rust SDK(`sdk/rust`) | 第 2 期 | | 4 | 新建 `lithe-plugin-database`:Rust 后端、网页界面、样例;先在 macOS 上以本地开发包验证 | 第 3 期 | | 5 | macOS 发布插件,加入迁移提示,从主仓库删除数据库代码 | 第 4 期 | | 6 | Windows 插件宿主和插件市场就绪后,按当时的宿主能力小幅调整插件,补 Windows 构建后发布 | Windows 插件市场 | @@ -229,7 +229,7 @@ - ~~`macos/Sources/Lithe/Application/Features/DatabasePluginTransition.swift`~~(已随 #1794 移除) - ~~`macos/Sources/Lithe/Application/Features/PluginHostServices.swift`~~(已随 #1794 移除) - ~~`macos/Sources/Lithe/Models/AppModel/AppModel+DatabasePlugin.swift`~~(已随 #1794 移除) -- `shared/contracts/plugins/v1/` +- `https://github.com/Lithe-IDEA/Lithe-core-rust/blob/main/shared/plugins/contract/v1/` - Lithe-core-rust 锁定修订:[rust/lithe-core/src/plugins/backend.rs](https://github.com/Lithe-IDEA/Lithe-core-rust/blob/0ffd327b4329261e393b08ed76fbd134b4dd17e9/rust/lithe-core/src/plugins/backend.rs) - Lithe-core-rust 锁定修订:[rust/lithe-core/src/lsp/interface/plugin_function.rs](https://github.com/Lithe-IDEA/Lithe-core-rust/blob/0ffd327b4329261e393b08ed76fbd134b4dd17e9/rust/lithe-core/src/lsp/interface/plugin_function.rs) - `shared/platform-feature-matrix/features/` diff --git a/.agents/notes/implemented/architecture/2026-10-25-java-plugin-distribution-foundation.md b/.agents/notes/implemented/architecture/2026-10-25-java-plugin-distribution-foundation.md index b60142305d..5c8e9722fa 100644 --- a/.agents/notes/implemented/architecture/2026-10-25-java-plugin-distribution-foundation.md +++ b/.agents/notes/implemented/architecture/2026-10-25-java-plugin-distribution-foundation.md @@ -111,7 +111,7 @@ JDT LS、JDK、Lombok、Debug 和 Test 扩展保持当前锁定版本。资源 - 已迁出:原 `Plugins/mac/Official/JavaSupport/`。官方插件的源码、组装与发布已移出本仓库(#1495),改由各插件仓库自行构建发布([lithe-plugin-java](https://github.com/Lithe-IDEA/lithe-plugin-java)、[lithe-plugin-maven](https://github.com/Lithe-IDEA/lithe-plugin-maven)、[lithe-plugin-gradle](https://github.com/Lithe-IDEA/lithe-plugin-gradle)),Store 索引由 Lithe Store 维护。 - 已迁出:原 `Plugins/marketplace/official-plugins.json`。官方插件的源码、组装与发布已移出本仓库(#1495),改由各插件仓库自行构建发布([lithe-plugin-java](https://github.com/Lithe-IDEA/lithe-plugin-java)、[lithe-plugin-maven](https://github.com/Lithe-IDEA/lithe-plugin-maven)、[lithe-plugin-gradle](https://github.com/Lithe-IDEA/lithe-plugin-gradle)),Store 索引由 Lithe Store 维护。 -- `shared/contracts/plugins/v1/` +- `https://github.com/Lithe-IDEA/Lithe-core-rust/blob/main/shared/plugins/contract/v1/` - Lithe-core-rust 锁定修订:[rust/lithe-core/src/plugins/](https://github.com/Lithe-IDEA/Lithe-core-rust/tree/0ffd327b4329261e393b08ed76fbd134b4dd17e9/rust/lithe-core/src/plugins) - ~~`macos/Sources/LitheModuleAPI/`~~(已随 #1794 移除) - ~~`macos/Sources/LitheCoreContracts/Plugins/DeclarativePluginContracts.swift`~~(已随 #1794 移除) diff --git a/.agents/notes/implemented/architecture/2026-10-26-build-provider-task-execution.md b/.agents/notes/implemented/architecture/2026-10-26-build-provider-task-execution.md index bf7f466ec5..6d90479f89 100644 --- a/.agents/notes/implemented/architecture/2026-10-26-build-provider-task-execution.md +++ b/.agents/notes/implemented/architecture/2026-10-26-build-provider-task-execution.md @@ -22,7 +22,7 @@ Core 继续校验工程/目标/模型任务选择、路径与生效选项,返回 Provider 计划。后端收到任务声明 ID、选择、选项、参数与可选工具路径后,自行解释并执行领域业务。显式无效的工具或运行时选择沿用现有解析器的终止失败,不许可后端换一套自动发现。普通声明式命令任务继续走原来的公共命令能力,这不是 Maven/Java 旧业务 fallback。 -这里只支持有界任务和测试;`application/service` 不借执行 RPC(请求/回复调用)伪装接入。测试发现使用独立的方法,不把发现误当成运行。正式形状、限制和共享用例在 `shared/contracts/plugins/v1/`,不在本笔记重复字段全集。 +这里只支持有界任务和测试;`application/service` 不借执行 RPC(请求/回复调用)伪装接入。测试发现使用独立的方法,不把发现误当成运行。正式形状、限制和共享用例在 `Lithe-core-rust/shared/plugins/contract/v1/`,不在本笔记重复字段全集。 ### 测试执行使用独立的版本准入 @@ -64,7 +64,7 @@ Core 用 JSON-RPC 请求 ID 作为后端看到的 `operationID`,进度按仍 本次没有新增下载入口、生成目录、缓存路径或用户数据迁移。执行复用既有 `workspaceStateDir` 和进程生命周期;插件包与发行目录只读,运行状态、日志、锁和输出仍由现有平台存储 adapter 提供位置。可变工作区状态不跨工作树共享,不影响代码签名或 Sparkle 增量更新的基线。 -契约/协议变更合并前,用 `lithe-plugin-docs` 的 SDK 端到端工具验证当前源码;合并后按[契约发布规则](2026-10-23-plugin-contract-publishing.md)同步副本。已有 SDK 模型/依赖示例须继续协商版本 1 并正常工作;SDK 的执行处理器和 Maven 插件接入在独立仓库分别推进;本地源码验证、正式发版与旧生产路径删除必须分别记录,不互相代替。 +契约/协议变更与 Core 实现、协议更新记录、API 总表在同一个 Core PR 里完成(规则见[契约单一来源规则](../../implemented/architecture/2026-11-11-plugin-contract-single-source-in-core.md));合并前在 Core 仓库根目录运行 `node shared/plugins/scripts/sdk-e2e.mjs`,用 SDK 端到端工具验证当前源码。已有 SDK 模型/依赖示例须继续协商版本 1 并正常工作;SDK 的执行处理器和 Maven 插件接入在独立仓库分别推进;本地源码验证、正式发版与旧生产路径删除必须分别记录,不互相代替。 ### 展示层消费已导入的模型事实 @@ -180,11 +180,11 @@ Windows 的已保存 Provider 引用保留公共选择器。框架/模块的已 ### SDK 使用同一组类型化入口 -配套 Node/Java SDK 源码在独立的 `lithe-plugin-docs` 仓库实现任务、测试、发现与运行准备处理器,不复制进主仓库。SDK 选择宿主明确提供的最高共同协议版本;版本 1 不能调用执行、版本 2 不能调用测试、版本 3 不能调用运行准备,即使后端注册了对应处理器也一样。清单能力准入与进程协商是两层独立检查,SDK 不用私有函数代替领域方法。 +配套 Node/Java SDK 源码实现任务、测试、发现与运行准备处理器,当时在独立的 lithe-plugin-docs 仓库,现在在 Core 仓库的 `shared/plugins/sdk/`,都不复制进主仓库。SDK 选择宿主明确提供的最高共同协议版本;版本 1 不能调用执行、版本 2 不能调用测试、版本 3 不能调用运行准备,即使后端注册了对应处理器也一样。清单能力准入与进程协商是两层独立检查,SDK 不用私有函数代替领域方法。 执行、测试和运行准备的上下文保留 Core 分配的线缆操作身份,进度只带这份身份。处理器改动自己的参数对象不能换掉进度归属;取消和结束后不再报告。Node 的类型声明与 Java 的具名入口共同表达这条边界,Core 继续负责选择器、工作区路径与领域输出校验,SDK 不再维护一份工程引擎。 -两套无页面示例使用虚构引擎展示协议,端到端回归通过真实 Core 检查构建退出码、精确筛选、运行前构建与准备计划、并行工作区隔离、取消后的工具清理,以及包含 SDK/JAR 的完整包字节不变。SDK 处理器属于开发中的源码,不代表已发布 SDK 或现有 Maven/Java 插件完成迁移;发布契约副本仍必须等主仓库合并后运行同步工具。 +两套无页面示例使用虚构引擎展示协议,端到端回归通过真实 Core 检查构建退出码、精确筛选、运行前构建与准备计划、并行工作区隔离、取消后的工具清理,以及包含 SDK/JAR 的完整包字节不变。SDK 处理器属于开发中的源码,不代表已发布 SDK 或现有 Maven/Java 插件完成迁移;契约改动与 Core 实现、协议更新记录在同一个 Core PR 里完成。 ### 调试启动保留已选适配器的身份 @@ -196,7 +196,7 @@ Windows 的已保存 Provider 引用保留公共选择器。框架/模块的已 `buildProviders: 5` 增加独立的原生程序调试准备请求。运行声明只引用同插件适配器;后端先构建,再返回程序路径、参数、工作目录和环境,不得夹带适配器身份、进程、端口或任意调试协议参数。Core 检查程序属于当前工程实例且为已有文件;平台交接前再次检查可执行权限和符号链接,随后复用注册表的目标绑定生成参数。`debugAdapters: 2` 只增加参数与环境的类型化目标绑定,原有 DAP 引擎、适配器资源与权限规则继续生效。 -Build 树和已保存的 Provider Run 配置都有 Debug 入口,启动前先保存文档。异步准备、Core 解码和宿主交接共享已有运行准备的配置、源码与模型失效判断;调试停止只取消对应准备,准备成功后由 Debug 会话负责资源。正确例子是插件自己的构建引擎生成当前程序,再交给自己声明的 LLDB 入口;不要把 `prepareRun` 返回的命令改名成调试计划,更不能从 Provider 返回另一个插件的私有函数或开放端口。两个 SDK 同步增加类型化入口并保留版本准入;正式契约副本仍在合并后同步。 +Build 树和已保存的 Provider Run 配置都有 Debug 入口,启动前先保存文档。异步准备、Core 解码和宿主交接共享已有运行准备的配置、源码与模型失效判断;调试停止只取消对应准备,准备成功后由 Debug 会话负责资源。正确例子是插件自己的构建引擎生成当前程序,再交给自己声明的 LLDB 入口;不要把 `prepareRun` 返回的命令改名成调试计划,更不能从 Provider 返回另一个插件的私有函数或开放端口。两个 SDK 同步增加类型化入口并保留版本准入;契约改动与 Core 实现在同一个 Core PR 里完成。 这个纵向增量只覆盖插件自有原生可执行程序。Java/JDT、跨插件准备与长期服务仍未迁移,不能据此声称整个阶段 C 或 Java Support 拆分已完成。 @@ -247,7 +247,7 @@ Java 语言后端、Maven 插件已经改用它;现有 Java/Maven 业务迁移 模型快照继续使用既有工作区状态目录。构建产物和测试报告写用户工程 target,插件 安装包保持只读,没有新增产品下载入口或运行缓存。 -这批源码在独立仓库的 [Maven Draft PR #7](https://github.com/Lithe-IDEA/lithe-plugin-maven/pull/7) 提交,配套 SDK 见 [Draft PR #4](https://github.com/Lithe-IDEA/lithe-plugin-docs/pull/4),均尚未合并或发布。正式 SDK 锁文件仍指向已经发布的旧版, +这批源码在独立仓库的 [Maven Draft PR #7](https://github.com/Lithe-IDEA/lithe-plugin-maven/pull/7) 提交,配套 SDK 见当时的 SDK 仓库(lithe-plugin-docs,现已退役)的 [Draft PR #4](https://github.com/Lithe-IDEA/lithe-plugin-docs/pull/4),均尚未合并或发布。正式 SDK 锁文件仍指向已经发布的旧版, 没有伪造新校验值,也不放松正式 package.mjs 的 SHA-256 校验。发布前必须先交付配套 Java SDK 并更新插件锁定值。开发验证通过显式 SDK JAR 构建独立临时包,记录 SDK 哈希与包文件清单,既不生成发行 ZIP,也不改 dist 或 SDK 锁文件;这些本地构建状态 @@ -469,7 +469,6 @@ Agent 入口回归从真实本地 Run 配置读取选择器,用可控 Provider ```bash ./scripts/agent-notes/verify-agent-notes.sh -./scripts/architecture/verify-shared-contracts.sh ./scripts/macos/verify/verify-runtime-bundle-immutability.sh ./scripts/architecture/verify-service-boundaries.sh ./scripts/windows/verify/verify-windows-boundaries.sh @@ -483,7 +482,9 @@ cargo test --manifest-path rust/Cargo.toml -p lithe-core --lib provider_debug cargo test --manifest-path rust/Cargo.toml -p lithe-core --lib lsp ``` -当前本地逐项计时证据为 `saved-provider-complete-macos.json`、`saved-provider-core.json`、`provider-sdk-unit.json` 与 `provider-sdk-native.json`,对应 HTML/JUnit 保存在 `.artifacts/test-stability/`。SDK 兼容场景另外使用契约锁定的 Core,原生工作流场景使用显式工作区源码快照,不能把日志里的基线 SHA 当作完整已提交实现。Java 产物检查 Java 8 字节码;本地运行时和 Windows 实机证据分别记录,不能用编译替代运行。 +插件契约与开发者文档的检查在 Core 仓库根目录运行 `node shared/plugins/scripts/verify-docs.mjs`。 + +当前本地逐项计时证据为 `saved-provider-complete-macos.json`、`saved-provider-core.json`、`provider-sdk-unit.json` 与 `provider-sdk-native.json`,对应 HTML/JUnit 保存在 `.artifacts/test-stability/`。SDK 兼容场景当时使用 lithe-plugin-docs 的契约副本锁定的 Core,原生工作流场景使用显式工作区源码快照,不能把日志里的基线 SHA 当作完整已提交实现。Java 产物检查 Java 8 字节码;本地运行时和 Windows 实机证据分别记录,不能用编译替代运行。 调试身份交接的本地回归记录在 `provider-debug-routing-final.json` 及对应 HTML/JUnit:182 个测试通过,包含真实 Rust Core 桥接后 DAP 参数不混入宿主身份、无源文件目标、明确身份失效、请求类型不匹配、多适配器断点、失败后恢复原会话及同步回调替换会话后的精确清理。测试使用受控会话,不代表真实插件适配器、Provider 调试准备或 Windows 已验收。 @@ -513,10 +514,10 @@ Java 8 字节码(major 52),这不代表已经在 Java 8 运行。原生单 SHA-256 与权限清单。初次本地计时为 3.552 秒,报告是 `stage-c-native-macos.json` 及对应 HTML/JUnit;这项证据覆盖真实宿主 adapter,仍不等于完整窗口或发行包验收。 -SDK 的 [显式宿主 CI 运行](https://github.com/Lithe-IDEA/lithe-plugin-docs/actions/runs/40531099687) +已退役的 lithe-plugin-docs 中 SDK 的 [显式宿主 CI 运行](https://github.com/Lithe-IDEA/lithe-plugin-docs/actions/runs/40531099687) 在 Node 20、Java 8 上对主仓库 `58ca81cf66c5c6e281c7df73ac67adb3526174f3` 通过真实 Core 原生工作流与锁定旧契约的兼容场景。整轮工作流仍因 preview 的调试 -契约已更新而报告镜像漂移失败;不能把单个端到端作业通过说成整轮 CI 通过, +契约已更新,使该仓库的契约副本检查报告漂移而失败;不能把单个端到端作业通过说成整轮 CI 通过, 也不能提前把未合并分支写进正式契约锁。Maven 的显式 SDK 开发验证同样独立于 普通 PR/发行打包,只有源码与最低运行时验证,不生成发行 ZIP 或改写正式 SDK 锁。 @@ -558,18 +559,17 @@ LLDB 集成分别为 3.776 秒与 2.032 秒;两项有对应 HTML/JUnit 和完 在 21 组记录 536 项通过,包括真实 Maven、LLDB 与新 TCP 传输;合并后的 Core 1,336 项单元/集成检查通过。 -在 `lithe-plugin-docs` 运行以下入口可以复验 SDK 部分: +在 Core 仓库根目录运行以下入口可以复验 SDK 部分: ```bash -node --test sdk/node/test/*.test.mjs scripts/*.test.mjs -npm ci --prefix sdk/node --ignore-scripts -npm run --prefix sdk/node test:types -mvn -B -ntp -f sdk/java/pom.xml verify -node scripts/sdk-e2e.mjs -node scripts/sdk-e2e.mjs --source /path/to/Lithe-IDEA --working-tree --build-workflows +node --test shared/plugins/sdk/node/test/*.test.mjs shared/plugins/scripts/*.test.mjs +npm ci --prefix shared/plugins/sdk/node --ignore-scripts +npm run --prefix shared/plugins/sdk/node test:types +mvn -B -ntp -f shared/plugins/sdk/java/pom.xml verify +node shared/plugins/scripts/sdk-e2e.mjs ``` -工作区快照工具只复制 `rust/` 和 `shared/` 的暂存、未暂存与未跟踪源码,源目录和 Git index 保持只读,忽略的构建缓存不复制。SDK 验证使用独立构建目录,不与主工作树共享可变 Cargo 状态;这些临时验证输入不是产品运行资源或可跨工作树复用缓存。 +SDK 端到端直接测试 Core 当前工作树,不生成源码快照。构建输出留在各自工作树的构建目录,不与其他工作树共享可变 Cargo 状态;这些验证输入不是产品运行资源或可跨工作树复用缓存。 这些证据不替代真实插件工程、发行包和 Windows 实机验收,功能矩阵保持 `pending`。没有新增下载物或产品资源目录;本地用户配置不属于可跨工作树共享的构建缓存。新增目录或依赖时仍须遵循资源复用和安装包只读规则。 @@ -581,7 +581,7 @@ node scripts/sdk-e2e.mjs --source /path/to/Lithe-IDEA --working-tree --build-wor - Lithe-core-rust 锁定修订:[rust/lithe-core/src/execution/configuration.rs](https://github.com/Lithe-IDEA/Lithe-core-rust/blob/0ffd327b4329261e393b08ed76fbd134b4dd17e9/rust/lithe-core/src/execution/configuration.rs) - `desktop/internal/core/plugin_session.go` - `desktop/internal/workbench/` -- `shared/contracts/plugins/v1/` +- `https://github.com/Lithe-IDEA/Lithe-core-rust/blob/main/shared/plugins/contract/v1/` - `shared/platform-feature-matrix/features/build-system-plugins.json` - `shared/contracts/run-configuration-v2.schema.json` - `shared/fixtures/run-configuration/build-provider.json` diff --git a/.agents/notes/implemented/architecture/2026-10-26-plugin-live-activation.md b/.agents/notes/implemented/architecture/2026-10-26-plugin-live-activation.md index 39c0b61439..d389b03d9d 100644 --- a/.agents/notes/implemented/architecture/2026-10-26-plugin-live-activation.md +++ b/.agents/notes/implemented/architecture/2026-10-26-plugin-live-activation.md @@ -4,7 +4,7 @@ ## 先说结论 -安装、更新、回退、卸载、启用、停用一个插件时,只有“它的每一项贡献在宿主里都有运行期实现”的插件才免重启生效。判断由宿主后端决定,写在 `PluginDescriptor.canActivateWithoutRestart`,不是 `plugin.json` 里的字段,所以插件契约没有变化,也不需要同步 lithe-plugin-docs。这条规则目前落地了四类:第一阶段的“纯调试适配器插件”(只贡献 `debugAdapters`,以及它声明的语言和设置,没有后端、没有其他模块),第二阶段的“纯语法高亮插件”(只贡献带 `grammar` 或编辑配置的语言,见 [独立插件编辑器 API](2026-10-31-plugin-editor-extension-apis.md)),以及“纯项目生成器插件”和“纯工具定义插件”(见[插件注入的新建项目向导](../feature/2026-10-23-plugin-project-generators.md)的工具字段一节)。这几类也可以出现在同一个插件里。 +安装、更新、回退、卸载、启用、停用一个插件时,只有“它的每一项贡献在宿主里都有运行期实现”的插件才免重启生效。判断由宿主后端决定,写在 `PluginDescriptor.canActivateWithoutRestart`,不是 `plugin.json` 里的字段,所以插件契约没有变化,不需要改 Core 仓库的 `shared/plugins/contract/v1/`。这条规则目前落地了四类:第一阶段的“纯调试适配器插件”(只贡献 `debugAdapters`,以及它声明的语言和设置,没有后端、没有其他模块),第二阶段的“纯语法高亮插件”(只贡献带 `grammar` 或编辑配置的语言,见 [独立插件编辑器 API](2026-10-31-plugin-editor-extension-apis.md)),以及“纯项目生成器插件”和“纯工具定义插件”(见[插件注入的新建项目向导](../feature/2026-10-23-plugin-project-generators.md)的工具字段一节)。这几类也可以出现在同一个插件里。 满足条件的插件不进模块图,而是登记在一个**内存实时注册表**(`MacLivePluginRegistry`)里。注册表用后台线程扫描已安装目录,主线程只读取扫描结果快照。其他插件的路径完全不变:仍然写成 `.updateStaged`,等重启才生效。 @@ -75,7 +75,7 @@ ## 考虑过的备选方案 1. **所有插件默认热激活,插件显式声明才重启**:被否。语言服务器、构建系统、界面贡献等在运行期没有登记和撤回实现,放行等于让用户看到“装上了但没效果”。这个方案要等每类贡献都有运行期实现之后才成立,所以改成逐类放行。 -2. **在 `plugin.json` 里加免重启字段**:被否,理由见决策 1。字段会进入公开契约,还要同步 lithe-plugin-docs,且作者无法判断宿主后端是否支持。 +2. **在 `plugin.json` 里加免重启字段**:被否,理由见决策 1。字段会进入公开契约,要在 Core 仓库的 `shared/plugins/contract/v1/` 里新增并登记协议更新记录,且作者无法判断宿主后端是否支持。 3. **把热插件登记进 `ModuleRuntime` / `ModuleRegistry`**:被否。模块图和项目窗口的生命周期绑定,每个窗口一套,运行期没有撤回路径;先做模块图的动态登记才能支持语言服务器等贡献,那是后续阶段的工作,不应该让第一类热插件等它。 4. **启动时清理或改写 bundle 来省去扫描**:被否。已发布的 app bundle 是只读基线,写入会破坏 Sparkle 增量更新校验。 diff --git a/.agents/notes/implemented/architecture/2026-10-30-plugin-backend-workspace-context.md b/.agents/notes/implemented/architecture/2026-10-30-plugin-backend-workspace-context.md index 1ad3de648a..8a94c9fd7c 100644 --- a/.agents/notes/implemented/architecture/2026-10-30-plugin-backend-workspace-context.md +++ b/.agents/notes/implemented/architecture/2026-10-30-plugin-backend-workspace-context.md @@ -114,7 +114,7 @@ Core 新增命令 `lsp.hostNotify { sessionId, method, params }`,返回 `{ del - Core 的义务:协议 3 会话的请求里出现方法没有定义的字段时,回 `-32018` `plugin.host.unsupportedOption`,`details.option` 写明是哪个字段,后端可以去掉它重试。协议 2 仍回 `invalidParams`,行为不变。参数由服务自己校验的方法(`HostParams::Object`)由服务按同样方式回答。 - 新服务的权限仍要在清单里声明。不认识该权限的旧宿主在安装时以 `plugin.permission.unknown` 拒绝整个包,不会悄悄授予或忽略权限。 -这样改的原因:插件后端调用宿主属于运行时能力,本来就靠协商和发现判断能不能用([按能力分版本](2026-10-17-plugin-capability-versions.md):“进程启动后还能做什么,走它自己的协议协商”)。如果每加一批服务都升一次版本,SDK 和插件要同时维护很多个版本分支,而版本号能表达的信息 `getCapabilities` 已经全部给出。用户在 PR #1595 评审时确认了这个取舍。 +这样改的原因:插件后端调用宿主属于运行时能力,本来就靠协商和发现判断能不能用([按能力分版本](2026-11-11-plugin-contract-single-baseline.md):“进程启动后还能做什么,走它自己的协议协商”)。如果每加一批服务都升一次版本,SDK 和插件要同时维护很多个版本分支,而版本号能表达的信息 `getCapabilities` 已经全部给出。用户在 PR #1595 评审时确认了这个取舍。 ### 公共服务接线与生命周期补全 @@ -223,9 +223,9 @@ contextExpired 必须重新解析原目标,不能换成活动窗口。新协 - `host_failure_details_are_a_bounded_object`、`host_failure_details_reach_a_version_3_backend` - 以及 `fixtures/manifest/invalid-manifests.json` 新增的 6 个拒绝用例 - ~~./scripts/macos/test/test-macos.sh --filter "PluginHostServiceDispatchTests|MacPluginBackendSessionsTests|PluginWebBridgeTests"~~(随旧客户端移除):上下文 generation 与换工作区发新 ID、按插件的 rootID 与密钥文件、`listContexts` 不建目录、授权核验、本地与远程描述、过期与格式错误、订阅的三条释放路径与 sequence、错误码与 details 透传、命令和订阅通知按顺序送达运行中的后端、`backend: 1` 与未运行的后端不收命令。 -- `zsh scripts/architecture/verify-shared-contracts.sh`:契约 schema、fixture 与 README。 +- `node shared/plugins/scripts/verify-docs.mjs`(在 Core 仓库根目录运行):契约 schema 的 `$id` 与文档链接。 - `./scripts/macos/verify/verify-runtime-bundle-immutability.sh`:运行时不向发行目录写入。 -- 合入前,在 lithe-plugin-docs 运行 `node scripts/sdk-e2e.mjs --source <本仓库路径> --ref <分支>`,确认 Node 和 Java SDK 的示例后端在协议 3 下仍能跑通。 +- 合入前,在 Core 仓库根目录运行 `node shared/plugins/scripts/sdk-e2e.mjs`(测试当前工作树的 Core),确认 Node 和 Java SDK 的示例后端在协议 3 下仍能跑通。 ## 适用范围 diff --git a/.agents/notes/implemented/architecture/2026-10-30-plugin-host-open-preview-services.md b/.agents/notes/implemented/architecture/2026-10-30-plugin-host-open-preview-services.md index 634fc6a6ac..24bf2b0db0 100644 --- a/.agents/notes/implemented/architecture/2026-10-30-plugin-host-open-preview-services.md +++ b/.agents/notes/implemented/architecture/2026-10-30-plugin-host-open-preview-services.md @@ -132,6 +132,6 @@ macOS 插件 API 计划里的 API-15(`editor.open/reveal`)、API-16(`previ ## 适用范围 - `desktop/internal/core/plugin_session.go` -- `shared/contracts/plugins/v1/README.md` +- `https://github.com/Lithe-IDEA/Lithe-core-rust/blob/main/shared/plugins/contract/v1/README.md` - `shared/platform-feature-matrix/features/plugin-functions.json` - [旧版服务、测试和原适用范围](https://github.com/1lck/Lithe-IDEA/blob/5a54c41aa37a4e6e6b68918a4b05765b9dd07a36/.agents/notes/implemented/architecture/2026-10-30-plugin-host-open-preview-services.md) diff --git a/.agents/notes/implemented/architecture/2026-10-31-plugin-capability-and-domain-boundaries.md b/.agents/notes/implemented/architecture/2026-10-31-plugin-capability-and-domain-boundaries.md index 8f2b547ac2..ca5aae2efb 100644 --- a/.agents/notes/implemented/architecture/2026-10-31-plugin-capability-and-domain-boundaries.md +++ b/.agents/notes/implemented/architecture/2026-10-31-plugin-capability-and-domain-boundaries.md @@ -69,7 +69,7 @@ - `.agents/skills/develop-lithe/SKILL.md` - `.agents/skills/lithe-code-review/` -- `shared/contracts/plugins/v1/` +- `https://github.com/Lithe-IDEA/Lithe-core-rust/blob/main/shared/plugins/contract/v1/` - Lithe-core-rust 锁定修订:[rust/lithe-core/src/plugins/](https://github.com/Lithe-IDEA/Lithe-core-rust/tree/0ffd327b4329261e393b08ed76fbd134b4dd17e9/rust/lithe-core/src/plugins) - ~~`macos/Sources/Lithe/Application/Features/`~~(已随 #1794 移除) - ~~`macos/Sources/Lithe/Platform/MacOS/Plugins/`~~(已随 #1794 移除) diff --git a/.agents/notes/implemented/architecture/2026-10-31-plugin-editor-extension-apis.md b/.agents/notes/implemented/architecture/2026-10-31-plugin-editor-extension-apis.md index 1e6d6a8869..cb477ecac0 100644 --- a/.agents/notes/implemented/architecture/2026-10-31-plugin-editor-extension-apis.md +++ b/.agents/notes/implemented/architecture/2026-10-31-plugin-editor-extension-apis.md @@ -116,6 +116,6 @@ grammar 从只读插件包有界读取,校验结果仅在本次进程内缓存 - Lithe-core-rust 锁定修订:[rust/lithe-core/src/plugins/editor_providers.rs](https://github.com/Lithe-IDEA/Lithe-core-rust/blob/0ffd327b4329261e393b08ed76fbd134b4dd17e9/rust/lithe-core/src/plugins/editor_providers.rs) - `desktop/internal/core/plugin_session.go` - `desktop/internal/core/plugin_session_test.go` -- `shared/contracts/plugins/v1/README.md` +- `https://github.com/Lithe-IDEA/Lithe-core-rust/blob/main/shared/plugins/contract/v1/README.md` - `shared/platform-feature-matrix/features/plugin-editor-grammars.json` - [旧版实现和原适用范围](https://github.com/1lck/Lithe-IDEA/blob/5a54c41aa37a4e6e6b68918a4b05765b9dd07a36/.agents/notes/implemented/architecture/2026-10-31-plugin-editor-extension-apis.md) diff --git a/.agents/notes/implemented/architecture/2026-11-02-plugin-owned-native-terminals.md b/.agents/notes/implemented/architecture/2026-11-02-plugin-owned-native-terminals.md index 7bbfcfbc68..dcb7a7d6ba 100644 --- a/.agents/notes/implemented/architecture/2026-11-02-plugin-owned-native-terminals.md +++ b/.agents/notes/implemented/architecture/2026-11-02-plugin-owned-native-terminals.md @@ -75,5 +75,5 @@ Docker 插件需要一键进入容器,但公共 API 计划中的 API-24 只有 - ~~`macos/Sources/LitheTerminalModule/`~~(已随 #1794 移除) - ~~`macos/Sources/Lithe/Platform/MacOS/Terminal/MacTerminalTransport.swift`~~(已随 #1794 移除) - Lithe-core-rust 锁定修订:[rust/lithe-core/src/lsp/interface/plugin_function.rs](https://github.com/Lithe-IDEA/Lithe-core-rust/blob/0ffd327b4329261e393b08ed76fbd134b4dd17e9/rust/lithe-core/src/lsp/interface/plugin_function.rs) -- `shared/contracts/plugins/v1/` +- `https://github.com/Lithe-IDEA/Lithe-core-rust/blob/main/shared/plugins/contract/v1/` - `docs/development/macos-plugin-api-plan.md` diff --git a/.agents/notes/implemented/architecture/2026-11-04-plugin-owned-language-server-sessions.md b/.agents/notes/implemented/architecture/2026-11-04-plugin-owned-language-server-sessions.md index a67fbac146..fe9a8b6ffe 100644 --- a/.agents/notes/implemented/architecture/2026-11-04-plugin-owned-language-server-sessions.md +++ b/.agents/notes/implemented/architecture/2026-11-04-plugin-owned-language-server-sessions.md @@ -111,7 +111,7 @@ - Lithe-core-rust 锁定修订:[rust/lithe-core/src/lsp/interface/plugin_function.rs](https://github.com/Lithe-IDEA/Lithe-core-rust/blob/0ffd327b4329261e393b08ed76fbd134b4dd17e9/rust/lithe-core/src/lsp/interface/plugin_function.rs) - Lithe-core-rust 锁定修订:[rust/lithe-core/src/plugins/language_server_sessions.rs](https://github.com/Lithe-IDEA/Lithe-core-rust/blob/0ffd327b4329261e393b08ed76fbd134b4dd17e9/rust/lithe-core/src/plugins/language_server_sessions.rs) - Lithe-core-rust 锁定修订:[rust/lithe-core/src/plugins/content_providers.rs](https://github.com/Lithe-IDEA/Lithe-core-rust/blob/0ffd327b4329261e393b08ed76fbd134b4dd17e9/rust/lithe-core/src/plugins/content_providers.rs) -- `shared/contracts/plugins/v1/README.md` +- `https://github.com/Lithe-IDEA/Lithe-core-rust/blob/main/shared/plugins/contract/v1/README.md` - ~~`macos/Sources/Lithe/Application/Features/PluginLanguageServerHostService.swift`~~(已随 #1794 移除) - ~~`macos/Sources/Lithe/Application/Features/PluginContentProviderHostService.swift`~~(已随 #1794 移除) - ~~`macos/Sources/Lithe/Models/AppModel/AppModel+PluginLanguageServers.swift`~~(已随 #1794 移除) diff --git a/.agents/notes/implemented/architecture/2026-11-08-viva-plugin-backend-bridge.md b/.agents/notes/implemented/architecture/2026-11-08-viva-plugin-backend-bridge.md index 6980fb42eb..7ac12ef718 100644 --- a/.agents/notes/implemented/architecture/2026-11-08-viva-plugin-backend-bridge.md +++ b/.agents/notes/implemented/architecture/2026-11-08-viva-plugin-backend-bridge.md @@ -21,8 +21,8 @@ Viva 的 Core 适配层可以校验插件声明、取得 Core 生成的后端启 fixture 随固定修订更新,Core 桥接测试验证了声明和语法解码;`DecodePluginGrammar` 只返回 Core 校验后的语言、原始语法与配置,不读取插件文件、认证包或注册编辑器。测试中传入的能力表不是 生产宿主的能力声明。Viva 尚未完成插件语法的发现、可信安装和编辑器注册,不能仅因 Core -支持就宣称该插件功能已可用。公开 `lithe-plugin-docs` 当前仍为旧契约,必须在本仓库 PR -合并后按仓库规则同步合并修订并登记协议变化,不能提前当作已同步。 +支持就宣称该插件功能已可用。契约变化和协议更新记录在 Core 的同一个 PR 里登记;桌面端 Go +测试通过 `LITHE_PLUGIN_CONTRACT_DIR` 读取正在链接的那个 Core 检出里的契约,没有需要另行同步的契约副本。 ## 考虑过的备选方案 diff --git a/.agents/notes/implemented/architecture/2026-11-11-plugin-contract-single-baseline.md b/.agents/notes/implemented/architecture/2026-11-11-plugin-contract-single-baseline.md new file mode 100644 index 0000000000..b956b819a7 --- /dev/null +++ b/.agents/notes/implemented/architecture/2026-11-11-plugin-contract-single-baseline.md @@ -0,0 +1,79 @@ +# Agent 笔记:插件契约从统一基线 0 开始 + +状态:已实现 + +## 先说结论 + +插件契约改为 `Lithe-core-rust/shared/plugins/contract/v1/`:`pluginAPIVersion` 只有 `0`,每个能力(Capability,清单里一个有自己段落、可以独立演进的部分)也都从版本 `0` 开始。版本 0 就是这个能力当前完整的功能,没有“低版本只能用一部分”的分支。 + +以后给某个能力加功能,只给这个能力加版本 `1`;清单段、宿主能力表和运行期协议跟着同一个数字一起变。对日常开发的直接影响:写插件只需要按契约写一份清单;改 Core 时不要再按版本号给同一个能力写多条分支。 + +## 问题 + +- **版本号叠得太多。** 原来有三条互不相关的版本线:整份清单的级别、每个能力的版本、每个运行期协议在 LSP `initialize` 里协商的版本。同一个功能(例如构建 Provider 的运行准备)要同时看清单版本和协议版本才能判断能不能用,Core 里到处是 `version < N` 分支。 +- **有的“能力”没有自己的清单段。** 启动进程的规则(`serverProcess`)和可执行文件候选的写法(`executableResolution`)只是改写别的段,于是出现“声明了语言服务器却没声明启动进程”这种无意义的组合,以及“某版本必须配合某级别”的交叉约束。 +- **宿主只能整版声明。** 能力版本是线性叠加的,宿主想支持第 11 版里的一个功能,就得先实现第 3 到第 10 版。正在迁移的 Viva 桌面端因此只能声明 `buildProviders {1,2}`,用到高版本的插件一律装不上。 + +## 决策 + +### 1. 统一基线 + +- `pluginAPIVersion` 只接受 `0`;`requires` 必填,并且必须正好列出清单用到的能力,每个值都是 `0`。 +- 市场索引的 `schemaVersion`、原生界面文档的 `schemaVersion` 也是 `0`。 +- 版本 0 的含义只有一种:该能力当前契约里的全部内容。Core 不保留任何按旧版本号判断的分支。 + +### 2. 一个能力对应一个清单段 + +`serverProcess` 和 `executableResolution` 不再是能力,并入基础契约:任何会启动进程的段都按同一套启动规则(打包程序、打包运行时、`requiresTools`、`{kind: "tool"}`、后端给出的启动命令),所有可执行文件候选都按同一套解析规则(设置来源、`id`、`priority`、`insertBefore`、`insertAfter`、严格选择)。清单在 `requires` 里写这两个名字时,按未知能力拒绝。 + +剩下的每个能力都只对应一个清单段,能力表、清单段、运行期协议和宿主承诺的对照表写在契约 README 里。 + +### 3. 协议版本就是能力版本 + +运行期协议不再单独编版本,版本号取所属能力的版本: + +| 协议 | 所属能力 | +| --- | --- | +| `litheBuild` | `buildProviders` | +| `litheFunctions` | `backend` | +| `litheVcs` | `vcsProviders` | +| 工具链 Provider 协议 | `toolchainProviders` | +| 快捷键导入 Provider 协议 | `keymapImportProviders` | +| `litheLogging` | 基础契约(`pluginAPIVersion`) | + +宿主仍在 `initialize` 里发 `{"versions": [...]}`,但列表来自所属能力在 Core 中支持的版本(`capabilities::versions`),不再有单独的常量。以后给 `buildProviders` 加版本 1,清单写法和 `litheBuild` 消息会一起变。 + +### 4. 宿主声明一个能力意味着什么 + +宿主在 `hostCapabilities` 里声明某个能力版本,承诺两件事:接受这个版本的所有清单写法,能讲它的协议。 + +- 插件**对外提供**的功能(构建 Provider 的测试、运行准备,只属于命令的界面入口等),宿主可以暂时不展示。不展示时不放按钮、菜单或窗口,而不是装上后点了才报错。插件不能依赖这些功能一定会被调用。 +- 插件**需要宿主提供**的服务(宿主方法、通知),在运行期通过 `getCapabilities` 和权限查询,不靠能力表。 + +正确做法:Viva 声明 `buildProviders {0}`,暂不展示测试和运行准备,并在 `desktop/internal/pluginhost/pluginhost.go` 的 `Declared()` 注释里逐项列出没展示的部分。 + +不要这样做:宿主声明了 `buildProviders {0}`,却在插件调用 `run/start` 之类的宿主方法时才发现没注册而报错;宿主方法必须通过 `getCapabilities` 提前暴露是否可用。 + +## 考虑过的备选方案 + +- **保留旧版本号,只删低版本。** 能少改一些插件,但版本号从 11、4、3 这些数字起步,读者必须知道历史才能理解为什么从这里开始,并且协议和清单的版本线仍然各走各的。被否。 +- **在 Core 里把 0 翻译回旧的最高版本号。** 改动最小,但会把“0 等于 11”这种对照永久留在代码里,新插件作者看文档也会遇到两套编号。被否。 +- **把大能力拆成很多小能力(例如构建测试单独一个能力)。** 能让宿主精确声明,但插件 `requires` 会变长,而且大多数拆出来的功能是插件提供的,宿主不展示也不会出错。改用第 4 条的声明规则解决,被否。 +- **去掉 `requires`,由 Core 根据清单段推断。** 现在每个能力都只有版本 0,推断确实可行;但以后有了版本 1,Core 无法从段落是否出现判断插件按哪一版编写,所以保留显式声明。被否。 + +## 后果 + +- 现有插件全部需要按基线 0 重新适配:`pluginAPIVersion` 改 `0`,`requires` 值改 `0`,去掉 `serverProcess` 和 `executableResolution`,协议协商回复版本 `0`。 +- 插件 SDK(Node、Java、Rust)只协商版本 0。 +- Viva 的能力表只有 `{0}` 一种取值;没有展示的子功能必须写进 `Declared()` 注释,并在实现时从注释里删除。 +- 以后新增能力版本时,必须同时更新:`capabilities.rs` 的支持表、契约 README 的对照表、清单 schema、对应协议说明和宿主能力表。 + +## 验证 + +- `cargo test --manifest-path rust/Cargo.toml -p lithe-core`(Core 仓库)覆盖清单校验、市场索引、协议协商和契约 fixture。 +- `node shared/plugins/scripts/verify-docs.mjs`(Core 仓库)检查每份 schema 的 `$id` 和插件文档的相对链接。 +- `scripts/desktop/desktop-go.sh test ./internal/pluginhost/... ./internal/core/... ./internal/marketplace/...` 用固定版本的 Core 及其契约 fixture 验证 Viva 能力表。 + +## 适用范围 + +适用于声明式插件清单、插件市场索引、原生界面文档、插件运行期协议协商,以及宿主的 `hostCapabilities` 表。不适用于插件自己给导出函数编的契约版本(`pluginFunctions` 里的 `contractVersion`),也不适用于 LSP 文档版本号、构建选项和工具链存储文件的格式版本。 diff --git a/.agents/notes/implemented/architecture/2026-11-11-plugin-contract-single-source-in-core.md b/.agents/notes/implemented/architecture/2026-11-11-plugin-contract-single-source-in-core.md new file mode 100644 index 0000000000..1955843725 --- /dev/null +++ b/.agents/notes/implemented/architecture/2026-11-11-plugin-contract-single-source-in-core.md @@ -0,0 +1,92 @@ +# Agent 笔记:插件契约与开发资料只在 Rust Core + +状态:已实现 + +## 先说结论 + +插件契约、插件开发指南与参考、三个官方后端 SDK(Node、Java、Rust)和 SDK 端到端测试只有一份,放在 Rust Core 仓库的 [`shared/plugins/`](https://github.com/Lithe-IDEA/Lithe-core-rust/tree/main/shared/plugins)。本仓库删除了 `shared/contracts/plugins/` 副本,原 lithe-plugin-docs 仓库的内容整体并入 Core,该仓库停止维护。 + +对日常开发的直接影响: + +- 改契约、能力版本或插件函数协议,在 Core 的同一个 PR 里同时改代码、契约、文档、SDK,并登记协议更新记录;不再有“合并后再同步到另一个仓库”这一步。 +- 本仓库的桌面端测试通过 `desktop/internal/contractfixture` 读取正在链接的 Core 检出里的 fixture,路径由 `scripts/desktop/desktop-go.sh` 导出的 `LITHE_PLUGIN_CONTRACT_DIR` 给出。直接运行 `go test` 会因为没有这个变量而报错,这是有意的。 +- 契约改了以后,把 `scripts/desktop/build-desktop-core.sh` 的 `PINNED_CORE_REVISION` 升到包含该改动的 Core commit,桌面端测试就会读到新契约。 + +## 问题 + +原来同一份契约有三份: + +1. 本仓库 `shared/contracts/plugins/v1/`,桌面端测试读它。 +2. Rust Core 仓库 `shared/plugins/contract/v1/`,执行契约的代码和它的测试读它。 +3. lithe-plugin-docs 仓库的逐字节副本,插件开发者看它,SDK 的端到端测试也用它,靠 `scripts/contract.mjs sync --revision ` 在合并后手动同步。 + +这套安排是在 Rust Core 还在本仓库里时定的(见已归档的 `.agents/notes/archived/architecture/2026-10-23-plugin-contract-publishing.md`)。当时它写明:“如果 Rust Core 拆成独立仓库,就重新考虑契约放在哪里。”Core 现在已经是独立仓库,于是出现了这些问题: + +- 执行契约的代码在 Core,但本仓库还留着一份契约,两边哪份是真源要靠约定,改动要在两个仓库各提一个 PR。 +- 文档仓库的副本永远落后于 Core 一次手动同步;漏同步时,插件开发者读到的是旧行为,SDK 端到端测试验证的也是旧契约。 +- SDK 和它要遵守的协议不在同一个仓库,改协议的 PR 无法在合并前用同一个提交跑三个 SDK 的示例后端。 + +## 决策 + +### 1. Core 的 `shared/plugins/` 是唯一来源 + +| 内容 | 位置(相对 Core 仓库根) | +| --- | --- | +| 契约 README、schema、fixture | `shared/plugins/contract/v1/` | +| 开发指南 | `shared/plugins/guides/` | +| API 总表、协议更新记录等参考页 | `shared/plugins/reference/` | +| Node、Java、Rust 后端 SDK 与示例 | `shared/plugins/sdk/` | +| SDK 端到端场景 | `shared/plugins/sdk/e2e/` | +| 文档检查与端到端入口 | `shared/plugins/scripts/verify-docs.mjs`、`shared/plugins/scripts/sdk-e2e.mjs` | + +Core 的 `shared/` 下只保留 `plugins/`。本仓库和 Lithe Store 都不再保存契约、SDK 或面向插件开发者的文档;需要引用时用指向 Core `main` 的绝对 URL。 + +之所以放在 Core 而不是放在本仓库,原因与旧笔记相同,只是现在指向了 Core:执行契约的代码在 Core,契约和代码必须能在同一个 PR 里改、同一个提交里测。 + +### 2. 同一个 Core PR 完成全部登记 + +改 `shared/plugins/contract/v1/`、`rust/lithe-core/src/plugins/capabilities.rs` 或 `rust/lithe-core/src/lsp/interface/plugin_function.rs` 的 Core PR,同时完成这些事: + +- 更新 [插件协议更新记录](https://github.com/Lithe-IDEA/Lithe-core-rust/blob/main/shared/plugins/reference/protocol-changelog.md),写明合入日期、PR、修改人和改了哪个协议或 API。 +- 新增宿主方法时,在 [API 总表](https://github.com/Lithe-IDEA/Lithe-core-rust/blob/main/shared/plugins/reference/api-catalog.md) 的中英方法表和更新记录的“宿主方法(按 API 编号)”索引里各加一行。 +- 改后端协议时,在 Core 仓库根运行 `node shared/plugins/scripts/sdk-e2e.mjs`,三个 SDK 的示例后端对同一个提交跑通后才能合并。 + +### 3. 本仓库的测试读链接的 Core 检出 + +`scripts/desktop/desktop-go.sh` 已经知道本次链接的是哪份 Core 检出:设置了 `LITHE_CORE_RUST_DIR` 时用该目录,否则用 `build-desktop-core.sh` 按 `PINNED_CORE_REVISION` 克隆的 `.artifacts/desktop/lithe-core-rust/source`。脚本把这份检出里的 `shared/plugins/contract/v1` 导出为 `LITHE_PLUGIN_CONTRACT_DIR`,测试通过 `contractfixture.Path("<相对路径>")` 读取 fixture。 + +这样,测试读到的契约和链接进来的 Core 代码一定来自同一个 commit,不会出现“代码是新的、fixture 是旧的”。 + +### 4. SDK 从 Core 发版 + +SDK 发版改为在 Core 打 `sdk-node-v*`、`sdk-java-v*`、`sdk-rust-v*` 标签,由 Core 的 `plugins-release-*-sdk.yml` 工作流发布。0.4.x 及更早的版本发布于已停止维护的 lithe-plugin-docs,旧标签和旧包继续可用。 + +## 考虑过的备选方案 + +- **保留本仓库的契约副本,加一致性检查。** 能让本仓库不依赖 Core 检出就跑测试,但仍然是两份真源,每次契约改动都要在两个仓库各提一个 PR,检查只能在事后发现不一致。被否。 +- **用 git submodule 把 Core 的 `shared/plugins` 挂进本仓库。** 引用的 commit 与 `PINNED_CORE_REVISION` 会变成两处需要一起升的版本号,克隆和 CI 也要多处理一层 submodule。`desktop-go.sh` 本来就会准备 Core 检出,直接复用它更简单。被否。 +- **把 fixture 复制进本仓库的测试目录。** 只复制测试用到的几份 fixture,看起来改动小,但本质上仍是副本,Core 改了 fixture 而本仓库没跟上时,测试会验证旧契约并且照样通过。被否。 +- **保留 lithe-plugin-docs,只把同步改成自动化。** 能保留一个面向开发者的独立仓库入口,但 SDK 和协议依然不在同一个提交里验证,自动同步还要额外的令牌、工作流和失败处理。插件开发者直接看 Core 的 `shared/plugins/` 即可,不需要克隆其他仓库。被否。 + +## 后果 + +- 本仓库桌面端测试必须通过 `scripts/desktop/desktop-go.sh` 运行;裸跑 `go test` 时 `contractfixture.Path` 会直接报出需要设置的变量。 +- 升级 `PINNED_CORE_REVISION` 同时升级了桌面端测试读到的契约;Core 契约变化导致本仓库测试失败时,在升级固定版本的同一个 PR 里修宿主。 +- lithe-plugin-docs 仓库需要归档,并在 README 指向 Core 的 `shared/plugins/`;这个操作对外可见,由维护者执行。 +- Lithe Store 的 CI 目前用 lithe-plugin-docs 的 URL 读取 `plugin-index.schema.json` 并核对 SHA,需要改成 Core 的 URL,同样由维护者在 Lithe Store 仓库处理。 +- 历史笔记、PR 和 CI 链接里出现的 lithe-plugin-docs 地址保留原样,作为历史记录;新写的引用一律指向 Core。 + +## 验证 + +- `node shared/plugins/scripts/verify-docs.mjs`(Core 仓库根)检查每份 schema 的 `$id` 和插件文档的相对链接。 +- `node shared/plugins/scripts/sdk-e2e.mjs`(Core 仓库根)用当前提交的 Core 跑三个 SDK 的示例后端。 +- `scripts/desktop/desktop-go.sh test ./internal/core/... ./internal/marketplace/... ./internal/pluginweb/... ./internal/workbench/... ./internal/pluginservice/...` 用链接的 Core 检出里的契约 fixture 运行桌面端测试。 + +## 适用范围 + +- `AGENTS.md` +- `.github/pull_request_template.md` +- `desktop/internal/contractfixture/contractfixture.go` +- `scripts/desktop/desktop-go.sh` +- `scripts/desktop/build-desktop-core.sh` +- `https://github.com/Lithe-IDEA/Lithe-core-rust/tree/main/shared/plugins` diff --git a/.agents/notes/implemented/feature/2026-10-12-plugin-marketplace.md b/.agents/notes/implemented/feature/2026-10-12-plugin-marketplace.md index 659b68d238..633526af86 100644 --- a/.agents/notes/implemented/feature/2026-10-12-plugin-marketplace.md +++ b/.agents/notes/implemented/feature/2026-10-12-plugin-marketplace.md @@ -10,7 +10,7 @@ Lithe 的插件管理改成和 IntelliJ IDEA 一样的“插件市场 / 已安 “官方”市场条目必须同时满足两点:来自默认源,并且带 Lithe 发布者签名。社区包也可以从磁盘 ZIP 或解包目录安装:先复制到本次操作的私有快照,再让用户确认权限和完整程序声明。市场索引校验值、本地快照摘要和发布者签名各自证明不同的事实,不能互相冒充;本地安装不会因市场出现同 ID 条目而自动变成市场管理的插件。 -对日常开发的直接影响:索引格式和校验规则只在 `shared/contracts/plugins/v1/` 与 `rust/lithe-core/src/plugins/marketplace.rs` 定义一次;官方插件不再跟随 Lithe 发版,而是每个插件按自己的标签单独发布。 +对日常开发的直接影响:索引格式和校验规则只在 `Lithe-core-rust/shared/plugins/contract/v1/` 与 `rust/lithe-core/src/plugins/marketplace.rs` 定义一次;官方插件不再跟随 Lithe 发版,而是每个插件按自己的标签单独发布。 ## 问题 @@ -164,7 +164,7 @@ Viva 插件安装或宿主能力已经接通的证据。 ## 适用范围 -- `shared/contracts/plugins/v1/` +- `https://github.com/Lithe-IDEA/Lithe-core-rust/blob/main/shared/plugins/contract/v1/` - `desktop/internal/core/marketplace.go` - `desktop/internal/marketplace/` - `desktop/internal/settingswindow/marketplace_view.go` diff --git a/.agents/notes/implemented/feature/2026-10-14-declarative-plugin-settings.md b/.agents/notes/implemented/feature/2026-10-14-declarative-plugin-settings.md index 349439d6bd..447b94b373 100644 --- a/.agents/notes/implemented/feature/2026-10-14-declarative-plugin-settings.md +++ b/.agents/notes/implemented/feature/2026-10-14-declarative-plugin-settings.md @@ -79,7 +79,7 @@ cargo test --manifest-path rust/lithe-core/Cargo.toml jdt ./scripts/macos/test/test-macos.sh --filter PluginLanguageServerLaunchResolverTests ``` -契约夹具:`shared/contracts/plugins/v1/fixtures/languages/node-runtime.plugin.json` 声明了三种类型的选项;`command-plans.json` 覆盖默认值、存储值、不合法存储值的回退和布尔类型保持;`invalid-manifests.json` 覆盖选项声明与引用的拒绝情形。 +契约夹具:`Lithe-core-rust/shared/plugins/contract/v1/fixtures/languages/node-runtime.plugin.json` 声明了三种类型的选项;`command-plans.json` 覆盖默认值、存储值、不合法存储值的回退和布尔类型保持;`invalid-manifests.json` 覆盖选项声明与引用的拒绝情形。 ## 适用范围 @@ -89,4 +89,4 @@ cargo test --manifest-path rust/lithe-core/Cargo.toml jdt - ~~`macos/Sources/Lithe/Platform/MacOS/Plugins/MacPluginSettingsStore.swift`~~(已随 #1794 移除):保存。 - ~~`macos/Sources/Lithe/Views/App/PluginSettingsSection.swift`~~(已随 #1794 移除):插件页上的控件。 - 已迁出:原 `Plugins/mac/Official/JavaSupport/plugin.json`。官方插件的源码、组装与发布已移出本仓库(#1495),改由各插件仓库自行构建发布([lithe-plugin-java](https://github.com/Lithe-IDEA/lithe-plugin-java)、[lithe-plugin-maven](https://github.com/Lithe-IDEA/lithe-plugin-maven)、[lithe-plugin-gradle](https://github.com/Lithe-IDEA/lithe-plugin-gradle)),Store 索引由 Lithe Store 维护。 -- `shared/contracts/plugins/v1/README.md`:对外契约。 +- `https://github.com/Lithe-IDEA/Lithe-core-rust/blob/main/shared/plugins/contract/v1/README.md`:对外契约。 diff --git a/.agents/notes/implemented/feature/2026-10-21-declarative-native-plugin-ui.md b/.agents/notes/implemented/feature/2026-10-21-declarative-native-plugin-ui.md index 0b0a44b345..1a590dc933 100644 --- a/.agents/notes/implemented/feature/2026-10-21-declarative-native-plugin-ui.md +++ b/.agents/notes/implemented/feature/2026-10-21-declarative-native-plugin-ui.md @@ -155,14 +155,14 @@ Git未跟踪目录摘要和可见行缓存;这些界面仍使用完整公共 - ~~./scripts/architecture/verify-shared-contracts.sh~~(随旧客户端移除) - `cargo test --manifest-path rust/lithe-core/Cargo.toml --lib native_ui_validates_version_ownership_actions_and_budgets` - `./.agents/skills/write-stable-tests/scripts/test-stability-macos.sh -- --filter 'PluginNativeUI|PluginWeb|WorkbenchContributionHostTests'` -- `LITHE_PLUGIN_SDK_ROOT= node --test macos/Tests/Fixtures/native-ui-lab/native-ui-lab.test.mjs` +- `LITHE_PLUGIN_SDK_ROOT=/shared/plugins/sdk/node node --test macos/Tests/Fixtures/native-ui-lab/native-ui-lab.test.mjs` - ~~./scripts/architecture/verify-service-boundaries.sh~~(随旧客户端移除) - `./scripts/macos/verify/verify-runtime-bundle-immutability.sh` - `./scripts/platform-feature-matrix/verify-platform-feature-matrix.sh` ## 适用范围 -- `shared/contracts/plugins/v1/native-ui.schema.json` +- `https://github.com/Lithe-IDEA/Lithe-core-rust/blob/main/shared/plugins/contract/v1/native-ui.schema.json` - Lithe-core-rust 锁定修订:[rust/lithe-core/src/plugins/native_ui.rs](https://github.com/Lithe-IDEA/Lithe-core-rust/blob/0ffd327b4329261e393b08ed76fbd134b4dd17e9/rust/lithe-core/src/plugins/native_ui.rs) - ~~`macos/Sources/LitheModuleAPI/Plugins/PluginNativeUI.swift`~~(已随 #1794 移除) - ~~`macos/Sources/Lithe/Application/Features/PluginNativeUIFeature.swift`~~(已随 #1794 移除) @@ -171,7 +171,7 @@ Git未跟踪目录摘要和可见行缓存;这些界面仍使用完整公共 ## 2026-10-23 SDK 迁移后的验收归属 -遵循 #1442,主仓库不恢复 SDK 及其端到端测试。UI Lab 作为 macOS 宿主的回归与人工验收 fixture 保留在 `macos/Tests/Fixtures/native-ui-lab/`;Core 继续验证其完整清单。打包和 Node 验收显式通过 `LITHE_PLUGIN_SDK_ROOT` 使用外部 lithe-plugin-docs 的官方 Node SDK,复制结果仅进入忽略的 `.artifacts/native-ui-lab/`,不写入已安装包或应用 bundle。插件开发者说明与 SDK 发版继续归 lithe-plugin-docs。 +遵循 #1442,主仓库不恢复 SDK 及其端到端测试。UI Lab 作为 macOS 宿主的回归与人工验收 fixture 保留在 `macos/Tests/Fixtures/native-ui-lab/`;Core 继续验证其完整清单。打包和 Node 验收显式通过 `LITHE_PLUGIN_SDK_ROOT` 使用外部的官方 Node SDK,即 Core 仓库的 `shared/plugins/sdk/node`(当时在 lithe-plugin-docs,该仓库已退役),复制结果仅进入忽略的 `.artifacts/native-ui-lab/`,不写入已安装包或应用 bundle。插件开发者说明与 SDK 发版归 Core 仓库的 `shared/plugins/`。 ## 与 MCP 和 Agent 设置的公共输入入口兼容 diff --git a/.agents/notes/implemented/feature/2026-10-23-plugin-project-generators.md b/.agents/notes/implemented/feature/2026-10-23-plugin-project-generators.md index 1e3bb4253d..f9e4508e00 100644 --- a/.agents/notes/implemented/feature/2026-10-23-plugin-project-generators.md +++ b/.agents/notes/implemented/feature/2026-10-23-plugin-project-generators.md @@ -17,7 +17,7 @@ - **入口什么都没做。** 欢迎页和项目切换器的「New Project…」调用 `chooseProject(title: "New Project")`,与「打开」只差一个标题。 - **生态知识没有地方放。** Cargo、Spring Initializr、Maven Archetype 各有自己的脚手架。写进宿主会违反「宿主不按插件名分支」;写进 Core 会重演 `execution/detectors/` 写死生态表的问题。 - **基础环境要重复配置。** 建完 Java 项目后还得去设置里再选一次 JDK。 -- **能力版本的副作用。** [按能力分版本](../architecture/2026-10-17-plugin-capability-versions.md)要求 `requires` 恰好列出用到的能力,宿主缺任何一项就整个插件不可装。生成器放进语言插件后,不支持生成器的宿主连这一版语言支持一起看不到。Java Support 只在 macOS 分发、随同版本的 Lithe.app 内置,所以影响的只是「旧宿主拿不到新版 Java Support」;社区语言插件加生成器前要权衡这一点。 +- **能力版本的副作用。** [按能力分版本](../architecture/2026-11-11-plugin-contract-single-baseline.md)要求 `requires` 恰好列出用到的能力,宿主缺任何一项就整个插件不可装。生成器放进语言插件后,不支持生成器的宿主连这一版语言支持一起看不到。Java Support 只在 macOS 分发、随同版本的 Lithe.app 内置,所以影响的只是「旧宿主拿不到新版 Java Support」;社区语言插件加生成器前要权衡这一点。 ## 决策 @@ -26,7 +26,7 @@ | 部分 | 负责方 | 落点 | | --- | --- | --- | | 声明的校验、表单求值(派生默认值、显示条件、错误码)、生成计划、压缩包解压 | Rust Core | `rust/lithe-core/src/project_generators/`,命令 `project.*` | -| 契约与标准答案 | 共享契约 | `shared/contracts/plugins/v1/README.md` 的 Project generators 一节,`fixtures/project-generators/project-generator.plugin.json`、`fixtures/project-generators/project-plans.json` | +| 契约与标准答案 | 共享契约 | `Lithe-core-rust/shared/plugins/contract/v1/README.md` 的 Project generators 一节,`fixtures/project-generators/project-generator.plugin.json`、`fixtures/project-generators/project-plans.json` | | 窗口、名称、位置、Git、空项目、启用插件提示 | macOS 宿主 | `NewProjectView`、`NewProjectFeatureModel` | | 执行计划:临时目录、写文件、跑命令、下载、移动到位 | macOS 宿主 | `ProjectGenerationService`(编排)+ `MacProjectGenerationPlatform`(平台操作) | | Java、Maven Archetype、Spring Boot 的字段、模板和步骤 | 插件 | 组织插件仓库 `Lithe-IDEA/lithe-plugin-java`(`java`、`spring-boot`)与 `Lithe-IDEA/lithe-plugin-maven`(Maven Archetype),各自 `plugin.json` 的 `projectGenerators`、`icons/`、`templates/`;2026-11 起本仓库不再内置任何插件(#1495) | @@ -179,7 +179,7 @@ cargo test --manifest-path rust/Cargo.toml -p lithe-core project_generators - Lithe-core-rust 锁定修订:[rust/lithe-core/src/project_generators/](https://github.com/Lithe-IDEA/Lithe-core-rust/tree/0ffd327b4329261e393b08ed76fbd134b4dd17e9/rust/lithe-core/src/project_generators) - Lithe-core-rust 锁定修订:[rust/lithe-core/src/plugins/declarative.rs](https://github.com/Lithe-IDEA/Lithe-core-rust/blob/0ffd327b4329261e393b08ed76fbd134b4dd17e9/rust/lithe-core/src/plugins/declarative.rs) - Lithe-core-rust 锁定修订:[rust/lithe-core/src/plugins/capabilities.rs](https://github.com/Lithe-IDEA/Lithe-core-rust/blob/0ffd327b4329261e393b08ed76fbd134b4dd17e9/rust/lithe-core/src/plugins/capabilities.rs) -- `shared/contracts/plugins/v1/` +- `https://github.com/Lithe-IDEA/Lithe-core-rust/blob/main/shared/plugins/contract/v1/` - ~~`macos/Sources/Lithe/Views/Workspace/NewProjectView.swift`~~(已随 #1794 移除) - ~~`macos/Sources/Lithe/Application/Features/NewProjectFeatureModel.swift`~~(已随 #1794 移除) - ~~`macos/Sources/Lithe/Services/ProjectGeneration/`~~(已随 #1794 移除) diff --git a/.agents/notes/implemented/feature/2026-10-26-debug-adapter-executable-setting.md b/.agents/notes/implemented/feature/2026-10-26-debug-adapter-executable-setting.md index ab6ffaf8f9..02e629601f 100644 --- a/.agents/notes/implemented/feature/2026-10-26-debug-adapter-executable-setting.md +++ b/.agents/notes/implemented/feature/2026-10-26-debug-adapter-executable-setting.md @@ -61,7 +61,7 @@ lldb 社区插件把 `program` 写成 `/Users/.../lldb-demo/main`: ## 后果 - 收益:lldb 插件不再带机器相关路径;换项目、换文件自动找到旁边的可执行文件;用户可以在设置里改成任何程序;找不到时界面直接说明去哪里、怎么做。 -- 代价:契约多了 `executable` 对象和 `target.executable` 绑定(加在尚未发布的插件 API 4 `debugAdapters` v1 内);设置页每次读取快照会做一次 Core 调用和至多 8 次文件检查,目前不缓存,避免用户刚编译完仍显示“Not found”,若出现卡顿再考虑按活动文件和修改时间缓存;`shared/contracts/plugins/v1/` 合并后要在 lithe-plugin-docs 运行 `node scripts/contract.mjs sync` 同步副本。 +- 代价:契约多了 `executable` 对象和 `target.executable` 绑定(加在尚未发布的插件 API 4 `debugAdapters` v1 内);设置页每次读取快照会做一次 Core 调用和至多 8 次文件检查,目前不缓存,避免用户刚编译完仍显示“Not found”,若出现卡顿再考虑按活动文件和修改时间缓存;契约改动要落在 Core 仓库的 `shared/plugins/contract/v1/`,并在同一个 Core PR 里登记协议更新记录。 - 需要重新评估的触发条件:Windows 端接入同一契约;候选需要读取构建系统输出(如 `cargo metadata`)而不只是文件模板;需要让用户在多个候选间选择。 ## 验证 @@ -77,7 +77,7 @@ lldb 社区插件把 `program` 写成 `/Users/.../lldb-demo/main`: ## 适用范围 -- `shared/contracts/plugins/v1/`(README、schema、`debug-adapter*.json` 夹具) +- `https://github.com/Lithe-IDEA/Lithe-core-rust/blob/main/shared/plugins/contract/v1/`(README、schema、`debug-adapter*.json` 夹具) - Lithe-core-rust 锁定修订:[rust/lithe-core/src/debug/adapters.rs](https://github.com/Lithe-IDEA/Lithe-core-rust/blob/0ffd327b4329261e393b08ed76fbd134b4dd17e9/rust/lithe-core/src/debug/adapters.rs)、`rust/lithe-core/src/plugins/declarative.rs`、`rust/lithe-core/src/plugins/settings.rs` - ~~`macos/Sources/Lithe/Platform/MacOS/Plugins/MacPluginDebugExecutableResolver.swift`~~(已随 #1794 移除) - ~~`macos/Sources/Lithe/Platform/MacOS/Plugins/MacPluginManager.swift`~~(已随 #1794 移除) diff --git a/.agents/notes/implemented/feature/2026-10-26-debug-console-prompt-and-completion.md b/.agents/notes/implemented/feature/2026-10-26-debug-console-prompt-and-completion.md index 5a3d0125cd..c523a8e12b 100644 --- a/.agents/notes/implemented/feature/2026-10-26-debug-console-prompt-and-completion.md +++ b/.agents/notes/implemented/feature/2026-10-26-debug-console-prompt-and-completion.md @@ -22,7 +22,7 @@ - **输入行归宿主,补全内容归适配器和插件。** `DebugConsolePane`(`macos/Sources/Lithe/Views/Debug/DebugConsolePromptView.swift`)画输入行和弹层,不认识任何具体调试器。候选来自 `GenericDebugFeatureModel.requestConsoleCompletions`,只在会话处于 `paused` 时发请求,否则返回空列表。 - **补全请求走 Rust Core。** `debug.inspect` 的 `completions` 类型由 Core 校验并转成 DAP `completions`:适配器没有协商 `supportsCompletionsRequest` 时直接拒绝;`text` 不能为空;`column` 是 1 起算的 UTF-16 单位,越界会被拒绝。Swift 侧的光标是 0 起算,由 `CoreDebugAdapterProtocolSession` 统一加 1,其他地方不要再换算。 -- **插件声明命令用 `debugAdapters[].console.commands[]`。** 每项只有 `name` 和可选 `description`,按名称排序、不重复、数量和长度有上限,违反时安装校验直接拒绝(`shared/contracts/plugins/v1/fixtures/debug-adapters/debug-adapter-rejections.json` 有对应用例)。清单按“整行前缀”匹配,已经完整输入的命令不再提示。适配器会实时补全时(如 lldb-dap)清单只用来补它没覆盖的命令,同名候选只显示一次,适配器的顺序在前。 +- **插件声明命令用 `debugAdapters[].console.commands[]`。** 每项只有 `name` 和可选 `description`,按名称排序、不重复、数量和长度有上限,违反时安装校验直接拒绝(`Lithe-core-rust/shared/plugins/contract/v1/fixtures/debug-adapters/debug-adapter-rejections.json` 有对应用例)。清单按“整行前缀”匹配,已经完整输入的命令不再提示。适配器会实时补全时(如 lldb-dap)清单只用来补它没覆盖的命令,同名候选只显示一次,适配器的顺序在前。 - **候选替换哪一段,规则固定。** 适配器给了 `start` / `length` 就照它的;没给(lldb-dap 就不给)时,替换“输入末尾与候选开头重合的最长一段”,忽略大小写;一点都不重合则在光标处插入。这条规则在 `DebugConsoleCompletion.swift`,有 10 条测试固定。改它要同时改 `DebugConsoleCompletionTests.swift`。 - **插件可以声明命令前缀,宿主只搬运不理解。** lldb-dap 在行首会把 C++ 关键字和类型(`long`、`int16_t`、`const`)和命令混在一起,这些词一执行就是 `evaluate` 失败;在行首加反引号它才只返回命令。这个差异属于适配器,所以由插件在 `debugAdapters[].console.commandPrefix` 里声明(1–8 个字符,不含空白和控制字符,可以和 `commands` 同时出现,两者至少有一个)。宿主只在发补全请求时把前缀拼到整行前面(行首已有就不拼),光标按前缀的 UTF-16 长度后移,适配器回来的 `start` / `length` 再减回去(`DebugConsoleCompletion.adapterRequest` / `restoring`)。用户看到和执行的行永远不带前缀。代价是行首位置拿不到变量名补全,`p to` 这类带命令的输入不受影响。 - **候选说明只取第一行。** lldb-dap 把整段帮助文字拼进标签,弹层一行放不下;`DebugConsoleCompletion` 取第一个非空行作为说明,完整文字不进弹层。 @@ -32,7 +32,7 @@ ### 不要这样做 -- **不要在宿主里按适配器名添加命令表。** lldb 的命令清单属于 lldb 插件的 `plugin.json`;宿主里出现 `if adapter == "lldb"` 这类分支,换一个调试器就要改宿主;宿主只认声明的数据,能力版本规则见[插件能力版本](../architecture/2026-10-17-plugin-capability-versions.md)。 +- **不要在宿主里按适配器名添加命令表。** lldb 的命令清单属于 lldb 插件的 `plugin.json`;宿主里出现 `if adapter == "lldb"` 这类分支,换一个调试器就要改宿主;宿主只认声明的数据,能力版本规则见[插件能力版本](../architecture/2026-11-11-plugin-contract-single-baseline.md)。 - **不要在宿主里把某个适配器的怪癖写成分支。** “行首先加反引号”是 lldb-dap 的行为,写在宿主里换一个适配器就是错的;它只能是插件声明的数据(`commandPrefix`),宿主不检查前缀内容的含义。 - **不要把补全请求发给没协商能力的适配器。** DAP 规定客户端只能发送适配器声明支持的请求,所以由 Core 在发送前按能力门控,而不是发出去等错误。 - **不要用行内 stdin 输入承载调试器命令。** 行内输入只属于被调试程序的标准输入,用户在这里输入的内容会进程序,不会进调试器。 @@ -63,7 +63,7 @@ ## 后果 - 收益:调试器命令和程序输入在界面上分开;插件只写数据就能让用户得到命令补全;Windows 以后复用同一个 Core 请求,只需要实现自己的输入行。 -- 代价:契约多了 `console.commands[]` 和 `console.commandPrefix`,`shared/contracts/plugins/v1/` 合并后要在 lithe-plugin-docs 运行 `node scripts/contract.mjs sync` 同步副本;弹层是叠加在 AppKit 输出视图上的 SwiftUI 视图,绘制顺序依赖当前的叠加方式。 +- 代价:契约多了 `console.commands[]` 和 `console.commandPrefix`,要落在 Core 仓库的 `shared/plugins/contract/v1/`,并在同一个 Core PR 里登记协议更新记录;弹层是叠加在 AppKit 输出视图上的 SwiftUI 视图,绘制顺序依赖当前的叠加方式。 - 需要重新评估的触发条件:Windows 端要做同样的输入行;适配器开始返回带 `start` / `length` 的补全并和宿主规则冲突;候选数量超过 60 条仍需要滚动浏览。 ## 验证 @@ -84,4 +84,4 @@ - ~~`macos/Sources/LitheDebugModule/Application/GenericDebugFeatureModel.swift`~~(已随 #1794 移除) - ~~`macos/Sources/LitheDebugModule/Runtime/CoreDebugAdapterProtocolSession.swift`~~(已随 #1794 移除) - Lithe-core-rust 锁定修订:[rust/lithe-core/src/debug/engine.rs](https://github.com/Lithe-IDEA/Lithe-core-rust/blob/0ffd327b4329261e393b08ed76fbd134b4dd17e9/rust/lithe-core/src/debug/engine.rs) -- `shared/contracts/plugins/v1/` +- `https://github.com/Lithe-IDEA/Lithe-core-rust/blob/main/shared/plugins/contract/v1/` diff --git a/.agents/notes/implemented/feature/2026-10-31-macos-ide-editor-settings-import.md b/.agents/notes/implemented/feature/2026-10-31-macos-ide-editor-settings-import.md index 331d686322..91b9573de5 100644 --- a/.agents/notes/implemented/feature/2026-10-31-macos-ide-editor-settings-import.md +++ b/.agents/notes/implemented/feature/2026-10-31-macos-ide-editor-settings-import.md @@ -239,7 +239,7 @@ VS Code 移除规则按上游解析器的两阶段行为处理:只移除指定 开发者怎么做: - 修改 VS Code 或 IDEA 的解析、命令映射、参考默认键:在独立插件仓库改,不在本仓库加回解析代码或插件目录。 -- 修改通用的 `keymapImportProviders` 契约、快照、规划或多提供方拒绝:在本仓库改,测试使用契约 fixture `shared/contracts/plugins/v1/fixtures/keymap-import/keymap-import-provider.plugin.json`,并在插件仓库用新 Core 重跑端到端测试。 +- 修改通用的 `keymapImportProviders` 契约、快照、规划或多提供方拒绝:在本仓库改,测试使用契约 fixture `Lithe-core-rust/shared/plugins/contract/v1/fixtures/keymap-import/keymap-import-provider.plugin.json`,并在插件仓库用新 Core 重跑端到端测试。 - 不要把任何插件 ID 写进宿主信任策略或界面分支。反例:为了让某个插件“看起来是官方的”,在 `trustPolicy(for:)` 里按 ID 返回固定策略。 验证:插件仓库 CI 用真实 Lithe Core 运行插件包,覆盖 VS Code 与 IDEA 导入、失败、`plugins.operation.finished` 与 `plugins.operation.failed` 日志事实不含导入内容,以及插件包在运行前后不变。宿主没有官方插件再带打包后端,`scripts/plugins/verify-official-plugins.sh` 改为在 Java Support 包的临时副本里注入后端声明,继续检查已声明后端可通过、未声明原生代码、缺失后端和越出包目录的路径都会被拒绝。 diff --git a/.agents/notes/proposed/architecture/2026-10-13-public-extension-contract-and-provider-api.md b/.agents/notes/proposed/architecture/2026-10-13-public-extension-contract-and-provider-api.md index 5341a70001..c9e896cd99 100644 --- a/.agents/notes/proposed/architecture/2026-10-13-public-extension-contract-and-provider-api.md +++ b/.agents/notes/proposed/architecture/2026-10-13-public-extension-contract-and-provider-api.md @@ -42,7 +42,7 @@ PR #37 建立了第一阶段 UI Contribution(插件声明的界面入口); 进程隔离与宿主授权不等于操作系统沙盒;原生后端可以拥有自己的系统权限,文档不能承诺代理之外的访问都被限制。WASM(可移植字节码)可在未来用 Wasmtime/WASI 等运行时承载,但仍需同一组 API、权限、取消和预算,且执行不进入应用主进程。它不依赖 Tauri,也不解决公共 API 缺失,因此暂不列为首版条件。 -公开文档和 SDK 继续只发布到 lithe-plugin-docs;主仓库计划只列内部任务与验收,不提供第二套开发者手册。新增契约与 Core 一起改、合并后同步副本,SDK 源码、正式发布物、契约锁定版本与 Mac 实际执行能力分别记录,避免“SDK 有方法但宿主不能执行”。 +公开文档和 SDK 发布在 Core 仓库的 `shared/plugins/`(`guides/`、`reference/`、`sdk/`);本仓库的计划只列内部任务与验收,不提供第二套开发者手册。新增契约、API 总表、协议更新记录和 SDK 与 Core 在同一个 Core PR 里修改;SDK 源码、正式发布物、契约版本与 Mac 实际执行能力分别记录,避免“SDK 有方法但宿主不能执行”。 ### 领域扩展点与宿主调度 @@ -105,7 +105,7 @@ Agent 的 Skills、Hooks、MCP 是用户管理的 Codex/Claude 原生配置, - 各样例覆盖安装、授权、启用/禁用、失败/晚到结果、恢复与布局持久化;无窗口 Provider 验证不会生成窗口或污染布局。 - 已发布 API v2 fixtures 继续通过;新版本 schema、兼容性拒绝和市场能力检查先于平台适配落地。 - 本轮只要求 Mac 产品验收;共享契约保持平台无关,功能矩阵如实记录各端现状,不把 Windows 适配作为本计划前置条件。 -- SDK、公开文档和样例在 lithe-plugin-docs 随各切片交付;契约副本锁定合并后的 preview commit,源码支持和正式 release 不混写。 +- SDK、公开文档和样例在 Core 仓库的 `shared/plugins/` 随各切片交付;契约与 SDK 源码在同一个 Core 提交里,源码支持和正式 release(Core 仓库的 `sdk-*` 标签)不混写。 ## 风险 @@ -113,12 +113,12 @@ Agent 的 Skills、Hooks、MCP 是用户管理的 Codex/Claude 原生配置, ## 验证 -- 本次计划只校验文档与边界:`./scripts/agent-notes/verify-agent-notes.sh`、~~./scripts/architecture/verify-shared-contracts.sh~~(随旧客户端移除)、`./scripts/macos/verify/verify-runtime-bundle-immutability.sh`、`./scripts/platform-feature-matrix/verify-platform-feature-matrix.sh`。 +- 本次计划只校验文档与边界:`./scripts/agent-notes/verify-agent-notes.sh`、Core 仓库的 `node shared/plugins/scripts/verify-docs.mjs`、`./scripts/macos/verify/verify-runtime-bundle-immutability.sh`、`./scripts/platform-feature-matrix/verify-platform-feature-matrix.sh`。 - 后续实现按实施计划的三个真实插件验收,包含 SDK 端到端、Mac 实机、越权/取消/失效结果、进程清理与 bundle 哈希不变;本 Note 不将计划中的验收记成已经通过。 ## 适用范围 -- `shared/contracts/plugins/v1/` +- `https://github.com/Lithe-IDEA/Lithe-core-rust/blob/main/shared/plugins/contract/v1/` - Lithe-core-rust 锁定修订:[rust/lithe-core/src/plugins/](https://github.com/Lithe-IDEA/Lithe-core-rust/tree/0ffd327b4329261e393b08ed76fbd134b4dd17e9/rust/lithe-core/src/plugins) - `desktop/internal/core/plugin_session.go` - `desktop/internal/workbench/` @@ -136,4 +136,4 @@ Agent 的 Skills、Hooks、MCP 是用户管理的 Codex/Claude 原生配置, - [通用 ServiceProvider 与资源归属 #42](https://github.com/Lithe-IDEA/Lithe-IDEA/issues/42)。 - [四个纵向端到端样例 #14](https://github.com/Lithe-IDEA/Lithe-IDEA/issues/14)。 -本 Note 保留公共扩展的未完成方向;已落地部分以[第一阶段工作台 UI 贡献](../../implemented/architecture/2026-10-12-workbench-ui-contributions.md)、[原生插件 UI](../../implemented/feature/2026-10-21-declarative-native-plugin-ui.md)及[插件契约](../../../../shared/contracts/plugins/v1/README.md)为准,不能再把第一阶段限制当成全部当前能力。 +本 Note 保留公共扩展的未完成方向;已落地部分以[第一阶段工作台 UI 贡献](../../implemented/architecture/2026-10-12-workbench-ui-contributions.md)、[原生插件 UI](../../implemented/feature/2026-10-21-declarative-native-plugin-ui.md)及[插件契约](https://github.com/Lithe-IDEA/Lithe-core-rust/blob/main/shared/plugins/contract/v1/README.md)为准,不能再把第一阶段限制当成全部当前能力。 diff --git a/.agents/notes/proposed/architecture/2026-10-16-unified-child-process-lifecycle.md b/.agents/notes/proposed/architecture/2026-10-16-unified-child-process-lifecycle.md index 82768d9468..eb896750a5 100644 --- a/.agents/notes/proposed/architecture/2026-10-16-unified-child-process-lifecycle.md +++ b/.agents/notes/proposed/architecture/2026-10-16-unified-child-process-lifecycle.md @@ -338,7 +338,7 @@ Agent(经由 ACP 连接的 Claude Code、Codex 等)会用自己的工具在 语言服务器、运行命令都由宿主根据 `plugin.json` 启动(见 [声明式语言插件](../../implemented/architecture/2026-10-12-declarative-language-plugins.md))。 宿主启动时一律经过账本,所以插件进程天然会被登记。 -2. **清单必须声明生命周期**。`shared/contracts/plugins/v1/` 为每个语言服务器、 +2. **清单必须声明生命周期**。`Lithe-core-rust/shared/plugins/contract/v1/` 为每个语言服务器、 常驻服务和资源提供者增加 `lifecycle` 字段;`plugins.declarative.validate` 对缺少或非法的字段返回稳定的 `plugin.*` 错误码,插件直接无法安装。 CI 中的 `ci-plugins.yml` 对所有官方插件跑同一组校验。 @@ -372,7 +372,7 @@ Agent(经由 ACP 连接的 Claude Code、Codex 等)会用自己的工具在 }] ``` -字段名称在实现阶段以 `shared/contracts/plugins/v1/` 的 schema 为准,这里只说明 +字段名称在实现阶段以 `Lithe-core-rust/shared/plugins/contract/v1/` 的 schema 为准,这里只说明 需要表达的信息。 ### 第二层:操作系统级兜底 @@ -716,6 +716,6 @@ Windows 仍未完成的部分:终端(ConPTY)和 Agent 进程树还没有 J - Lithe-core-rust 锁定修订:[rust/lithe-core/](https://github.com/Lithe-IDEA/Lithe-core-rust/tree/0ffd327b4329261e393b08ed76fbd134b4dd17e9/rust/lithe-core) - `shared/contracts/` - `shared/fixtures/process-lifecycle/` -- `shared/contracts/plugins/v1/` +- `https://github.com/Lithe-IDEA/Lithe-core-rust/blob/main/shared/plugins/contract/v1/` - [旧客户端实现与原适用范围(历史版本)](https://github.com/1lck/Lithe-IDEA/blob/5a54c41aa37a4e6e6b68918a4b05765b9dd07a36/.agents/notes/proposed/architecture/2026-10-16-unified-child-process-lifecycle.md) - 相关决策:[模块运行时边界与生命周期](../../implemented/architecture/2026-09-13-module-runtime-boundaries-and-lifecycle.md) diff --git a/.agents/notes/proposed/architecture/2026-10-17-build-system-provider-api.md b/.agents/notes/proposed/architecture/2026-10-17-build-system-provider-api.md index eeeb0001b2..6800e86b9a 100644 --- a/.agents/notes/proposed/architecture/2026-10-17-build-system-provider-api.md +++ b/.agents/notes/proposed/architecture/2026-10-17-build-system-provider-api.md @@ -22,7 +22,7 @@ Lithe 对构建工具的支持原本分散在三处:Rust Core 里写死的运 | --- | --- | --- | | `rust/lithe-core/src/execution/detectors/` | npm、Cargo、Go、Gradle、Python、Make、just、Compose、Procfile 等探测器,在一次共享目录遍历中产出运行配置 | 生态知识写死在 Core 里。Gradle 只能匹配一张固定的插件 ID 表(Spring Boot、Quarkus、Micronaut、`application`),表外插件注入的任务完全看不到,这就是 Issue #10 | | `rust/lithe-core/src/project/maven*.rs` + `MavenService` / `MavenView`(macOS)+ `windows/tauri/src/features/maven/`(Windows) | Reactor(Maven 的多模块聚合工程)扫描、Profile、生命周期、依赖树、诊断解析、Surefire 测试报告、工具窗口 | 质量很高,但类型全是 `Maven*`,其他构建工具无法复用;工具窗口的“生命周期 / 依赖 / Profile / 执行目标”结构也没有通用版本 | -| `shared/contracts/plugins/v1/` | API 1/2 只有 `languages`、`languageServers`、`executionProviders`(按语言运行/测试单个文件);API 3 已加入 `buildSystems` | 契约和 Core 已就绪。macOS 宿主已经通过通用 Build 工具窗口使用 `build.*` 命令,声明 `buildSystems: [1]` 和 `buildProviders: [1]`;Windows 宿主还没有接入,也不声明能力 | +| `Lithe-core-rust/shared/plugins/contract/v1/` | API 1/2 只有 `languages`、`languageServers`、`executionProviders`(按语言运行/测试单个文件);API 3 已加入 `buildSystems` | 契约和 Core 已就绪。macOS 宿主已经通过通用 Build 工具窗口使用 `build.*` 命令,声明 `buildSystems: [1]` 和 `buildProviders: [1]`;Windows 宿主还没有接入,也不声明能力 | [公共扩展契约提案](2026-10-13-public-extension-contract-and-provider-api.md) 已把 BuildSystem/Task 列为领域扩展点,但没有展开字段和边界。 @@ -118,7 +118,7 @@ Lithe 对构建工具的支持原本分散在三处:Rust Core 里写死的运 另外两项不属于工具窗口,但要一起完成: - **运行配置接入构建模型**:`runConfig.generate` 增加“构建模型”这个输入来源,生成、覆盖和 ID 仍走原流程,不另起一套运行配置。Cargo fixture 已经证明运行入口与现有探测器逐字一致,可以作为第一个迁移对象。 -- **插件市场放开 API 3**:宿主具备 Build 工具窗口后,让宿主接受级别 3,并在宿主自己的能力表里加上 `buildSystems: [1]`,通过 `hostCapabilities` 发给 Core。macOS 已完成声明式构建这一步,Windows 待做;Provider 插件还要求独立的 `buildProviders: 1`,宿主必须完成协议协商、请求和生命周期管理后才可声明,macOS 已声明,Windows 待做。不需要再改 `plugins/marketplace.rs`:只用语言服务器的级别 3 插件,在宿主声明对应能力后就能先上架,不必等 Build 工具窗口。规则见[声明式插件按能力分版本](../../implemented/architecture/2026-10-17-plugin-capability-versions.md)。 +- **插件市场放开 API 3**:宿主具备 Build 工具窗口后,让宿主接受级别 3,并在宿主自己的能力表里加上 `buildSystems: [1]`,通过 `hostCapabilities` 发给 Core。macOS 已完成声明式构建这一步,Windows 待做;Provider 插件还要求独立的 `buildProviders: 1`,宿主必须完成协议协商、请求和生命周期管理后才可声明,macOS 已声明,Windows 待做。不需要再改 `plugins/marketplace.rs`:只用语言服务器的级别 3 插件,在宿主声明对应能力后就能先上架,不必等 Build 工具窗口。规则见[插件契约从统一基线 0 开始](../../implemented/architecture/2026-11-11-plugin-contract-single-baseline.md)。 ### 3. 执行仓库代码的信任边界 @@ -338,7 +338,7 @@ Core 契约部分的验收已在已实现的 Note 里完成。剩下的工作按 ## 适用范围 -- `shared/contracts/plugins/v1/` +- `https://github.com/Lithe-IDEA/Lithe-core-rust/blob/main/shared/plugins/contract/v1/` - Lithe-core-rust 锁定修订:[rust/lithe-core/src/plugins/declarative.rs](https://github.com/Lithe-IDEA/Lithe-core-rust/blob/0ffd327b4329261e393b08ed76fbd134b4dd17e9/rust/lithe-core/src/plugins/declarative.rs) - Lithe-core-rust 锁定修订:[rust/lithe-core/src/execution/detectors/](https://github.com/Lithe-IDEA/Lithe-core-rust/tree/0ffd327b4329261e393b08ed76fbd134b4dd17e9/rust/lithe-core/src/execution/detectors) - Lithe-core-rust 锁定修订:[rust/lithe-core/src/execution/types.rs](https://github.com/Lithe-IDEA/Lithe-core-rust/blob/0ffd327b4329261e393b08ed76fbd134b4dd17e9/rust/lithe-core/src/execution/types.rs) diff --git a/.agents/notes/proposed/architecture/2026-10-22-unified-vcs-provider-model.md b/.agents/notes/proposed/architecture/2026-10-22-unified-vcs-provider-model.md index 256e248229..fa65b45ae1 100644 --- a/.agents/notes/proposed/architecture/2026-10-22-unified-vcs-provider-model.md +++ b/.agents/notes/proposed/architecture/2026-10-22-unified-vcs-provider-model.md @@ -24,7 +24,7 @@ Lithe 现在只认识 Git:Rust Core、macOS 和 Windows 的变更列表、提 | `macos/Sources/LitheGitModule/` | `GitOperations` 端口、`GitFeatureModel`、Changelist、Shelve | Changelist 和 Shelve 在 IDEA 里属于平台层,与具体 VCS 无关;在 Lithe 里绑在 Git 模块上 | | `macos/Sources/Lithe/Views/`(项目树、编辑器、Diff) | 直接引用 `GitChange`、`GitChangeKind`、`GitSnapshot` | 文件颜色和 gutter 这类通用展示被 Git 类型锁死 | | `windows/tauri/src/features/git/` | 约 6 万行 React/TS,状态表、提交面板、Log | 同样只认 Git | -| `shared/contracts/plugins/v1/` | 语言、语言服务器、构建系统等能力 | 没有 VCS 扩展点,社区插件无法提供 VCS | +| `Lithe-core-rust/shared/plugins/contract/v1/` | 语言、语言服务器、构建系统等能力 | 没有 VCS 扩展点,社区插件无法提供 VCS | ### 不处理的后果 @@ -91,7 +91,7 @@ Git Log 图、Rebase、Worktree、Stash、Push 和 Fetch 对话框、历史改 - 清单在插件 API 级别 3 新增 `vcsProviders` 能力(`requires: { vcsProviders: 1 }`),只写启动前必须知道的事:VCS ID、显示名、根识别标记(例如名为 `.svn` 的目录),以及复用 `serverProcess` 的启动字段。 - 打开项目时由 Core 按静态标记识别根,不启动进程。识别到这种 VCS 的根之后,宿主才启动 Provider,因为文件状态颜色在打开项目时就需要。安装审查时要向用户说明这一点。 -- 进程启动后,宿主在 `initialize` 里通过 `capabilities.experimental.litheVcs` 协商版本,Provider 在回复里给出自己的能力集。能力集描述的是运行中的进程,所以不写进清单,这遵守[声明式插件按能力分版本](../../implemented/architecture/2026-10-17-plugin-capability-versions.md)第 4 节的规则。 +- 进程启动后,宿主在 `initialize` 里通过 `capabilities.experimental.litheVcs` 协商版本,Provider 在回复里给出自己的能力集。能力集描述的是运行中的进程,所以不写进清单,这遵守[插件契约从统一基线 0 开始](../../implemented/architecture/2026-11-11-plugin-contract-single-baseline.md)第 4 节的规则。 - 请求方法统一以 `lithe/vcs/` 开头。宿主不按 Provider ID 写分支;进程按“插件 ID + VCS ID + 工作区”隔离,生命周期规则与构建 Provider 相同。 字段和方法见 [VCS Provider 契约](../../../../shared/contracts/vcs-provider-v1.md),示例数据见 [`shared/fixtures/vcs/model-v1.json`](../../../../shared/fixtures/vcs/model-v1.json)。Core 已按契约实现(见第 9 节的进度),但还没有宿主声明 `vcsProviders`,所以插件市场不会列出这类插件;宿主接入前契约仍可以修改,改动要同时更新 fixtures 和 Core 测试。 @@ -100,7 +100,7 @@ Git Log 图、Rebase、Worktree、Stash、Push 和 Fetch 对话框、历史改 SVN 插件在独立仓库维护和发布(见第 9 节 P2),调用用户系统里的 `svn` 命令行,解析它稳定的 `--xml` 输出。IDEA 的 svn4idea 也是这样做的(`plugins/svn4idea/src/org/jetbrains/idea/svn/status/CmdStatusClient.kt` 使用 `svn status --xml`)。这和 Lithe 使用系统 Git 的方式一致,不需要打包 JVM 或跨平台编译 libsvn。 -后端进程用官方 Node SDK([lithe-plugin-docs](https://github.com/Lithe-IDEA/lithe-plugin-docs) 的 `sdk/node`)编写,以 `runtime` 方式启动(`tool: node`)。SDK 已经负责线协议、协商、取消、子进程清理和错误映射,Cargo 社区插件也走这条路;同一份后端在 macOS 和 Windows 上都能运行,插件包里没有原生二进制,不涉及按架构编译和 Gatekeeper。代价是用户除了 `svn` 还需要 Node 20.3 以上,安装审查和缺少运行时的提示要说清楚。SDK 新增 `litheVcs` 支持,和 `litheBuild` 并列;2026-10-23 起 SDK 不在主仓库,这部分改动在 lithe-plugin-docs 提交(见[插件契约、SDK 与开发者资料的发布](../../implemented/architecture/2026-10-23-plugin-contract-publishing.md))。 +后端进程用官方 Node SDK(Core 仓库的 [`shared/plugins/sdk/node`](https://github.com/Lithe-IDEA/Lithe-core-rust/tree/main/shared/plugins/sdk/node))编写,以 `runtime` 方式启动(`tool: node`)。SDK 已经负责线协议、协商、取消、子进程清理和错误映射,Cargo 社区插件也走这条路;同一份后端在 macOS 和 Windows 上都能运行,插件包里没有原生二进制,不涉及按架构编译和 Gatekeeper。代价是用户除了 `svn` 还需要 Node 20.3 以上,安装审查和缺少运行时的提示要说清楚。SDK 新增 `litheVcs` 支持,和 `litheBuild` 并列;SDK 不在本仓库:2026-10-23 起在 lithe-plugin-docs 维护,该仓库退役后在 Core 仓库的 `shared/plugins/sdk/node` 里与对应的 Core PR 一起提交(见[插件契约与开发资料只在 Rust Core](../../implemented/architecture/2026-11-11-plugin-contract-single-source-in-core.md))。 凭据规则沿用[Git 执行与项目控制台](../../implemented/architecture/2026-09-12-git-execution-and-project-console.md):命令始终带 `--non-interactive`,SVN 自己的认证缓存优先回答。第一版只依赖这份缓存,认证失败时返回 `vcs.authentication.failed`,宿主提示原因;交互式认证(宿主弹窗收集用户名和密码,经 `--password-from-stdin` 传给 `svn`)在宿主阶段实现。密码不出现在命令参数、控制台和日志里,Lithe 也不保存密码。 @@ -129,15 +129,15 @@ P1 已完成(2026-10-22): - 插件清单:API 级别 3 的 `vcsProviders`、`process.vcs` 权限和 `onVcsRoot:` 激活事件;`git` 是保留 ID。安装审查列出 Provider 进程,SVN 这类工具路径另放在 `vcsTool` 字段,不覆盖运行时的 `tool`。 - 根识别 `vcs.detectRoots`:只读目录项,不读文件、不启动进程;工作区自己没有标记时向上查祖先目录,所以“工作区开在 SVN 工作副本的子目录里”也能识别。新增 `vcs.ownerOf`,让各宿主用同一条“最深根”规则给文件找归属,不必各写一份。 - 会话:`litheVcs` 只提供给插件启动的会话;`lsp.vcsRequest` 按操作名生成 `lithe/vcs/*` 请求,未协商的能力在写出前就拒绝;Provider 只能使用契约列出的错误码,其余一律变成 `vcs.provider.failed`。`lithe/vcs/authenticate` 在宿主实现交互式认证前按未知请求回绝。 -- Node SDK:`backend.vcs(id, handlers, traits)` 按声明的处理函数协商能力,VCS 处理函数里的 `context.run` 会自动发出 `lithe/vcs/execution` 执行报告(只带命令行、退出码、耗时和截断后的 stderr,不带 stdout)。示例 `sdk/node/examples/sample-vcs` 是一个把修订存在 JSON 文件里的玩具 VCS,端到端场景经真实 Core 会话跑通它的协商和全部 11 种操作。SDK、示例和端到端场景随 SDK 迁到 lithe-plugin-docs,在那里用 `scripts/sdk-e2e.mjs --ref <本分支>` 运行;主仓库只保留契约、fixtures 和 Core 测试。 +- Node SDK:`backend.vcs(id, handlers, traits)` 按声明的处理函数协商能力,VCS 处理函数里的 `context.run` 会自动发出 `lithe/vcs/execution` 执行报告(只带命令行、退出码、耗时和截断后的 stderr,不带 stdout)。示例 `sdk/node/examples/sample-vcs` 是一个把修订存在 JSON 文件里的玩具 VCS,端到端场景经真实 Core 会话跑通它的协商和全部 11 种操作。SDK、示例和端到端场景都在 Core 仓库的 `shared/plugins/` 下(曾发布在已退役的 lithe-plugin-docs),在 Core 仓库根运行 `node shared/plugins/scripts/sdk-e2e.mjs`;本仓库只保留宿主侧测试。 P2 已完成(2026-10-23),同日改为社区插件: - 插件在独立仓库 [lithe-plugin-svn](https://github.com/Lithe-IDEA/lithe-plugin-svn),ID 是 `io.github.lithe-idea.svn-support`,`vendor.signatureRequirement` 为 `none`。仓库结构照搬 [Cargo 插件](../../implemented/feature/2026-10-22-cargo-build-plugin.md):`sdk.lock.json` 按上游提交和逐文件 SHA-256 固定 Node SDK,打包前校验;安装包发在插件仓库的 GitHub Releases,Lithe Store 索引记录下载地址和 SHA-256。 - 插件仓库自己的 CI 按 `sdk.lock.json` 的同一个宿主提交检出 Core,经公开 JSON 接口在 `svnadmin create` 建立的 `file://` 仓库上跑状态、提交、更新、冲突、回滚、移动、历史和 Annotate。svn 怎样映射到每个操作、svn 错误码怎样映射到契约错误码,都写在插件仓库的 README 里,主仓库的契约只留一个指向。 -- 主仓库不再有 SVN 专属的代码和测试,CI 也不用装 svn。它保留通用的部分:契约、fixtures 和 Core 测试,以及宿主测试用的 `shared/contracts/plugins/v1/fixtures/vcs/vcs-provider.plugin.json`(只有清单,没有实现)。样例 Provider `sample-vcs` 和它的端到端场景随 SDK 在 lithe-plugin-docs。 +- 主仓库不再有 SVN 专属的代码和测试,CI 也不用装 svn。它保留通用的部分:契约、fixtures 和 Core 测试,以及宿主测试用的 `Lithe-core-rust/shared/plugins/contract/v1/fixtures/vcs/vcs-provider.plugin.json`(只有清单,没有实现)。样例 Provider `sample-vcs` 和它的端到端场景随 SDK 在 Core 仓库的 `shared/plugins/sdk/node`。 -正确做法:主仓库改 VCS 契约或 Core 时,用 fixtures 和 Core 测试验证,合并前在 lithe-plugin-docs 用 `scripts/sdk-e2e.mjs --ref <分支>` 跑样例 Provider;SVN 插件升级 `sdk.lock.json` 后在自己的 CI 里验证。 +正确做法:改 VCS 契约或 Core 时,用 fixtures 和 Core 测试验证,合并前在 Core 仓库根运行 `node shared/plugins/scripts/sdk-e2e.mjs` 跑样例 Provider;契约、API 总表和协议更新记录在同一个 Core PR 里修改;SVN 插件升级 `sdk.lock.json` 后在自己的 CI 里验证。 不要这样做:在主仓库测试里引用隔壁的 SVN 插件 checkout,或者为 SVN 在宿主代码里加按名字判断的分支。 宿主需要知道的 SVN 行为(插件 README 有完整说明): @@ -236,6 +236,6 @@ P2 的第一版就是这样:插件放在 `Plugins/mac/Official/SvnSupport/`, - [旧版 Windows Git 实现](https://github.com/1lck/Lithe-IDEA/tree/5a54c41aa37a4e6e6b68918a4b05765b9dd07a36/windows/tauri/src/features/git) - `desktop/internal/workbench/` - `desktop/internal/core/plugin_session.go` -- `shared/contracts/plugins/v1/` +- `https://github.com/Lithe-IDEA/Lithe-core-rust/blob/main/shared/plugins/contract/v1/` - `shared/contracts/vcs-provider-v1.md` - `shared/fixtures/vcs/` diff --git a/.agents/notes/proposed/architecture/2026-10-24-java-support-independent-distribution.md b/.agents/notes/proposed/architecture/2026-10-24-java-support-independent-distribution.md index 552a2ee1a0..a57cdf1847 100644 --- a/.agents/notes/proposed/architecture/2026-10-24-java-support-independent-distribution.md +++ b/.agents/notes/proposed/architecture/2026-10-24-java-support-independent-distribution.md @@ -77,7 +77,7 @@ Java Support 已经是声明式插件,JDT LS、JDK、Lombok 和调试、测试 - 旧内置包只能在宿主自身签名封装的 bundle 内按旧策略读取;用户目录里的旧 ID 包不能因此获得旧信任,新 ID 也不继承旧 ID 的任何信任。 - 实测下载包里的 JDK 可执行文件及动态库的签名、解压后的执行权限、隔离属性和系统启动限制;沿用或调整原生签名、公证方式的选择由这轮证据确定,不能靠启动时改写包或移除系统保护来通过。 - 发布前确定版本不匹配的拒绝方案;不为旧宿主补业务兼容路径。当前索引没有可直接填写的最低宿主版本字段,不能虚构字段,也不能仅凭 `pluginAPIVersion: 3` 判定可安装。若现有能力表不足以表达信任边界变化,先通过通用契约变更补齐拒绝机制,再上架新包。 -- 如需新增兼容或信任能力,契约在主仓库随 Core 修改,合并后按[两仓库同步规则](../../implemented/architecture/2026-10-23-plugin-contract-publishing.md)发布到 `lithe-plugin-docs`;未来独立插件仓库不能直接修改契约副本。 +- 如需新增兼容或信任能力,契约在 Core 仓库随 Core 修改,协议更新记录和 API 总表在同一个 Core PR 里登记(见[契约单一来源规则](../../implemented/architecture/2026-11-11-plugin-contract-single-source-in-core.md));独立插件仓库不能直接修改契约。 改为普通插件后,独立仓库的发布流程不需要私钥,也就不存在跨仓库私钥分发的问题。 @@ -190,7 +190,7 @@ git diff --check 后续实现按改动选择以下现有入口,并按 `write-stable-tests` Skill 编写和运行有界测试;下面是计划要求,不表示本次已经执行: ```bash -./scripts/architecture/verify-shared-contracts.sh +node shared/plugins/scripts/verify-docs.mjs # 在 Core 仓库根运行 ./scripts/plugins/verify-official-plugins.sh ./scripts/macos/verify/verify-macos-package.sh ./scripts/macos/verify/verify-runtime-bundle-immutability.sh @@ -224,5 +224,5 @@ node scripts/architecture/verify-java-semantic-ownership.mjs - `docs/ci-builds.md` - 已迁出:原 `macos/Sources/Lithe/Services/Java/ProjectRuntimeService.swift`。宿主侧 Java 专属代码已删除(#1495);运行、调试、入口标记与工具链改走通用插件 API(`run/start`、`debug/start`、`editor/registerActions`、`toolDefinitions`),实现见 [lithe-plugin-java](https://github.com/Lithe-IDEA/lithe-plugin-java)。 - Lithe-core-rust 锁定修订:[rust/lithe-core/src/lsp/languages/](https://github.com/Lithe-IDEA/Lithe-core-rust/tree/0ffd327b4329261e393b08ed76fbd134b4dd17e9/rust/lithe-core/src/lsp/languages) -- `shared/contracts/plugins/v1/` +- `https://github.com/Lithe-IDEA/Lithe-core-rust/blob/main/shared/plugins/contract/v1/` - `shared/platform-feature-matrix/features/java-support-plugin.json` diff --git a/.agents/notes/proposed/architecture/2026-10-25-plugin-dependencies-and-exports.md b/.agents/notes/proposed/architecture/2026-10-25-plugin-dependencies-and-exports.md index bcd04c54a7..2b8d1aa487 100644 --- a/.agents/notes/proposed/architecture/2026-10-25-plugin-dependencies-and-exports.md +++ b/.agents/notes/proposed/architecture/2026-10-25-plugin-dependencies-and-exports.md @@ -57,7 +57,7 @@ ### 5. 第一阶段已落地的部分 -对应计划 API-35 的第一阶段,不新增 API 编号,决策正文写在[插件函数契约](../../implemented/architecture/2026-10-20-plugin-function-contract.md)的决策 8,契约写在 `shared/contracts/plugins/v1/README.md` 的 “Cross-plugin calls (protocol version 4)”。它只落地了本提案里不依赖安装解析的那一部分: +对应计划 API-35 的第一阶段,不新增 API 编号,决策正文写在[插件函数契约](../../implemented/architecture/2026-10-20-plugin-function-contract.md)的决策 8,契约写在 `Lithe-core-rust/shared/plugins/contract/v1/README.md` 的 “Cross-plugin calls (protocol version 4)”。它只落地了本提案里不依赖安装解析的那一部分: - 清单新能力键 `requires.pluginFunctions: 1` 与顶层 `pluginFunctions {exports, calls}`。导出是 `{id, version, context}`,`context` 是封闭集合,第一阶段只有 `"workspace"`,缺失或未知就拒绝整个清单:这兑现了第 2 节“没有定义可接受调用上下文的导出,不允许跨包调用”。调用方只声明 `{id, version}`,版本必须相等,不相等是 `plugin.function.versionMismatch`。 - 协议 `litheFunctions` 增加版本 4,只有协商到 4 的后端能用 `lithe/host/functions/providers` 与 `lithe/host/functions/invoke`。运行时发现被调方,清单里不写被调方的插件 ID。 @@ -87,7 +87,7 @@ - 有共同兼容版本与不兼容菱形两组标准用例,冲突报告带确定排序的两条依赖路径;失败不修改原安装闭包。 - 禁用/卸载、启动时依赖缺失、升级失效及恢复分别验证反向依赖与资源清理;任何失败不误停不相关插件。 - 社区依赖官方、同名包来自不同来源、签名变化和导出撤回均有拒绝输入;旧私有函数的归属和递归拒绝语义不变。(第一阶段已覆盖导出撤回、禁用与卸载的进行中调用,以及旧 `wrongPlugin`、`recursiveCall` 不变;来源与签名相关的输入属于安装解析,尚未覆盖。) -- 如涉及函数协议,在 `lithe-plugin-docs` 验证 Node/Java SDK;正式契约与 Core 一起落地后再同步副本。 +- 如涉及函数协议,合并前在 Core 仓库根运行 `node shared/plugins/scripts/sdk-e2e.mjs` 验证 Node、Java、Rust SDK;正式契约、API 总表和协议更新记录与 Core 在同一个 Core PR 里完成。 - #1210 的基础 Registry 和第三方 DAP 验收可以完全不安装依赖包而完成。 ## 风险 @@ -96,14 +96,14 @@ ## 验证 -第一阶段的跨插件调用由 Core 测试(`plugins::plugin_functions`、`lsp::interface::function_relay`、`lsp::interface::engine`)和 macOS 单测(`MacPluginBackendSessionsTests`、`PluginHostServiceDispatchTests`、`PluginPublicHostAPITests`)覆盖,细节见实现 Note 的“验证”。依赖解析器和安装期规则仍没有实现,不能声称安装、版本冲突或依赖授权用例通过。实施时使用 `write-stable-tests`、~~./scripts/architecture/verify-shared-contracts.sh~~(随旧客户端移除)、~~./scripts/rust-core/verify-rust-core.sh~~(随旧客户端移除),并分别验证两个宿主和函数 SDK;新增资源时遵守工作树复用与安装目录只读要求。 +第一阶段的跨插件调用由 Core 测试(`plugins::plugin_functions`、`lsp::interface::function_relay`、`lsp::interface::engine`)和 macOS 单测(`MacPluginBackendSessionsTests`、`PluginHostServiceDispatchTests`、`PluginPublicHostAPITests`)覆盖,细节见实现 Note 的“验证”。依赖解析器和安装期规则仍没有实现,不能声称安装、版本冲突或依赖授权用例通过。实施时使用 `write-stable-tests`、~~./scripts/rust-core/verify-rust-core.sh~~(随旧客户端移除),并分别验证两个宿主和函数 SDK(在 Core 仓库根运行 `node shared/plugins/scripts/sdk-e2e.mjs`,契约与指南改动再运行 `node shared/plugins/scripts/verify-docs.mjs`);新增资源时遵守工作树复用与安装目录只读要求。 ## 适用范围 - Lithe-core-rust 锁定修订:[rust/lithe-core/src/plugins/](https://github.com/Lithe-IDEA/Lithe-core-rust/tree/0ffd327b4329261e393b08ed76fbd134b4dd17e9/rust/lithe-core/src/plugins) - Lithe-core-rust 锁定修订:[rust/lithe-core/src/lsp/interface/plugin_function.rs](https://github.com/Lithe-IDEA/Lithe-core-rust/blob/0ffd327b4329261e393b08ed76fbd134b4dd17e9/rust/lithe-core/src/lsp/interface/plugin_function.rs) - Lithe-core-rust 锁定修订:[rust/lithe-core/src/lsp/interface/function_relay.rs](https://github.com/Lithe-IDEA/Lithe-core-rust/blob/0ffd327b4329261e393b08ed76fbd134b4dd17e9/rust/lithe-core/src/lsp/interface/function_relay.rs) -- `shared/contracts/plugins/v1/` +- `https://github.com/Lithe-IDEA/Lithe-core-rust/blob/main/shared/plugins/contract/v1/` - ~~`macos/Sources/Lithe/Platform/MacOS/`~~(已随 #1794 移除) - ~~`windows/tauri/src-tauri/src/plugin_host/`~~(已随 #1794 移除) -- [插件契约与 SDK 仓库](https://github.com/Lithe-IDEA/lithe-plugin-docs) +- `https://github.com/Lithe-IDEA/Lithe-core-rust/tree/main/shared/plugins/sdk` diff --git a/.agents/notes/proposed/architecture/2026-10-25-unified-debug-engine-and-adapter-registry.md b/.agents/notes/proposed/architecture/2026-10-25-unified-debug-engine-and-adapter-registry.md index 9696ec1c41..e8160c9292 100644 --- a/.agents/notes/proposed/architecture/2026-10-25-unified-debug-engine-and-adapter-registry.md +++ b/.agents/notes/proposed/architecture/2026-10-25-unified-debug-engine-and-adapter-registry.md @@ -31,7 +31,7 @@ - **不自研调试器。** 符号解析、ptrace / Mach 异常端口 / Windows Debug API、各 CPU 架构的断点和单步,都由 GDB、LLDB 等上游负责。GCC 是编译器;GCC 编出来的程序用 GDB 或 LLDB 调试。 - **不重建项目模型。** Java 的主类和 classpath 来自 JDT,Python 解释器来自 Run,C/C++/Rust 产物来自 Build/Run。 -- **不另造插件协议。** 启动声明复用 `serverProcess`、启动模板、能力版本和安装审查,详见[正式调试适配器契约](../../../../shared/contracts/plugins/v1/README.md#api-level-4-debug-adapters)。 +- **不另造插件协议。** 启动声明复用 `serverProcess`、启动模板、能力版本和安装审查,详见[正式调试适配器契约](https://github.com/Lithe-IDEA/Lithe-core-rust/blob/main/shared/plugins/contract/v1/README.md#debug-adapters)。 - **现有行为是迁移基线,不能丢。** 包括 Java 热替换、JUnit/TestNG、调试使用 Run 选中的 JDK、子调试会话与 source map 位置透传、断点先于 launch 入队、停止与清理顺序。 ## 提案 @@ -99,7 +99,7 @@ Registry 注册时不启动程序做验证。一个适配器在接入验收中 ### 5. Registry 与插件声明 -完整字段和拒绝规则见[正式调试适配器契约](../../../../shared/contracts/plugins/v1/README.md#api-level-4-debug-adapters)、[清单 schema](../../../../shared/contracts/plugins/v1/plugin-manifest.schema.json) 和[拒绝 fixtures](../../../../shared/contracts/plugins/v1/fixtures/debug-adapters/debug-adapter-rejections.json),这里只记录决策: +完整字段和拒绝规则见[正式调试适配器契约](https://github.com/Lithe-IDEA/Lithe-core-rust/blob/main/shared/plugins/contract/v1/README.md#debug-adapters)、[清单 schema](https://github.com/Lithe-IDEA/Lithe-core-rust/blob/main/shared/plugins/contract/v1/plugin-manifest.schema.json) 和[拒绝 fixtures](https://github.com/Lithe-IDEA/Lithe-core-rust/blob/main/shared/plugins/contract/v1/fixtures/debug-adapters/debug-adapter-rejections.json),这里只记录决策: - 插件只写一个 `plugin.json.debugAdapters` 块,必填 `id`、`displayName`、`launch`。`launch` 由两部分组成:复用 `serverProcess` 的进程,加上 `stdio`、`tcpAnnounced` 或 `tcpPort` 三种传输之一;调试服务寄居在同一插件的语言服务器里时(Java Debug Server 之于 JDT LS),改用 `tcpLanguageServer`,此时没有 `process`,只有 `endpoint`。 - 拟定 API 4、`requires.debugAdapters: 1`、`debug.launch` / `debug.attach` 权限。需要 Run 选中的运行时时,使用 `serverProcess: 2` 的 `runSelectedRuntime`。 @@ -126,7 +126,7 @@ Registry 注册时不启动程序做验证。一个适配器在接入验收中 | P4 第三方纵向验收 | 两个平台各用一个真实第三方适配器(GDB DAP `gdb -i=dap` 或 `lldb-dap`)完成安装、选择、launch / attach、必选层全流程和资源回收 | | P5 删除旧路径 | 所有消费者迁到 v2 之后,在同一个 PR 里删除 Swift 会话、按语言的工厂和 v1 投影 | -P0 的清单落在 `shared/fixtures/debug/v1-baseline.json`:每一项指向 Rust、macOS 上现有的测试和 fixture(Windows 不在当前阶段范围内),并标明 `covered` / `partial` / `gap`。`scripts/architecture/verify-debug-v1-baseline.mjs`(已接入 `verify-shared-contracts.sh`)检查引用的测试仍然存在,防止重命名或删除悄悄缩小基线。 +P0 的清单落在 `shared/fixtures/debug/v1-baseline.json`:每一项指向 Rust、macOS 上现有的测试和 fixture(Windows 不在当前阶段范围内),并标明 `covered` / `partial` / `gap`。`scripts/architecture/verify-debug-v1-baseline.mjs` 曾检查引用的测试仍然存在(该脚本和接入它的 `verify-shared-contracts.sh` 都已不存在),防止重命名或删除悄悄缩小基线。 P1 已在 Rust Core 落地:v2 投影类型与校验(`debug/projection_v2.rs`,共用 `projection-v2-examples.json`)、DAP `startDebugging` 反向请求(`debug.startDebuggingResponse`,仅在宿主声明 `supportsStartDebuggingRequest` 时启用)、Node source map 位置透传。macOS 的 `DebugProjectionV2` 与 Core 会话读同一份 fixture。旧的 Swift `DebugAdapterProtocolSession` 已删除:Java、Python、Rust 全部走 Core 会话(Python、Rust 经 `DebugAdapterRuntimeFactory` 用 stdio 传输)。宿主同时移除了内置的 Go(Delve)和 Node(js-debug)调试,TCP 传输、会话工厂、启动配置解析和语言包调试入口都已删除,之后由对应语言插件按 Registry 契约补上。P1 之后基础层逻辑也已在 Core 落地(`debug/capabilities.rs`、`engine.rs`):能力快照 `supported = 适配器协商 ∧ 扩展注册 ∧ 已授权`,带单调递增 `revision`,只在变化时发出;插件只能通过 `disabledCapabilities` 关闭标准能力,`supportsConfigurationDoneRequest` 不可关闭。停止代数(`stopGeneration`)在停止、继续、终止时递增,旧代数发出的引用型请求的回复被丢弃并报 `StaleReference`(`stale-reference-v1.json`)。evaluate 的 context 受校验。Core 记录父子会话树,随父会话停止发出 `ChildSessionStopRequested`。子会话生命周期与父会话统一:销毁父会话会级联销毁整棵子树(叶子在前),`debug.destroySession` 返回 `destroyedChildSessionIds` 供宿主关闭对应传输,Core 里不会留下孤儿子会话。栈帧与作用域响应同时发出 v2 `Projection` 事件,v1 仍为准,校验失败的 v2 投影不下发。 macOS 多会话(本阶段):宿主在 `DebugAdapterSessionManager` 里实现 `startDebugging`。父会话收到反向请求后,管理器通过 `makeChildSession` 向 provider 要一个子会话,把父会话的 Core 会话 ID 设为子会话的 `parentSessionId`,登记为带 `parentID` 的会话并用请求里的配置启动。子会话不会替换 provider 的当前会话(兼容目标仍是父会话),所以单会话的断点、状态和按钮行为不变。生命周期由宿主统一:停止父会话先停子会话;父会话进入 `terminated` 或 `failed` 也会关闭它的子会话;功能模型同步清理快照、Java 热更新目标,并在当前会话消失时改选剩余会话,没有剩余会话就回到空闲。 @@ -135,7 +135,7 @@ macOS 多会话(本阶段):宿主在 `DebugAdapterSessionManager` 里实 `makeChildSession` 是可选覆盖:默认子会话就是 provider 的 `makeSession` 再开一个会话,宿主因此总会声明 `supportsStartDebuggingRequest`。这是有意取舍:旧调试内核要整体被替换,不为兼容旧行为保留休眠开关。代价是 debugpy 这类通过 `connect` 主机和端口附加的适配器,在没有 TCP 子会话传输前,子会话会被忽略该端点,多进程 Python 调试暂时不可用;由具体语言插件覆盖 `makeChildSession` 补上。Swift 侧仍未消费 `projection`、`childSession*` 与 `disabledCapabilities`。 -P3 的声明层已在 Rust Core 落地:`plugin.json.debugAdapters[]` 作为插件 API 4 进入正式契约(`shared/contracts/plugins/v1/`),`debug/adapters.rs` 校验声明、安装包资源和启动计划,C01–C09、S01–S02 拒绝用例由 `fixtures/debug-adapters/debug-adapter-rejections.json` 驱动 Core 测试。启动计划与安装检查由 macOS 声明式 Provider 接入(先 stdio + launch)。 +P3 的声明层已在 Rust Core 落地:`plugin.json.debugAdapters[]` 作为插件 API 4 进入正式契约(`Lithe-core-rust/shared/plugins/contract/v1/`),`debug/adapters.rs` 校验声明、安装包资源和启动计划,C01–C09、S01–S02 拒绝用例由 `fixtures/debug-adapters/debug-adapter-rejections.json` 驱动 Core 测试。启动计划与安装检查由 macOS 声明式 Provider 接入(先 stdio + launch)。 macOS 声明式 Provider: - Rust Core 新增 `languageServerLaunchPlan` 的 `debugAdapterID` 选择器和 `debug.adapters.startArguments` 命令;后者按 manifest、adapterID、request 与事实(注册代次、目标、运行时选择)返回启动参数,拒绝码为 `debug.provider.stale`、`debug.request.unsupported`、`debug.runtime.stale`、`debug.target.invalid`、`plugin.launch.unavailable`。 @@ -317,15 +317,15 @@ P0–P5 完成后关闭 #1210。可选扩展、插件依赖和私有 resolver ## 验证 -文档与共享 fixture 运行 `./scripts/agent-notes/verify-agent-notes.sh`、~~./scripts/architecture/verify-shared-contracts.sh~~(随旧客户端移除)、`./scripts/macos/verify/verify-runtime-bundle-immutability.sh` 和 `git diff --check`。会话投影 v2 的解码、拒绝与往返一致性由正式 fixture 及现有 Rust、Swift 测试验证,不再依赖草案 schema。这些静态检查不构成运行时证据。 +文档与共享 fixture 运行 `./scripts/agent-notes/verify-agent-notes.sh`、`./scripts/macos/verify/verify-runtime-bundle-immutability.sh` 和 `git diff --check`;契约与指南改动再在 Core 仓库根运行 `node shared/plugins/scripts/verify-docs.mjs`。会话投影 v2 的解码、拒绝与往返一致性由正式 fixture 及现有 Rust、Swift 测试验证,不再依赖草案 schema。这些静态检查不构成运行时证据。 -实施阶段加载 `write-stable-tests`,按改动范围运行 ~~./scripts/rust-core/verify-rust-core-comments.sh~~(随旧客户端移除)、~~./scripts/rust-core/verify-rust-core.sh~~(随旧客户端移除)、~~./scripts/macos/test/test-macos.sh~~(随旧客户端移除)、~~./scripts/architecture/verify-service-boundaries.sh~~(随旧客户端移除) 和 ~~./scripts/windows/verify/verify-windows-boundaries.sh~~(随旧客户端移除);Windows 另外执行 ~~./scripts/windows/build/build-windows.ps1 -Configuration Release~~(随旧客户端移除)、宿主 Rust 测试和前端测试。所有等待都有上限,失败时也释放资源,结束后确认本次启动的进程都已退出。平台行为变化时同步功能矩阵,运行 `./scripts/platform-feature-matrix/verify-platform-feature-matrix.sh`。正式契约与 Core 一起修改,合并后按[两仓库发布规则](../../implemented/architecture/2026-10-23-plugin-contract-publishing.md)同步 `lithe-plugin-docs`。 +实施阶段加载 `write-stable-tests`,按改动范围运行 ~~./scripts/rust-core/verify-rust-core-comments.sh~~(随旧客户端移除)、~~./scripts/rust-core/verify-rust-core.sh~~(随旧客户端移除)、~~./scripts/macos/test/test-macos.sh~~(随旧客户端移除)、~~./scripts/architecture/verify-service-boundaries.sh~~(随旧客户端移除) 和 ~~./scripts/windows/verify/verify-windows-boundaries.sh~~(随旧客户端移除);Windows 另外执行 ~~./scripts/windows/build/build-windows.ps1 -Configuration Release~~(随旧客户端移除)、宿主 Rust 测试和前端测试。所有等待都有上限,失败时也释放资源,结束后确认本次启动的进程都已退出。平台行为变化时同步功能矩阵,运行 `./scripts/platform-feature-matrix/verify-platform-feature-matrix.sh`。正式契约、API 总表和协议更新记录与 Core 在同一个 Core PR 里修改,规则见[契约单一来源规则](../../implemented/architecture/2026-11-11-plugin-contract-single-source-in-core.md)。 ## 适用范围 - Lithe-core-rust 锁定修订:[rust/lithe-core/src/debug/](https://github.com/Lithe-IDEA/Lithe-core-rust/tree/0ffd327b4329261e393b08ed76fbd134b4dd17e9/rust/lithe-core/src/debug) - Lithe-core-rust 锁定修订:[rust/lithe-core/src/plugins/](https://github.com/Lithe-IDEA/Lithe-core-rust/tree/0ffd327b4329261e393b08ed76fbd134b4dd17e9/rust/lithe-core/src/plugins) -- `shared/contracts/plugins/v1/` +- `https://github.com/Lithe-IDEA/Lithe-core-rust/blob/main/shared/plugins/contract/v1/` - `shared/contracts/rust-core-api.md` - `shared/fixtures/debug/` - ~~`macos/Sources/LitheCoreContracts/Debug/`~~(已随 #1794 移除) @@ -337,7 +337,7 @@ P0–P5 完成后关闭 #1210。可选扩展、插件依赖和私有 resolver ## 依据 -- [公共扩展契约](2026-10-13-public-extension-contract-and-provider-api.md)、[能力版本](../../implemented/architecture/2026-10-17-plugin-capability-versions.md)、[插件函数契约](../../implemented/architecture/2026-10-20-plugin-function-contract.md)。 +- [公共扩展契约](2026-10-13-public-extension-contract-and-provider-api.md)、[能力版本](../../implemented/architecture/2026-11-11-plugin-contract-single-baseline.md)、[插件函数契约](../../implemented/architecture/2026-10-20-plugin-function-contract.md)。 - [Java 构建与启动边界](../../implemented/architecture/2026-09-18-java-project-build-and-launch-boundary.md)、[Java Debug 使用 Run 的 JDK](../../implemented/bug-fix/2026-10-14-java-debug-uses-the-run-jdk.md)、[Windows Java 调试生命周期](../../implemented/bug-fix/2026-10-07-windows-java-debug-lifecycle.md)。 - [DAP 标准](https://microsoft.github.io/debug-adapter-protocol/overview)、[DAP 定义](https://github.com/microsoft/debug-adapter-protocol/blob/main/debugAdapterProtocol.json)、[GDB DAP](https://sourceware.org/gdb/current/onlinedocs/gdb.html/Debugger-Adapter-Protocol.html)、[LLDB DAP](https://lldb.llvm.org/use/lldbdap.html)。 - [debugpy 1.8.22 的 listen 启动适配器](https://github.com/microsoft/debugpy/blob/v1.8.22/src/debugpy/server/api.py#L189-L225)、[GDB 16.3 的 attach target 处理](https://github.com/RTEMS/sourceware-mirror-binutils-gdb/blob/gdb-16.3-release/gdb/python/lib/gdb/dap/launch.py#L129-L145)。 diff --git a/.agents/notes/proposed/architecture/2026-10-26-maven-java-domain-plugin-migration.md b/.agents/notes/proposed/architecture/2026-10-26-maven-java-domain-plugin-migration.md index 33962e024b..fa595b02df 100644 --- a/.agents/notes/proposed/architecture/2026-10-26-maven-java-domain-plugin-migration.md +++ b/.agents/notes/proposed/architecture/2026-10-26-maven-java-domain-plugin-migration.md @@ -57,9 +57,9 @@ Maven 插件单独使用 [`Lithe-IDEA/lithe-plugin-maven@bfa56dc80914df22ab60967 | [`backend: 1`][page-backend]及[macOS 会话][page-sessions] | 每插件一个进程,供插件自己的网页函数/设置动作调用;要求网页窗口,不绑定工作区,拒绝 `workspaceStateDir`。 | 无页面时可用、工作区隔离的原生领域入口。不能用空网页绕过限制,也不能把任意私有函数开放为宿主业务 API。 | | 现有函数协商与 `BuildSystemService.invokePluginFunction` | 已有协商、调用和构建 Provider 目标定位;不能把它描述为“完全没有函数调用”。 | 调用存在不等于已有公开、类型化的 Run/Test/Debug/Maven 业务契约;权限、版本、参数与生命周期仍须定义。 | | 通用 Debug 服务及 [#1210 提案][debug-note] | 已有 #1508 基础调试重构、#1509 macOS 多会话;#1510 已将 API 4/`debugAdapters` 声明及校验纳入[正式契约][debug-contract]。 | DebugAdapter Registry(适配器注册表)与宿主运行时接入仍待完成;新 Core 启动计划和包资源检查尚无生产调用方。复用已发布声明,不能把声明校验通过写成插件调试已可用。 | -| 插件契约与两个后端 SDK(开发工具包) | 主仓库拥有契约和 Core,`lithe-plugin-docs` 拥有契约副本与 Node/Java SDK。 | 新契约随 Core/fixtures 评审,合并后同步副本;协议实现合并前用两个 SDK 的真实后端跑端到端验证。 | +| 插件契约与官方后端 SDK(开发工具包) | Core 仓库的 `shared/plugins/` 拥有契约、API 总表、协议更新记录和 Node、Java、Rust 三个官方 SDK;SDK 曾发布在已退役的 lithe-plugin-docs。 | 新契约、API 总表和协议更新记录随 Core/fixtures 在同一个 Core PR 里评审;协议实现合并前在 Core 仓库根运行 `node shared/plugins/scripts/sdk-e2e.mjs`,用真实后端跑端到端验证。 | -新能力必须明确插件 ID/版本、工作区身份与重开代次、配置/工程快照身份、`operationID`、进度、取消、超时和晚到结果。停用、更新、崩溃、切换/关闭工作区及退出,必须撤销能力并结束对应进程/订阅。以上是职责要求,不是已经发布的新字段或方法名;正式协议只在 `shared/contracts/plugins/v1/` 随实现定义。 +新能力必须明确插件 ID/版本、工作区身份与重开代次、配置/工程快照身份、`operationID`、进度、取消、超时和晚到结果。停用、更新、崩溃、切换/关闭工作区及退出,必须撤销能力并结束对应进程/订阅。以上是职责要求,不是已经发布的新字段或方法名;正式协议只在 `Lithe-core-rust/shared/plugins/contract/v1/` 随实现定义。 ### 三、Maven 当前入口、调用链与替换能力 @@ -212,7 +212,7 @@ D/E/F 完成须逐行附上真实新路径、删除证据、工具/插件/平台 git diff --check ``` -后续实现按受影响边界运行共享契约、服务边界、Rust Core、macOS/Windows 与测试稳定性检查;修改插件协议时合并前执行 `lithe-plugin-docs` 的 Node/Java SDK 端到端验证,合并后按[契约发布规则][contract-note]同步逐字节副本。平台改动提交前通过实际 PR 基线的矩阵变更门禁。 +后续实现按受影响边界运行共享契约、服务边界、Rust Core、macOS/Windows 与测试稳定性检查;修改插件协议时合并前在 Core 仓库根运行 `node shared/plugins/scripts/sdk-e2e.mjs`,契约、API 总表和协议更新记录在同一个 Core PR 里完成(见[契约发布规则][contract-note])。平台改动提交前通过实际 PR 基线的矩阵变更门禁。 真实工作流验收必须比较 app/Windows 安装资源与已安装插件版本的文件清单或哈希,证明典型启动/构建/运行/测试/调试后不变。只读静态脚本通过不代替此证据。本次没有启动应用;以后每次验证结束关闭本次启动的所有 Lithe/子进程、listener、订阅和临时资源,确认无残留后交付。 @@ -262,6 +262,6 @@ git diff --check [distribution-note]: 2026-10-24-java-support-independent-distribution.md [debug-note]: 2026-10-25-unified-debug-engine-and-adapter-registry.md [settings-note]: ../../implemented/architecture/2026-10-25-settings-native-configuration-editing.md -[contract-note]: ../../implemented/architecture/2026-10-23-plugin-contract-publishing.md +[contract-note]: ../../implemented/architecture/2026-11-11-plugin-contract-single-source-in-core.md [lsp-note]: ../../implemented/architecture/2026-09-13-language-tooling-and-lsp-runtime-ownership.md -[debug-contract]: https://github.com/1lck/Lithe-IDEA/blob/1a7a95c8ce9d254bb6b8811af73e93d86a7badc1/shared/contracts/plugins/v1/README.md#api-level-4-debug-adapters +[debug-contract]: https://github.com/Lithe-IDEA/Lithe-core-rust/blob/main/shared/plugins/contract/v1/README.md#debug-adapters diff --git a/.agents/notes/proposed/architecture/2026-10-27-debug-network-paths-and-tcp-lifecycle.md b/.agents/notes/proposed/architecture/2026-10-27-debug-network-paths-and-tcp-lifecycle.md index ad4cbde18c..859fce171d 100644 --- a/.agents/notes/proposed/architecture/2026-10-27-debug-network-paths-and-tcp-lifecycle.md +++ b/.agents/notes/proposed/architecture/2026-10-27-debug-network-paths-and-tcp-lifecycle.md @@ -93,7 +93,7 @@ IDE -- DAP(调试适配器协议,stdio 或 TCP)--> 调试适配器 - Lithe-core-rust 锁定修订:[rust/lithe-core/src/debug/](https://github.com/Lithe-IDEA/Lithe-core-rust/tree/0ffd327b4329261e393b08ed76fbd134b4dd17e9/rust/lithe-core/src/debug) - ~~`macos/Sources/Lithe/Platform/MacOS/Debug/`~~(已随 #1794 移除) - ~~`windows/tauri/src-tauri/src/debug.rs`~~(已随 #1794 移除) -- `shared/contracts/plugins/v1/` +- `https://github.com/Lithe-IDEA/Lithe-core-rust/blob/main/shared/plugins/contract/v1/` - Lithe-core-rust 锁定修订:[rust/lithe-remote/src/client/transport.rs](https://github.com/Lithe-IDEA/Lithe-core-rust/blob/0ffd327b4329261e393b08ed76fbd134b4dd17e9/rust/lithe-remote/src/client/transport.rs) - Lithe-core-rust 锁定修订:[rust/lithe-remote/src/client/forward.rs](https://github.com/Lithe-IDEA/Lithe-core-rust/blob/0ffd327b4329261e393b08ed76fbd134b4dd17e9/rust/lithe-remote/src/client/forward.rs) diff --git a/.agents/notes/proposed/architecture/2026-10-27-remote-debug-adapter-over-ssh.md b/.agents/notes/proposed/architecture/2026-10-27-remote-debug-adapter-over-ssh.md index 525799ef37..1f301b6ed9 100644 --- a/.agents/notes/proposed/architecture/2026-10-27-remote-debug-adapter-over-ssh.md +++ b/.agents/notes/proposed/architecture/2026-10-27-remote-debug-adapter-over-ssh.md @@ -157,7 +157,7 @@ 仅在独立网络方案批准后细化,不是本轮的任务清单: 1. Core:清单声明与 schema、declaration 校验与拒绝 fixture、`plan_descriptor.remoteRun`、目的地校验与命令构造、路径翻译函数与会话接入、首帧噪声丢弃、ssh 失败分类、测试。 -2. 契约与文档:`shared/contracts/plugins/v1/` 的 README、schema、fixture;合并后同步 lithe-plugin-docs。 +2. 契约与文档:`Lithe-core-rust/shared/plugins/contract/v1/` 的 README、schema、fixture,和 `Lithe-core-rust/shared/plugins/reference/` 的协议更新记录、API 总表,在同一个 Core PR 里完成。 3. macOS 宿主:对话框、确认弹窗、进程所有权与清理、退出确认、`shared/i18n` 词条、假 ssh 集成测试。 4. 真机验收:一台 Linux 主机上的 `gdb -i=dap`,覆盖设断点、命中、看栈帧、单步、结束、断线。 5. Windows 宿主和模型 A 另议。 @@ -212,7 +212,7 @@ - 首帧噪声:噪声后接正常帧能成功;超过 64 KiB 或没有 `Content-Length:` 时会话结束并返回被丢弃输出;进入帧流之后的格式错误仍然报错。 - ssh 失败分类:每一类用固定 stderr 样本测试,原文被保留。 - 平台集成测试使用**假 ssh 可执行文件**(有界等待),验证确认弹窗每次出现、结束后没有残留的 ssh 进程、断开时发送了正确的 `terminateDebuggee`。 -- 契约、README、schema、fixture 更新;`shared/i18n/` 补齐中英词条并通过 `node scripts/i18n/generate-i18n.mjs --check`;功能矩阵 `plugin-debug-adapters` 增补说明;合并后同步 lithe-plugin-docs。 +- 契约、README、schema、fixture 更新;`shared/i18n/` 补齐中英词条并通过 `node scripts/i18n/generate-i18n.mjs --check`;功能矩阵 `plugin-debug-adapters` 增补说明;协议更新记录和 API 总表的登记与契约在同一个 Core PR 里完成。 - 真机验收:一台 Linux 主机上的 `gdb -i=dap`(设断点、命中、栈帧对应本地源码、单步、结束、断线)。 ## 风险 @@ -232,6 +232,6 @@ - Lithe-core-rust 锁定修订:[rust/lithe-core/src/debug/](https://github.com/Lithe-IDEA/Lithe-core-rust/tree/0ffd327b4329261e393b08ed76fbd134b4dd17e9/rust/lithe-core/src/debug) - Lithe-core-rust 锁定修订:[rust/lithe-remote/src/client/transport.rs](https://github.com/Lithe-IDEA/Lithe-core-rust/blob/0ffd327b4329261e393b08ed76fbd134b4dd17e9/rust/lithe-remote/src/client/transport.rs) -- `shared/contracts/plugins/v1/` +- `https://github.com/Lithe-IDEA/Lithe-core-rust/blob/main/shared/plugins/contract/v1/` - ~~`macos/Sources/Lithe/Platform/MacOS/Debug/`~~(已随 #1794 移除) - `shared/i18n/` diff --git a/.agents/notes/proposed/architecture/2026-10-31-plugin-injected-toolchains.md b/.agents/notes/proposed/architecture/2026-10-31-plugin-injected-toolchains.md index ea0fbbcf09..7d2032a11b 100644 --- a/.agents/notes/proposed/architecture/2026-10-31-plugin-injected-toolchains.md +++ b/.agents/notes/proposed/architecture/2026-10-31-plugin-injected-toolchains.md @@ -159,7 +159,7 @@ macOS 的声明式路线由 `MacToolchainDiscovery` 执行,宿主不认识任 阶段 3 清理 `ProjectRuntimeService` 的专属选择链和 `project-jdk`、`project-maven` 等被替代引用前,须按 [Java/Maven 迁移清单](2026-10-26-maven-java-domain-plugin-migration.md)核对真实消费者和数据迁移。Node、Go、Python 等在其插件声明定义之前保持当前实现,不新增特判;不能在本次提案删除仍在生产使用的代码,或用永久兼容别名伪装迁移完成。 -阶段 1 的契约草案 `shared/contracts/plugins/v1/toolchains/proposal/` 及其 fixture 已于 2026-11-05 删除。草案把已实现和未实现的行为写在一起,同步到 lithe-plugin-docs 后,插件开发者分不清哪些能用。其中已经实现的后端协商 `litheToolchains`、稳定失败码和错误回复规则已写进正式契约 `shared/contracts/plugins/v1/toolchains/README.md`;Core 测试改用 `rust/lithe-core/src/tests/toolchain_vectors.rs` 里的内联数据。消费者迁移、查询生命周期与缓存、固定值保存和版本管理器插件等未实现部分只在本笔记跟踪,实现时再写进正式契约;旧 `local-v1` schema 与 Run 配置读写路径保持不变,新 Core 固定解析入口只处理调用方传入的 JSON,不打开文件或保存忽略规则。合并后在插件文档仓库按合并的 `preview` 提交执行 `node scripts/contract.mjs sync --revision `;实际插件后端协议接入时同步 Node/Java SDK,并在合并前执行 SDK 端到端验证。每阶段的功能矩阵只记录实际实现和目标平台运行证据,不把本提案或 Core 单元测试当作 Windows 已完成。 +阶段 1 的契约草案 `Lithe-core-rust/shared/plugins/contract/v1/toolchains/proposal/` 及其 fixture 已于 2026-11-05 删除。草案把已实现和未实现的行为写在一起,插件开发者读到的是整个契约目录,分不清哪些能用。其中已经实现的后端协商 `litheToolchains`、稳定失败码和错误回复规则已写进正式契约 `Lithe-core-rust/shared/plugins/contract/v1/toolchains/README.md`;Core 测试改用 `rust/lithe-core/src/tests/toolchain_vectors.rs` 里的内联数据。消费者迁移、查询生命周期与缓存、固定值保存和版本管理器插件等未实现部分只在本笔记跟踪,实现时再写进正式契约;旧 `local-v1` schema 与 Run 配置读写路径保持不变,新 Core 固定解析入口只处理调用方传入的 JSON,不打开文件或保存忽略规则。契约、API 总表和协议更新记录在同一个 Core PR 里完成;实际插件后端协议接入时在同一个 Core PR 里更新 Node、Java、Rust SDK,并在合并前于 Core 仓库根运行 `node shared/plugins/scripts/sdk-e2e.mjs`。每阶段的功能矩阵只记录实际实现和目标平台运行证据,不把本提案或 Core 单元测试当作 Windows 已完成。 ## 风险 @@ -176,7 +176,7 @@ macOS 的声明式路线由 `MacToolchainDiscovery` 执行,宿主不认识任 当前验证覆盖文档、契约、Core 纯数据边界和 macOS 设置页的扫描与布局测试,不声称运行时流程已验收: - `./scripts/agent-notes/verify-agent-notes.sh`:中文笔记格式、生命周期、链接与路径。 -- ~~./scripts/architecture/verify-shared-contracts.sh~~(随旧客户端移除):现行共享契约及 JSON 有效性;不检查 Core 语义,语义由下面的 Core 测试保护。 +- `node shared/plugins/scripts/verify-docs.mjs`(在 Core 仓库根运行):契约、指南和参考文档的检查;不检查 Core 语义,语义由下面的 Core 测试保护。 - `./scripts/platform-feature-matrix/verify-platform-feature-matrix.sh`:矩阵记录实际 Core 切片与平台待接入状态,不把纯数据测试标成产品运行时已验证。 - `cargo test --manifest-path rust/Cargo.toml -p lithe-core --lib toolchain_definitions -- --test-threads=1`:任何插件可定义短 ID、多个插件定义同一短 ID 时都不注册且 `conflicts` 排序稳定、其余定义照常注册、重复插件 ID 整批拒绝、嵌套字段失败即拒绝、只报告安装的提供方,以及定义插件为自己的工具声明提供方。 - `cargo test --manifest-path rust/Cargo.toml -p lithe-core --lib toolchain_pins -- --test-threads=1`:目录按组件继承、失效数据、跨平台路径语法、数量边界和 legacy 数据保留。 @@ -187,7 +187,7 @@ macOS 的声明式路线由 `MacToolchainDiscovery` 执行,宿主不认识任 ## 适用范围 -- `shared/contracts/plugins/v1/` +- `https://github.com/Lithe-IDEA/Lithe-core-rust/blob/main/shared/plugins/contract/v1/` - `shared/contracts/toolchain-local-v1.schema.json` - Lithe-core-rust 锁定修订:[rust/lithe-core/src/plugins/](https://github.com/Lithe-IDEA/Lithe-core-rust/tree/0ffd327b4329261e393b08ed76fbd134b4dd17e9/rust/lithe-core/src/plugins) - Lithe-core-rust 锁定修订:[rust/lithe-core/src/execution/](https://github.com/Lithe-IDEA/Lithe-core-rust/tree/0ffd327b4329261e393b08ed76fbd134b4dd17e9/rust/lithe-core/src/execution) diff --git a/.agents/notes/proposed/architecture/2026-11-04-java-extraction-generic-apis-and-gate.md b/.agents/notes/proposed/architecture/2026-11-04-java-extraction-generic-apis-and-gate.md index 3cfa0a68ac..38982027cb 100644 --- a/.agents/notes/proposed/architecture/2026-11-04-java-extraction-generic-apis-and-gate.md +++ b/.agents/notes/proposed/architecture/2026-11-04-java-extraction-generic-apis-and-gate.md @@ -82,7 +82,7 @@ 该 Note 还要求每个导出写明可接受的调用上下文和所需授权,这一项留给 C-IMPORT 在契约里定稿。依赖与导出那篇 Note 继续留在 `proposed/`,由 C-IMPORT 的 PR 落地时更新,本 PR 不移动它。 -SDK:三份官方后端 SDK(Node、Java、Rust)各自增加发现、调用和导出的类型化包装,由 `lithe-plugin-docs` 的 SDK 批次交付。 +SDK:三份官方后端 SDK(Node、Java、Rust)各自增加发现、调用和导出的类型化包装,在 Core 仓库的 `shared/plugins/sdk/{node,java,rust}` 里,与对应的 Core PR 一起交付。 ### 三、Java 拆分怎样使用这个中转 @@ -149,7 +149,7 @@ SDK:三份官方后端 SDK(Node、Java、Rust)各自增加发现、调用 | 仓库 | PR | 内容 | | --- | --- | --- | -| lithe-plugin-docs | docs-LS、docs-RUN、docs-EDIT、docs-IMPORT、docs-PROJ | 契约同步,三份 SDK 的类型化包装;C-* 合入前先过 `sdk-e2e` | +| Lithe-core-rust | core-LS、core-RUN、core-EDIT、core-IMPORT、core-PROJ | 契约、API 总表、协议更新记录和三份 SDK 的类型化包装,与对应的 C-* 同批完成;合入前在 Core 仓库根运行 `node shared/plugins/scripts/sdk-e2e.mjs` | | lithe-plugin-java | J0 | 骨架,移植纯逻辑 | | | J1 | 启动解析器、`jdt://`、状态目录、准备状态、导入配置消费方 | | | J2 | 入口和运行标记、Run、Debug、长类路径 | @@ -175,14 +175,14 @@ Windows 现在还通过 Core 的命令调用 Maven 和 Java 功能,而 Windows ### 七、验收闸门脚本 -~~scripts/architecture/verify-no-host-language-specifics.mjs~~(随旧客户端移除) 扫描六个目录:`rust/lithe-core/src`、`macos/Sources`、`frontend/editor/src`、`shared/contracts/plugins/v1`、`windows/tauri/src`、`windows/tauri/src-tauri/src`。跳过 `vendor`、`node_modules` 和以点开头的目录。 +~~scripts/architecture/verify-no-host-language-specifics.mjs~~(随旧客户端移除) 扫描六个目录:`rust/lithe-core/src`、`macos/Sources`、`frontend/editor/src`、`shared/contracts/plugins/v1`、`windows/tauri/src`、`windows/tauri/src-tauri/src`。其中 `shared/contracts/plugins/v1` 当时在本仓库,现在是 Core 仓库的 `shared/plugins/contract/v1/`。跳过 `vendor`、`node_modules` 和以点开头的目录。 检查什么: - **词表**:把标识符和字符串按 camelCase、snake_case、`.`、`/`、`-` 切成词,命中 `java`、`jdt`、`jdtls`、`jvm`、`maven`、`mvn`、`gradle`、`spring`、`mybatis`、`lombok`、`junit`、`testng`、`m2e`、`surefire` 就计数。`JavaScript` 不算。它按整词匹配,所以 `javac`、`javadoc`、`mvnw`、`springframework` 不计入。 - **名字比较**:Rust、Swift、TypeScript 里把某个值与带词表词的字符串字面量做相等比较,或者写成 `match`、`switch` 的分支,例如 `tool == "java"`、`case "maven":`。 - **工具名常量表**:Rust 里的 `const`、`static` 字符串数组,内容列出词表词,或 `node`、`go`、`python` 这类工具名,例如 `const X: &[&str] = &["java", ...]`。按条目计数:这类表有几项就记几,所以给已有的表再加一个 `python` 也会让计数上升。 -- **schema 封闭枚举**:`shared/contracts/plugins/v1/` 下的 JSON schema 里,`tool`、`runtime` 属性用 `enum` 或 `const` 把取值写死,`languageImport.kind` 同样写死,以及每一个 `hostIntegration` 属性。按取值计数:`enum` 有几个成员就记几(含 `items`、`oneOf`、`anyOf`、`allOf` 里的),`const` 记 1;`hostIntegration` 记它的集成名个数(对象形式只数 `id` 的取值),至少记 1。这样已有枚举从 `["java", "node"]` 扩成 `["java", "node", "python"]` 也会被棘轮拦下。 +- **schema 封闭枚举**:`Lithe-core-rust/shared/plugins/contract/v1/` 下的 JSON schema 里,`tool`、`runtime` 属性用 `enum` 或 `const` 把取值写死,`languageImport.kind` 同样写死,以及每一个 `hostIntegration` 属性。按取值计数:`enum` 有几个成员就记几(含 `items`、`oneOf`、`anyOf`、`allOf` 里的),`const` 记 1;`hostIntegration` 记它的集成名个数(对象形式只数 `id` 的取值),至少记 1。这样已有枚举从 `["java", "node"]` 扩成 `["java", "node", "python"]` 也会被棘轮拦下。 - **六个旧 token**:`is_main_method`、`main_declaration_index`、`main_class_exists`、`containsJavaMainMethod`、`java.runConfigurations`、`java.testMethods`,原脚本 `verify-java-semantic-ownership.mjs` 里的规则,在任何模式下都失败,白名单文件里也一样。 三种模式: @@ -273,7 +273,7 @@ node scripts/architecture/verify-java-semantic-ownership.mjs ./scripts/agent-notes/verify-agent-notes.sh ``` -后续 PR 按受影响边界运行 `./scripts/architecture/verify-core.sh`、~~./scripts/architecture/verify-shared-contracts.sh~~(随旧客户端移除)、~~./scripts/rust-core/verify-rust-core.sh~~(随旧客户端移除)、`./scripts/macos/verify/verify-runtime-bundle-immutability.sh`,修改后端协议时在 `lithe-plugin-docs` 运行 `node scripts/sdk-e2e.mjs`,合并后按[契约发布规则](../../implemented/architecture/2026-10-23-plugin-contract-publishing.md)同步契约副本。 +后续 PR 按受影响边界运行 `./scripts/architecture/verify-core.sh`、~~./scripts/rust-core/verify-rust-core.sh~~(随旧客户端移除)、`./scripts/macos/verify/verify-runtime-bundle-immutability.sh`。契约、指南和 SDK 的改动在 Core 仓库根运行 `node shared/plugins/scripts/verify-docs.mjs`;修改后端协议时在同一目录运行 `node shared/plugins/scripts/sdk-e2e.mjs`。契约、`capabilities.rs`、`plugin_function.rs` 的改动与协议更新记录、API 总表的登记在同一个 Core PR 里完成,规则见[契约单一来源规则](../../implemented/architecture/2026-11-11-plugin-contract-single-source-in-core.md)。 ## 适用范围 @@ -283,11 +283,12 @@ node scripts/architecture/verify-java-semantic-ownership.mjs - ~~`.github/workflows/verify-host-language-specifics.yml`~~(已随 #1794 移除) - Lithe-core-rust 锁定修订:[rust/lithe-core/src/plugins/](https://github.com/Lithe-IDEA/Lithe-core-rust/tree/0ffd327b4329261e393b08ed76fbd134b4dd17e9/rust/lithe-core/src/plugins) - Lithe-core-rust 锁定修订:[rust/lithe-core/src/lsp/interface/plugin_function.rs](https://github.com/Lithe-IDEA/Lithe-core-rust/blob/0ffd327b4329261e393b08ed76fbd134b4dd17e9/rust/lithe-core/src/lsp/interface/plugin_function.rs) -- `shared/contracts/plugins/v1/` +- `https://github.com/Lithe-IDEA/Lithe-core-rust/blob/main/shared/plugins/contract/v1/` - ~~`macos/Sources/`~~(已随 #1794 移除) - ~~`frontend/editor/src/`~~(已随 #1794 移除) - ~~`windows/tauri/src/`~~(已随 #1794 移除) - ~~`windows/tauri/src-tauri/src/`~~(已随 #1794 移除) - `docs/development/macos-plugin-api-plan.md` -- 外部仓库:[lithe-plugin-docs](https://github.com/Lithe-IDEA/lithe-plugin-docs)、[lithe-plugin-java](https://github.com/Lithe-IDEA/lithe-plugin-java)、[lithe-plugin-maven](https://github.com/Lithe-IDEA/lithe-plugin-maven)、[lithe-plugin-gradle](https://github.com/Lithe-IDEA/lithe-plugin-gradle) -- 关联决策:[Maven/Java 领域插件迁移](2026-10-26-maven-java-domain-plugin-migration.md)、[插件依赖与导出](2026-10-25-plugin-dependencies-and-exports.md)、[Java 独立分发](2026-10-24-java-support-independent-distribution.md)、[公共扩展契约](2026-10-13-public-extension-contract-and-provider-api.md)、[编辑器扩展 API](../../implemented/architecture/2026-10-31-plugin-editor-extension-apis.md)、[契约发布](../../implemented/architecture/2026-10-23-plugin-contract-publishing.md)、[真实配置读写](../../implemented/architecture/2026-10-25-settings-native-configuration-editing.md)、[共享契约](../../../../shared/contracts/plugins/v1/README.md) +- `https://github.com/Lithe-IDEA/Lithe-core-rust/tree/main/shared/plugins/sdk` +- 外部仓库:[lithe-plugin-java](https://github.com/Lithe-IDEA/lithe-plugin-java)、[lithe-plugin-maven](https://github.com/Lithe-IDEA/lithe-plugin-maven)、[lithe-plugin-gradle](https://github.com/Lithe-IDEA/lithe-plugin-gradle) +- 关联决策:[Maven/Java 领域插件迁移](2026-10-26-maven-java-domain-plugin-migration.md)、[插件依赖与导出](2026-10-25-plugin-dependencies-and-exports.md)、[Java 独立分发](2026-10-24-java-support-independent-distribution.md)、[公共扩展契约](2026-10-13-public-extension-contract-and-provider-api.md)、[编辑器扩展 API](../../implemented/architecture/2026-10-31-plugin-editor-extension-apis.md)、[契约发布](../../implemented/architecture/2026-11-11-plugin-contract-single-source-in-core.md)、[真实配置读写](../../implemented/architecture/2026-10-25-settings-native-configuration-editing.md)、[共享契约](https://github.com/Lithe-IDEA/Lithe-core-rust/blob/main/shared/plugins/contract/v1/README.md) diff --git a/.agents/skills/create-lithe-plugin/SKILL.md b/.agents/skills/create-lithe-plugin/SKILL.md index 35e6d274d1..fc6d4ad649 100644 --- a/.agents/skills/create-lithe-plugin/SKILL.md +++ b/.agents/skills/create-lithe-plugin/SKILL.md @@ -17,11 +17,11 @@ description: 创建新的 Lithe 插件(社区插件仓库,或本仓库的官 | 默认 | 除非满足该条写明的例外条件,否则照做。采用例外时在交付说明中写明理由。 | | 可以 | 允许,但不要求。 | | 不适用 | 某一项的对象在这个插件里不存在。例如纯语法插件没有进程,就没有 SDK、上游程序、取消入口、高频操作和降级路径。标记不适用时,在交付说明中写明对象为什么不存在。对象存在的项不得标记不适用;对象存在但无法验证的项,列为未验证。 | -| 插件文档仓库 | [Lithe-IDEA/lithe-plugin-docs](https://github.com/Lithe-IDEA/lithe-plugin-docs):插件开发指南、教程和官方后端 SDK。 | -| 契约 | 本仓库 `shared/contracts/plugins/v1/`。插件文档仓库保存它的逐字节副本。 | +| 插件资料目录 | Rust Core 仓库的 [`shared/plugins/`](https://github.com/Lithe-IDEA/Lithe-core-rust/tree/main/shared/plugins):插件契约、开发指南、参考和官方后端 SDK 的唯一来源。 | +| 契约 | 插件资料目录下的 `contract/v1/`。 | | 插件进程 | 插件声明、由宿主启动的外部进程,例如语言服务器、插件后端、构建或 VCS 提供者、调试适配器。 | -路径除特别说明外都相对于本仓库根目录。 +路径除特别说明外都相对于本仓库根目录;写作“插件资料目录”的路径相对于 Core 仓库的 `shared/plugins/`。 ## 一、参考地址 @@ -29,17 +29,17 @@ description: 创建新的 Lithe 插件(社区插件仓库,或本仓库的官 | 内容 | 地址 | | --- | --- | -| 插件是什么、入门步骤、API 等级、示例插件、SDK 列表与获取方式 | 插件文档仓库 `README.md` | -| 语言服务器、构建、调试、后端等专题教程 | 插件文档仓库 `guides/` | -| SDK 用法,包括日志接口 | 插件文档仓库 `sdk/<语言>/README.md` | +| 插件是什么、入门步骤、API 等级、示例插件、SDK 列表与获取方式 | 插件资料目录 `README.md` | +| 语言服务器、构建、调试、后端等专题教程 | 插件资料目录 `guides/` | +| SDK 用法,包括日志接口 | 插件资料目录 `sdk/<语言>/README.md` | | 清单字段、权限、激活事件、启动模板、信任规则、插件日志协议 | 契约 `README.md` 及其引用的 fixture | -| 日志级别语义、通道、目录事件 | `shared/logging/README.md`、`shared/logging/events/` | +| 日志级别语义、通道、目录事件 | Core 仓库 [`rust/logging/`](https://github.com/Lithe-IDEA/Lithe-core-rust/tree/main/rust/logging) | | 宿主侧日志接入(修改 Core 或宿主时) | `.agents/skills/develop-lithe/references/logging.md` | | 插件能力边界、新增插件 API | `.agents/notes/implemented/architecture/2026-10-31-plugin-capability-and-domain-boundaries.md` | | 语言服务器的构建与资源归属 | `.agents/notes/implemented/architecture/2026-09-30-lsp-plugin-build-and-distribution.md` | | 本仓库官方插件的构建、开发包与发布 | `Plugins/mac/README.md` | | 社区插件进入插件市场 | [Lithe Store 发布指南](https://github.com/Lithe-IDEA/Lithe-store/blob/main/docs/publishing.md) | -| 契约变更后的两仓库同步 | `AGENTS.md` 的“插件契约的两仓库同步” | +| 契约变更的登记与验证 | `AGENTS.md` 的“插件契约只在 Rust Core” | 参考地址之间有冲突时,以契约为准,并告知用户哪份资料已经过时。 @@ -56,12 +56,12 @@ description: 创建新的 Lithe 插件(社区插件仓库,或本仓库的官 ## 三、流程 1. **确定归属。** 默认创建社区插件:独立仓库,使用自己的命名空间和社区插件的信任设置。只有用户明确要求时,才在本仓库创建官方插件,并按 `Plugins/mac/README.md` 处理。 -2. **确定形态。** 按插件文档仓库的 API 等级说明选最低等级。默认先用纯声明式实现,只有声明式无法表达时才增加后端。从插件文档仓库“示例插件”中最接近的一个开始。 -3. **编写清单。** 按契约编写,并按插件文档仓库的说明在编辑器中关联 Schema。用户可调整的选项通过插件设置声明;难以理解的设置必须写说明,宿主会显示为 ⓘ。插件界面默认使用宿主渲染的原生内容,只有原生内容无法表达时才使用网页内容。 +2. **确定形态。** 按插件资料目录的 API 等级说明选最低等级。默认先用纯声明式实现,只有声明式无法表达时才增加后端。从插件资料目录“示例插件”中最接近的一个开始。 +3. **编写清单。** 按契约编写,并按插件资料目录的说明在编辑器中关联 Schema。用户可调整的选项通过插件设置声明;难以理解的设置必须写说明,宿主会显示为 ⓘ。插件界面默认使用宿主渲染的原生内容,只有原生内容无法表达时才使用网页内容。 4. **准备构建期资源。** 构建脚本负责获取、校验和组装插件包,每个外部输入都在锁文件中记录来源和哈希。上游许可证不允许随包分发时,改为使用用户已安装的程序。在本仓库新增下载、解压、生成或缓存资源时,按 `AGENTS.md` 的“工作树资源复用与文档维护”同步更新。 5. **编写后端。** 默认使用官方 SDK 的当前版本,SDK 负责协议、取消、进程清理、错误处理和日志协商。所用语言没有官方 SDK 时,可以按契约自行实现协议,但必须用契约 fixture 测试全部用例。 6. **完成日志接线。** 按第四节。 -7. **安装试用。** 社区插件按插件文档仓库的入门步骤从磁盘安装,发布前再从自己的插件仓库走一遍用户的真实安装流程;官方插件按 `Plugins/mac/README.md` 构建开发包。 +7. **安装试用。** 社区插件按插件资料目录的入门步骤从磁盘安装,发布前再从自己的插件仓库走一遍用户的真实安装流程;官方插件按 `Plugins/mac/README.md` 构建开发包。 8. **验证。** 按第五节。 9. **发布。** 社区插件按 Lithe Store 发布指南;官方插件按 `Plugins/mac/README.md`。依赖尚未随稳定版宿主发布的能力时,只能发预发布版本,不进入插件市场。已发布版本的包不得修改,任何改动都发新版本。 diff --git a/.agents/skills/develop-lithe/SKILL.md b/.agents/skills/develop-lithe/SKILL.md index 51bb2aedff..e854a4c76e 100644 --- a/.agents/skills/develop-lithe/SKILL.md +++ b/.agents/skills/develop-lithe/SKILL.md @@ -323,7 +323,7 @@ Viva 在 macOS、Windows 和 Linux 使用 `desktop/internal/i18n/` 的接口及 - 实现内部用 `//` 解释不明显的兼容性、确定性、顺序、安全、性能或跨平台约束。 - 测试名和断言不足以说明意图时,补充场景、回归风险或保护的边界。 - 不得为凑覆盖率复述赋值、声明或名称,也不得给简单访问器和直接的控制流机械地加注释。 -- 迁移前的 `scripts/rust-core/verify-rust-core-comments.sh` 未随 Core 移仓保留。Core 改动需要先恢复或提供等价的注释检查,再运行较慢的 Core 检查;不能把缺失脚本视为已通过。检查覆盖模块说明、导出项 Rustdoc、英文注释和 `unsafe` 安全说明,内部类型的语义仍须人工检查。 +- 注释检查脚本在 Rust Core 仓库:Core 改动先在 Core 仓库根运行 `scripts/rust-core/verify-rust-core-comments.sh`,通过后再运行较慢的 Core 检查。检查覆盖模块说明、导出项 Rustdoc、英文注释和 `unsafe` 安全说明,内部类型的语义仍须人工检查。 ### Windows 平台适配 diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index 9175277817..c533e3c3c4 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -107,7 +107,7 @@ Lithe 的目标是 macOS 与 Windows 能力对齐。必须选下面一项: - [ ] 长期决策、取舍和约束写在 `.agents/notes/`(中文),`docs/` 只保留操作说明、正式 schema、发布说明和验收材料;改了 Note 已运行 `./scripts/agent-notes/verify-agent-notes.sh` - [ ] 规则只在真源(Skill、Note)里写一份,入口文件只留指针,没有复制出会漂移的第二份 - [ ] 文中的路径、命令、链接已核对真实存在 -- [ ] 改了 `shared/contracts/plugins/v1/` 的,已完成下方“插件与共享契约”一组 +- [ ] 涉及插件契约或宿主方法的,已完成下方“插件契约”一组 ## 类型专属:release @@ -185,17 +185,16 @@ Windows 目前仍使用 v1 日志,Windows 改动沿用现有写法,并在此 - [ ] 非敏感的工具配置读取并回显工具的真实来源,用户确认后才写回并回读;打开页面不写文件;敏感字段不明文回显 - [ ] 新增或移动 macOS 设置页的,归属已按设置页分类 Note 确定 -### 插件与共享契约 / Plugin and shared contracts +### 插件契约 / Plugin contract -- [ ] 契约、Core 和所有消费者同一个 PR 里一起改;方法的参数、返回值、错误码、权限、生命周期和平台限制写进契约 README,指向契约目录以外的链接是绝对 URL -- [ ] 修改插件后端协议的,合并前已在 lithe-plugin-docs 运行 `node scripts/sdk-e2e.mjs --source <本仓库路径> --ref <分支>`,三个 SDK 示例后端仍能跑通 -- [ ] 合并后会在 lithe-plugin-docs 运行 `node scripts/contract.mjs sync --revision <合并后的 preview commit>`,并在插件协议更新记录登记(合入日期、PR、修改人、协议或 API) +- [ ] 契约改动已在 Rust Core PR 里随执行它的代码一起提交,同一个 Core PR 已登记插件协议更新记录(合入日期、PR、修改人、协议或 API);链接: +- [ ] `scripts/desktop/build-desktop-core.sh` 的 `PINNED_CORE_REVISION` 已升到包含该契约的 Core commit,桌面端测试经 `scripts/desktop/desktop-go.sh` 读到的就是这份契约 +- [ ] 修改插件后端协议的,已在 Core 仓库运行 `node shared/plugins/scripts/sdk-e2e.mjs`,三个 SDK 示例后端仍能跑通 - [ ] 新增或修改宿主方法、宿主通知的,已在下表逐个列出,原计划编号只用 API-01 到 API-44,不属于任何编号的写 — | 原计划编号 | 方法 | 用途 | diff --git a/AGENTS.md b/AGENTS.md index b6274d4525..1bdd04f5e8 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -129,44 +129,38 @@ Viva 由 `desktop/go.mod` 的 `replace` 固定到 [Lithe-IDEA/viva](https://gith [LSP 插件构建与语言服务器资源归属](.agents/notes/implemented/architecture/2026-09-30-lsp-plugin-build-and-distribution.md)。 所有 LSP 插件都必须在构建阶段固定来源并校验语言服务器,把完整资源放入插件包后签名;运行时只能从已安装插件发现入口,不能把下载物、解压物或插件状态写入 app bundle、安装目录或跨工作树共享缓存。 -## 插件契约的两仓库同步 - -插件契约在本仓库的 `shared/contracts/plugins/v1/` 定义,和执行它的 Rust Core 一起修改。 -公开仓库 [Lithe-IDEA/lithe-plugin-docs](https://github.com/Lithe-IDEA/lithe-plugin-docs) -的 `contract/v1/` 保存这个目录的逐字节副本,连同开发指南、教程和三个官方插件后端 SDK(Node、Java、Rust)的 -源码、发版和端到端测试。插件开发者只看 lithe-plugin-docs 就能开发,不需要克隆本仓库,所以两个仓库的契约 -必须保持一致: - -- 修改 `shared/contracts/plugins/v1/` 下任何文件(README、schema、fixture)的 PR 合并后,在 - lithe-plugin-docs 运行 `node scripts/contract.mjs sync --revision <合并后的 preview commit>` - 并提交。不要在 lithe-plugin-docs 里直接改副本。 -- 新增或修改插件协议、能力版本或 API 功能的 PR(即改动 `shared/contracts/plugins/v1/`、 - `rust/lithe-core/src/plugins/capabilities.rs` 或 `rust/lithe-core/src/lsp/interface/plugin_function.rs` - 的 PR),合并后必须在 lithe-plugin-docs 的 - [插件协议更新记录](https://github.com/Lithe-IDEA/lithe-plugin-docs/blob/main/reference/protocol-changelog.md) - 登记:合入日期、PR、修改人(PR 作者)、改了哪个协议或 API;新版本号同时写进该页“按协议查首次出现”的表。 - 只改了后两个文件、契约目录没变时,同样要同步到合并后的 commit 并登记。登记和契约同步放在同一个 - lithe-plugin-docs PR 里,PR 描述中直接 `@` 每个被登记 PR 的作者,请他们核对自己那一行。具体步骤见该页的“维护”一节。 +## 插件契约只在 Rust Core + +插件契约、插件开发指南与参考、三个官方插件后端 SDK(Node、Java、Rust)和它们的端到端测试只有一份, +在 Rust Core 仓库 [Lithe-IDEA/Lithe-core-rust](https://github.com/Lithe-IDEA/Lithe-core-rust) 的 +[`shared/plugins/`](https://github.com/Lithe-IDEA/Lithe-core-rust/tree/main/shared/plugins),和执行契约的 +Core 代码在同一个仓库、同一个 PR 里修改。本仓库不保存契约、SDK 或插件开发文档的副本;插件开发者只看那个目录就能开发, +不需要克隆本仓库。 + +- 改契约(`shared/plugins/contract/v1/` 的 README、schema、fixture)、能力版本 + (`rust/lithe-core/src/plugins/capabilities.rs`)或插件函数协议 + (`rust/lithe-core/src/lsp/interface/plugin_function.rs`)的 Core PR,在同一个 PR 里更新 + [插件协议更新记录](https://github.com/Lithe-IDEA/Lithe-core-rust/blob/main/shared/plugins/reference/protocol-changelog.md): + 合入日期、PR、修改人(PR 作者)、改了哪个协议或 API;新版本号同时写进该页“按协议查首次出现”的表。 - 新增或修改宿主方法、宿主通知的 PR,即使只是给已有 API 加一个子方法,也要在 PR 描述里附一张 “原计划编号 | 方法 | 用途”表,每个方法占一行,格式参照 [#1653](https://github.com/1lck/Lithe-IDEA/pull/1653) 的描述。原计划编号只用 [API 实施计划](docs/development/macos-plugin-api-plan.md)里的 API-01–44,不得自编新号; - 不属于任何编号的方法写 —。合并后登记时,每个方法在 lithe-plugin-docs 两处各加一行: - [API 总表](https://github.com/Lithe-IDEA/lithe-plugin-docs/blob/main/reference/api-catalog.md)的中英两张方法表 + 不属于任何编号的方法写 —。同一个 Core PR 里,每个方法在两处各加一行: + [API 总表](https://github.com/Lithe-IDEA/Lithe-core-rust/blob/main/shared/plugins/reference/api-catalog.md)的中英两张方法表 (API、方法、用途、权限、协议),以及更新记录的“宿主方法(按 API 编号)”索引(API、方法、协议、日期、PR)。 - 这个 PR 在时间线上的“API 编号”列也要填上。同一个 API 的方法分几个 PR 加入时,每个方法记自己的 PR。 -- 插件开发者只读 lithe-plugin-docs 就必须能开发对应插件。方法的参数、返回值、错误码、权限、生命周期和平台限制, - 要写进契约 README,再经同步进入 lithe-plugin-docs 的 `contract/v1/`;面向开发者的用法说明写进 - lithe-plugin-docs 的功能页。只写在实施计划、Agent Note、契约草案或宿主代码里的行为,不算已公开。 -- 契约 README 里指向该目录以外的链接必须写成绝对 URL;`scripts/architecture/verify-shared-contracts.sh` - 会拒绝离开该目录的相对链接。 -- 面向插件开发者的新说明写进 lithe-plugin-docs,不写进本仓库或 Lithe Store。 -- 本仓库不保存 SDK。修改插件后端协议(例如 `rust/lithe-core/src/lsp/interface/plugin_function.rs`)时, - 合并前在 lithe-plugin-docs 运行 `node scripts/sdk-e2e.mjs --source <本仓库路径> --ref <分支>`,确认三个 - SDK 的示例后端仍能跑通。 - -决策原因、同步工具和被否方案见 -[插件契约、SDK 与开发者资料的发布](.agents/notes/implemented/architecture/2026-10-23-plugin-contract-publishing.md)。 + 同一个 API 的方法分几个 PR 加入时,每个方法记自己的 PR。 +- 方法的参数、返回值、错误码、权限、生命周期和平台限制写进契约 README;面向开发者的用法写进 + `shared/plugins/guides/` 或 `shared/plugins/reference/` 的对应页。只写在实施计划、Agent Note 或宿主代码里的行为,不算已公开。 + 面向插件开发者的新说明不写进本仓库或 Lithe Store。 +- Core 仓库根运行 `node shared/plugins/scripts/verify-docs.mjs`,检查每份 schema 的 `$id` 和文档相对链接; + 改插件后端协议时运行 `node shared/plugins/scripts/sdk-e2e.mjs`,确认三个 SDK 的示例后端对当前 Core 仍能跑通。 +- 本仓库的桌面端测试通过 `desktop/internal/contractfixture` 读取正在链接的 Core 检出里的契约 fixture, + 路径由 `scripts/desktop/desktop-go.sh` 导出的 `LITHE_PLUGIN_CONTRACT_DIR` 给出。不要把 fixture 复制回本仓库; + 改了契约后,把 `scripts/desktop/build-desktop-core.sh` 的 `PINNED_CORE_REVISION` 升到包含该改动的 Core commit。 + +决策原因和被否方案见 +[插件契约与开发资料只在 Rust Core](.agents/notes/implemented/architecture/2026-11-11-plugin-contract-single-source-in-core.md)。 ## 跨平台功能同步 diff --git a/README.md b/README.md index 97ceca3bca..dc3c7cc370 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ Product tour · Download · Plugin marketplace · - Plugin development · + Plugin development · Decision board · Develop Lithe

@@ -250,11 +250,12 @@ Before submitting a change, run: ./scripts/architecture/verify-core.sh ./scripts/git-graph/verify-git-graph.sh ./scripts/architecture/verify-service-boundaries.sh -./scripts/architecture/verify-shared-contracts.sh ./scripts/windows/verify/verify-windows-boundaries.sh ./scripts/rust-core/verify-rust-core.sh ``` +The plugin contract, guides, and official SDKs live in the Rust Core repository under [`shared/plugins/`](https://github.com/Lithe-IDEA/Lithe-core-rust/tree/main/shared/plugins). For changes there, run `node shared/plugins/scripts/verify-docs.mjs` (and `node shared/plugins/scripts/sdk-e2e.mjs` for backend protocol changes) from the root of that repository. + `scripts/macos/perf/test-git-performance-baseline.sh` runs deterministic Git graph work gates and records an optimized multi-sample timing baseline under `.artifacts/`. diff --git a/README.zh-CN.md b/README.zh-CN.md index 01cbcd806a..97fc58ff42 100644 --- a/README.zh-CN.md +++ b/README.zh-CN.md @@ -11,7 +11,7 @@ 产品截图 · 下载 · 插件市场 · - 插件开发 · + 插件开发 · 工程决策看板 · 如何开发

@@ -249,11 +249,12 @@ open dist/Lithe.app ./scripts/architecture/verify-core.sh ./scripts/git-graph/verify-git-graph.sh ./scripts/architecture/verify-service-boundaries.sh -./scripts/architecture/verify-shared-contracts.sh ./scripts/windows/verify/verify-windows-boundaries.sh ./scripts/rust-core/verify-rust-core.sh ``` +插件契约、开发指南和官方 SDK 在 Rust Core 仓库的 [`shared/plugins/`](https://github.com/Lithe-IDEA/Lithe-core-rust/tree/main/shared/plugins) 下。修改那里的内容时,在该仓库根目录运行 `node shared/plugins/scripts/verify-docs.mjs`;修改后端协议时再运行 `node shared/plugins/scripts/sdk-e2e.mjs`。 + 目录归属、跨平台边界、共享规则以及 Rust Core 必须遵守的注释规范见[仓库所有权与共享边界](./.agents/notes/implemented/architecture/2026-11-08-viva-repository-ownership-and-sharing-boundaries.md)。提交功能改动时,请说明验证方式和已知限制。 diff --git a/desktop/internal/buildprovider/buildprovider_test.go b/desktop/internal/buildprovider/buildprovider_test.go index 8d5e255466..b331c6f2ef 100644 --- a/desktop/internal/buildprovider/buildprovider_test.go +++ b/desktop/internal/buildprovider/buildprovider_test.go @@ -84,13 +84,13 @@ func TestBuildProviderHelper(t *testing.T) { case "initialize": reply(request.ID, map[string]any{ "capabilities": map[string]any{ - "experimental": map[string]any{"litheBuild": map[string]any{"version": 2}}, + "experimental": map[string]any{"litheBuild": map[string]any{"version": 0}}, }, }) case "lithe/build/model": reply(request.ID, map[string]any{ "format": "litheBuildModel", - "version": 1, + "version": 0, "projects": []any{map[string]any{"path": ".", "name": "fixture"}}, }) case "lithe/build/execute": @@ -147,12 +147,12 @@ func TestProviderModelTaskAndCancellation(t *testing.T) { t.Fatal(err) } manifest := json.RawMessage(fmt.Sprintf(`{ - "schemaVersion": 2, + "schemaVersion": 0, "id": "dev.lithe.fixture.build-provider-test", "displayName": "Build Provider Test", "version": "1.0.0", - "pluginAPIVersion": 3, - "requires": {"buildProviders": 2, "buildSystems": 1, "serverProcess": 1}, + "pluginAPIVersion": 0, + "requires": {"buildProviders": 0, "buildSystems": 0}, "vendor": {"id": "org.example", "displayName": "Example", "signatureRequirement": "publisherPackage"}, "permissions": ["languageServer.launch", "process.build"], "activationEvents": ["onBuildSystem:fixture"], diff --git a/desktop/internal/contractfixture/contractfixture.go b/desktop/internal/contractfixture/contractfixture.go new file mode 100644 index 0000000000..77675cf039 --- /dev/null +++ b/desktop/internal/contractfixture/contractfixture.go @@ -0,0 +1,24 @@ +// Package contractfixture locates the plugin contract that tests read. The contract has a single +// source, shared/plugins/contract/v1/ of the Lithe-core-rust checkout this client links, and this +// repository keeps no copy. scripts/desktop/desktop-go.sh exports LITHE_PLUGIN_CONTRACT_DIR for +// the same checkout it builds: the pinned clone, or LITHE_CORE_RUST_DIR when that is set. +package contractfixture + +import ( + "os" + "path/filepath" +) + +// EnvironmentVariable names the contract directory of the linked Lithe-core-rust checkout. +const EnvironmentVariable = "LITHE_PLUGIN_CONTRACT_DIR" + +// Path returns rel inside the contract directory, for example "fixtures/backend/backend.plugin.json". +// It panics when the variable is unset, because a test that silently read nothing would pass +// without checking the contract; run Go through scripts/desktop/desktop-go.sh instead. +func Path(rel string) string { + dir := os.Getenv(EnvironmentVariable) + if dir == "" { + panic(EnvironmentVariable + " is not set; run Go through scripts/desktop/desktop-go.sh") + } + return filepath.Join(dir, filepath.FromSlash(rel)) +} diff --git a/desktop/internal/core/build_test.go b/desktop/internal/core/build_test.go index d0dbd8d082..dbf93e8afb 100644 --- a/desktop/internal/core/build_test.go +++ b/desktop/internal/core/build_test.go @@ -5,12 +5,14 @@ import ( "os" "path/filepath" "testing" + + "github.com/1lck/Lithe-IDEA/desktop/internal/contractfixture" ) // readBuildFixture returns a shared build-provider manifest. func readBuildFixture(t *testing.T, name string) json.RawMessage { t.Helper() - body, err := os.ReadFile(filepath.Join("../../../shared/contracts/plugins/v1/fixtures/build-providers", name)) + body, err := os.ReadFile(filepath.Join(contractfixture.Path("fixtures/build-providers"), name)) if err != nil { t.Fatal(err) } @@ -80,7 +82,7 @@ func TestBuildDecodeModelKeepsTargetsAndModelTasks(t *testing.T) { manifest := readBuildFixture(t, "build-provider.plugin.json") result := json.RawMessage(`{ "format": "litheBuildModel", - "version": 1, + "version": 0, "projects": [{"path": ".", "name": "shop"}], "targets": [{"project": ".", "name": "app", "path": "app", "tags": ["application"]}], "tasks": [{"project": ".", "name": "bootRun", "template": "gradle-task", "execution": "service"}] @@ -111,7 +113,7 @@ func TestBuildDecodeRunKeepsValidatedExecutable(t *testing.T) { t.Fatal(err) } manifest := readBuildFixture(t, "build-provider-run-preparation.plugin.json") - raw, err := os.ReadFile("../../../shared/contracts/plugins/v1/fixtures/build-providers/build-run-preparation.json") + raw, err := os.ReadFile(contractfixture.Path("fixtures/build-providers/build-run-preparation.json")) if err != nil { t.Fatal(err) } diff --git a/desktop/internal/core/marketplace_test.go b/desktop/internal/core/marketplace_test.go index 57ee012489..0841894b55 100644 --- a/desktop/internal/core/marketplace_test.go +++ b/desktop/internal/core/marketplace_test.go @@ -2,6 +2,7 @@ package core import ( "encoding/json" + "github.com/1lck/Lithe-IDEA/desktop/internal/contractfixture" "os" "path/filepath" "testing" @@ -10,7 +11,7 @@ import ( // readMarketFixture uses the shared fixtures of the pinned Core contract. func readMarketFixture(t *testing.T, name string, value any) { t.Helper() - data, err := os.ReadFile(filepath.Join("..", "..", "..", "shared", "contracts", "plugins", "v1", "fixtures", name)) + data, err := os.ReadFile(contractfixture.Path("fixtures/" + name)) if err != nil { t.Fatal(err) } @@ -113,7 +114,8 @@ func TestMarketplaceReviewRejectsMissingHostCapabilities(t *testing.T) { } // The Store fixture is the public community index at Lithe-store revision -// 53676c51c756d8ead093053f0128735626ff64ec (Apache-2.0). +// 53676c51c756d8ead093053f0128735626ff64ec (Apache-2.0), written in contract +// v2 form: every level and capability version is 0. func TestMarketplaceValidatesCommunityStore(t *testing.T) { index, err := os.ReadFile(filepath.Join("testdata", "marketplace", "lithe-store-index.json")) if err != nil { diff --git a/desktop/internal/core/output_links_test.go b/desktop/internal/core/output_links_test.go index 60b43744a4..319586fa72 100644 --- a/desktop/internal/core/output_links_test.go +++ b/desktop/internal/core/output_links_test.go @@ -3,8 +3,8 @@ package core import ( "context" "encoding/json" + "github.com/1lck/Lithe-IDEA/desktop/internal/contractfixture" "os" - "path/filepath" "reflect" "testing" "time" @@ -12,7 +12,7 @@ import ( func readRunFixture(t *testing.T, name string) []byte { t.Helper() - data, err := os.ReadFile(filepath.Join("..", "..", "..", "shared", "contracts", "plugins", "v1", "fixtures", "run", name)) + data, err := os.ReadFile(contractfixture.Path("fixtures/run/" + name)) if err != nil { t.Fatal(err) } diff --git a/desktop/internal/core/plugin_session.go b/desktop/internal/core/plugin_session.go index 9b9d2540c8..5b8f5e865b 100644 --- a/desktop/internal/core/plugin_session.go +++ b/desktop/internal/core/plugin_session.go @@ -58,8 +58,9 @@ var EditorHost = EditorHostOptions{ ProviderTypes: []string{"definition", "hover", "completion", "semanticTokens", "documentLink"}, } -// EditorActionDecodeVersion is the decode version EditorHost is declared under. -const EditorActionDecodeVersion = 2 +// EditorActionDecodeVersion is the plugins.editorActions.decode request version EditorHost is +// validated under. +const EditorActionDecodeVersion = 0 // NativeDocumentPath asks Core to convert a native absolute path to a URI. type NativeDocumentPath struct { @@ -252,7 +253,7 @@ func (c *Client) PlanPluginLanguageServer(ctx context.Context, manifest json.Raw } // DecodePluginLanguageServerLaunch checks the answer of a backend-resolved launch -// function (serverProcess 3) and returns the plan the host starts. +// function and returns the plan the host starts. func (c *Client) DecodePluginLanguageServerLaunch(ctx context.Context, manifest json.RawMessage, languageID string, directories PluginBackendDirectories, answer json.RawMessage) (PluginBackendPlan, error) { const command = "plugins.languageServers.decodeLaunch" var result struct { diff --git a/desktop/internal/core/plugin_session_test.go b/desktop/internal/core/plugin_session_test.go index ee07fe6e41..db5bbc662c 100644 --- a/desktop/internal/core/plugin_session_test.go +++ b/desktop/internal/core/plugin_session_test.go @@ -15,6 +15,7 @@ import ( "testing" "time" + "github.com/1lck/Lithe-IDEA/desktop/internal/contractfixture" "github.com/1lck/Lithe-IDEA/desktop/internal/editor/textmate" ) @@ -30,7 +31,7 @@ func TestPluginArchitectureUsesContractNames(t *testing.T) { } func TestPluginBackendPlanUsesCoreManifestAndCapabilities(t *testing.T) { - manifest, err := os.ReadFile("../../../shared/contracts/plugins/v1/fixtures/backend/backend.plugin.json") + manifest, err := os.ReadFile(contractfixture.Path("fixtures/backend/backend.plugin.json")) if err != nil { t.Fatal(err) } @@ -40,7 +41,7 @@ func TestPluginBackendPlanUsesCoreManifestAndCapabilities(t *testing.T) { if !errors.As(err, &rejection) || rejection.Code != "plugin.api.unsupported" { t.Fatalf("missing capabilities were accepted: %v", err) } - validated, err := client.ValidatePluginManifest(ctx, manifest, map[string][]int{"backend": {1}, "serverProcess": {1}, "ui": {2}}) + validated, err := client.ValidatePluginManifest(ctx, manifest, map[string][]int{"backend": {0}, "ui": {0}}) if err != nil { t.Fatal(err) } @@ -58,16 +59,16 @@ func TestPluginBackendPlanUsesCoreManifestAndCapabilities(t *testing.T) { // The desktop editor consumes TextMate, so a pinned Core must validate the // matching contract and reject the withdrawn Monarch capability version. func TestPluginTextMateGrammarUsesPinnedCore(t *testing.T) { - manifest, err := os.ReadFile("../../../shared/contracts/plugins/v1/fixtures/languages/language-grammar.plugin.json") + manifest, err := os.ReadFile(contractfixture.Path("fixtures/languages/language-grammar.plugin.json")) if err != nil { t.Fatal(err) } - grammar, err := os.ReadFile("../../../shared/contracts/plugins/v1/fixtures/languages/grammars/http.tmLanguage.json") + grammar, err := os.ReadFile(contractfixture.Path("fixtures/languages/grammars/http.tmLanguage.json")) if err != nil { t.Fatal(err) } client, ctx := NewClient(), testContext(t) - validated, err := client.ValidatePluginManifest(ctx, manifest, map[string][]int{"languages": {3}}) + validated, err := client.ValidatePluginManifest(ctx, manifest, map[string][]int{"languages": {0}}) if err != nil { t.Fatal(err) } @@ -87,23 +88,12 @@ func TestPluginTextMateGrammarUsesPinnedCore(t *testing.T) { if !errors.As(err, &rejection) || rejection.Code != "plugin.grammar.invalid" { t.Fatalf("invalid grammar was not rejected: %v", err) } - var legacy map[string]any - if err := json.Unmarshal(manifest, &legacy); err != nil { + var configured map[string]any + if err := json.Unmarshal(manifest, &configured); err != nil { t.Fatal(err) } - legacy["requires"].(map[string]any)["languages"] = 2 - legacy["languages"].([]any)[0].(map[string]any)["grammar"].(map[string]any)["kind"] = "monarch" - legacyJSON, err := json.Marshal(legacy) - if err != nil { - t.Fatal(err) - } - _, err = client.ValidatePluginManifest(ctx, legacyJSON, map[string][]int{"languages": {2, 3}}) - if !errors.As(err, &rejection) || rejection.Code != "plugin.api.unsupported" { - t.Fatalf("withdrawn Monarch capability was not rejected: %v", err) - } - delete(legacy["languages"].([]any)[0].(map[string]any), "grammar") - legacy["requires"].(map[string]any)["languages"] = 3 - configOnly, err := json.Marshal(legacy) + delete(configured["languages"].([]any)[0].(map[string]any), "grammar") + configOnly, err := json.Marshal(configured) if err != nil { t.Fatal(err) } @@ -220,7 +210,7 @@ func TestPluginBackendHelper(t *testing.T) { var result any switch request.Method { case "initialize": - result = map[string]any{"capabilities": map[string]any{"experimental": map[string]any{"litheFunctions": map[string]any{"version": 2, "functions": []any{map[string]any{"id": "snapshot.refresh"}}}}}} + result = map[string]any{"capabilities": map[string]any{"experimental": map[string]any{"litheFunctions": map[string]any{"version": 0, "functions": []any{map[string]any{"id": "snapshot.refresh"}}}}}} case "lithe/function/invoke": var parameters struct { Params struct { @@ -256,7 +246,7 @@ func TestPluginBackendCoreSessionInvokesFunctionAndCleansUp(t *testing.T) { t.Fatal(err) } root := t.TempDir() - fixture, err := os.ReadFile("../../../shared/contracts/plugins/v1/fixtures/backend/backend.plugin.json") + fixture, err := os.ReadFile(contractfixture.Path("fixtures/backend/backend.plugin.json")) if err != nil { t.Fatal(err) } @@ -271,7 +261,7 @@ func TestPluginBackendCoreSessionInvokesFunctionAndCleansUp(t *testing.T) { if err != nil { t.Fatal(err) } - validated, err := client.ValidatePluginManifest(ctx, input, map[string][]int{"backend": {1}, "serverProcess": {1}, "ui": {2}}) + validated, err := client.ValidatePluginManifest(ctx, input, map[string][]int{"backend": {0}, "ui": {0}}) if err != nil { t.Fatal(err) } @@ -417,12 +407,12 @@ func TestPluginBackendCoreSessionInvokesFunctionAndCleansUp(t *testing.T) { // Verify accepted and rejected architecture spellings through the real Core planner. func TestPluginLaunchArchitectureAcceptsOnlyTheContractSpelling(t *testing.T) { - manifest, err := os.ReadFile("../../../shared/contracts/plugins/v1/fixtures/backend/backend.plugin.json") + manifest, err := os.ReadFile(contractfixture.Path("fixtures/backend/backend.plugin.json")) if err != nil { t.Fatal(err) } client, ctx := NewClient(), testContext(t) - validated, err := client.ValidatePluginManifest(ctx, manifest, map[string][]int{"backend": {1}, "serverProcess": {1}, "ui": {2}}) + validated, err := client.ValidatePluginManifest(ctx, manifest, map[string][]int{"backend": {0}, "ui": {0}}) if err != nil { t.Fatal(err) } diff --git a/desktop/internal/core/plugin_setting_actions_test.go b/desktop/internal/core/plugin_setting_actions_test.go index 91afb8277f..68d7597f21 100644 --- a/desktop/internal/core/plugin_setting_actions_test.go +++ b/desktop/internal/core/plugin_setting_actions_test.go @@ -8,6 +8,8 @@ import ( "reflect" "testing" "time" + + "github.com/1lck/Lithe-IDEA/desktop/internal/contractfixture" ) func TestPluginSettingActionPlansMatchSharedFixture(t *testing.T) { @@ -27,7 +29,7 @@ func TestPluginSettingActionPlansMatchSharedFixture(t *testing.T) { if err := json.Unmarshal(data, &fixture); err != nil { t.Fatal(err) } - manifest, err := os.ReadFile("../../../shared/contracts/plugins/v1/fixtures/settings/settings-v2.plugin.json") + manifest, err := os.ReadFile(contractfixture.Path("fixtures/settings/settings.plugin.json")) if err != nil { t.Fatal(err) } diff --git a/desktop/internal/core/plugin_settings_test.go b/desktop/internal/core/plugin_settings_test.go index 4f35e959b4..d38ada94d3 100644 --- a/desktop/internal/core/plugin_settings_test.go +++ b/desktop/internal/core/plugin_settings_test.go @@ -8,6 +8,8 @@ import ( "reflect" "testing" "time" + + "github.com/1lck/Lithe-IDEA/desktop/internal/contractfixture" ) func TestPluginSettingsDocumentSharedFixture(t *testing.T) { @@ -83,7 +85,7 @@ func TestPluginWorkspaceConfigurationUpdatesTheSameRealSession(t *testing.T) { ctx, cancel := context.WithTimeout(context.Background(), 8*time.Second) defer cancel() client := NewClient() - manifest, err := os.ReadFile("../../../shared/contracts/plugins/v1/fixtures/settings/settings-v2.plugin.json") + manifest, err := os.ReadFile(contractfixture.Path("fixtures/settings/settings.plugin.json")) if err != nil { t.Fatal(err) } @@ -100,7 +102,7 @@ func TestPluginWorkspaceConfigurationUpdatesTheSameRealSession(t *testing.T) { if err != nil { t.Fatal(err) } - started, err := client.StartPluginLanguageServer(ctx, PluginBackendStart{ProviderID: "settings-configuration-peer", PluginID: "dev.lithe.fixture.settings-v2", ExecutablePath: executable, Arguments: []string{"-test.run=^TestPluginBackendHelper$"}, Environment: map[string]string{"LITHE_TEST_PLUGIN_BACKEND": "1", "LITHE_TEST_PLUGIN_CONFIGURATION": "1"}, RootURI: uri, WorkingDirectory: root, WorkspaceConfiguration: initial, InitializeTimeoutMilliseconds: 3000, RequestTimeoutMilliseconds: 3000, ShutdownTimeoutMilliseconds: 2000}) + started, err := client.StartPluginLanguageServer(ctx, PluginBackendStart{ProviderID: "settings-configuration-peer", PluginID: "dev.lithe.fixture.settings", ExecutablePath: executable, Arguments: []string{"-test.run=^TestPluginBackendHelper$"}, Environment: map[string]string{"LITHE_TEST_PLUGIN_BACKEND": "1", "LITHE_TEST_PLUGIN_CONFIGURATION": "1"}, RootURI: uri, WorkingDirectory: root, WorkspaceConfiguration: initial, InitializeTimeoutMilliseconds: 3000, RequestTimeoutMilliseconds: 3000, ShutdownTimeoutMilliseconds: 2000}) if err != nil { t.Fatal(err) } diff --git a/desktop/internal/core/project_generators.go b/desktop/internal/core/project_generators.go index d61a904b6c..3ea55678d0 100644 --- a/desktop/internal/core/project_generators.go +++ b/desktop/internal/core/project_generators.go @@ -40,7 +40,6 @@ type ProjectGeneratorField struct { Presentation string `json:"presentation,omitempty"` Placeholder string `json:"placeholder,omitempty"` Optional bool `json:"optional,omitempty"` - Runtime string `json:"runtime,omitempty"` Tool string `json:"tool,omitempty"` MinimumVersion string `json:"minimumVersion,omitempty"` } @@ -110,12 +109,6 @@ type ProjectRejection struct { func (r *ProjectRejection) Error() string { return fmt.Sprintf("%s: %s", r.Code, r.Message) } -// ProjectRuntimeSelection is the installation the user chose for a version 1 runtime field. -type ProjectRuntimeSelection struct { - Home string `json:"home"` - Version string `json:"version"` -} - // ProjectToolInstallation is an installation the host found for a tool field. type ProjectToolInstallation struct { Home string `json:"home"` @@ -129,7 +122,6 @@ type ProjectGeneratorFormInput struct { ProjectName string `json:"projectName"` Values map[string]any `json:"values"` Edited []string `json:"edited"` - Runtimes map[string]ProjectRuntimeSelection `json:"runtimes"` Tools map[string][]ProjectToolInstallation `json:"tools"` } @@ -142,9 +134,6 @@ func (input ProjectGeneratorFormInput) normalized() ProjectGeneratorFormInput { edited := append([]string{}, input.Edited...) sort.Strings(edited) input.Edited = edited - if input.Runtimes == nil { - input.Runtimes = map[string]ProjectRuntimeSelection{} - } if input.Tools == nil { input.Tools = map[string][]ProjectToolInstallation{} } @@ -202,14 +191,6 @@ type ProjectPlanStep struct { Format string `json:"format,omitempty"` } -// ProjectPlanRuntime is a version 1 runtime field's selection. -type ProjectPlanRuntime struct { - Field string `json:"field"` - Runtime string `json:"runtime"` - Home string `json:"home"` - Version string `json:"version"` -} - // ProjectPlanToolPin is a tool selection the host saves as the project's pin. type ProjectPlanToolPin struct { Field string `json:"field"` @@ -224,7 +205,6 @@ type ProjectGenerationPlan struct { ProjectName string `json:"projectName"` Steps []ProjectPlanStep `json:"steps"` OpenFiles []string `json:"openFiles"` - Runtimes []ProjectPlanRuntime `json:"runtimes"` ToolPins []ProjectPlanToolPin `json:"toolPins"` UsesNetwork bool `json:"usesNetwork"` } diff --git a/desktop/internal/core/project_generators_test.go b/desktop/internal/core/project_generators_test.go index 1c732d4812..679c289e0c 100644 --- a/desktop/internal/core/project_generators_test.go +++ b/desktop/internal/core/project_generators_test.go @@ -9,9 +9,11 @@ import ( "reflect" "testing" "time" + + "github.com/1lck/Lithe-IDEA/desktop/internal/contractfixture" ) -const projectGeneratorFixtures = "../../../shared/contracts/plugins/v1/fixtures/project-generators" +var projectGeneratorFixtures = contractfixture.Path("fixtures/project-generators") func projectFixture(t *testing.T, name string) json.RawMessage { t.Helper() @@ -130,9 +132,6 @@ func normalizePlan(plan ProjectGenerationPlan) ProjectGenerationPlan { if len(plan.OpenFiles) == 0 { plan.OpenFiles = nil } - if len(plan.Runtimes) == 0 { - plan.Runtimes = nil - } if len(plan.ToolPins) == 0 { plan.ToolPins = nil } @@ -166,7 +165,7 @@ func TestProjectGeneratorCatalogListsSectionsInOrderWithProviders(t *testing.T) t.Fatal("usesNetwork does not follow the declared steps") } app := catalog.Generators[0] - if len(app.Generator.Fields) != 4 || app.Generator.Fields[1].Runtime != "java" || app.Generator.Fields[0].Presentation != "segmented" { + if len(app.Generator.Fields) != 4 || app.Generator.Fields[1].Tool != "java" || app.Generator.Fields[0].Presentation != "segmented" { t.Fatalf("fields = %+v", app.Generator.Fields) } if len(app.Requirements) != 2 || app.Requirements[0].LanguageID != "java" || len(app.Requirements[0].Providers) != 0 { diff --git a/desktop/internal/core/run_start_test.go b/desktop/internal/core/run_start_test.go index 52560fb3ba..bad28e2304 100644 --- a/desktop/internal/core/run_start_test.go +++ b/desktop/internal/core/run_start_test.go @@ -4,6 +4,7 @@ import ( "context" "encoding/json" "errors" + "github.com/1lck/Lithe-IDEA/desktop/internal/contractfixture" "os" "path/filepath" "reflect" @@ -107,7 +108,7 @@ func TestDecodeDebugBackendConfigurationFollowsTheContractFixture(t *testing.T) } `json:"error"` } `json:"cases"` } - path := filepath.Join("..", "..", "..", "shared", "contracts", "plugins", "v1", "fixtures", "debug-adapters") + path := contractfixture.Path("fixtures/debug-adapters") raw, err := os.ReadFile(filepath.Join(path, "debug-start.json")) if err != nil { t.Fatal(err) diff --git a/desktop/internal/core/test_test.go b/desktop/internal/core/test_test.go index 56b286aec3..e6ebbd8b7a 100644 --- a/desktop/internal/core/test_test.go +++ b/desktop/internal/core/test_test.go @@ -13,12 +13,12 @@ import ( // JUnit XML reports. Core validates it on every call, so this test exercises // the real planning and decoding paths rather than a host-side copy. const testsFixtureManifest = `{ - "schemaVersion": 2, + "schemaVersion": 0, "id": "dev.lithe.test.tests-fixture", "displayName": "Tests Fixture", "version": "0.1.0", - "pluginAPIVersion": 3, - "requires": {"buildSystems": 1}, + "pluginAPIVersion": 0, + "requires": {"buildSystems": 0}, "vendor": {"id": "org.example", "displayName": "Example", "signatureRequirement": "publisherPackage"}, "permissions": ["process.build"], "activationEvents": ["onBuildSystem:fixture-tests"], diff --git a/desktop/internal/core/testdata/marketplace/lithe-official-index.json b/desktop/internal/core/testdata/marketplace/lithe-official-index.json index eeb1ecbf10..a9c68b5bb8 100644 --- a/desktop/internal/core/testdata/marketplace/lithe-official-index.json +++ b/desktop/internal/core/testdata/marketplace/lithe-official-index.json @@ -1,4 +1,4 @@ { - "schemaVersion": 1, + "schemaVersion": 0, "plugins": [] } diff --git a/desktop/internal/core/testdata/marketplace/lithe-store-index.json b/desktop/internal/core/testdata/marketplace/lithe-store-index.json index 43fe2de7ec..845e0b88dd 100644 --- a/desktop/internal/core/testdata/marketplace/lithe-store-index.json +++ b/desktop/internal/core/testdata/marketplace/lithe-store-index.json @@ -1,5 +1,5 @@ { - "schemaVersion": 1, + "schemaVersion": 0, "plugins": [ { "id": "io.github.fxrayhughes.mise", @@ -11,23 +11,31 @@ "localizedDescriptions": { "zh-Hans": "预发布工具链提供方:告诉 Lithe mise 装了哪些 JDK、Node.js、Maven、Gradle、Go、Python 和 pnpm,以及项目的 mise.toml / .tool-versions 和全局 mise 配置要求哪个版本,无需手动添加路径。后端只以离线方式运行只读的 mise 命令(mise ls、mise bin-paths),不会安装或信任任何东西。需要支持 toolchainProviders 能力的 Lithe preview 开发版,以及 PATH 中可用的 mise,仅支持 macOS。" }, - "tags": ["tool", "toolchain", "mise", "java", "node"], + "tags": [ + "tool", + "toolchain", + "mise", + "java", + "node" + ], "license": "Apache-2.0", "icon": "https://raw.githubusercontent.com/FxRayHughes/lithe-plugin-mise/ced89b3dd0a5fe11f9d5e6da73dfaa3e65a350e9/io.github.fxrayhughes.mise/icons/mise.svg", "versions": [ { "version": "0.2.1", - "pluginAPIVersion": 3, + "pluginAPIVersion": 0, "requires": { - "backend": 2, - "serverProcess": 1, - "settings": 2, - "toolchainProviders": 1 + "backend": 0, + "settings": 0, + "toolchainProviders": 0 }, "releaseDate": "2026-11-02", "downloads": [ { - "platforms": ["darwin-arm64", "darwin-x64"], + "platforms": [ + "darwin-arm64", + "darwin-x64" + ], "downloadURL": "https://github.com/FxRayHughes/lithe-plugin-mise/releases/download/v0.2.1/mise-0.2.1-darwin.zip", "sha256": "635366955e73f64ef6a821e3af9bee043c8c1ac871e6a44ddc3d43aae4823755" } @@ -35,17 +43,19 @@ }, { "version": "0.2.0", - "pluginAPIVersion": 3, + "pluginAPIVersion": 0, "requires": { - "backend": 2, - "serverProcess": 1, - "settings": 2, - "toolchainProviders": 1 + "backend": 0, + "settings": 0, + "toolchainProviders": 0 }, "releaseDate": "2026-11-02", "downloads": [ { - "platforms": ["darwin-arm64", "darwin-x64"], + "platforms": [ + "darwin-arm64", + "darwin-x64" + ], "downloadURL": "https://github.com/FxRayHughes/lithe-plugin-mise/releases/download/v0.2.0/mise-0.2.0-darwin.zip", "sha256": "2b088c02aec5707b78e3da4de82ad45a8d22e8c8010a8a01afa26947b8561f82" } @@ -53,14 +63,17 @@ }, { "version": "0.1.0", - "pluginAPIVersion": 3, + "pluginAPIVersion": 0, "requires": { - "toolchainSources": 1 + "toolchainSources": 0 }, "releaseDate": "2026-10-29", "downloads": [ { - "platforms": ["darwin-arm64", "darwin-x64"], + "platforms": [ + "darwin-arm64", + "darwin-x64" + ], "downloadURL": "https://github.com/FxRayHughes/lithe-plugin-mise/releases/download/v0.1.0/mise-0.1.0-darwin.zip", "sha256": "e8020787ee45264159c0026717b694d6b64976a5afc951eba20e153128527a1e" } @@ -78,23 +91,30 @@ "localizedDescriptions": { "zh-Hans": "Cargo 构建预发布插件:原生 workspace/包编译、检查、测试、清理及 binary/example 运行,支持 Release、Features 和 Offline。0.1.1 新增 Cargo 可执行文件路径设置,需要 buildSystems 2/settings 2、Cargo 1.70+ 和 Node.js 20.3+;旧宿主保留兼容的 0.1.0。完整原生界面验收待完成,仅支持 macOS。" }, - "tags": ["build", "cargo", "rust", "testing"], + "tags": [ + "build", + "cargo", + "rust", + "testing" + ], "license": "Apache-2.0", "icon": "https://raw.githubusercontent.com/Lithe-IDEA/lithe-plugin-cargo/8fea6ad38995ce31d657da371420df6b8e8c0e7d/io.github.lithe-idea.cargo-build/icons/cargo.svg", "versions": [ { "version": "0.1.1", - "pluginAPIVersion": 3, + "pluginAPIVersion": 0, "requires": { - "buildProviders": 1, - "buildSystems": 2, - "serverProcess": 1, - "settings": 2 + "buildProviders": 0, + "buildSystems": 0, + "settings": 0 }, "releaseDate": "2026-10-22", "downloads": [ { - "platforms": ["darwin-arm64", "darwin-x64"], + "platforms": [ + "darwin-arm64", + "darwin-x64" + ], "downloadURL": "https://github.com/Lithe-IDEA/lithe-plugin-cargo/releases/download/v0.1.1/cargo-build-0.1.1-darwin.zip", "sha256": "cfcb293bc25aede904ca3d40d699ba22d84a0bcbac446f818aa0eec8549f2a4f" } @@ -102,16 +122,18 @@ }, { "version": "0.1.0", - "pluginAPIVersion": 3, + "pluginAPIVersion": 0, "requires": { - "buildProviders": 1, - "buildSystems": 1, - "serverProcess": 1 + "buildProviders": 0, + "buildSystems": 0 }, "releaseDate": "2026-10-22", "downloads": [ { - "platforms": ["darwin-arm64", "darwin-x64"], + "platforms": [ + "darwin-arm64", + "darwin-x64" + ], "downloadURL": "https://github.com/Lithe-IDEA/lithe-plugin-cargo/releases/download/v0.1.0/cargo-build-0.1.0-darwin.zip", "sha256": "a6148b3fe931e0b8d51f3a305592d4827ba5b452ec905f921560bb84a3f949a5" } @@ -129,22 +151,31 @@ "localizedDescriptions": { "zh-Hans": "数据库工具窗口:连接 MySQL、MariaDB、PostgreSQL、SQLite、SQL Server、MongoDB、Redis 和 Nacos,提供 SQL 控制台、表数据与结构编辑、CSV/JSON/SQL 导入导出、SQL 历史、只读与生产保护,以及 DBX 连接导入。取代 Lithe 以前内置的数据库模块,首次启动时自动迁入已保存的连接和密码。需要支持 backend 1 和网页桥接第 2 版的 Lithe preview;仅支持 macOS。" }, - "tags": ["tool", "database", "sql", "mysql", "postgresql", "redis"], + "tags": [ + "tool", + "database", + "sql", + "mysql", + "postgresql", + "redis" + ], "license": "Apache-2.0", "icon": "https://raw.githubusercontent.com/Lithe-IDEA/lithe-plugin-database/bf531b5a40495c404d857aab5fd6a55d3a116921/assets/database.svg", "versions": [ { "version": "0.1.1", - "pluginAPIVersion": 3, + "pluginAPIVersion": 0, "requires": { - "backend": 1, - "serverProcess": 1, - "ui": 2 + "backend": 0, + "ui": 0 }, "releaseDate": "2026-10-24", "downloads": [ { - "platforms": ["darwin-arm64", "darwin-x64"], + "platforms": [ + "darwin-arm64", + "darwin-x64" + ], "downloadURL": "https://github.com/Lithe-IDEA/lithe-plugin-database/releases/download/v0.1.1/database-0.1.1-darwin.zip", "sha256": "8882e0e2f5106286ea16e89f0c21e7d73de9765306966d63b4580e5286d33005" } @@ -152,16 +183,18 @@ }, { "version": "0.1.0", - "pluginAPIVersion": 3, + "pluginAPIVersion": 0, "requires": { - "backend": 1, - "serverProcess": 1, - "ui": 2 + "backend": 0, + "ui": 0 }, "releaseDate": "2026-10-24", "downloads": [ { - "platforms": ["darwin-arm64", "darwin-x64"], + "platforms": [ + "darwin-arm64", + "darwin-x64" + ], "downloadURL": "https://github.com/Lithe-IDEA/lithe-plugin-database/releases/download/v0.1.0/database-0.1.0-darwin.zip", "sha256": "295fd702dbf6839ca3745e74e17d43ae88ed2f8ecc7981817e658534e4fc03c6" } @@ -179,22 +212,31 @@ "localizedDescriptions": { "zh-Hans": "在工具窗口中管理本机 Docker 容器、镜像、卷和网络,支持容器原生终端、Compose 分组及配置路径、日志搜索与 JSON 高亮、可调采样间隔的 CPU/内存/网络/磁盘实时图,以及普通文件上传下载。需要支持 backend 2、Web UI 2、文件对话框和 browser.open 的 macOS Lithe 宿主。终端需要支持 API-24 的本机工作区、终端 PATH 中可用的 Docker CLI,以及容器内所选的 /bin/sh、/bin/bash 或 /bin/ash。容器文件浏览需要 /bin/sh 和 stat -c;单文件传输上限 256 MiB。原生终端、文件对话框与 Finder 拖入验收待完成,仅支持 macOS。" }, - "tags": ["tool", "docker", "containers", "compose", "logs", "monitoring"], + "tags": [ + "tool", + "docker", + "containers", + "compose", + "logs", + "monitoring" + ], "license": "Apache-2.0", "icon": "https://raw.githubusercontent.com/Lithe-IDEA/lithe-plugin-docker/fb0e6eed5be851e282eb4d38236554f615deab92/icons/docker.svg", "versions": [ { "version": "0.1.1", - "pluginAPIVersion": 3, + "pluginAPIVersion": 0, "requires": { - "backend": 2, - "serverProcess": 1, - "ui": 2 + "backend": 0, + "ui": 0 }, "releaseDate": "2026-11-02", "downloads": [ { - "platforms": ["darwin-arm64", "darwin-x64"], + "platforms": [ + "darwin-arm64", + "darwin-x64" + ], "downloadURL": "https://github.com/Lithe-IDEA/lithe-plugin-docker/releases/download/v0.1.1/docker-0.1.1-darwin.zip", "sha256": "736b9d49f5218caf3e8fd119fc46159b61659842dd2da48d27c73641a2b98c40" } @@ -202,16 +244,18 @@ }, { "version": "0.1.0", - "pluginAPIVersion": 3, + "pluginAPIVersion": 0, "requires": { - "backend": 2, - "serverProcess": 1, - "ui": 2 + "backend": 0, + "ui": 0 }, "releaseDate": "2026-11-02", "downloads": [ { - "platforms": ["darwin-arm64", "darwin-x64"], + "platforms": [ + "darwin-arm64", + "darwin-x64" + ], "downloadURL": "https://github.com/Lithe-IDEA/lithe-plugin-docker/releases/download/v0.1.0/docker-0.1.0-darwin.zip", "sha256": "ba56adf2caf4899b2c368a683da682a638e8539cfb574facd4b85cc54068d6c9" } @@ -229,21 +273,31 @@ "localizedDescriptions": { "zh-Hans": "使用你自己安装的 gopls 提供 Go 补全、跳转定义和错误提示,并支持运行 main 包和 go test(整个模块、单个文件所在的包或单个测试函数)。需要先安装 Go 和 gopls(go install golang.org/x/tools/gopls@latest)。" }, - "tags": ["language", "go"], + "tags": [ + "language", + "go" + ], "license": "Apache-2.0", "icon": "https://raw.githubusercontent.com/Lithe-IDEA/lithe-plugin-go/14321930779d1b441e1b7d13d2a4a741ef8f305c/io.github.lithe-idea.go-support/icons/go.svg", "versions": [ { "version": "0.1.0", - "pluginAPIVersion": 1, + "pluginAPIVersion": 0, "releaseDate": "2026-10-20", "downloads": [ { - "platforms": ["darwin-arm64", "darwin-x64"], + "platforms": [ + "darwin-arm64", + "darwin-x64" + ], "downloadURL": "https://github.com/Lithe-IDEA/lithe-plugin-go/releases/download/v0.1.0/go-support-0.1.0-darwin.zip", "sha256": "032ec66b0748fb8d68fa54063a6a735f7b4273e588eb8ecca9db42c1ed06e1df" } - ] + ], + "requires": { + "languages": 0, + "languageServers": 0 + } } ] }, @@ -257,20 +311,28 @@ "localizedDescriptions": { "zh-Hans": "预发布 Gradle 集成:项目与任务树、JavaExec 运行入口、筛选测试、编译诊断及依赖树。需要支持 API 3 buildSystems 和原生构建窗口的 Lithe preview 开发版、Gradle 7.6+ 及兼容的 Java;插件不附带 Gradle。" }, - "tags": ["build", "gradle", "java", "testing"], + "tags": [ + "build", + "gradle", + "java", + "testing" + ], "license": "Apache-2.0", "icon": "https://raw.githubusercontent.com/Lithe-IDEA/lithe-plugin-gradle/88a86cae73403d715d1385e447d8e4a9273e8f2f/io.github.lithe-idea.gradle-build/icons/gradle.svg", "versions": [ { "version": "0.1.1", - "pluginAPIVersion": 3, + "pluginAPIVersion": 0, "requires": { - "buildSystems": 1 + "buildSystems": 0 }, "releaseDate": "2026-10-18", "downloads": [ { - "platforms": ["darwin-arm64", "darwin-x64"], + "platforms": [ + "darwin-arm64", + "darwin-x64" + ], "downloadURL": "https://github.com/Lithe-IDEA/lithe-plugin-gradle/releases/download/v0.1.1/gradle-build-0.1.1-darwin.zip", "sha256": "6d0c49d4c95d9a03afff372d4cad40017a97120bd7b43d903b7dc2d8e82a841f" } @@ -278,14 +340,17 @@ }, { "version": "0.1.0", - "pluginAPIVersion": 3, + "pluginAPIVersion": 0, "requires": { - "buildSystems": 1 + "buildSystems": 0 }, "releaseDate": "2026-10-18", "downloads": [ { - "platforms": ["darwin-arm64", "darwin-x64"], + "platforms": [ + "darwin-arm64", + "darwin-x64" + ], "downloadURL": "https://github.com/Lithe-IDEA/lithe-plugin-gradle/releases/download/v0.1.0/gradle-build-0.1.0-darwin.zip", "sha256": "3c8ac1398b53df1dcb7ffd4a3e93308f39d6796f37f65b9692f4b9327c180215" } @@ -303,22 +368,28 @@ "localizedDescriptions": { "zh-Hans": "HTTP 请求工具预览版:支持打开请求文件、语法高亮、会话历史、可调整分栏、响应头阅读、原始响应保存和编辑区 HTML 预览。正文预览默认 128 KiB,可按 1 KiB 调整。仅支持 macOS;原生文件对话框和编辑区预览的完整验收仍待完成。" }, - "tags": ["http", "rest", "tool"], + "tags": [ + "http", + "rest", + "tool" + ], "license": "Apache-2.0", "icon": "https://raw.githubusercontent.com/Lithe-IDEA/lithe-plugin-http-client/e3cead6da09ecd07fa6964e66ca903219b374634/assets/http.svg", "versions": [ { "version": "0.1.2", - "pluginAPIVersion": 3, + "pluginAPIVersion": 0, "requires": { - "backend": 2, - "serverProcess": 1, - "ui": 2 + "backend": 0, + "ui": 0 }, "releaseDate": "2026-11-02", "downloads": [ { - "platforms": ["darwin-arm64", "darwin-x64"], + "platforms": [ + "darwin-arm64", + "darwin-x64" + ], "downloadURL": "https://github.com/Lithe-IDEA/lithe-plugin-http-client/releases/download/v0.1.2/http-client-0.1.2-darwin.zip", "sha256": "1a4aecbb8901c3243c213643fd2fc6e4e65655c170173eda005c8f0794e9ad9f" } @@ -326,16 +397,18 @@ }, { "version": "0.1.1", - "pluginAPIVersion": 3, + "pluginAPIVersion": 0, "requires": { - "backend": 1, - "serverProcess": 1, - "ui": 2 + "backend": 0, + "ui": 0 }, "releaseDate": "2026-11-02", "downloads": [ { - "platforms": ["darwin-arm64", "darwin-x64"], + "platforms": [ + "darwin-arm64", + "darwin-x64" + ], "downloadURL": "https://github.com/Lithe-IDEA/lithe-plugin-http-client/releases/download/v0.1.1/http-client-0.1.1-darwin.zip", "sha256": "7eab10168660a9dd49423916ed3303559fae53e1668f1f32fa61e6ad992cc24c" } @@ -343,16 +416,18 @@ }, { "version": "0.1.0", - "pluginAPIVersion": 3, + "pluginAPIVersion": 0, "requires": { - "backend": 1, - "serverProcess": 1, - "ui": 2 + "backend": 0, + "ui": 0 }, "releaseDate": "2026-11-02", "downloads": [ { - "platforms": ["darwin-arm64", "darwin-x64"], + "platforms": [ + "darwin-arm64", + "darwin-x64" + ], "downloadURL": "https://github.com/Lithe-IDEA/lithe-plugin-http-client/releases/download/v0.1.0/http-client-0.1.0-darwin.zip", "sha256": "699d04a4ddc69e46c27d79ac6063f214eef6af2ee81edf0b30db7595e9657b74" } @@ -370,22 +445,31 @@ "localizedDescriptions": { "zh-Hans": "预发布 LLDB 调试器:通过你电脑上的 lldb-dap 调试 C、C++、Objective-C、Swift 和 Rust,支持断点、单步、变量,以及带补全的 lldb 控制台。需要支持插件 API 4 的 Lithe preview 开发版,以及来自 Xcode 命令行工具或 LLVM 的 lldb-dap。" }, - "tags": ["tool", "debug", "lldb", "cpp", "rust", "swift"], + "tags": [ + "tool", + "debug", + "lldb", + "cpp", + "rust", + "swift" + ], "license": "Apache-2.0", "versions": [ { "version": "0.1.0", - "pluginAPIVersion": 4, + "pluginAPIVersion": 0, "requires": { - "debugAdapters": 1, - "languages": 1, - "serverProcess": 1, - "settings": 2 + "debugAdapters": 0, + "languages": 0, + "settings": 0 }, "releaseDate": "2026-10-26", "downloads": [ { - "platforms": ["darwin-arm64", "darwin-x64"], + "platforms": [ + "darwin-arm64", + "darwin-x64" + ], "downloadURL": "https://github.com/Lithe-IDEA/lithe-plugin-lldb/releases/download/v0.1.0/lldb-debug-0.1.0-darwin.zip", "sha256": "b550668dd9ea3e25098cf3fd32850a51f144865cc109c7164ee1b877e02fe69f" } @@ -404,67 +488,100 @@ "localizedDescriptions": { "zh-Hans": "内置 lua-language-server(LuaLS)提供 Lua 补全、跳转定义和错误提示,无需另外安装;“运行当前文件”使用你自己的 lua(brew install lua)。" }, - "tags": ["language", "lua"], + "tags": [ + "language", + "lua" + ], "license": "Apache-2.0", "icon": "https://raw.githubusercontent.com/Lithe-IDEA/lithe-plugin-lua/c5f88bf94e9d5616c7770e58febc53a0d520dd50/io.github.lithe-idea.lua-support/icons/lua.svg", "versions": [ { "version": "0.3.1", - "pluginAPIVersion": 2, + "pluginAPIVersion": 0, "releaseDate": "2026-11-04", "downloads": [ { - "platforms": ["darwin-arm64"], + "platforms": [ + "darwin-arm64" + ], "downloadURL": "https://github.com/Lithe-IDEA/lithe-plugin-lua/releases/download/v0.3.1/lua-support-0.3.1-darwin-arm64.zip", "sha256": "0b9b88f7e02f4190d8ee4d3d982003362f078c94cd4e6690d711b9fe77b12efa" }, { - "platforms": ["darwin-x64"], + "platforms": [ + "darwin-x64" + ], "downloadURL": "https://github.com/Lithe-IDEA/lithe-plugin-lua/releases/download/v0.3.1/lua-support-0.3.1-darwin-x64.zip", "sha256": "a44059ddfa414960c8f05cea9ad25082fafef3298ea0626160b2c25d92a8791b" } - ] + ], + "requires": { + "languages": 0, + "languageServers": 0 + } }, { "version": "0.3.0", - "pluginAPIVersion": 1, + "pluginAPIVersion": 0, "releaseDate": "2026-10-12", "downloads": [ { - "platforms": ["darwin-arm64"], + "platforms": [ + "darwin-arm64" + ], "downloadURL": "https://github.com/Lithe-IDEA/lithe-plugin-lua/releases/download/v0.3.0/lua-support-0.3.0-darwin-arm64.zip", "sha256": "8a01d3ca34bd43217525f0c0304501187ecebb5360a278df1189af7698099924" }, { - "platforms": ["darwin-x64"], + "platforms": [ + "darwin-x64" + ], "downloadURL": "https://github.com/Lithe-IDEA/lithe-plugin-lua/releases/download/v0.3.0/lua-support-0.3.0-darwin-x64.zip", "sha256": "35e6c1c9b80b73770cafd04660070d3b856e690304b5de817fbe59c4d6507ccf" } - ] + ], + "requires": { + "languages": 0, + "languageServers": 0 + } }, { "version": "0.2.0", - "pluginAPIVersion": 1, + "pluginAPIVersion": 0, "releaseDate": "2026-10-12", "downloads": [ { - "platforms": ["darwin-arm64", "darwin-x64"], + "platforms": [ + "darwin-arm64", + "darwin-x64" + ], "downloadURL": "https://github.com/Lithe-IDEA/lithe-plugin-lua/releases/download/v0.2.0/lua-support-0.2.0-darwin.zip", "sha256": "9d9def8e72e225d9c76121d16641ad87f5b02a220178a06f8cf06dd895d15a14" } - ] + ], + "requires": { + "languages": 0, + "languageServers": 0 + } }, { "version": "0.1.0", - "pluginAPIVersion": 1, + "pluginAPIVersion": 0, "releaseDate": "2026-10-12", "downloads": [ { - "platforms": ["darwin-arm64", "darwin-x64"], + "platforms": [ + "darwin-arm64", + "darwin-x64" + ], "downloadURL": "https://github.com/Lithe-IDEA/lithe-plugin-lua/releases/download/v0.1.0/lua-support-0.1.0-darwin.zip", "sha256": "7e496eca6f265f2bca13b1c445d30d801fb1aec1d443cc78894b7760ada18dc0" } - ] + ], + "requires": { + "languages": 0, + "languageServers": 0 + } } ] }, @@ -478,22 +595,29 @@ "localizedDescriptions": { "zh-Hans": "预发布 Maven 集成:反应堆与目标树、Profiles、带 JUnit 报告的筛选测试、编译诊断及依赖树。附带只读 Maven 核心扩展;需要支持 API 3 buildSystems 和原生构建窗口的 Lithe preview 开发版、Maven 3.6.3+ 与 Java 8+。" }, - "tags": ["build", "maven", "java", "testing"], + "tags": [ + "build", + "maven", + "java", + "testing" + ], "license": "Apache-2.0", "icon": "https://raw.githubusercontent.com/Lithe-IDEA/lithe-plugin-maven/177ee4e9b12b9fe06a07498eb316539f7472d5d8/io.github.lithe-idea.maven-build/icons/maven.svg", "versions": [ { "version": "0.1.1", - "pluginAPIVersion": 3, + "pluginAPIVersion": 0, "requires": { - "buildProviders": 1, - "buildSystems": 1, - "serverProcess": 1 + "buildProviders": 0, + "buildSystems": 0 }, "releaseDate": "2026-10-20", "downloads": [ { - "platforms": ["darwin-arm64", "darwin-x64"], + "platforms": [ + "darwin-arm64", + "darwin-x64" + ], "downloadURL": "https://github.com/Lithe-IDEA/lithe-plugin-maven/releases/download/v0.1.1/maven-build-0.1.1-darwin.zip", "sha256": "5887e3fc661e5c493170510a23f0e349e3d1d3cfb6f0d60960e29eea05cb41fd" } @@ -501,14 +625,17 @@ }, { "version": "0.1.0", - "pluginAPIVersion": 3, + "pluginAPIVersion": 0, "requires": { - "buildSystems": 1 + "buildSystems": 0 }, "releaseDate": "2026-10-18", "downloads": [ { - "platforms": ["darwin-arm64", "darwin-x64"], + "platforms": [ + "darwin-arm64", + "darwin-x64" + ], "downloadURL": "https://github.com/Lithe-IDEA/lithe-plugin-maven/releases/download/v0.1.0/maven-build-0.1.0-darwin.zip", "sha256": "4543ec130cc8c0ffc9a1c6c01b0436547b88a5273987c2c96d6ca110c1e6a655" } @@ -526,21 +653,31 @@ "localizedDescriptions": { "zh-Hans": "使用你自己安装的 Intelephense 提供 PHP 补全、跳转定义和错误提示,并支持运行 PHP 文件和 PHPUnit 测试。插件不内置 Intelephense(其许可证不允许再分发),请用 npm install -g intelephense 安装;需要 Node.js,运行和测试需要 php 与项目内的 PHPUnit。" }, - "tags": ["language", "php"], + "tags": [ + "language", + "php" + ], "license": "Apache-2.0", "icon": "https://raw.githubusercontent.com/Lithe-IDEA/lithe-plugin-php/a0b5600d2629e7acc72dda5871dbe403ce1922a9/io.github.lithe-idea.php-support/icons/php.svg", "versions": [ { "version": "0.1.0", - "pluginAPIVersion": 1, + "pluginAPIVersion": 0, "releaseDate": "2026-10-20", "downloads": [ { - "platforms": ["darwin-arm64", "darwin-x64"], + "platforms": [ + "darwin-arm64", + "darwin-x64" + ], "downloadURL": "https://github.com/Lithe-IDEA/lithe-plugin-php/releases/download/v0.1.0/php-support-0.1.0-darwin.zip", "sha256": "a9ae2654a7a24fb897ce73f3fbe6c7269a4f23686e4a7fecae3e7997eb6e2b2d" } - ] + ], + "requires": { + "languages": 0, + "languageServers": 0 + } } ] }, @@ -554,21 +691,27 @@ "localizedDescriptions": { "zh-Hans": "Subversion 预发布插件:在版本控制工具窗口查看 SVN 工作副本的变更,支持提交、更新、回滚、解决冲突、清理、历史、Annotate 和与基线比较;项目树移动通过 svn move 记录。需要支持 API 3 vcsProviders 1 与 serverProcess 1 的 Lithe preview 开发版、Subversion 1.8+ 和 Node.js 20.3+。完整原生界面验收待完成,仅支持 macOS。" }, - "tags": ["vcs", "svn", "subversion"], + "tags": [ + "vcs", + "svn", + "subversion" + ], "license": "Apache-2.0", "icon": "https://raw.githubusercontent.com/Lithe-IDEA/lithe-plugin-svn/717d23cd417f796d8487b3b7cbc8150a8356b512/assets/subversion.svg", "versions": [ { "version": "0.1.0", - "pluginAPIVersion": 3, + "pluginAPIVersion": 0, "requires": { - "serverProcess": 1, - "vcsProviders": 1 + "vcsProviders": 0 }, "releaseDate": "2026-10-24", "downloads": [ { - "platforms": ["darwin-arm64", "darwin-x64"], + "platforms": [ + "darwin-arm64", + "darwin-x64" + ], "downloadURL": "https://github.com/Lithe-IDEA/lithe-plugin-svn/releases/download/v0.1.0/svn-support-0.1.0-darwin.zip", "sha256": "23fb009cf9fc51f1093a77809f1865b52a781565bbde0c49a1ed890a3b0c46fc" } diff --git a/desktop/internal/i18n/shared.generated.go b/desktop/internal/i18n/shared.generated.go index 55c2ebc290..964a2f52dd 100644 --- a/desktop/internal/i18n/shared.generated.go +++ b/desktop/internal/i18n/shared.generated.go @@ -814,7 +814,6 @@ var sharedCatalogs = map[string]map[string]string{ "desktop.newProject.pinFailed": "The project was created, but the tool you selected could not be saved. You can choose it again in the toolchain settings.", "desktop.newProject.problem.invalidFormat": "The value has an invalid format.", "desktop.newProject.problem.required": "This field is required.", - "desktop.newProject.problem.runtimeTooOld": "The selected version is too old.", "desktop.newProject.problem.tooLong": "The value is too long.", "desktop.newProject.problem.toolTooOld": "The selected version is too old.", "desktop.newProject.problem.unsupportedValue": "This value is not supported.", @@ -2599,7 +2598,6 @@ var sharedCatalogs = map[string]map[string]string{ "desktop.newProject.pinFailed": "项目已创建,但无法保存你选择的工具。你可以稍后在工具链设置中重新选择。", "desktop.newProject.problem.invalidFormat": "格式无效。", "desktop.newProject.problem.required": "此项必填。", - "desktop.newProject.problem.runtimeTooOld": "所选版本过旧。", "desktop.newProject.problem.tooLong": "内容过长。", "desktop.newProject.problem.toolTooOld": "所选版本过旧。", "desktop.newProject.problem.unsupportedValue": "不支持此值。", diff --git a/desktop/internal/marketplace/service_test.go b/desktop/internal/marketplace/service_test.go index 4751657ecb..5153a86f2a 100644 --- a/desktop/internal/marketplace/service_test.go +++ b/desktop/internal/marketplace/service_test.go @@ -11,6 +11,7 @@ import ( "testing" "time" + "github.com/1lck/Lithe-IDEA/desktop/internal/contractfixture" "github.com/1lck/Lithe-IDEA/desktop/internal/core" ) @@ -19,7 +20,7 @@ type transportFunc func(*http.Request) (*http.Response, error) func (f transportFunc) RoundTrip(r *http.Request) (*http.Response, error) { return f(r) } func TestFetchValidatesIndexThroughCore(t *testing.T) { - index, err := os.ReadFile("../../../shared/contracts/plugins/v1/fixtures/marketplace/index.json") + index, err := os.ReadFile(contractfixture.Path("fixtures/marketplace/index.json")) if err != nil { t.Fatal(err) } @@ -82,7 +83,7 @@ func TestPublishedOfficialIndexExistsInRepository(t *testing.T) { } func TestFetchOfficialSourceKeepsOfficialNamespace(t *testing.T) { - index, err := os.ReadFile("../../../shared/contracts/plugins/v1/fixtures/marketplace/index.json") + index, err := os.ReadFile(contractfixture.Path("fixtures/marketplace/index.json")) if err != nil { t.Fatal(err) } @@ -158,7 +159,7 @@ func (failingCloseBody) Close() error { return errCloseBody } var errCloseBody = errors.New("injected close failure") func TestFetchReportsResponseCloseFailure(t *testing.T) { - index, err := os.ReadFile("../../../shared/contracts/plugins/v1/fixtures/marketplace/index.json") + index, err := os.ReadFile(contractfixture.Path("fixtures/marketplace/index.json")) if err != nil { t.Fatal(err) } diff --git a/desktop/internal/pluginbackend/pluginbackend.go b/desktop/internal/pluginbackend/pluginbackend.go index c44ab1a553..d256a65e44 100644 --- a/desktop/internal/pluginbackend/pluginbackend.go +++ b/desktop/internal/pluginbackend/pluginbackend.go @@ -114,7 +114,7 @@ type StartRequest struct { RootURI any WorkingDirectory string // Plan is an already decoded launch plan, such as the one Core returns for - // the answer of a backend-resolved language-server launch (serverProcess 3). + // the answer of a backend-resolved language-server launch. // When set the runner does not plan again; the plan is still verified // against the installed package exactly like a planned one. Plan *core.PluginBackendPlan diff --git a/desktop/internal/pluginhost/pluginhost.go b/desktop/internal/pluginhost/pluginhost.go index c81dbe11f7..95836dfede 100644 --- a/desktop/internal/pluginhost/pluginhost.go +++ b/desktop/internal/pluginhost/pluginhost.go @@ -52,106 +52,100 @@ type ManifestValidator interface { // the shape Core expects: capability name to the versions served. type Capabilities map[string][]int -// Declared is what this client can serve today. +// Declared is what this client can serve today, in plugin contract v1 terms. // -// A plugin language needs a grammar file and a few editor delimiters, and both are -// wired: the grammar is decoded by Core and registered with the editor, and the -// delimiters reach the language's comment and bracket rules. +// Every capability starts at version 0. A host declares a capability version +// when it accepts every manifest form of that version and speaks its protocol. +// Features a plugin offers may go unpresented: this client leaves such a part +// out of the surface (no button, menu or window) instead of failing when a user +// reaches for it, and the parts still missing are listed below so the table +// never hides them. Host services a plugin needs are discovered at runtime +// through getCapabilities and permissions, not through this table. // -// A language server is served at versions 1 and 3. This client resolves the -// launch Core plans (a packaged program, a packaged runtime, a bare command the -// host finds on PATH, or, for serverProcess 3, the command line the plugin backend -// answers), starts the process, keeps the session's documents in step with the -// editor, and draws the diagnostics it publishes. languageServers 3 plugin-owned -// sessions are wired: the backend's languageServer/request and notify reach the -// server under Core's session policy, and didReceiveNotification and -// didChangeState reach the backend. +// Starting plugin processes and resolving executables are base contract rules, +// not capabilities: every section that starts a process uses them. // -// A plugin backend (backend 1 and 2) is started on demand: when a workspace opens -// for a plugin that declares onWorkspaceOpen, when its language server needs a -// launch answer, or when another plugin calls it. It is answered the host -// services workspace/getFolders, listContexts and getContext (with -// didChangeContexts), subscriptions/dispose, the languageServer methods, the -// cross-plugin functions relay (pluginFunctions 1), credentials/get|set|delete -// (the platform secret store), documents/list and getSnapshot, -// editor/getActive, getSelections, open, reveal, insertText, replaceSelections -// and applyEdits, window/showInformation|showWarning|showError, -// browser/openExternal (http and https only), terminal/create|show|close|reopen| -// dispose|onExit, and documents/registerContentProvider. The window-bound ones -// are registered only when the window attaches (Service.AttachWorkbench), so a -// session without a window is never granted a method nobody can answer. -// getCapabilities lists only what is registered. Run, debug, workspace file and -// search services, editor/registerActions and registerProviders and -// preview/openHTML are not registered, so a plugin that needs one is refused when -// it asks for the permission's methods. +// Served: // -// Three things the contract can ask for are still missing: +// - languages: the grammar is decoded by Core and registered with the editor, +// and the delimiters reach the language's comment and bracket rules. +// - languageServers: this client resolves the launch Core +// plans (a packaged program, a packaged runtime, a bare command found on +// PATH, or the command line the plugin backend answers), starts the process, +// keeps the session's documents in step with the editor and draws the +// diagnostics it publishes. Plugin-owned sessions are wired: the backend's +// languageServer/request and notify reach the server under Core's session +// policy, and didReceiveNotification and didChangeState reach the backend. +// - backend and pluginFunctions: a backend starts on demand (onWorkspaceOpen, +// a launch answer, or a call from another plugin) and is answered the host +// services workspace/getFolders, listContexts and getContext (with +// didChangeContexts), subscriptions/dispose, the languageServer methods, the +// cross-plugin functions relay, credentials/get|set|delete, documents/list +// and getSnapshot, editor/getActive, getSelections, open, reveal, insertText, +// replaceSelections and applyEdits, window/showInformation|showWarning| +// showError, browser/openExternal (http and https only), terminal/create| +// show|close|reopen|dispose|onExit and documents/registerContentProvider. +// Window-bound methods are registered only when the window attaches +// (Service.AttachWorkbench); getCapabilities lists only what is registered. +// Run, debug, workspace file and search services, editor/registerActions +// and registerProviders and preview/openHTML are not registered, so a +// plugin that needs one is refused when it asks for that permission. +// - buildSystems and buildProviders: the Build window detects instances, +// loads provider models, resolves the ordered executable candidates Core +// returns, runs command and provider tasks and prepares application targets. +// Run sessions a backend starts (run/start, run/stop, run/didExit) are owned +// by the host. +// - toolDefinitions: settings discovery and Build/Run selection use the +// shared Core resolver. +// - projectGenerators: the New Project window lists generators, evaluates +// their forms through Core, discovers tools with the shared toolchain and +// runs the plan in a staging directory. +// - settings: pages per language and build system, sections, every control +// type, the project layer, setting effects and page buttons. +// - debugAdapters: stdio adapters and adapters inside the plugin's language +// server over loopback TCP, launch and attach (a remote host after the user +// confirms it), argument and environment bindings, features and defaults. +// - outputLinkMatchers: Build, Run and Test console lines become links at the +// ranges Core finds; a matcher with resolve asks the backend on click. +// - ui: text, web (window.lithe bridge) and native tree, list or form tool +// windows docked in the tool stripes. // -// - a language server launch answer of {kind: "tool"} (serverProcess 4) is -// refused at start, because the tool is not resolved through the toolchain -// registry yet; the plugin's packaged answer works. requiresTools is accepted. -// - only diagnostics are presented. Completion, hover, navigation, rename and -// formatting have no editor surface, so a server runs and reports problems but -// cannot yet answer a question about the code. -// - tool discovery for system commands reads PATH only. A plan that depends on a -// project toolchain or a user override is refused rather than started with -// whatever PATH holds. +// Not presented yet (the plugin installs, the part has no surface): // -// Run sessions a backend starts (run/start, run/stop, run/didExit) are served -// by the host: it owns the process, the console and the end of the run, and -// resolves the plugin's required tools or packaged executable. +// - a language server launch answer of {kind: "tool"} is refused at start, +// because the tool is not resolved through the toolchain registry yet. +// - only diagnostics are presented; completion, hover, navigation, rename and +// formatting have no editor surface. +// - tool discovery for system commands reads PATH only; a plan that depends +// on a project toolchain or a user override is refused. +// - build provider run preparation, tests, debug preparation, model inputs, +// native configuration, inline test reports and runtime debug; build system +// instance options and task preparations. +// - ui commands that belong to no tool window. // -// Build systems are served through both provider processes and command plans. -// The Build window detects instances, loads their model, resolves the ordered -// executable candidates Core returns, runs command and provider tasks, and -// prepares application targets. A shared provider attaches to the language -// server of the same plugin. Run preparation, tests and debug preparation are -// not served. Everything else a manifest can ask for — user -// interface contributions, project generators — is likewise not served, -// and claiming one would let a plugin install and then fail the first time a -// user reaches for it. +// buildModelInputs, executionProviders, keymapImportProviders, packageTrust, +// toolchainProviders and vcsProviders are not declared: nothing here serves +// them, so a plugin that needs one is not offered for installation. func Declared() Capabilities { - return Capabilities{ - "languages": {1, 3}, - "languageServers": {1, 3}, - "serverProcess": {1, 3, 4}, - "backend": {1, 2}, - "pluginFunctions": {1}, - // The Build tool window detects the declared build systems, loads - // provider models and runs command or provider tasks. Version 2 is - // provider task execution. Run preparation (4), tests, debug and - // toolchain resolution remain undeclared until their native surfaces - // are complete. - "buildSystems": {1}, - "buildProviders": {1, 2}, - // Tool definitions and strict executable resolution behind them are - // wired: settings discovery and Build/Run selection use the shared Core - // resolver. Provider queries are not, so toolchainProviders stays out - // rather than admitting a backend whose answers this client cannot read. - "executableResolution": {2}, - "toolDefinitions": {1}, - // The New Project window lists plugin generators, evaluates their forms - // through Core, discovers tool and runtime installations with the shared - // toolchain, and runs the plan (files, commands, archives) in a staging - // directory. Version 2 adds tool fields. - "projectGenerators": {1, 2}, - // Settings v2: pages per language and build system, sections, every - // control type, the project layer, setting effects and page buttons. - "settings": {1, 2}, - // Debug adapters run over stdio, or inside the plugin's language server - // over loopback TCP (tcpLanguageServer). Launch and attach (including a - // remote host and port after the user confirms it), argument and - // environment bindings, and the declared features and defaults reach the - // shared debug engine. - "debugAdapters": {1, 2, 3}, - // Console lines of Build, Run and Test output become links at the ranges - // Core finds; a matcher with resolve asks the plugin's backend on click. - "outputLinkMatchers": {1}, - // Plugin tool windows dock in the tool stripes: plain text (1), a - // page of the package behind the window.lithe bridge (2), or a - // host-rendered native tree, list or form (3) whose data Core checks. - "ui": {1, 2, 3}, + baseline := []string{ + "backend", + "buildProviders", + "buildSystems", + "debugAdapters", + "languageServers", + "languages", + "outputLinkMatchers", + "pluginFunctions", + "projectGenerators", + "settings", + "toolDefinitions", + "ui", } + declared := make(Capabilities, len(baseline)) + for _, name := range baseline { + declared[name] = []int{0} + } + return declared } // Clone returns a copy callers may modify without touching the original. diff --git a/desktop/internal/pluginhost/pluginhost_test.go b/desktop/internal/pluginhost/pluginhost_test.go index 151bc0f657..5da7a52de2 100644 --- a/desktop/internal/pluginhost/pluginhost_test.go +++ b/desktop/internal/pluginhost/pluginhost_test.go @@ -37,7 +37,7 @@ func TestValidatePassesCapabilitiesToCore(t *testing.T) { if !validator.called { t.Fatal("the validator was never called") } - if versions := validator.capabilities["backend"]; len(versions) != 2 || versions[0] != 1 || versions[1] != 2 { + if versions := validator.capabilities["backend"]; len(versions) != 1 || versions[0] != 0 { t.Fatalf("capabilities = %v", validator.capabilities) } } @@ -55,62 +55,29 @@ func TestValidateRefusesBrokenValidator(t *testing.T) { } } -func TestDeclaredServesLanguagesAndBaseLanguageServers(t *testing.T) { +func TestDeclaredServesTheBaselineOfEveryWiredCapability(t *testing.T) { declared := Declared() - if len(declared) != 14 { - t.Fatalf("declared = %v", declared) - } - // Plugin tool windows: text (1) and package pages (2); native trees (3) are not served. - if versions := declared["ui"]; len(versions) != 2 || versions[0] != 1 || versions[1] != 2 { - t.Fatalf("ui = %v", versions) + want := []string{ + "backend", "buildProviders", "buildSystems", "debugAdapters", + "languageServers", "languages", "outputLinkMatchers", "pluginFunctions", + "projectGenerators", "settings", "toolDefinitions", "ui", } - // The New Project window serves generators and, with version 2, tool fields. - if versions := declared["projectGenerators"]; len(versions) != 2 || versions[0] != 1 || versions[1] != 2 { - t.Fatalf("projectGenerators = %v", versions) + if len(declared) != len(want) { + t.Fatalf("declared = %v", declared) } - for name, want := range map[string][]int{"settings": {1, 2}, "debugAdapters": {1, 2, 3}, "outputLinkMatchers": {1}} { - if got := declared[name]; len(got) != len(want) || got[len(got)-1] != want[len(want)-1] { - t.Fatalf("%s = %v, want %v", name, got, want) + for _, name := range want { + if versions := declared[name]; len(versions) != 1 || versions[0] != 0 { + t.Fatalf("%s = %v, want [0]", name, versions) } } - // Tool definitions are resolved through the shared Core resolver for settings - // and for Build/Run selection. Provider queries are not wired, so - // toolchainProviders must stay absent. - if versions := declared["executableResolution"]; len(versions) != 1 || versions[0] != 2 { - t.Fatalf("executableResolution = %v", versions) - } - if versions := declared["toolDefinitions"]; len(versions) != 1 || versions[0] != 1 { - t.Fatalf("toolDefinitions = %v", versions) - } - if _, ok := declared["toolchainProviders"]; ok { - t.Fatal("toolchainProviders was declared without a provider query path") - } - if versions := declared["languages"]; len(versions) != 2 || versions[0] != 1 || versions[1] != 3 { - t.Fatalf("languages = %v", versions) - } - // Plugin-owned sessions (languageServers 3) forward the backend's requests, - // and a backend-resolved launch (serverProcess 3) is answered by the backend. - if versions := declared["languageServers"]; len(versions) != 2 || versions[0] != 1 || versions[1] != 3 { - t.Fatalf("languageServers = %v", versions) - } - if versions := declared["serverProcess"]; len(versions) != 3 || versions[1] != 3 || versions[2] != 4 { - t.Fatalf("serverProcess = %v", versions) - } - if versions := declared["backend"]; len(versions) != 2 || versions[1] != 2 { - t.Fatalf("backend = %v", versions) - } - if versions := declared["pluginFunctions"]; len(versions) != 1 || versions[0] != 1 { - t.Fatalf("pluginFunctions = %v", versions) - } - // A plugin that declares a provider cannot be installed until both the - // build system and provider capability are advertised. The provider version - // gates task execution (2) and application run preparation (4); tests and - // debug stay undeclared because their native surfaces do not exist yet. - if versions := declared["buildSystems"]; len(versions) != 1 || versions[0] != 1 { - t.Fatalf("buildSystems = %v", versions) - } - if versions := declared["buildProviders"]; len(versions) != 2 || versions[0] != 1 || versions[1] != 2 { - t.Fatalf("buildProviders = %v", versions) + // Capabilities nothing here serves stay absent so their plugins are not + // offered for installation. + for _, name := range []string{ + "buildModelInputs", "executionProviders", "keymapImportProviders", "packageTrust", "toolchainProviders", "vcsProviders", + } { + if _, ok := declared[name]; ok { + t.Fatalf("%s was declared", name) + } } } diff --git a/desktop/internal/pluginservice/backendlaunch.go b/desktop/internal/pluginservice/backendlaunch.go index b55017cd99..92f497cc07 100644 --- a/desktop/internal/pluginservice/backendlaunch.go +++ b/desktop/internal/pluginservice/backendlaunch.go @@ -19,7 +19,7 @@ type backendLaunch struct { } // resolveBackendLaunch runs the two steps of a backend-resolved language-server -// launch (serverProcess 3): Core plans the first step, the plugin backend answers +// launch: Core plans the first step, the plugin backend answers // the command line through its launch function, and Core checks the answer and // returns the plan the host starts like any other. // diff --git a/desktop/internal/pluginservice/backends.go b/desktop/internal/pluginservice/backends.go index 58cfb9fbe4..1adf160ef7 100644 --- a/desktop/internal/pluginservice/backends.go +++ b/desktop/internal/pluginservice/backends.go @@ -183,7 +183,7 @@ type languageServerDeclaration struct { } // declaresBackendLaunch reports whether the plugin's backend resolves the launch -// of the language server for languageID (serverProcess 3). +// of the language server for languageID. func declaresBackendLaunch(manifest json.RawMessage, languageID string) bool { var declaration languageServerDeclaration if json.Unmarshal(manifest, &declaration) != nil { diff --git a/desktop/internal/pluginservice/builds_test.go b/desktop/internal/pluginservice/builds_test.go index db536c159a..48c19c0cfe 100644 --- a/desktop/internal/pluginservice/builds_test.go +++ b/desktop/internal/pluginservice/builds_test.go @@ -8,6 +8,7 @@ import ( "path/filepath" "testing" + "github.com/1lck/Lithe-IDEA/desktop/internal/contractfixture" "github.com/1lck/Lithe-IDEA/desktop/internal/core" "github.com/1lck/Lithe-IDEA/desktop/internal/pluginhost" "github.com/1lck/Lithe-IDEA/desktop/internal/pluginmanager" @@ -19,12 +20,12 @@ func TestBuildProviderManifestNeedsTheBuildCapabilities(t *testing.T) { // the test about the build gate itself, not about the settings surface that // this client does not advertise yet. manifest := json.RawMessage(`{ - "schemaVersion": 2, + "schemaVersion": 0, "id": "dev.lithe.fixture.build-gate", "displayName": "Build Gate", "version": "1.0.0", - "pluginAPIVersion": 3, - "requires": {"buildProviders": 2, "buildSystems": 1, "serverProcess": 1}, + "pluginAPIVersion": 0, + "requires": {"buildProviders": 0, "buildSystems": 0}, "vendor": {"id": "org.example", "displayName": "Example", "signatureRequirement": "publisherPackage"}, "permissions": ["languageServer.launch", "process.build"], "activationEvents": ["onBuildSystem:fixture"], @@ -53,7 +54,7 @@ func TestBuildProviderManifestNeedsTheBuildCapabilities(t *testing.T) { }`) client, ctx := core.NewClient(), context.Background() _, err := client.ValidatePluginManifest(ctx, manifest, map[string][]int{ - "languages": {1, 3}, "languageServers": {1}, "serverProcess": {1}, + "languages": {0}, "languageServers": {0}, }) var rejection *core.MarketplaceRejection if !errors.As(err, &rejection) || rejection.Code != "plugin.api.unsupported" { @@ -68,7 +69,7 @@ func TestBuildProviderManifestNeedsTheBuildCapabilities(t *testing.T) { } func TestBuildPluginsReadsProviderTasksAndRuns(t *testing.T) { - manifest, err := os.ReadFile("../../../shared/contracts/plugins/v1/fixtures/build-providers/build-provider-run-preparation.plugin.json") + manifest, err := os.ReadFile(contractfixture.Path("fixtures/build-providers/build-provider-run-preparation.plugin.json")) if err != nil { t.Fatal(err) } @@ -104,7 +105,7 @@ func TestBuildPluginsReadsProviderTasksAndRuns(t *testing.T) { } func TestBuildPluginsSkipsDisabledPlugins(t *testing.T) { - manifest, err := os.ReadFile("../../../shared/contracts/plugins/v1/fixtures/build-providers/build-provider-execution.plugin.json") + manifest, err := os.ReadFile(contractfixture.Path("fixtures/build-providers/build-provider-execution.plugin.json")) if err != nil { t.Fatal(err) } diff --git a/desktop/internal/pluginservice/debug_start_test.go b/desktop/internal/pluginservice/debug_start_test.go index b576405c86..a026f4286c 100644 --- a/desktop/internal/pluginservice/debug_start_test.go +++ b/desktop/internal/pluginservice/debug_start_test.go @@ -3,6 +3,7 @@ package pluginservice import ( "context" "encoding/json" + "github.com/1lck/Lithe-IDEA/desktop/internal/contractfixture" "os" "path/filepath" "sync" @@ -25,7 +26,7 @@ func debugStartHarness(t *testing.T) (*Service, string) { if err := os.MkdirAll(installed, 0o700); err != nil { t.Fatal(err) } - manifest, err := os.ReadFile(filepath.Join("..", "..", "..", "shared", "contracts", "plugins", "v1", "fixtures", "debug-adapters", "debug-adapter-features.plugin.json")) + manifest, err := os.ReadFile(contractfixture.Path("fixtures/debug-adapters/debug-adapter-features.plugin.json")) if err != nil { t.Fatal(err) } diff --git a/desktop/internal/pluginservice/pluginservice_test.go b/desktop/internal/pluginservice/pluginservice_test.go index be09e81d95..70f6c5df3c 100644 --- a/desktop/internal/pluginservice/pluginservice_test.go +++ b/desktop/internal/pluginservice/pluginservice_test.go @@ -131,7 +131,7 @@ func TestOpenAssemblesEveryPart(t *testing.T) { if service.Root == "" { t.Fatal("the service has no root") } - if versions := service.Capabilities()["languages"]; len(versions) != 2 { + if versions := service.Capabilities()["languages"]; len(versions) != 1 || versions[0] != 0 { t.Fatalf("capabilities = %v", service.Capabilities()) } } @@ -186,7 +186,7 @@ func TestReviewerAdaptsCoreReview(t *testing.T) { } // The capabilities handed to Core must be the ones this client implements, not // what Core could parse. - if len(kernel.reviewCaps["languages"]) != 2 { + if caps := kernel.reviewCaps["languages"]; len(caps) != 1 || caps[0] != 0 { t.Fatalf("capabilities = %v", kernel.reviewCaps) } } diff --git a/desktop/internal/pluginservice/runs_test.go b/desktop/internal/pluginservice/runs_test.go index 87697402c3..d6b6c4749d 100644 --- a/desktop/internal/pluginservice/runs_test.go +++ b/desktop/internal/pluginservice/runs_test.go @@ -4,6 +4,7 @@ import ( "context" "encoding/json" "fmt" + "github.com/1lck/Lithe-IDEA/desktop/internal/contractfixture" "net" "os" "path/filepath" @@ -80,7 +81,7 @@ func newRunHarness(t *testing.T) *runHarness { if err := os.MkdirAll(installed, 0o700); err != nil { t.Fatal(err) } - manifest, err := os.ReadFile(filepath.Join("..", "..", "..", "shared", "contracts", "plugins", "v1", "fixtures", "run", "tool-reference-launch.plugin.json")) + manifest, err := os.ReadFile(contractfixture.Path("fixtures/run/tool-reference-launch.plugin.json")) if err != nil { t.Fatal(err) } diff --git a/desktop/internal/pluginservice/settings_actions_test.go b/desktop/internal/pluginservice/settings_actions_test.go index 6c05d0c563..d027c0c034 100644 --- a/desktop/internal/pluginservice/settings_actions_test.go +++ b/desktop/internal/pluginservice/settings_actions_test.go @@ -9,6 +9,7 @@ import ( "time" "github.com/1lck/Lithe-IDEA/desktop/internal/configfile" + "github.com/1lck/Lithe-IDEA/desktop/internal/contractfixture" "github.com/1lck/Lithe-IDEA/desktop/internal/core" "github.com/1lck/Lithe-IDEA/desktop/internal/pluginstate" "github.com/1lck/Lithe-IDEA/desktop/internal/store" @@ -32,7 +33,7 @@ func TestSettingsActionPlanningRechecksNativeOwnersWithoutPublishing(t *testing. t.Run(scenario, func(t *testing.T) { ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second) defer cancel() - manifest, err := os.ReadFile("../../../shared/contracts/plugins/v1/fixtures/settings/settings-v2.plugin.json") + manifest, err := os.ReadFile(contractfixture.Path("fixtures/settings/settings.plugin.json")) if err != nil { t.Fatal(err) } @@ -40,7 +41,7 @@ func TestSettingsActionPlanningRechecksNativeOwnersWithoutPublishing(t *testing. if err := os.Mkdir(workspace, 0o700); err != nil { t.Fatal(err) } - packageRoot := filepath.Join(plugins, "dev.lithe.fixture.settings-v2", "0.1.0") + packageRoot := filepath.Join(plugins, "dev.lithe.fixture.settings", "0.1.0") writePackage := func() { t.Helper() if err := os.MkdirAll(packageRoot, 0o700); err != nil { @@ -53,7 +54,7 @@ func TestSettingsActionPlanningRechecksNativeOwnersWithoutPublishing(t *testing. writePackage() storage := store.At(preferences) state := pluginstate.New(storage) - if err := state.SetEnabled("dev.lithe.fixture.settings-v2", true); err != nil { + if err := state.SetEnabled("dev.lithe.fixture.settings", true); err != nil { t.Fatal(err) } kernel := &settingsActionKernel{settingsPlanningKernel: &settingsPlanningKernel{fakeKernel: &fakeKernel{}, client: core.NewClient()}} @@ -61,7 +62,7 @@ func TestSettingsActionPlanningRechecksNativeOwnersWithoutPublishing(t *testing. if err != nil { t.Fatal(err) } - editor, err := service.LoadSettingsEditor(ctx, "dev.lithe.fixture.settings-v2", workspace) + editor, err := service.LoadSettingsEditor(ctx, "dev.lithe.fixture.settings", workspace) if err != nil { t.Fatal(err) } @@ -77,12 +78,12 @@ func TestSettingsActionPlanningRechecksNativeOwnersWithoutPublishing(t *testing. var check func() error switch scenario { case "disabled": - if err := state.SetEnabled("dev.lithe.fixture.settings-v2", false); err != nil { + if err := state.SetEnabled("dev.lithe.fixture.settings", false); err != nil { t.Fatal(err) } case "disabled-during-plan": kernel.afterPlan = func() { - if err := state.SetEnabled("dev.lithe.fixture.settings-v2", false); err != nil { + if err := state.SetEnabled("dev.lithe.fixture.settings", false); err != nil { t.Fatal(err) } } diff --git a/desktop/internal/pluginservice/settings_start_test.go b/desktop/internal/pluginservice/settings_start_test.go index bd83d6faec..8a7639b45d 100644 --- a/desktop/internal/pluginservice/settings_start_test.go +++ b/desktop/internal/pluginservice/settings_start_test.go @@ -9,6 +9,7 @@ import ( "testing" "time" + "github.com/1lck/Lithe-IDEA/desktop/internal/contractfixture" "github.com/1lck/Lithe-IDEA/desktop/internal/core" "github.com/1lck/Lithe-IDEA/desktop/internal/pluginbackend" "github.com/1lck/Lithe-IDEA/desktop/internal/pluginmanager" @@ -117,7 +118,7 @@ func (k *settingsPlanningKernel) UpdatePluginWorkspaceConfiguration(_ context.Co func TestSavedProjectSettingIsRereadBeforeUpdatingTheCurrentLanguageSession(t *testing.T) { ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second) defer cancel() - manifest, err := os.ReadFile("../../../shared/contracts/plugins/v1/fixtures/settings/settings-v2.plugin.json") + manifest, err := os.ReadFile(contractfixture.Path("fixtures/settings/settings.plugin.json")) if err != nil { t.Fatal(err) } @@ -138,7 +139,7 @@ func TestSavedProjectSettingIsRereadBeforeUpdatingTheCurrentLanguageSession(t *t if len(saved.Effects) != 1 || saved.Effects[0] != "immediate" { t.Fatalf("unexpected Core effects: %v", saved.Effects) } - session := &LanguageSession{PluginID: "dev.lithe.fixture.settings-v2", Version: "0.1.0", LanguageID: "elixir", manifest: manifest, workspace: workspace, Session: pluginbackend.Session{ID: "current-language-session"}} + session := &LanguageSession{PluginID: "dev.lithe.fixture.settings", Version: "0.1.0", LanguageID: "elixir", manifest: manifest, workspace: workspace, Session: pluginbackend.Session{ID: "current-language-session"}} result, err := service.ApplyLanguageSettings(ctx, session) if err != nil || !result.Available || !result.Sent { t.Fatalf("apply saved source: %+v, %v", result, err) diff --git a/desktop/internal/pluginweb/page_test.go b/desktop/internal/pluginweb/page_test.go index d7bbd7c5c3..007de56230 100644 --- a/desktop/internal/pluginweb/page_test.go +++ b/desktop/internal/pluginweb/page_test.go @@ -11,6 +11,7 @@ import ( "testing" "time" + "github.com/1lck/Lithe-IDEA/desktop/internal/contractfixture" "github.com/1lck/Lithe-IDEA/desktop/internal/core" ) @@ -98,7 +99,7 @@ type fixture struct { func openFixture(t *testing.T) *fixture { t.Helper() - manifest, err := os.ReadFile("../../../shared/contracts/plugins/v1/fixtures/ui/web-panel.plugin.json") + manifest, err := os.ReadFile(contractfixture.Path("fixtures/ui/web-panel.plugin.json")) if err != nil { t.Fatal(err) } @@ -185,7 +186,7 @@ func errorCode(t *testing.T, message map[string]json.RawMessage) string { func TestPageServesItsPackageOnly(t *testing.T) { f := openFixture(t) - if info := f.page.Info(); info.URL != "lithe-plugin://dev.lithe.fixture.web-panel/ui/index.html" || info.BridgeVersion != 2 { + if info := f.page.Info(); info.URL != "lithe-plugin://dev.lithe.fixture.web-panel/ui/index.html" || info.BridgeVersion != 0 { t.Fatalf("page = %+v", info) } mime, body, ok := f.page.Serve("/ui/index.html") diff --git a/desktop/internal/projectgen/maven_integration_test.go b/desktop/internal/projectgen/maven_integration_test.go index e58e67b491..24d8f4ea5e 100644 --- a/desktop/internal/projectgen/maven_integration_test.go +++ b/desktop/internal/projectgen/maven_integration_test.go @@ -36,9 +36,11 @@ func TestMavenPluginProjectGeneratesABuildableMavenProject(t *testing.T) { defer cancel() kernel := core.NewClient() // Core only needs a JDK's home and version for the templates; the files step runs no JDK. + home := t.TempDir() input := core.ProjectGeneratorFormInput{ ProjectName: "maven-demo", - Runtimes: map[string]core.ProjectRuntimeSelection{"jdk": {Home: t.TempDir(), Version: "17.0.2"}}, + Values: map[string]any{"jdk": home}, + Tools: map[string][]core.ProjectToolInstallation{"jdk": {{Home: home, Version: "17.0.2"}}}, } form, err := kernel.ProjectGeneratorFormOf(ctx, manifest, "maven-java", input) if err != nil || !form.Valid { @@ -86,12 +88,14 @@ func TestMavenPluginArchetypeRunsRealMaven(t *testing.T) { ctx, cancel := context.WithTimeout(t.Context(), 10*time.Minute) defer cancel() kernel := core.NewClient() + home := os.Getenv("JAVA_HOME") + if home == "" { + t.Skip("JAVA_HOME is not set") + } input := core.ProjectGeneratorFormInput{ ProjectName: "archetype-demo", - Runtimes: map[string]core.ProjectRuntimeSelection{"jdk": {Home: os.Getenv("JAVA_HOME"), Version: "17.0.2"}}, - } - if input.Runtimes["jdk"].Home == "" { - t.Skip("JAVA_HOME is not set") + Values: map[string]any{"jdk": home}, + Tools: map[string][]core.ProjectToolInstallation{"jdk": {{Home: home, Version: "17.0.2"}}}, } plan, err := kernel.ProjectGenerationPlanOf(ctx, manifest, "maven-archetype", directory, input) if err != nil { diff --git a/desktop/internal/projectgen/run.go b/desktop/internal/projectgen/run.go index b64e37010c..d43a985790 100644 --- a/desktop/internal/projectgen/run.go +++ b/desktop/internal/projectgen/run.go @@ -184,7 +184,7 @@ func Run(ctx context.Context, request Request) Result { } moved = true result := Result{Path: destination, OpenFiles: existingFiles(destination, request.Plan.OpenFiles)} - if request.SavePins != nil && (len(request.Plan.ToolPins) > 0 || len(request.Plan.Runtimes) > 0) { + if request.SavePins != nil && (len(request.Plan.ToolPins) > 0) { if err := request.SavePins(ctx, destination, request.Plan); err != nil { result.Failure = &Failure{Reason: ReasonPinFailed, Err: err} return result diff --git a/desktop/internal/toolchain/testdata/compiler.plugin.json b/desktop/internal/toolchain/testdata/compiler.plugin.json index 76cb8a6e8f..9905f8462b 100644 --- a/desktop/internal/toolchain/testdata/compiler.plugin.json +++ b/desktop/internal/toolchain/testdata/compiler.plugin.json @@ -1,13 +1,10 @@ { - "schemaVersion": 2, + "schemaVersion": 0, "id": "dev.example.toolsmith", "displayName": "Fictional compiler tools", "version": "1.0.0", - "pluginAPIVersion": 3, - "requires": { - "toolDefinitions": 1, - "executableResolution": 2 - }, + "pluginAPIVersion": 0, + "requires": {"toolDefinitions": 0}, "vendor": { "id": "org.example", "displayName": "Fixture publisher", diff --git a/desktop/internal/toolchain/testdata/conflict-b.plugin.json b/desktop/internal/toolchain/testdata/conflict-b.plugin.json index db4cb0250f..92d293406b 100644 --- a/desktop/internal/toolchain/testdata/conflict-b.plugin.json +++ b/desktop/internal/toolchain/testdata/conflict-b.plugin.json @@ -1,13 +1,10 @@ { - "schemaVersion": 2, + "schemaVersion": 0, "id": "dev.example.conflicting-two", "displayName": "Fictional conflicting tool", "version": "1.0.0", - "pluginAPIVersion": 3, - "requires": { - "toolDefinitions": 1, - "executableResolution": 2 - }, + "pluginAPIVersion": 0, + "requires": {"toolDefinitions": 0}, "vendor": { "id": "org.example", "displayName": "Fixture publisher", diff --git a/desktop/internal/toolchain/testdata/conflict.plugin.json b/desktop/internal/toolchain/testdata/conflict.plugin.json index 3a660633ca..bf1c8cbc4c 100644 --- a/desktop/internal/toolchain/testdata/conflict.plugin.json +++ b/desktop/internal/toolchain/testdata/conflict.plugin.json @@ -1,13 +1,10 @@ { - "schemaVersion": 2, + "schemaVersion": 0, "id": "dev.example.conflicting", "displayName": "Fictional conflicting tool", "version": "1.0.0", - "pluginAPIVersion": 3, - "requires": { - "toolDefinitions": 1, - "executableResolution": 2 - }, + "pluginAPIVersion": 0, + "requires": {"toolDefinitions": 0}, "vendor": { "id": "org.example", "displayName": "Fixture publisher", diff --git a/desktop/internal/toolchain/testdata/runtime.plugin.json b/desktop/internal/toolchain/testdata/runtime.plugin.json index f93ef3e3a2..5a09d8f645 100644 --- a/desktop/internal/toolchain/testdata/runtime.plugin.json +++ b/desktop/internal/toolchain/testdata/runtime.plugin.json @@ -1,13 +1,10 @@ { - "schemaVersion": 2, + "schemaVersion": 0, "id": "dev.example.runtime", "displayName": "Fictional runtime tools", "version": "1.0.0", - "pluginAPIVersion": 3, - "requires": { - "toolDefinitions": 1, - "executableResolution": 2 - }, + "pluginAPIVersion": 0, + "requires": {"toolDefinitions": 0}, "vendor": { "id": "org.example", "displayName": "Fixture publisher", diff --git a/desktop/internal/workbench/build_settings_test.go b/desktop/internal/workbench/build_settings_test.go index ad988bf910..3dc11bf992 100644 --- a/desktop/internal/workbench/build_settings_test.go +++ b/desktop/internal/workbench/build_settings_test.go @@ -10,6 +10,7 @@ import ( "testing" "time" + "github.com/1lck/Lithe-IDEA/desktop/internal/contractfixture" "github.com/1lck/Lithe-IDEA/desktop/internal/core" "github.com/1lck/Lithe-IDEA/desktop/internal/pluginservice" "github.com/1lck/Lithe-IDEA/desktop/internal/store" @@ -18,7 +19,7 @@ import ( func TestBuildExecutableUsesActualGlobalPluginSettingWithoutFallback(t *testing.T) { for _, mode := range []string{"configured", "missing-configured", "directory-configured", "invalid-stored-value"} { t.Run(mode, func(t *testing.T) { - manifest, err := os.ReadFile("../../../shared/contracts/plugins/v1/fixtures/build-systems/build-tool-path.plugin.json") + manifest, err := os.ReadFile(contractfixture.Path("fixtures/build-systems/build-tool-path.plugin.json")) if err != nil { t.Fatal(err) } @@ -115,7 +116,7 @@ func (k *providerPreferenceKernel) PluginDocumentURI(ctx context.Context, path, func TestBuildProviderUsesCapturedSettingsAndCoreWorkspaceURI(t *testing.T) { ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second) defer cancel() - raw, err := os.ReadFile("../../../shared/contracts/plugins/v1/fixtures/build-providers/build-provider.plugin.json") + raw, err := os.ReadFile(contractfixture.Path("fixtures/build-providers/build-provider.plugin.json")) if err != nil { t.Fatal(err) } @@ -123,7 +124,7 @@ func TestBuildProviderUsesCapturedSettingsAndCoreWorkspaceURI(t *testing.T) { if err := json.Unmarshal(raw, &manifest); err != nil { t.Fatal(err) } - manifest["requires"].(map[string]any)["settings"] = 2 + manifest["requires"].(map[string]any)["settings"] = 0 manifest["settings"].([]any)[0].(map[string]any)["scope"] = "project" encoded, err := json.Marshal(manifest) if err != nil { diff --git a/desktop/internal/workbench/debug_launch_test.go b/desktop/internal/workbench/debug_launch_test.go index 2aeabb57b8..58b1e18b05 100644 --- a/desktop/internal/workbench/debug_launch_test.go +++ b/desktop/internal/workbench/debug_launch_test.go @@ -77,7 +77,7 @@ func TestDebugRuntimeArgumentsComeFromTheToolDefinition(t *testing.T) { manifest["toolDefinitions"] = []any{definition} manifest["requiresTools"] = []string{toolID} requires := manifest["requires"].(map[string]any) - requires["serverProcess"], requires["toolDefinitions"], requires["executableResolution"], requires["debugAdapters"] = 4, 1, 2, 2 + requires["toolDefinitions"], requires["debugAdapters"] = 0, 0 declared := manifest["debugAdapters"].([]any)[0].(map[string]any) declared["configurations"].(map[string]any)["launch"].(map[string]any)["targetBindings"] = map[string]any{"args": "target.arguments", "env": "target.environment"} declared["launch"].(map[string]any)["process"].(map[string]any)["launch"] = map[string]any{"kind": "runtime", "tool": toolID, "entry": "adapter-entry", "runtimeArguments": []string{"--runtime"}} @@ -118,7 +118,7 @@ func debugAdapterWithProgramSetting(t *testing.T, adapter debugAdapter, candidat if err := json.Unmarshal(adapter.Manifest, &manifest); err != nil { t.Fatal(err) } - manifest["requires"].(map[string]any)["settings"] = 2 + manifest["requires"].(map[string]any)["settings"] = 0 manifest["settings"] = []any{map[string]any{"id": "program", "type": "file", "title": "Program", "default": "", "scope": "project", "effect": "nextRun"}} launch := manifest["debugAdapters"].([]any)[0].(map[string]any)["configurations"].(map[string]any)["launch"].(map[string]any) launch["executable"] = map[string]any{"setting": "program", "candidates": candidates} diff --git a/desktop/internal/workbench/debug_native_e2e_test.go b/desktop/internal/workbench/debug_native_e2e_test.go index d490f46301..6bbcce3263 100644 --- a/desktop/internal/workbench/debug_native_e2e_test.go +++ b/desktop/internal/workbench/debug_native_e2e_test.go @@ -30,7 +30,7 @@ func TestDebugRealLLDBLaunchTargetAndBreakpoints(t *testing.T) { } validationContext, cancelValidation := context.WithTimeout(context.Background(), 5*time.Second) _, validationErr := core.NewClient().ValidatePluginManifest(validationContext, manifest, map[string][]int{ - "debugAdapters": {1}, "serverProcess": {1}, "languages": {1}, "settings": {2}, + "debugAdapters": {0}, "languages": {0}, "settings": {0}, }) cancelValidation() if validationErr != nil { diff --git a/desktop/internal/workbench/debug_tcp_test.go b/desktop/internal/workbench/debug_tcp_test.go index 005176dbfa..7b9b128e1b 100644 --- a/desktop/internal/workbench/debug_tcp_test.go +++ b/desktop/internal/workbench/debug_tcp_test.go @@ -21,12 +21,12 @@ import ( // the server hands out. It also declares the debugAdapters 3 features and // defaults the engine has to receive. const debugHostedManifest = `{ - "schemaVersion": 2, + "schemaVersion": 0, "id": "dev.lithe.test.debug-hosted", "displayName": "Hosted Debug Fixture", "version": "1.0.0", - "pluginAPIVersion": 4, - "requires": {"debugAdapters": 3, "languageServers": 1, "languages": 1, "serverProcess": 1}, + "pluginAPIVersion": 0, + "requires": {"debugAdapters": 0, "languageServers": 0, "languages": 0}, "vendor": {"id": "dev.lithe.test", "displayName": "Test", "signatureRequirement": "publisherPackage"}, "permissions": ["debug.launch", "languageServer.launch"], "activationEvents": ["onDebug:hosted", "onLanguage:hosted"], @@ -47,12 +47,12 @@ const debugHostedManifest = `{ // debugAttachManifest is a stdio adapter that only attaches, to a host and port // the adapter's own arguments name. const debugAttachManifest = `{ - "schemaVersion": 2, + "schemaVersion": 0, "id": "dev.lithe.test.debug-attach", "displayName": "Attach Debug Fixture", "version": "1.0.0", - "pluginAPIVersion": 4, - "requires": {"debugAdapters": 1, "serverProcess": 1}, + "pluginAPIVersion": 0, + "requires": {"debugAdapters": 0}, "vendor": {"id": "dev.lithe.test", "displayName": "Test", "signatureRequirement": "publisherPackage"}, "permissions": ["debug.launch", "debug.attach"], "activationEvents": ["onDebug:attach"], diff --git a/desktop/internal/workbench/debug_test.go b/desktop/internal/workbench/debug_test.go index be8423ead4..46b71e8950 100644 --- a/desktop/internal/workbench/debug_test.go +++ b/desktop/internal/workbench/debug_test.go @@ -23,12 +23,12 @@ import ( // debugFixtureManifest declares one packaged stdio debug adapter. Core still // validates the manifest; the host only resolves and starts the process. const debugFixtureManifest = `{ - "schemaVersion": 2, + "schemaVersion": 0, "id": "dev.lithe.test.debug-adapter", "displayName": "Debug Fixture", "version": "1.0.0", - "pluginAPIVersion": 4, - "requires": {"debugAdapters": 1, "serverProcess": 1}, + "pluginAPIVersion": 0, + "requires": {"debugAdapters": 0}, "vendor": {"id": "dev.lithe.test", "displayName": "Test", "signatureRequirement": "publisherPackage"}, "permissions": ["debug.launch"], "activationEvents": ["onDebug:fixture"], @@ -469,7 +469,7 @@ func TestDebugFrameRowsKeepTheTopAndSelectedFrames(t *testing.T) { // the run's program, arguments, directory and environment into the launch, and the run // learns when the session ends. func TestRunLaunchTargetBindsTheRunsProcessIntoTheLaunch(t *testing.T) { - manifest := strings.Replace(debugFixtureManifest, `"requires": {"debugAdapters": 1`, `"requires": {"debugAdapters": 2`, 1) + manifest := debugFixtureManifest manifest = strings.Replace(manifest, `"configurations": {"launch":{"arguments":{"stopOnEntry":true}}}`, `"configurationTypes": ["fixture"], "configurations": {"launch":{"arguments":{"stopOnEntry":true},`+ `"targetBindings":{"program":"target.path","cwd":"target.workingDirectory","args":"target.arguments","env":"target.environment"}}}`, 1) diff --git a/desktop/internal/workbench/new_project.go b/desktop/internal/workbench/new_project.go index 1d6e06b0f0..3f436919a7 100644 --- a/desktop/internal/workbench/new_project.go +++ b/desktop/internal/workbench/new_project.go @@ -346,12 +346,6 @@ func (a *App) loadProjectTools(ctx context.Context, tools []string) (map[string] Provider: installation.Provider, }) } - switch { - case tool.Effective != nil && tool.Effective.Home != nil: - list.Default = *tool.Effective.Home - case tool.AutomaticHome != "": - list.Default = tool.AutomaticHome - } break } result[wanted] = list @@ -521,9 +515,6 @@ func (a *App) saveProjectPins(ctx context.Context, form *generatorForm, root str for _, p := range plan.ToolPins { pin(p.Tool, p.Home) } - for _, runtime := range plan.Runtimes { - pin(runtime.Runtime, runtime.Home) - } if len(edits) == 0 { return nil } diff --git a/desktop/internal/workbench/new_project_form.go b/desktop/internal/workbench/new_project_form.go index 667cc72801..e2bc91fcad 100644 --- a/desktop/internal/workbench/new_project_form.go +++ b/desktop/internal/workbench/new_project_form.go @@ -17,7 +17,6 @@ const ( fieldEnum = "enum" fieldBoolean = "boolean" fieldMultiSelect = "multiSelect" - fieldRuntime = "runtime" fieldTool = "tool" ) @@ -28,11 +27,9 @@ type toolInstall struct { Provider string } -// toolList is what discovery found for one tool, and the installation the -// toolchain would use on its own. +// toolList is what discovery found for one tool. type toolList struct { Installations []toolInstall - Default string } // formField holds the widgets of one declared field. The widgets bind to these @@ -160,34 +157,18 @@ func (g *generatorForm) toolIDs() []string { return ids } -// toolID is the tool definition a tool or runtime field selects an installation of. +// toolID is the tool definition a tool field selects an installation of. func (f *formField) toolID() string { - switch f.decl.Type { - case fieldTool: + if f.decl.Type == fieldTool { return f.decl.Tool - case fieldRuntime: - return f.decl.Runtime } return "" } -// setTools records what discovery found. A runtime field the user has not -// chosen for starts on the installation the toolchain would use itself. +// setTools records what discovery found. Core derives each tool field's +// default from the installations the form input lists. func (g *generatorForm) setTools(tools map[string]toolList, failed bool) { g.tools, g.toolsLoaded, g.toolsFailed = tools, true, failed - for _, f := range g.fields { - if f.decl.Type != fieldRuntime || f.edited || f.text != "" { - continue - } - list := tools[f.toolID()] - switch { - case list.Default != "": - f.text = list.Default - case len(list.Installations) > 0: - f.text = list.Installations[0].Home - } - f.shown = f.text - } } func (g *generatorForm) installation(tool, home string) (toolInstall, bool) { @@ -206,7 +187,6 @@ func (g *generatorForm) input(name string) core.ProjectGeneratorFormInput { input := core.ProjectGeneratorFormInput{ ProjectName: name, Values: map[string]any{}, - Runtimes: map[string]core.ProjectRuntimeSelection{}, Tools: map[string][]core.ProjectToolInstallation{}, } for _, f := range g.fields { @@ -232,10 +212,6 @@ func (g *generatorForm) input(name string) core.ProjectGeneratorFormInput { if f.edited { input.Values[id] = append([]string{}, f.selected()...) } - case fieldRuntime: - if installation, ok := g.installation(f.toolID(), f.text); ok { - input.Runtimes[id] = core.ProjectRuntimeSelection{Home: installation.Home, Version: installation.Version} - } case fieldTool: list := g.tools[f.toolID()].Installations installations := make([]core.ProjectToolInstallation, 0, len(list)) @@ -261,7 +237,7 @@ func (g *generatorForm) apply(form core.ProjectGeneratorForm) { continue } f.state = state - if f.edited || f.decl.Type == fieldRuntime { + if f.edited { continue } f.show(state.Value) diff --git a/desktop/internal/workbench/new_project_test.go b/desktop/internal/workbench/new_project_test.go index c918c940c8..996c3d393a 100644 --- a/desktop/internal/workbench/new_project_test.go +++ b/desktop/internal/workbench/new_project_test.go @@ -12,6 +12,7 @@ import ( "testing" "time" + "github.com/1lck/Lithe-IDEA/desktop/internal/contractfixture" "github.com/1lck/Lithe-IDEA/desktop/internal/core" "github.com/1lck/Lithe-IDEA/desktop/internal/i18n" "github.com/1lck/Lithe-IDEA/desktop/internal/pluginservice" @@ -68,7 +69,7 @@ func (h *harness) openNewProjectSheet() { h.await("the generator catalog", func() bool { return h.app.newProject.catalogLoaded }) } -const generatorFixtures = "../../../shared/contracts/plugins/v1/fixtures/project-generators" +var generatorFixtures = contractfixture.Path("fixtures/project-generators") func fixtureGeneratorPlugin(t *testing.T) pluginservice.GeneratorPlugin { t.Helper() @@ -89,7 +90,6 @@ func fixtureJavaTools() map[string]toolList { {ProjectToolInstallation: core.ProjectToolInstallation{Home: "/opt/jdk-21", Executable: "/opt/jdk-21/bin/java", Version: "21.0.4"}, Provider: "host:system"}, {ProjectToolInstallation: core.ProjectToolInstallation{Home: "/opt/jdk-11", Executable: "/opt/jdk-11/bin/java", Version: "11.0.2"}, Provider: "host:system"}, }, - Default: "/opt/jdk-21", }} } @@ -574,8 +574,8 @@ func commandGeneratorPlugin(t *testing.T) pluginservice.GeneratorPlugin { } } manifest, err := json.Marshal(map[string]any{ - "schemaVersion": 2, "id": "dev.lithe.test.scaffold", "displayName": "Scaffold", "version": "1.0.0", - "pluginAPIVersion": 3, "requires": map[string]int{"projectGenerators": 1}, + "schemaVersion": 0, "id": "dev.lithe.test.scaffold", "displayName": "Scaffold", "version": "1.0.0", + "pluginAPIVersion": 0, "requires": map[string]int{"projectGenerators": 0}, "vendor": map[string]string{"id": "org.example", "displayName": "Example", "signatureRequirement": "publisherPackage"}, "permissions": []string{"project.generate"}, "activationEvents": []string{}, "projectGenerators": []map[string]any{ @@ -870,7 +870,7 @@ func TestNewProjectToolFieldListsInstallationsAndPinsTheChoice(t *testing.T) { h.app.projectToolLists = func(_ context.Context, tools []string) (map[string]toolList, error) { lists := map[string]toolList{} for _, tool := range tools { - lists[tool] = toolList{Default: "/opt/python-3.12", Installations: []toolInstall{ + lists[tool] = toolList{Installations: []toolInstall{ {ProjectToolInstallation: core.ProjectToolInstallation{Home: "/opt/python-3.10", Executable: "/opt/python-3.10/bin/python3", Version: "3.10.14"}, Provider: "host:system"}, {ProjectToolInstallation: core.ProjectToolInstallation{Home: "/opt/python-3.12", Executable: "/opt/python-3.12/bin/python3", Version: "3.12.4"}, Provider: "host:system"}, }} diff --git a/desktop/internal/workbench/new_project_view.go b/desktop/internal/workbench/new_project_view.go index 3d76293d40..cfb5c4ee0c 100644 --- a/desktop/internal/workbench/new_project_view.go +++ b/desktop/internal/workbench/new_project_view.go @@ -377,7 +377,7 @@ func (a *App) generatorField(c ui.C, language i18n.Language, form *generatorForm ui.Checkbox(c, &field.flag, decl.Title) case fieldMultiSelect: a.multiSelectField(c, field) - case fieldRuntime, fieldTool: + case fieldTool: a.installationField(c, language, form, field) } }) @@ -558,8 +558,6 @@ func fieldProblemMessage(language i18n.Language, problem string) string { return i18n.Shared(language, "desktop.newProject.problem.tooLong") case "invalidFormat": return i18n.Shared(language, "desktop.newProject.problem.invalidFormat") - case "runtimeTooOld": - return i18n.Shared(language, "desktop.newProject.problem.runtimeTooOld") case "toolTooOld": return i18n.Shared(language, "desktop.newProject.problem.toolTooOld") case "versionTooHigh": diff --git a/desktop/internal/workbench/outputlinks_test.go b/desktop/internal/workbench/outputlinks_test.go index f712c56e36..ebd320431f 100644 --- a/desktop/internal/workbench/outputlinks_test.go +++ b/desktop/internal/workbench/outputlinks_test.go @@ -13,12 +13,12 @@ import ( // outputLinkManifest is a plugin that only declares a matcher: no backend, no // language, no server. Core resolves a match to workspace files itself. const outputLinkManifest = `{ - "schemaVersion": 2, + "schemaVersion": 0, "id": "dev.lithe.test.output-links", "displayName": "Output Link Fixture", "version": "1.0.0", - "pluginAPIVersion": 4, - "requires": {"outputLinkMatchers": 1}, + "pluginAPIVersion": 0, + "requires": {"outputLinkMatchers": 0}, "vendor": {"id": "dev.lithe.test", "displayName": "Test", "signatureRequirement": "publisherPackage"}, "permissions": [], "activationEvents": [], diff --git a/desktop/internal/workbench/pluginsync_e2e_test.go b/desktop/internal/workbench/pluginsync_e2e_test.go index 42d5d8e2be..611ea86cb6 100644 --- a/desktop/internal/workbench/pluginsync_e2e_test.go +++ b/desktop/internal/workbench/pluginsync_e2e_test.go @@ -19,11 +19,11 @@ import ( // system command, the host starts the real clangd process, and every assertion // below observes that process's diagnostics rather than injected records. const clangdManifest = `{ - "schemaVersion": 2, + "schemaVersion": 0, "id": "dev.lithe.test.clangd", "displayName": "Clangd Test Server", "version": "1.0.0", - "pluginAPIVersion": 1, + "pluginAPIVersion": 0, "vendor": {"id": "dev.lithe.test", "displayName": "Test", "signatureRequirement": "publisherPackage"}, "permissions": ["languageServer.launch", "process.run"], "activationEvents": ["onLanguage:c"], diff --git a/desktop/internal/workbench/plugintools_test.go b/desktop/internal/workbench/plugintools_test.go index c17780792f..379c91e0a0 100644 --- a/desktop/internal/workbench/plugintools_test.go +++ b/desktop/internal/workbench/plugintools_test.go @@ -6,6 +6,7 @@ import ( "slices" "testing" + "github.com/1lck/Lithe-IDEA/desktop/internal/contractfixture" "github.com/1lck/Lithe-IDEA/desktop/internal/core" "github.com/1lck/Lithe-IDEA/desktop/internal/pluginstate" "github.com/1lck/Lithe-IDEA/desktop/internal/store" @@ -31,7 +32,7 @@ func webPanelHarness(t *testing.T) (*harness, *store.Store) { if err := os.MkdirAll(filepath.Join(installed, "ui"), 0o700); err != nil { t.Fatal(err) } - manifest, err := os.ReadFile("../../../shared/contracts/plugins/v1/fixtures/ui/web-panel.plugin.json") + manifest, err := os.ReadFile(contractfixture.Path("fixtures/ui/web-panel.plugin.json")) if err != nil { t.Fatal(err) } diff --git a/desktop/internal/workbench/settings_plugin_actions_test.go b/desktop/internal/workbench/settings_plugin_actions_test.go index 3741bbcd76..11ddaf8b28 100644 --- a/desktop/internal/workbench/settings_plugin_actions_test.go +++ b/desktop/internal/workbench/settings_plugin_actions_test.go @@ -24,7 +24,7 @@ func TestSettingsActionConfirmsInvokesExistingProviderWithoutSaving(t *testing.T t.Fatal(err) } requires := manifest["requires"].(map[string]any) - requires["settings"] = 2 + requires["settings"] = 0 manifest["settingActions"] = []any{map[string]any{"id": "refresh", "title": "Refresh fixture", "function": "snapshot.refresh", "confirm": true}} data, err := json.Marshal(manifest) if err != nil { diff --git a/desktop/internal/workbench/tests_provider_test.go b/desktop/internal/workbench/tests_provider_test.go index 0fd9df654a..d884686807 100644 --- a/desktop/internal/workbench/tests_provider_test.go +++ b/desktop/internal/workbench/tests_provider_test.go @@ -22,12 +22,12 @@ import ( // its own provider process. Core still plans the test request and decodes the // canonical report; the host only starts the provider and routes frames. const providerTestsManifest = `{ - "schemaVersion": 2, + "schemaVersion": 0, "id": "dev.lithe.test.provider-tests", "displayName": "Provider Tests Fixture", "version": "1.0.0", - "pluginAPIVersion": 3, - "requires": {"buildProviders": 8, "buildSystems": 1, "serverProcess": 1}, + "pluginAPIVersion": 0, + "requires": {"buildProviders": 0, "buildSystems": 0}, "vendor": {"id": "dev.lithe.test", "displayName": "Test", "signatureRequirement": "publisherPackage"}, "permissions": ["languageServer.launch", "process.build"], "activationEvents": ["onBuildSystem:fixture-provider-tests"], @@ -126,9 +126,9 @@ func TestProviderTestRunner(t *testing.T) { } switch request.Method { case "initialize": - experimental := map[string]any{"litheBuild": map[string]any{"version": 8}} + experimental := map[string]any{"litheBuild": map[string]any{"version": 0}} if _, err := os.Stat("settings-action.marker"); err == nil { - experimental["litheFunctions"] = map[string]any{"version": 2, "functions": []any{map[string]any{"id": "snapshot.refresh"}}} + experimental["litheFunctions"] = map[string]any{"version": 0, "functions": []any{map[string]any{"id": "snapshot.refresh"}}} } reply(request.ID, map[string]any{"capabilities": map[string]any{"experimental": experimental}}) case "lithe/function/invoke": diff --git a/desktop/internal/workbench/tests_test.go b/desktop/internal/workbench/tests_test.go index 20d405f7b6..6290c7dadd 100644 --- a/desktop/internal/workbench/tests_test.go +++ b/desktop/internal/workbench/tests_test.go @@ -16,12 +16,12 @@ import ( // workspace test command. Core validates it, plans the command and decodes the // JUnit report; the host only runs the plan and presents the decoded tree. const testsPanelManifest = `{ - "schemaVersion": 2, + "schemaVersion": 0, "id": "dev.lithe.test.tests-panel", "displayName": "Tests Panel Fixture", "version": "1.0.0", - "pluginAPIVersion": 3, - "requires": {"buildSystems": 1}, + "pluginAPIVersion": 0, + "requires": {"buildSystems": 0}, "vendor": {"id": "dev.lithe.test", "displayName": "Test", "signatureRequirement": "publisherPackage"}, "permissions": ["process.build"], "activationEvents": ["onBuildSystem:fixture-tests"], diff --git a/docs/ci-builds.md b/docs/ci-builds.md index f0d3d15a25..1b4376f1ab 100644 --- a/docs/ci-builds.md +++ b/docs/ci-builds.md @@ -599,9 +599,10 @@ Cargo 社区插件在 [独立仓库](https://github.com/Lithe-IDEA/lithe-plugin- 不跨 worktree 共享,也不进入发布 ZIP。主仓库保留通用插件契约回归,不下载或组装 Cargo 插件。 插件仓库每次打包校验 `sdk.lock.json` 固定的 SDK 源码提交与文件 SHA-256, SDK 复制只发生在打包阶段,安装目录保持只读。 -官方插件 SDK 已移到 [lithe-plugin-docs](https://github.com/Lithe-IDEA/lithe-plugin-docs): -SDK 的 Maven 构建输出和端到端测试使用的 Lithe 稀疏检出(`.artifacts/lithe`)都属于该仓库, -主仓库不再构建 SDK,也不把这些目录登记为可复用资源。 +官方插件 SDK 在 Core 仓库的 `shared/plugins/sdk/` 下维护和发布: +SDK 的构建输出,以及对当前工作树的 Core 运行的端到端测试 +(`node shared/plugins/scripts/sdk-e2e.mjs`)都属于 Core 仓库, +本仓库不构建 SDK,也不把这些目录登记为可复用资源。 `Lithe-Dev` 的运行时用户状态不属于可复用构建缓存。macOS 用 `app.lithe.desktop.dev` 隔离偏好和钥匙串,并在系统 Application Support、Caches、 diff --git a/docs/development/issue-1495-plugin-migration-remaining-plan.md b/docs/development/issue-1495-plugin-migration-remaining-plan.md index abf38f50f0..93f6038d6c 100644 --- a/docs/development/issue-1495-plugin-migration-remaining-plan.md +++ b/docs/development/issue-1495-plugin-migration-remaining-plan.md @@ -2,6 +2,8 @@ 这是执行计划,不代表下面的迁移已经完成。总目标见 [#1495](https://github.com/1lck/Lithe-IDEA/issues/1495),职责和取舍以 [Build Provider 决策笔记](../../.agents/notes/implemented/architecture/2026-10-26-build-provider-task-execution.md) 为准。每个大任务可以包含多个可验收 PR,不能只增加新接口而一直保留旧业务入口。 +文中的 `lithe-plugin-docs`(SDK PR、CI 编号、“公开契约镜像”和“漂移检查”)指已退役的文档与 SDK 仓库,只作为当时的历史证据保留。插件契约、指南、API 总表、协议更新记录和三个官方 SDK 现在都在 [Lithe-core-rust](https://github.com/Lithe-IDEA/Lithe-core-rust/tree/main/shared/plugins) 的 `shared/plugins/` 下;契约改动与登记在同一个 Core PR 里完成,不再有镜像同步。 + ## 当前交付边界 - 阶段 A 清单 [PR #1513](https://github.com/1lck/Lithe-IDEA/pull/1513) 与独立分发 [PR #1483](https://github.com/1lck/Lithe-IDEA/pull/1483) 已合并,保持原范围,不重复认领。 @@ -22,7 +24,7 @@ | 服务调试 v11 | 已删除本入口的 `runtime: jvm` 与内置 Java attach;协议传递适配器身份、公开配置类型和 `connection` 目标,宿主从当前 Registry 选择并验证配置,跨准备/监听/连接检查包与注册代次。Java Support 自己声明同包 JDT 托管适配器,Maven 仅声明配置类型;真实断点 UI 与发行组合仍待验收。 | | 工具选择 | #1581 已实际合并,本分支从已授权的 b87 预集成继续适配最终版本及最新 preview,仍保持 Draft、不合并发布。macOS Build/Provider Run 已接 `toolDefinitions` / `toolchainProviders` 与四层选择;删除新增的 Maven JDK 注册和 Java 准备按 Maven 名字选工具的分支。按 Run 的明确工具选择现已接入两端 adapter,并保留两层继承和显式清空;旧 Maven 明确路径可一次性转移。Windows 已补来源证明和操作内 Provider 查询;项目/全局默认与应用 JDK 联动、Windows 完整产品准入和现有 Java 消费者仍待完成。 | | Maven 运行配置与准备任务 | 新 Provider 路径已改为不透明通用选择器:Core 不解释 Maven profile/reactor/framework,提供者拥有语义。准备任务已改为 `buildSystems: 4` 清单的通用用途和适用源码角色,宿主不约定固定任务 ID。自动运行配置已由声明/目标生成 `build.provider` 选择器,独立于 Java 导入,删除 `mavenRunProvider` 字段与 Core 框架名单;快照指纹、目标撤回和用户通用覆盖已接线。旧 Run v2 中可确认的服务/显式任务已保留 ID 转为通用引用并通过两层预检及冲突保护;后续已补 v1、可确认偏好、隐式模块及明确的按 Run 工具转换,当前归属投影已移除 reactor/Wrapper/版本字段;项目/全局默认的动态继承、Windows 旧生产路径与旧 Java 扩展兼容消费者仍待处理。 | -| SDK 与版本 | 当前分支已整合公开 main 的函数协议 3、源码版本 0.2.0 与已合并 f64d262c 契约副本,Node 20/Java 8 固定组合 CI 已通过;Build 7~11 增量仍在 Draft、未正式发布。重写 v7 为提供者暂存编辑,保留 8~10 版本及处理器,v11 改为注册表连接目标,正式发行组合仍待验收。只在宿主合并后同步契约副本,正式 SDK 锁定值不变。 | +| SDK 与版本 | 当前分支已整合公开 main 的函数协议 3、源码版本 0.2.0 与已合并 f64d262c 契约副本,Node 20/Java 8 固定组合 CI 已通过;Build 7~11 增量仍在 Draft、未正式发布。重写 v7 为提供者暂存编辑,保留 8~10 版本及处理器,v11 改为注册表连接目标,正式发行组合仍待验收。契约副本已随 lithe-plugin-docs 退役,不再有同步步骤,正式 SDK 锁定值不变。 | ### 整合最新 preview 与工具默认迁移的切片边界(2026-11-04) @@ -731,12 +733,12 @@ N+2 目标版本。兼容窗口关闭须在该稳定版发布说明交代,跳 **范围与顺序:** 1. #1517 已于 2026-10-29 核实合入 preview(`659739011`);以合并提交核对最终契约,阶段 D 增量仍需各自验证。 -2. 在 `lithe-plugin-docs` 用合并后的 preview commit 运行 `node scripts/contract.mjs sync --revision `;不手改镜像或伪造锁定值。 -3. 已合并的 Node/Java SDK 实现按最终契约重新验证,在锁定 Core 与当前 preview 上运行真实端到端场景;补齐 Node 20、Java 8 运行证据后,按其发布流程发布实际的新版本。 +2. 确认 Core 仓库 `shared/plugins/contract/v1/` 的契约与 #1517 合并提交的最终契约一致,协议更新记录和 API 总表与对应 Core 改动在同一个 Core PR 里登记;不手改任何副本,不伪造锁定值。 +3. 已合并的 Node/Java SDK 实现按最终契约重新验证:在 Core 仓库根运行 `node shared/plugins/scripts/sdk-e2e.mjs`,对当前工作树的 Core 跑真实端到端场景;补齐 Node 20、Java 8 运行证据后,从 Core 仓库按 SDK 标签(例如 `sdk-node-v0.5.0`)发布实际的新版本。 4. Maven 插件将 `sdk.lock.json` 和构建依赖更新到实际发布的版本、URL、SHA-256;用正式 `package.mjs` 验证,开发构建覆盖不能进入发行流程。 5. 验证最新宿主的安装、更新、能力拒绝提示和插件包只读。只有实际符合来源、签名和市场规则的工件才进入分发。 -**退出条件:** 三仓 PR 和依赖顺序可追踪;契约副本逐字节一致;SDK 和 Maven 包都有真实发行地址与校验值;正式打包、最低支持运行时和当前平台流程通过。未实现的 Windows Provider 能力继续明确拒绝。这个任务不负责删除全部旧 Maven/Java 业务。 +**退出条件:** 三仓 PR 和依赖顺序可追踪;契约、API 总表和协议更新记录与 Core 实现在同一个 Core 提交里一致;SDK 和 Maven 包都有真实发行地址与校验值;正式打包、最低支持运行时和当前平台流程通过。未实现的 Windows Provider 能力继续明确拒绝。这个任务不负责删除全部旧 Maven/Java 业务。 ### 阶段 C 的验收记录与交付门槛 @@ -745,9 +747,9 @@ N+2 目标版本。兼容窗口关闭须在该稳定版发布说明交代,跳 | 无页面的工作区 Provider、执行与测试 | Core、生产 macOS 会话表与真实 Maven 后端已经完成多模块读取、模块编译、精确单方法执行和报告解码;集成测试显式选择开发包与工具,关闭后核对包清单不变。 | | Run、原生 Debug 与适配器贡献 | 原生入口、保存配置、Agent 操作身份和类型化准备已经实现;真实 SDK 进程覆盖准备、失败、取消及另一工作区隔离。真实 LLDB 已通过 Provider 编译→Registry 启动→命中断点→读取栈帧→带参数继续执行→退出及清理,插件包保持只读;完整 UI/发行包流程仍需验收,Java/JDT 领域迁移属于任务三。 | | 配置快照与跨插件协作 | 协议 6 的只读模型输入公开选定事实,配置/源码/模型/插件/工作区变化撤销旧输入;两个真实 SDK 后端经过 Core 交换公开投影。不能据此声称 Java 已消费 Maven 全部配置。 | -| 最低 SDK 运行时 | 历史[显式宿主 CI](https://github.com/Lithe-IDEA/lithe-plugin-docs/actions/runs/40531099687) 的 Node 20、Java 8 原生端到端作业通过,宿主固定为 `58ca81cf66c5c6e281c7df73ac67adb3526174f3`。该轮契约漂移检查失败;SDK #4 后续已合并且 main CI 通过,镜像仍需在 #1517 合并后按最终宿主提交同步。 | +| 最低 SDK 运行时 | 历史[显式宿主 CI](https://github.com/Lithe-IDEA/lithe-plugin-docs/actions/runs/40531099687) 的 Node 20、Java 8 原生端到端作业通过,宿主固定为 `58ca81cf66c5c6e281c7df73ac67adb3526174f3`。该轮契约漂移检查失败;SDK #4 后续已合并且 main CI 通过。该仓库退役后,最低运行时证据要在 Core 仓库用 `node shared/plugins/scripts/sdk-e2e.mjs` 重新取得。 | | Maven 最低运行时 | [固定 SDK 提交的开发验证](https://github.com/Lithe-IDEA/lithe-plugin-maven/actions/runs/40533306865) 已通过 Java 8 后端及当前/3.6.3 Maven,每组 55 项计时检查(含 3 项打包);不能代替旧 SDK 锁定下仍失败的正式打包检查。 | -| 正式合并、契约同步与发行 | SDK #4 已合并;宿主 #1517 已于 2026-10-29 核实合并(preview `659739011`),Maven #7 因正式 SDK 锁定依赖继续保持 Draft。最终契约同步与新版发行尚未完成。使用最终 preview commit 同步契约、发布 SDK,再更新 Maven 的真实版本/URL/SHA-256 和完成正式包验收;不能先填预期校验值。 | +| 正式合并、契约与发行 | SDK #4 已合并;宿主 #1517 已于 2026-10-29 核实合并(preview `659739011`),Maven #7 因正式 SDK 锁定依赖继续保持 Draft。新版 SDK 发行尚未完成。契约和 SDK 都在 Core 仓库,没有契约同步步骤:先从 Core 仓库发布 SDK,再更新 Maven 的真实版本/URL/SHA-256 和完成正式包验收;不能先填预期校验值。 | 阶段 C 不能仅凭接口存在或本地开发包通过就勾选完成。下面的任务二至四不阻塞通用接口继续评审,但不会代替上表中尚未完成的验收与发行条件。 diff --git a/docs/development/macos-plugin-api-plan.md b/docs/development/macos-plugin-api-plan.md index cdf56a2239..b3925f4c7b 100644 --- a/docs/development/macos-plugin-api-plan.md +++ b/docs/development/macos-plugin-api-plan.md @@ -7,7 +7,7 @@ 本轮已将原有三组宿主内部服务注册为协议 3 的公共方法;`ui:4` 提供不打开 工具窗口的命令。逐方法授权、上下文 lease、编辑器返回 documentID/version、 真实 HTML 呈现模式、后端初始化/退出/通知背压也已接入。正式参数和限制以 -`shared/contracts/plugins/v1/README.md` 为准,历史盘点表不是当前能力表。 +`Lithe-core-rust/shared/plugins/contract/v1/README.md` 为准,历史盘点表不是当前能力表。 尚未交付的部分包括:官方 SDK 新 API 的类型封装与发布、通用原生 Tree 后端 数据源、精确全文搜索匹配范围、文件修改/保存事务、可替换预览标签和 Windows @@ -90,13 +90,13 @@ Windows 不在本轮,平台矩阵的 partial/pending 保持真实。 嵌入语言在该 worker 适配器中按普通文本处理。Windows 接入、SDK 新能力封装与发布、 打包后安装真实插件的完整验收仍未完成,功能矩阵保持 partial/pending。 决策边界见[独立插件编辑器 API](../../.agents/notes/implemented/architecture/2026-10-31-plugin-editor-extension-apis.md), -正式资源契约见[语法与编辑配置](../../shared/contracts/plugins/v1/README.md#grammars-and-editor-configuration-languages-2)。 +正式资源契约见[语法与编辑配置](https://github.com/Lithe-IDEA/Lithe-core-rust/blob/main/shared/plugins/contract/v1/README.md#grammars-and-editor-configuration)。 ### 当前公共调用面汇总 所有宿主请求以 `lithe/host/` 为前缀;这里的点号是阅读简写,正式方法使用 `/`。 精确参数、返回、权限、预算及失败语义见 -[契约公共方法表](../../shared/contracts/plugins/v1/README.md#public-document-file-and-window-methods-protocol-version-3)。 +[契约公共方法表](https://github.com/Lithe-IDEA/Lithe-core-rust/blob/main/shared/plugins/contract/v1/README.md#public-document-file-and-window-methods)。 | 分组 | 已开放请求 | 权限 | | --- | --- | --- | @@ -122,16 +122,16 @@ Windows 不在本轮,平台矩阵的 partial/pending 保持真实。 本轮只规划 macOS。没有 Windows 实现任务、时间表或双端验收前置条件;共享数据协议仍不嵌入 SwiftUI/AppKit 类型。本 PR 不实现 API、不修改 schema/SDK,也不把未来能力记成已实现。 -这是**主仓库内部执行计划和文档待办**,不是可直接使用的开发者 API 参考。下文所有“候选”方法、事件及文档路径都需要后续契约 PR 定义;不能直接写进现有 `plugin.json`。公开指南、API 参考、SDK 和示例最终交付到 [lithe-plugin-docs](https://github.com/Lithe-IDEA/lithe-plugin-docs),不在本仓库维护第二套开发者手册。 +这是**主仓库内部执行计划和文档待办**,不是可直接使用的开发者 API 参考。下文所有“候选”方法、事件及文档路径都需要后续契约 PR 定义;不能直接写进现有 `plugin.json`。公开指南、API 参考、SDK 和示例最终交付到 Core 仓库的 [`shared/plugins/`](https://github.com/Lithe-IDEA/Lithe-core-rust/tree/main/shared/plugins),不在本仓库维护第二套开发者手册。 -架构选择由[公共扩展契约提案](../../.agents/notes/proposed/architecture/2026-10-13-public-extension-contract-and-provider-api.md)持有;本文件负责能力盘点、任务拆分和验收。契约发布遵循[两仓库同步决策](../../.agents/notes/implemented/architecture/2026-10-23-plugin-contract-publishing.md)。 +架构选择由[公共扩展契约提案](../../.agents/notes/proposed/architecture/2026-10-13-public-extension-contract-and-provider-api.md)持有;本文件负责能力盘点、任务拆分和验收。契约、指南和 SDK 的发布遵循[契约单一来源决策](../../.agents/notes/implemented/architecture/2026-11-11-plugin-contract-single-source-in-core.md)。 ### 盘点基线 | 对象 | 固定版本与证据 | 使用限制 | | --- | --- | --- | | Lithe | [preview `e8c4e9fc933a`](https://github.com/1lck/Lithe-IDEA/tree/e8c4e9fc933a85f789d603371e77efd219214452) | 本文件的本地源码路径均相对此版本,已包含下面两个合并的 PR;源码存在不代表本次做过实机验收 | -| 插件文档/SDK | [main `be779d2000e3`](https://github.com/Lithe-IDEA/lithe-plugin-docs/tree/be779d2000e38415ea047fc2e2b2b7973e7d8e07) | 2026-10-30 复核仍是该 commit。`contract.lock.json` 锁定主仓库 `32021a86f0c6c4ad2964dbbe3c2bb7854d84ad67`,不能与本次 preview 基线混用;该锁之后 `shared/contracts/plugins/v1` 又有 4 个提交(含 #1517),副本尚未同步 | +| 插件文档/SDK(已退役的 lithe-plugin-docs) | [main `be779d2000e3`](https://github.com/Lithe-IDEA/lithe-plugin-docs/tree/be779d2000e38415ea047fc2e2b2b7973e7d8e07) | 2026-10-30 复核仍是该 commit。`contract.lock.json` 锁定主仓库 `32021a86f0c6c4ad2964dbbe3c2bb7854d84ad67`,不能与本次 preview 基线混用;该锁之后 `shared/contracts/plugins/v1` 又有 4 个提交(含 #1517)。该仓库已退役,契约、指南和 SDK 现在在 Core 仓库的 `shared/plugins/`,不再有副本同步 | | OpenIDEA | [`8ff8f229407d`](https://github.com/l0ng-ai/openidea/tree/8ff8f229407df73e722d0a933f8e0aebd48f516c) | 比较其公开源码,不推断全量功能成熟度或产品安全结论 | | 原生 Provider 工作流 | [PR #1517](https://github.com/1lck/Lithe-IDEA/pull/1517),合并提交 `659739011591`(2026-10-28 已合并) | 已在上面的 preview 中;Mac 已声明 `buildProviders:1–6`、`buildModelInputs:1`、`debugAdapters:1/2`,见 2.1 | | 远程工作区适配 | [PR #1515](https://github.com/1lck/Lithe-IDEA/pull/1515),合并提交 `823fe428384d`(2026-10-29 已合并,关联 #1507) | 已在上面的 preview 中,但 PR 自述为阶段性实现,功能矩阵保持 partial / pending;不得据此认定远程工作区已完整可用,范围与缺口见 API-40 | @@ -302,11 +302,11 @@ Mac 当前声明的能力版本为:`backend:1`、`buildModelInputs:1`、`build ### 5.1 先消除“源码支持 = 已发版 = 宿主可用”的误解 -以下是固定 SDK commit 的源码盘点,不是本次运行 SDK 测试的结果。 +以下是固定 SDK commit 的源码盘点,不是本次运行 SDK 测试的结果。这个 commit 属于已退役的 lithe-plugin-docs;SDK 现在在 Core 仓库的 `shared/plugins/sdk/{node,java,rust}`,从 Core 仓库按标签发布(例如 `sdk-node-v0.5.0`)。 | SDK | 源码已见能力 | 仍需核对/补齐 | 已核实发布物 | | --- | --- | --- | --- | -| [Node 源码](https://github.com/Lithe-IDEA/lithe-plugin-docs/blob/be779d2000e38415ea047fc2e2b2b7973e7d8e07/sdk/node/src/backend.mjs) | Build、私有 Functions v1、VCS;开发中 Build 2–6 的执行、测试、发现、Run/Debug 准备、模型输入 | 通用 host API、Functions v2/credentials 等不能因 Rust SDK 有就宣称 Node 也有;宿主侧 Build 2–6 已随 #1517 合入 preview,但文档仓库的契约副本早于该合并,需先同步契约再对齐 SDK 与 fixtures | [sdk-node-v0.1.0](https://github.com/Lithe-IDEA/lithe-plugin-docs/releases/tag/sdk-node-v0.1.0),2026-10-23;源码新功能不等于已在此包发布 | +| [Node 源码](https://github.com/Lithe-IDEA/lithe-plugin-docs/blob/be779d2000e38415ea047fc2e2b2b7973e7d8e07/sdk/node/src/backend.mjs) | Build、私有 Functions v1、VCS;开发中 Build 2–6 的执行、测试、发现、Run/Debug 准备、模型输入 | 通用 host API、Functions v2/credentials 等不能因 Rust SDK 有就宣称 Node 也有;宿主侧 Build 2–6 已随 #1517 合入 preview,但该快照里的契约副本早于该合并;SDK 现与契约同在 Core 仓库,按当前契约对齐 SDK 与 fixtures | [sdk-node-v0.1.0](https://github.com/Lithe-IDEA/lithe-plugin-docs/releases/tag/sdk-node-v0.1.0),2026-10-23;源码新功能不等于已在此包发布 | | [Java 源码](https://github.com/Lithe-IDEA/lithe-plugin-docs/blob/be779d2000e38415ea047fc2e2b2b7973e7d8e07/sdk/java/plugin-sdk/src/main/java/io/github/litheidea/plugin/sdk/Backend.java) | Build、私有 Functions v1;开发中 Build 2–6 | 本次源码未见 VCS/credentials 实现,不能写成与 Node/Rust 全量对等 | [历史 sdk-java-v0.1.0](https://github.com/1lck/Lithe-IDEA/releases/tag/sdk-java-v0.1.0),2026-10-20,JAR 与 SHA-256 | | [Rust 说明](https://github.com/Lithe-IDEA/lithe-plugin-docs/blob/be779d2000e38415ea047fc2e2b2b7973e7d8e07/sdk/rust/README.md) | Functions v1/v2、credentials,独立后端示例 | 明确尚不实现 Build/VCS;文档描述 release 方案不等于该 tag 已发布 | 本次未核实到 Rust SDK 正式 release,不提供可用发布承诺 | @@ -314,7 +314,7 @@ Mac 当前声明的能力版本为:`backend:1`、`buildModelInputs:1`、`build ### 5.2 需要编写或更新的文档 -路径均相对 **lithe-plugin-docs**,是后续交付目标,不是本 PR 新建文件。已有指南优先更新,不重复写第二份。每个 API 任务完成时同步补相应文档与可运行示例,不等全部 API 完成后才写教程。 +路径均相对 Core 仓库的 `shared/plugins/`,是后续交付目标,不是本 PR 新建文件。已有指南优先更新,不重复写第二份。每个 API 任务完成时同步补相应文档与可运行示例,不等全部 API 完成后才写教程。 | 文档 ID | 拟交付页面/更新位置 | 必须讲清楚什么 | 对应任务/阶段 | | --- | --- | --- | --- | @@ -340,13 +340,13 @@ Mac 当前声明的能力版本为:`backend:1`、`buildModelInputs:1`、`build 每个正式 API 页统一包含:稳定 ID/方法签名,调用方向,参数/结果/示例,最低宿主能力与 SDK 发布版本,权限与授权方式,窗口/工作区/插件作用域,dirty/路径/编码/位置语义,取消与截止时间,事件/释放,限制/分页,稳定错误,安全注意事项,以及成功、拒绝、旧版本和失效结果的测试链接。没有实现与发布证据的候选名不得出现在“可用 API”导航中。 -### 5.3 两仓库交付顺序 +### 5.3 Core 仓库的交付顺序 -1. 主仓库同一实现 PR 修改 Core、`shared/contracts/plugins/v1/`、Mac adapter、fixtures 和真实能力表。API 计划文档不代替 schema/契约,也不先放开未实现字段。 -2. 涉及后端协议变更,合并前在 lithe-plugin-docs 运行 `node scripts/sdk-e2e.mjs --source <本仓库路径> --ref <实现分支>`;覆盖 Node/Java 既有示例,修改 Rust SDK 时也覆盖 Rust 后端场景。 -3. 主仓库合并后,在 lithe-plugin-docs 运行 `node scripts/contract.mjs sync --revision <合并后的 preview commit>`,提交逐字节副本与 lock;不手改 `contract/v1/`。 -4. SDK、指南、示例和兼容性矩阵在文档仓库配套提交,锁定实际已支持宿主;正式 release 与哈希校验成功后再把该能力标成“已发布”。不能把正在开发的 main 当稳定 SDK 下载入口。 -5. 主仓库不重新保存 SDK、不让 CI 隐式依赖文档仓库浮动 main。本次纯计划未改契约/协议,因此不触发契约副本同步或 SDK 发版。 +1. 同一个 Core PR 修改 Core、`Lithe-core-rust/shared/plugins/contract/v1/`、fixtures 和真实能力表;宿主适配器(Mac adapter)在本仓库另提 PR,固定到该 Core PR 合入后的 commit。API 计划文档不代替 schema/契约,也不先放开未实现字段。 +2. 涉及后端协议变更,合并前在 Core 仓库根运行 `node shared/plugins/scripts/sdk-e2e.mjs`(测试当前工作树的 Core);覆盖 Node/Java 既有示例,修改 Rust SDK 时也覆盖 Rust 后端场景。 +3. 契约、`capabilities.rs`、`plugin_function.rs` 的改动,和[协议更新记录](https://github.com/Lithe-IDEA/Lithe-core-rust/blob/main/shared/plugins/reference/protocol-changelog.md)、[API 总表](https://github.com/Lithe-IDEA/Lithe-core-rust/blob/main/shared/plugins/reference/api-catalog.md)的登记,在同一个 Core PR 里完成;没有合并后的同步步骤。 +4. SDK、指南、示例和兼容性矩阵在同一个 Core PR 里配套提交,锁定实际已支持宿主;正式 release(Core 仓库的 `sdk-*` 标签)与哈希校验成功后再把该能力标成“已发布”。不能把正在开发的 main 当稳定 SDK 下载入口。 +5. 本仓库不保存 SDK;桌面端测试读取正在链接的那个 Core 检出里的契约(`desktop/internal/contractfixture`),CI 不隐式依赖浮动 main。本次纯计划未改契约/协议,因此不触发 Core PR 登记或 SDK 发版。 ## 6. 分阶段 PR 与交付门槛 @@ -391,7 +391,7 @@ Mac 当前声明的能力版本为:`backend:1`、`buildModelInputs:1`、`build | 索引 | 所有者与证据 | | --- | --- | -| S1 | [插件契约](../../shared/contracts/plugins/v1/README.md)、[Core 能力](../../rust/lithe-core/src/plugins/capabilities.rs)、[清单校验与激活事件](../../rust/lithe-core/src/plugins/declarative.rs)、[清单 schema](../../shared/contracts/plugins/v1/plugin-manifest.schema.json)、[Mac 能力表](../../macos/Sources/LitheModuleAPI/Plugins/PluginTypes.swift) | +| S1 | [插件契约](https://github.com/Lithe-IDEA/Lithe-core-rust/blob/main/shared/plugins/contract/v1/README.md)、[Core 能力](../../rust/lithe-core/src/plugins/capabilities.rs)、[清单校验与激活事件](../../rust/lithe-core/src/plugins/declarative.rs)、[清单 schema](https://github.com/Lithe-IDEA/Lithe-core-rust/blob/main/shared/plugins/contract/v1/plugin-manifest.schema.json)、[Mac 能力表](../../macos/Sources/LitheModuleAPI/Plugins/PluginTypes.swift) | | S2 | [backend 1](../../rust/lithe-core/src/plugins/backend.rs)、[函数协议](../../rust/lithe-core/src/lsp/interface/plugin_function.rs)、[Mac 后端会话](../../macos/Sources/Lithe/Platform/MacOS/Plugins/MacPluginBackendSessions.swift)、[宿主凭据服务](../../macos/Sources/Lithe/Application/Features/PluginHostServices.swift) | | S3 | [原生 UI 功能](../../macos/Sources/Lithe/Application/Features/PluginNativeUIFeature.swift)、[Core UI 校验](../../rust/lithe-core/src/plugins/native_ui.rs)、[已实现原生 UI Note](../../.agents/notes/implemented/feature/2026-10-21-declarative-native-plugin-ui.md) | | S4 | [Web bridge](../../macos/Sources/Lithe/Application/Features/PluginWebBridge.swift)、[包内内容](../../macos/Sources/Lithe/Platform/MacOS/Plugins/Web/MacPluginWebContent.swift)、[页面生命周期](../../macos/Sources/Lithe/Application/Features/PluginWebPageLifecycle.swift)、[状态存储](../../macos/Sources/Lithe/Platform/MacOS/Plugins/Web/MacPluginWebStateStore.swift) | diff --git a/docs/development/windows-plugin-parity-plan.md b/docs/development/windows-plugin-parity-plan.md index d9a3ebe1d0..a5f33cf9e2 100644 --- a/docs/development/windows-plugin-parity-plan.md +++ b/docs/development/windows-plugin-parity-plan.md @@ -24,7 +24,7 @@ | Windows 声明式宿主 [PR #1424](https://github.com/1lck/Lithe-IDEA/pull/1424) | OPEN,head 为 `ce0ef4dfa24002c29ced37ec5f6b345d83cffd2e`,目标 preview | 尚不能把在审宿主当作 preview 已有能力 | | macOS 能力表 | `macos/Sources/LitheModuleAPI/Plugins/PluginTypes.swift` 的 `PluginManifest.hostCapabilities` | 作为能力盘点入口,还要核对实际产品入口与矩阵限制 | | Windows 在审能力表 | PR #1424 的 `plugin_host/mod.rs::host_capabilities` | 只说明宿主接受哪些版本,不证明全部语义已验收 | -| 公共 SDK 与开发文档 | 已迁至 [lithe-plugin-docs](https://github.com/Lithe-IDEA/lithe-plugin-docs) | 不再使用主仓库旧 `sdk/node`、`sdk/java` 路径;测试固定外部提交与校验身份 | +| 公共 SDK 与开发文档 | 位于 Core 仓库的 [`shared/plugins/`](https://github.com/Lithe-IDEA/Lithe-core-rust/tree/main/shared/plugins)(`guides/`、`reference/`、`sdk/`);原 lithe-plugin-docs 已退役 | 不使用本仓库旧 `sdk/node`、`sdk/java` 路径;测试固定 Core 提交与校验身份 | 每个实施 PR 都从当时最新 preview 创建 `codex/` 分支。优先等前置 PR 合入后再开始依赖它的实现;必须提前验证时,可在隔离工作树试验并记录依赖,待前置合入后重新整理为可独立评审的差异。不要把别的工作树未提交文件当作依赖,也不要复制整个 `.artifacts`。 @@ -337,7 +337,7 @@ bun run typecheck 这些命令是按受影响范围选择的检查集合,不要求每个纯文档 PR 重建所有平台。矩阵 change gate 使用真实 PR base/head SHA;实现期间仍要在提交前按 Skill 检查实际改动范围。Rust 改动另执行相应 manifest 的 `cargo fmt --check`,涉及 Core 时先执行 Core 注释门禁。 -macOS/具备 zsh 的正式验证环境按相应 Skill 执行 `scripts/architecture/verify-shared-contracts.sh`、`scripts/rust-core/verify-rust-core.sh`、`scripts/macos/verify/verify-runtime-bundle-immutability.sh` 和相关 Swift 测试/计时 harness。`verify-agent-notes.sh` 只包装 Node 校验,可在 Windows 原样运行其 Node 入口;共享契约脚本包含多项语义检查,不能以“所有 JSON 能解析”冒充全脚本通过。安装资源的静态不可变检查也不能代替真实工作流前后的文件哈希比较。 +macOS/具备 zsh 的正式验证环境按相应 Skill 执行 `scripts/rust-core/verify-rust-core.sh`、`scripts/macos/verify/verify-runtime-bundle-immutability.sh` 和相关 Swift 测试/计时 harness。`verify-agent-notes.sh` 只包装 Node 校验,可在 Windows 原样运行其 Node 入口。契约、指南和参考文档的检查在 Core 仓库根运行 `node shared/plugins/scripts/verify-docs.mjs`,不能以“所有 JSON 能解析”冒充整套检查通过。安装资源的静态不可变检查也不能代替真实工作流前后的文件哈希比较。 ### 5.3 资源生命周期 @@ -378,7 +378,7 @@ macOS/具备 zsh 的正式验证环境按相应 Skill 执行 `scripts/architectu - [跨平台功能同步规则](platform-parity.md)。 - [应用边界](../../shared/contracts/application-boundary.md)与 [Rust Core API](../../shared/contracts/rust-core-api.md)。 -- [插件契约与 fixtures](../../shared/contracts/plugins/v1/README.md)。 +- [插件契约与 fixtures](https://github.com/Lithe-IDEA/Lithe-core-rust/blob/main/shared/plugins/contract/v1/README.md)。 - [插件市场与来源](../../.agents/notes/implemented/feature/2026-10-12-plugin-marketplace.md)。 - [构建系统契约](../../.agents/notes/implemented/architecture/2026-10-17-build-system-plugin-contract.md)。 - [插件设置注册面](../../.agents/notes/implemented/architecture/2026-10-21-plugin-settings-surfaces.md)。 diff --git a/scripts/desktop/build-desktop-core.sh b/scripts/desktop/build-desktop-core.sh index fbd9efadd1..4be15579ac 100755 --- a/scripts/desktop/build-desktop-core.sh +++ b/scripts/desktop/build-desktop-core.sh @@ -28,12 +28,10 @@ native_path() { } PINNED_CORE_REPOSITORY="https://github.com/Lithe-IDEA/Lithe-core-rust.git" -# Lithe-core-rust main after Lithe-IDEA/Lithe-core-rust#8 merged: gitExecution.reportQueries -# records internal queries in the Git console, and commits take an author and a sign-off; on top -# of #7 (git.stashes keeps each reference as stash@{N}), #6 (the git_worktree_* refusal codes of -# the worktree writes) and #4 (git_authentication_failed code, featuresChanged completionOptions, -# rangeFormatting and formattingOptions used by the Viva client). -PINNED_CORE_REVISION="1122fdeaa36c3308fc9db4412a4b9ea0ddffa6b9" +# Lithe-core-rust feature/plugin-api-single-baseline: the plugin contract is one baseline with +# pluginAPIVersion and every capability, protocol and document version at 0; on top of main at +# #15 (word-level changed ranges in diff rows and the Git write-field documentation). +PINNED_CORE_REVISION="83f853d278d34da551348248a5d8f2416c983ed5" PROFILE="debug" while [[ $# -gt 0 ]]; do case "$1" in diff --git a/scripts/desktop/desktop-go.sh b/scripts/desktop/desktop-go.sh index 197b84ac77..72974a48b5 100755 --- a/scripts/desktop/desktop-go.sh +++ b/scripts/desktop/desktop-go.sh @@ -83,6 +83,14 @@ STAGE_DIR="$("$ROOT_DIR/scripts/desktop/build-desktop-core.sh" "$PROFILE_FLAG")" # Packaging reads the staged helper to embed it; development runs use it directly so the IDE # Connection page is testable without a packaged build. export LITHE_CORE_STAGE_DIR="$STAGE_DIR" +# The plugin contract has one copy, in the core checkout that was just built: tests read its +# fixtures through internal/contractfixture. This mirrors the checkout build-desktop-core.sh uses. +if [[ -n "${LITHE_CORE_RUST_DIR:-}" ]]; then + CORE_CHECKOUT="$(cd "$LITHE_CORE_RUST_DIR" && pwd -P)" +else + CORE_CHECKOUT="$ROOT_DIR/.artifacts/desktop/lithe-core-rust/source" +fi +export LITHE_PLUGIN_CONTRACT_DIR="$(native_path "$CORE_CHECKOUT/shared/plugins/contract/v1")" if [[ -x "$STAGE_DIR/bin/lithe-mcp" ]]; then export LITHE_IDE_HELPER="$STAGE_DIR/bin/lithe-mcp" elif [[ -x "$STAGE_DIR/bin/lithe-mcp.exe" ]]; then diff --git a/shared/contracts/plugins/v1/README.md b/shared/contracts/plugins/v1/README.md deleted file mode 100644 index 6a6b901828..0000000000 --- a/shared/contracts/plugins/v1/README.md +++ /dev/null @@ -1,4555 +0,0 @@ -# Plugin contract v1: declarative plugins - -A declarative plugin currently describes language support or first-stage UI contributions as data. The host reads -`plugin.json`, validates it, checks the applicable signature or community approval, and launches the -declared external processes itself. The host never loads plugin code into its -own process, so a package does not depend on the host's binary layout and does -not need to be rebuilt for each Lithe release. - -This directory is the cross-platform source of truth: - -| Path | Purpose | -| --- | --- | -| `plugin-manifest.schema.json` | JSON shape of `plugin.json` | -| `native-ui.schema.json` | JSON shape of native UI documents rendered by the host | -| `plugin-index.schema.json` | JSON shape of a marketplace source index | -| `fixtures/` | Valid example manifests and golden cases, one folder per contract area (below). Manifests are named after the capability they exercise rather than a published plugin. Case files name their base manifest by file name, so file names are unique across the folders | -| `toolchains/README.md` | Implemented Core foundation: plugin definitions/provider declarations, registry (a short tool ID defined by several enabled plugins belongs to none of them), reply validation, directory pins, snapshot resolution, version matching and discovery plans; macOS uses it for its read-only settings pages and for Build and run tools, Windows is not connected | - -| Fixture folder | Contents | -| --- | --- | -| `fixtures/manifest/` | `hello-lithe.plugin.json`, the smallest UI plugin, and `invalid-manifests.json`: edits to a valid manifest and the rejection code every host must report | -| `fixtures/languages/` | Language support: packaged, system-command, and host-integration language servers, `node-runtime` for a discovered runtime, and `language-grammar` with `grammars/`; `command-plans.json` holds golden run/test command expansions and language-server launch plans, `runtime-versions.json` the golden outcomes of the launch runtime version check; `language-server-backend-launch.plugin.json` is a language server whose backend resolves the launch and a session policy (`languageServers` 3, `serverProcess` 3), and `language-server-launch-resolution.json` holds its golden first-step plans and decoded answers | -| `fixtures/backend/` | Plugin backends (`backend`, `backend-workspace`, `command-backend`, `terminal-backend`); cross-plugin calls (`plugin-functions-exporter`, `plugin-functions-caller`); `function-protocol.json` holds golden plugin-function negotiation, registration, invocation, outcome, progress, and refusal cases, `plugin-logging.json` the golden `litheLogging` negotiation and notifications | -| `fixtures/editor/` | Editor actions served by a backend: `editor-actions.plugin.json`, version 2 icons, alternatives and click results in `editor-actions-v2.json`; editor providers in `editor-providers.plugin.json` with registration and result cases in `editor-providers.json` | -| `fixtures/ui/` | Native controls, forms, and panels, and a web panel | -| `fixtures/settings/` | Plugin settings declared with `settings: 2` | -| `fixtures/build-systems/` | Level 3 build systems (`build-*`: static file, command output, host integration, instance options, model producer and consumer, tool path, toolchains); `build-plans.json` holds golden build-system plans and decoded outputs | -| `fixtures/build-providers/` | Build providers (`build-provider*`) and the golden cases of their configuration, run options, run and debug preparation, execution, and test protocols | -| `fixtures/debug-adapters/` | Debug adapters (standalone, served by a language server, remote attach, and `debug-adapter-features` with declared features and defaults), `debug-adapter-rejections.json`, and `debug-start.json`: what `debug.decodeBackendConfiguration` returns for each `debug/start` case | -| `fixtures/run/` | Run sessions and console links: `tool-reference-launch` names its runtimes by tool-definition ID (`serverProcess` 4) and declares output link matchers; `run-start.json` holds what `run.decodeStart` returns for each case, including the rejections, and `output-link-matchers.json` the golden matches and resolutions | -| `fixtures/vcs/` | A version control provider | -| `fixtures/keymap-import/` | Two independent shortcut import providers sharing one packaged backend | -| `fixtures/project-generators/` | Project generators: template files (`templates/`), a scaffolding command, and an archive download; `project-generator-tool-field.plugin.json` with `templates/tool-field/` picks tool installations with `tool` fields (`projectGenerators` 2); `project-plans.json` holds golden `project.*` form evaluations, generation plans, and name checks, and a case's optional `manifest` names the fixture it runs against (the version 1 generator by default) | -| `fixtures/toolchains/` | Production-shape fixtures for tool definitions and a packaged toolchain provider; they require `toolDefinitions` and `toolchainProviders`, which only macOS advertises | -| `fixtures/package-trust/` | `publisher-bundled.plugin.json` and `signature-vectors.json`: public cross-platform vectors for the package publisher signature: the RFC 8032 test key, a fixed package with non-ASCII file names, its canonical payload, RFC 8032 deterministic signature, and content digest. Both platforms must build the same canonical payload and digest and accept the recorded signature; signers that add randomness, such as CryptoKit, check the signature by verification instead of byte comparison | -| `fixtures/marketplace/` | Marketplace index, availability, source URL, and install review golden cases | - -Validation and template expansion are implemented once in Rust Core -(`rust/lithe-core/src/plugins/`, with build systems in -`rust/lithe-core/src/build/`) and exposed through the -`plugins.declarative.*` commands in [`shared/contracts/rust-core-api.md`](https://github.com/1lck/Lithe-IDEA/blob/preview/shared/contracts/rust-core-api.md). Hosts must not -reimplement them. - -Plugin authors do not need this repository. The public -[`Lithe-IDEA/lithe-plugin-docs`](https://github.com/Lithe-IDEA/lithe-plugin-docs) -repository holds the developer guide and a byte-identical copy of this whole -directory under `contract/v1/`, pinned to a revision of this repository; each -schema's `$id` is its URL there. Contract changes land here first and must then -be synced to that repository, so links in this file that leave this directory -are absolute. `plugin.json` may not carry a `$schema` key, because unknown -fields are rejected; editors associate the schema by file name instead. - -## Plugin-owned toolchains (Core foundation) - -The design follows the rewrite plan in -[PR #1581](https://github.com/1lck/Lithe-IDEA/pull/1581#issuecomment-6541366112). -All tool definitions belong to enabled plugins; the host supplies only generic -query, validation, resolution, persistence, and presentation mechanisms. It -does not add a built-in tool-definition table or interpret version-manager -configuration formats. - -The [implemented Core contract](toolchains/README.md) now accepts `toolDefinitions: 1` -and `toolchainProviders: 1` declarations and provides the `toolchains.*` commands -listed there. -`executableResolution: 2` applies to tool-definition candidates only; it does not -admit new sources into existing Build candidate sets. Definitions are entirely -plugin-owned. Any plugin may define a short ID such as `compiler` or a qualified -`:`; the host supplies no provenance evidence. A short ID defined -by more than one enabled plugin belongs to none of them: the registry omits -those definitions and reports the contest as a conflict. - -macOS advertises these capabilities for its read-only toolchain settings pages. -The native adapter scans declarations, probes checked executables, queries plugin -backends and watches their inputs; Core consumes captured facts and owns validation -and resolution. A separate fresh resolution serves Build tools and run plans -whose `toolchain` executable names a plugin-defined tool rather than a host -toolchain; settings detections never grant launch authority. Windows does not advertise the capabilities. Saving pins, -`toolchainConsumers`, generic runtime launches and live backend activation remain -unsupported, and Java and language-server consumers keep their previous adapters. Version-manager -implementations such as mise belong to their own plugin packages. See -[the implemented slice](toolchains/README.md). - -## Shortcut import providers (Core foundation) - -`keymapImportProviders` contains one to eight `{id, displayName, recognition, inputs}` entries. -IDs are unique within the plugin, start with a lowercase letter, contain only -lowercase ASCII letters, digits and hyphens, and are at most 64 bytes. The -plugin requires `keymapImportProviders: 1`, `backend: 2`, `serverProcess: 1`, -`backend.launch`, `keymaps.provide` and `keymaps.readSelectedSources`. Its backend starts from a packaged -executable or packaged runtime without discovered runtime dependencies. The -host starts it for an explicit import; it is not a startup or workspace-open -activation event. The permission permits offering mappings; it grants no file -access on its own. `keymaps.readSelectedSources` authorizes only the provider's -declared inputs under the source directory the user explicitly selected for this -import, and only for the lifetime of that import. - -`recognition` lists one to sixteen distinct metadata-only probes. A -`{kind: "file" | "directory", path}` probe matches an entry of that kind -beneath the selected root, using the input path restrictions and refusing -symlinks. A `{kind: "root", base: "userConfig", components}` probe matches -the selected directory's exact path beneath the platform's user configuration -directory (macOS Application Support, Windows roaming AppData). Components -contain one to eight safe literal names and may end in one `*`, matching -exactly one directory component; the first component must be literal. The -source matches any probe. Recognition never authorizes reading file contents -or discloses the absolute path to the provider. A host may use probes without -launching backends, and must recheck them on import. - -`inputs` lists one to sixteen unique selectors. `{kind: "file", path}` selects -one relative file; `{kind: "directory", path, extension}` selects immediate -children of that directory with the exact lowercase alphanumeric extension, -never recursive descendants. Paths have at most 256 characters, contain no -empty, `.` or `..` segments, backslashes, colons, wildcards, control characters, -or segments ending in a dot or space. Directory selectors have at most 64 -matches after scanning at most 4096 directory entries. The native reader must reject symlinks and paths escaping the -selected root, bound each file to 1 MiB and the snapshot to 8 MiB, and expose -only scoped opaque handles in chunks of at most 128 KiB. A manifest cannot -authorize arbitrary paths or access an unselected source. - -Core offers `experimental.litheKeymapImport: {versions: [1], providers}` only -to a plugin-owned session with declared providers. The backend selects a -nonempty duplicate-free subset as `{version: 1, providers}`. A request to an -unselected provider is refused. `lithe/keymap/import` carries only -`{providerID, snapshotID}`. The snapshot is an opaque host-owned reference; -the provider never interprets it as a path. Core bounds the operation and -validates normalized results against the host's action catalog. Providers own -source formats and must not silently promote conditional or multi-stroke rules -to global shortcuts. The exact Core commands, limits and fixtures are in the -[Rust Core API](https://github.com/1lck/Lithe-IDEA/blob/preview/shared/contracts/rust-core-api.md#normalized-shortcut-import-validation). - -When granted individually, protocol 3 methods `lithe/host/keymapImport/listInputs` -and `lithe/host/keymapImport/readChunk` take `snapshotID` and `providerID`. -Listing returns `{files: [{id, path, byteCount}]}`; a read additionally takes -`fileID`, a nonnegative `offset` and `maximumBytes` from 1 through 131072 and -returns `{data}` containing base64 bytes. Paths are relative to the selected -root and file IDs are opaque. The host binds snapshots to their plugin, session -and provider, revokes them when the import or session ends, and rejects files -replaced or changed after capture. A new snapshot for that provider revokes the -previous one. Errors never disclose absolute paths. - -macOS advertises `keymapImportProviders` 1 and implements the scoped reader. -Windows has no import source reader and does not advertise the capability; a -host advertises it only with the complete import workflow. The official Node, -Java and Rust SDKs implement `litheKeymapImport` 1. - -## Package layout - -```text -/ -├── plugin.json # this contract -├── lithe-plugin-signature.json # publisher signature over every other file -└── … # resources referenced by plugin.json -``` - -Every path in `plugin.json` is relative to the package root, uses `/`, and may -not contain `..`, a leading `/`, a backslash, or NUL. Packages may not contain -symbolic links. A host treats an installed package as read-only. - -## Manifest - -| Field | Meaning | -| --- | --- | -| `schemaVersion` | Always `2`. Schema `1` was the retired macOS native-bundle manifest; hosts refuse it with `plugin.schema.unsupported`. | -| `id` | Stable plugin ID: lowercase letters, digits, `.` and `-`. | -| `displayName` | Name shown in plugin management. | -| `version` | Plugin version, `major.minor.patch`. Independent of the Lithe version. | -| `pluginAPIVersion` | Declarative plugin API level of the manifest format. Hosts list the levels they support; Lithe's own version is never used for compatibility. This contract defines levels `1`, `2`, `3`, and `4`; see [API levels](#api-levels). | -| `requires` | Level 3 only, and required there: every capability the manifest uses, with the version of that capability's contract it was written against; see [Capability versions](#capability-versions-level-3). | -| `vendor` | `id`, `displayName`, and `signatureRequirement` (see Trust). | -| `permissions` | Capabilities the plugin may ask the host to perform. | -| `activationEvents` | When the host may start each provider. | -| `languages` | Languages the plugin recognizes. | -| `languageServers` | At most one language server per declared language. | -| `executionProviders` | At most one run/test provider per declared language. | -| `settings` | User-adjustable plugin options (level 2 and later). | -| `ui` | Host-rendered tool windows and commands (level 2 and later). | -| `buildSystems` | Project-level build tools (level 3). | -| `toolDefinitions` | Plugin-owned tool policy ([Core foundation](toolchains/README.md)); requires `toolDefinitions: 1` and `executableResolution: 2`; macOS hosts read-only discovery and resolves Build and run tools. | -| `toolchainProviders` | Backend fact-provider declarations ([Core foundation](toolchains/README.md)); requires `toolchainProviders: 1`, backend/server-process capabilities and `toolchains.provide`. | -| `keymapImportProviders` | Independent shortcut import providers; requires `keymapImportProviders: 1`, `backend: 2`, `serverProcess: 1` and `keymaps.provide`. macOS provides access to explicitly selected sources; Windows does not yet advertise this capability. | -| `pluginFunctions` | [Functions the plugin exports to, and calls from, other plugins](#cross-plugin-calls-protocol-version-4); requires `pluginFunctions: 1`, `backend: 2` and `serverProcess: 1`, and grants no permission. macOS relays the calls; Windows does not advertise this capability. | - -Unknown fields are refused (`plugin.manifest.invalid`) so an older host -rejects a package instead of ignoring part of it. At levels 1 and 2 a new -field needs a new `pluginAPIVersion`. From level 3 on it needs a new version -of the one capability that owns it, and only plugins that use the field -declare that version. - -### Languages - -`id` is lowercase (`[a-z0-9+_-]`). `fileExtensions`, `fileNames`, and -`projectFileNames` are matched case-insensitively; at least one must be -present. A leading dot is optional only in `fileExtensions` (`.php` equals -`php`). In complete file names, project markers, and management file names it -is part of the name, so `.toolrc` and `.env.example` stay hidden-file names. Optional `dependencies` lists `managementFileNames`, -`projectDependencyPaths`, and `projectBinaryPaths` relative to the project. - -#### Grammars and editor configuration (`languages` 3) - -`languages` 3 adds two optional fields to a language. Both are data: the host -reads them from the package and the editor applies them without starting any -process, so a language with a grammar needs no language server, backend, or -activation event, and a plugin may consist of grammars alone. - -```json -{ - "id": "http", - "displayName": "HTTP Request", - "fileExtensions": ["http", "rest"], - "grammar": { "kind": "textmate", "path": "grammars/http.tmLanguage.json" }, - "configuration": { - "lineComment": "#", - "blockComment": ["/*", "*/"], - "brackets": [["{", "}"], ["[", "]"]], - "autoClosingPairs": [["{", "}"], ["\"", "\""]] - } -} -``` - -- `grammar.kind` names the highlighting engine. Version 3 defines only - `textmate`; another engine is added as a new kind in a later version, so a - plugin can move between engines without changing anything else. -- Version 2 defined `monarch`, the JSON form of a Monaco Monarch tokenizer. - The desktop editor does not embed Monaco, so version 2 is withdrawn: Core - does not support it, and a manifest that requires `languages: 2` is - `plugin.api.unsupported`. A Monarch grammar is rewritten as a TextMate - grammar under `languages: 3`; the manifest changes only in `kind`, `path`, - and the required version. -- This is a static package contribution: `languages[]` belongs to the manifest - and `grammar.path` references a package JSON file. No public host method accepts - inline grammar JSON to dynamically register, replace, or dispose a highlighting - provider. Live installation/update/withdrawal of eligible static packages does - not imply such an API or automatic reload after arbitrary file changes; - installed packages remain read-only. -- Adding another language or grammar using the supported structure needs only - plugin data; changing its rules does not itself raise the API version. A new - engine or capability kind still needs an implemented host adapter and an - explicit contract; an arbitrary new `kind` string cannot supply one. -- This contribution does not register completion, hover, definition, symbol, - formatting, rename, or Code Action providers backed by ordinary plugin - functions. A backend binds the provider types a host routes with - [`editor/registerProviders`](#editor-language-feature-providers-protocol-version-3); - existing LSP support and `editor/registerActions` are separate capabilities. -- `grammar.path` is a package-relative file that stays inside the package. - Hosts read it read-only from the installed package, pass its text to - `plugins.declarative.decodeGrammar`, and register the returned `source`, the - text Core validated byte for byte, under the returned `scopeName`. A grammar - Core refuses is `plugin.grammar.invalid` with the failing field (such as - `grammar.repository.string.patterns[2].begin`); the language then opens as - plain text and the rest of the plugin keeps working. -- A TextMate grammar is the JSON form VS Code reads, a `.tmLanguage.json` - file; plist and YAML grammars are converted to JSON first. The fixture - [`fixtures/languages/grammars/http.tmLanguage.json`](fixtures/languages/grammars/http.tmLanguage.json) - is a complete example. A grammar is an object with `scopeName`, 1 to 128 - bytes of ASCII letters, digits, `.`, `-`, `_`, and `+`, and a `patterns` - array, and optionally `repository` and `name`. Every rule is an object. The - editor reads `include`, `match`, `begin`, `end`, `while`, `name`, - `contentName`, `captures`, `beginCaptures`, `endCaptures`, `whileCaptures`, - `patterns`, `repository`, and `applyEndPatternLast` (`true`, `false`, `0`, - or `1`), and Core refuses a grammar where one of them has another type. - Captures are an object keyed by group number or an array by position; - object keys that are not group numbers are ignored. Every other key, such as - `comment`, `fileTypes`, `firstLineMatch`, or `uuid`, is ignored and not - checked. -- Core accepts at most 2 MiB, 16384 rules counting every pattern, repository - entry, and capture, rules nested 32 deep, regexes of 32 KiB, capture group - 4096, `name` and `contentName` of 1024 bytes, and `include` targets and - repository keys of 256 bytes. VS Code's own grammars, the largest of which is - C++ at 662 KiB and 3165 rules, are well within these bounds. -- Regexes use the Oniguruma syntax TextMate grammars are written in. Core does - not compile them: a pattern the editor's engine cannot compile never - matches, and the rest of the grammar still applies. -- `include` is `$self`, `$base`, `#name` for a repository entry, or `scope` or - `scope#name` for another grammar. Another grammar resolves against those the - editor has, its own and those of enabled plugins, which is how a grammar - embeds a language such as CSS inside HTML; an include that resolves to - nothing matches nothing, as in VS Code. `injections` and `injectionSelector` - are not supported, so they are ignored and not checked. -- A plugin grammar replaces the editor's own grammar of the same `scopeName` - while the plugin is enabled. Two plugin languages cannot register the same - scope: the first keeps it, and the other is reported and opens as plain - text. -- `configuration` sets `lineComment`, `blockComment` (open and close), - `brackets`, and `autoClosingPairs`. Each delimiter is 1 to 16 bytes without - control characters; each list has at most 32 pairs. -- Plugin grammars never run on the editor UI thread. The host bounds the - backtracking of each regex search and the time one line may take, so a - grammar cannot stall editing; a line not yet tokenized, or that the grammar - could not tokenize within that budget, is drawn as plain text. -- Declaring `languages: 3` without using either field is - `plugin.manifest.invalid`; using them under `languages: 1` is too. - -### Language servers - -| Field | Meaning | -| --- | --- | -| `languageID` | A declared language. | -| `languageIdentifier` | LSP `languageId` for documents; defaults to `languageID`. | -| `launch` | `{"kind": "packaged", "path": …}` runs an executable inside the package. `{"kind": "systemCommand", "commands": [...]}` lists bare command names the host resolves with its tool discovery (PATH, project toolchains, user overrides). API 2 adds `{"kind": "runtime", …}`; see Runtime launch. `serverProcess` 3 adds `{"kind": "backend", …}`, whose command line the plugin backend answers at each start; see [Backend-resolved launch](#backend-resolved-launch-serverprocess-3). | -| `arguments` | Arguments passed to the server. Literal text at API 1; launch templates at API 2. | -| `validationArguments` | Probe that must exit with status 0 before a candidate is used; empty means the host trusts the candidate and lets the LSP handshake decide. | -| `runtimeDependencies` | Runtimes the host must discover and pass to the server. The host runtimes are `node` and `go`; any other valid short tool-definition ID names the tool definition with that ID (see [Tool references](#tool-references-serverprocess-4)). The host exports each path as `LITHE__PATH` (`LITHE_NODE_PATH`, `LITHE_GO_PATH`; a user-set value takes precedence) and prepends its directory to the server's `PATH`, because servers such as gopls run the tool themselves and an app opened from the Dock does not inherit the shell `PATH`. A project-local copy is never chosen, since servers start automatically when a file opens. | - -| `initializationOptions` | API 2. A JSON object sent as the LSP `initializationOptions`. Every string value inside it is a launch template. | -| `hostIntegration` | API 2. Any plugin may declare one. A named integration implemented in the host, with the package resources it reads; see Host integrations. | -| `requestMethods`, `commands`, `serializedCommands`, `forwardNotifications`, `state`, `remote` | `languageServers` 3. What the plugin backend may ask of the running server and how the host keeps its state; see [Plugin-owned sessions](#plugin-owned-sessions-languageservers-3). | - -The host owns the language-server process lifecycle, the LSP session, and -stopping the process when the provider is disabled. An API 3 build provider is -the same kind of process: it declares `launch`, `arguments`, -`validationArguments`, `runtimeDependencies`, and `initializationOptions` with -the same meaning and validation; see [Build providers](#build-providers). - -#### Runtime launch (API 2) - -`{"kind": "runtime", "tool", "packagedRuntime"?, "minimumVersion"?, -"runtimeArguments"?, "entry"}` starts a file inside the package with a -runtime, so the package needs no launcher script. The runtime is either -shipped by the plugin (`packagedRuntime`) or discovered by the host. - -| Field | Meaning | -| --- | --- | -| `tool` | `node`, the host runtime, or a tool-definition ID whose definition decides how the entry is passed (see [Tool references](#tool-references-serverprocess-4)). | -| `packagedRuntime` | Package-relative path of the runtime executable the plugin ships, for example `runtime/${arch}/bin/node`; `${arch}` is the only variable it may use. The host starts exactly this file: it never looks the tool up on the machine, and no user override or other plugin can replace it. A plugin that needs a specific runtime owns it this way, so the host carries no knowledge of where that runtime lives. It excludes `minimumVersion`. | -| `minimumVersion` | Lowest acceptable runtime version: one to three dot-separated numbers such as `21` or `18.17`, for a runtime the host discovers. Only the components it names are compared, so `21` accepts every 21.x. A runtime whose version cannot be read does not qualify. | -| `runtimeArguments` | Launch templates placed before the entry, such as runtime options. | -| `entry` | Package-relative entry file. For `node` the command line is ` `. | - -The launch tool is already a requirement and must not be repeated in -`runtimeDependencies`. A runtime launch declares no `validationArguments`: -the host's probe of the runtime is its version check. For `node` the launch -plan carries the probe's `versionArguments` (`--version`); the host runs the -candidate with them, capturing stderr together with stdout, and passes the -output to `plugins.declarative.checkRuntimeVersion`, which returns -`{satisfied, version?}`. A candidate that does not satisfy the requirement is -not used, the same as a candidate that fails a validation probe. The reported -version is the first dotted number on the first output line that contains a -digit; see `fixtures/languages/runtime-versions.json`. Core probes no other -runtime: `checkRuntimeVersion` answers `plugin.runtime.unsupported` for any -other `tool`. - -Any other valid short tool-definition ID in `tool` (lowercase letters, digits -and `-`, starting with a letter, at most 64 characters) is an implicit -reference to the tool definition with the same ID, at every `serverProcess` -version. Its launch plan has the tool shape of -[Tool references](#tool-references-serverprocess-4): the definition's `launch` -template places the entry, and `toolchains.checkVersion` checks -`minimumVersion`. The host adds no runtime-specific option such as a `-jar` -flag; the definition's template supplies whatever the tool needs. - -#### Tool references (`serverProcess` 4) - -`serverProcess` 4 stops naming runtimes from the host's closed lists (the -`tool` values that versions 1 to 3 accept) and names them by -[tool-definition ID](toolchains/README.md) instead, so a host never learns a tool from -a name. The plugin lists every tool it starts -a process with in the top-level `requiresTools`, and the definitions come from -`toolDefinitions` of the plugin itself or of another enabled plugin. - -| Field | Meaning | -| --- | --- | -| `requiresTools` | At most 32 tool-definition IDs, each short (`interpreter`) or plugin-qualified (`org.example.tools:interpreter`), without duplicates; stored sorted. Present exactly when `requires.serverProcess` is 4: the version without the list is `plugin.manifest.invalid` at `requires.serverProcess`, the list without the version is invalid at `requiresTools`. | -| `launch.tool` of a `runtime` launch, `runtimeDependencies[].tool`, `runSelectedRuntime.tool` of a debug adapter | A tool-definition ID that `requiresTools` lists. An ID it does not list is `plugin.runtime.undeclared` with the `field` that names it. Versions 1 to 3 accept the closed lists (`node` to launch an entry, `node` and `go` as dependencies) and, without `requiresTools`, any valid short tool-definition ID as an implicit reference to the definition with the same ID; only an invalid ID is `plugin.runtime.unsupported`. | - -The definition, not the host, decides how its executable starts an entry: its -`launch` template says where `runtimeArguments`, the entry and `arguments` go -(`["${executable}", "${runtimeArguments}", "${entry}", "${arguments}"]` runs -` `, a template without `${entry}` -runs no entry). The launch plan of a version 4 process therefore returns the -parts, not a command line: - -| Field | Meaning | -| --- | --- | -| `launch` | `{kind: "tool", tool, entry, runtimeArguments, minimumVersion?, packagedRuntime?}`. `entry` is the absolute path of the package file, `runtimeArguments` are expanded, and `packagedRuntime` is the expanded path of a runtime the plugin ships (the host then uses that file as the tool's executable and never looks the tool up). | -| `arguments` | Only the plugin's own arguments; the host places them where the definition's `${arguments}` is. | -| `runtimeRequirements` | `{kind: "tool", tool, minimumVersion?}` for every tool the host must resolve. | - -The host resolves each tool through the four layers of -[toolchains/README.md](toolchains/README.md), checks `minimumVersion` with -`toolchains.checkVersion`, and expands the start with `toolchains.instantiateLaunch`. -A tool that resolves to no executable is `plugin.host.toolUnresolved` -(`details.reason` says why). See `fixtures/run/tool-reference-launch.plugin.json`. - -#### Host integrations (API 2) - -Most of a language server is described by its launch. A few servers also need -behavior that data cannot express: a project model computed from build files, -virtual documents, test and debug wiring. That behavior is code in the host, -called a host integration. A server opts into one by name and tells it where -the files it needs are inside the plugin's own package: - -```json -"hostIntegration": { - "id": "jdt", - "capabilities": ["debug", "run", "testing"], - "resources": { "configuration": "language-server/configuration/${arch}", "lombokAgent": "…" } -} -``` - -The plugin owns the files; the host owns the behavior. The host enables an -integration only for the server that declares it and never matches on a -language ID or looks for the files anywhere else, so removing the plugin -removes the integration's inputs with it. Any plugin may declare one, whatever -its namespace. The integration is host code, but it reads only resources inside -the declaring plugin's own package and hands them to the language server or -helper process that same plugin starts (extension bundles, agents, a test -runner, debugging); it grants the plugin no permission beyond running its own -server process, which an installed plugin may already do once the user confirms -the install review. An ID the host does not implement is refused with -`plugin.integration.unsupported`. A build system's `hostIntegration` is a -different declaration and stays limited to official plugins; see -[Host integrations](#host-integrations) under API level 3: build systems. - -Each resource is a package-relative path, or a list of them, that may vary -only by `${arch}`. An integration defines which names it reads; a missing -required name, an unknown name, or the wrong shape is `plugin.manifest.invalid`. - -A plugin that declares a language owns its process-backed features: the host -stops running its built-in tools for that language, so a missing or disabled -plugin never falls back to them. `capabilities` is how the plugin hands a -feature back. It lists the features of the server's language that the host's -own implementation provides through the integration: `run`, `testing`, and -`debug`. A feature that is neither listed here nor supplied by one of the -plugin's `executionProviders` is unavailable for the language. Omitting the -list claims nothing. - -Each integration defines the capabilities it provides and the resources each -one reads. A capability the integration does not provide, a capability whose -resource is not declared, and `run` or `testing` listed for a language whose -execution provider already supplies it are all `plugin.manifest.invalid`. The -normalized manifest lists capabilities sorted and without duplicates. - -| Integration | Requires | Capabilities | Resources | -| --- | --- | --- | --- | -| `jdt` | A `runtime` launch with the `java` tool | `run`. `debug`: needs `extensionBundleDirectories`, which must contain the Java Debug Server bundle. `testing`: needs `extensionBundleDirectories` with the Java Test bundles, and `testRunner`. | `configuration` (required): the Equinox configuration directory, of which the host gives each launch a writable copy. `lombokAgent` (required): the Lombok agent JAR. `extensionBundleDirectories` (list): directories whose JAR files are loaded as JDT LS extension bundles, in declared order and then by file name. `testRunner`: the standalone Java test runner JAR. | - -The launch plan returns `hostIntegration` as `{id, resources}` with every -path expanded, and lists the paths in `requiredPackagePaths`. - -#### Launch templates (API 2) - -`arguments`, `validationArguments`, `runtimeArguments`, and the string values -of `initializationOptions` may use these variables. A package therefore never -contains a machine path, and the host decides where state lives. - -| Variable | Value | -| --- | --- | -| `${pluginDir}` | Root of the installed, read-only package. It must be used at most once per value and be followed by a `/`-rooted path inside the package; that path may vary only by `${arch}`. | -| `${stateDir}` | Writable directory the host keeps for this plugin's server and removes when the plugin is uninstalled. Not available in `validationArguments`. | -| `${workspaceStateDir}` | Writable directory for the server's state of the current workspace. Not available in `validationArguments`, nor in a [plugin backend](#plugin-backend), which belongs to no workspace. | -| `${logDir}` | Absolute current-session `plugins//files/` directory, explicitly supplied by the host as `logDirectory`. Available for language servers and plugin backends, never in `validationArguments`. The host creates it in writable log storage, outside the installed package; Core does not derive it from package resources. | -| `${arch}` | Host CPU architecture: `arm64` or `x86_64`. | -| `${setting:}` | Current value of a declared [plugin setting](#plugin-settings-api-2). Not available in `validationArguments`, and never inside a package path. | - -`plugins.declarative.languageServerLaunchPlan` expands a server's launch. The -host selects the process with exactly one of `languageID` (a language server), -`buildSystemID` (a build provider), `vcsProviderID` (a VCS provider), and -`backend: true` (the [plugin backend](#plugin-backend)), passes `{pluginDirectory, -stateDirectory, workspaceStateDirectory?, logDirectory?, temporaryDirectory?, architecture, -settings?}`, and receives. `workspaceStateDirectory` may be omitted only when the selected -process does not use `${workspaceStateDir}`; otherwise the request is -`plugin.launch.invalidRequest`. The same error applies when a template uses `${logDir}` but `logDirectory` is absent, empty, or not absolute. - -| Field | Meaning | -| --- | --- | -| `owner` | `{pluginID, version}` of the installed package Core validated for this plan. The host starts the server for that exact installation and uses this identity, not one it read elsewhere, when it later relays requests or reports the session. | -| `launch` | `{kind: "packaged", path}`, `{kind: "systemCommand", commands}`, or `{kind: "runtime", tool, entry, packagedRuntime?, minimumVersion?, versionArguments?}`: what the host resolves to an executable. `packagedRuntime` is the expanded package-relative path of a shipped runtime. `minimumVersion` and `versionArguments` appear together when a discovered runtime must meet a minimum version. A `runtime` launch whose `tool` names a tool definition, by `serverProcess` 4 or implicitly, returns the `{kind: "tool", …}` shape of [Tool references](#tool-references-serverprocess-4) instead. A [backend-resolved launch](#backend-resolved-launch-serverprocess-3) returns `{kind: "backend", function, timeoutMilliseconds}` here, and `{kind: "tool", tool}` appears in the plan `plugins.languageServers.decodeLaunch` returns. | -| `arguments` | Complete argument list after the executable, including the entry of a `node` runtime launch. A tool-shaped launch returns only the plugin's own arguments. | -| `validationArguments` | Expanded probe arguments. | -| `runtimeRequirements` | `{tool, minimumVersion?, kind?}` for every runtime the host must discover, a discovered launch tool included, sorted by tool. `kind: "tool"` marks a tool definition the host resolves through [toolchains](toolchains/README.md); without it the tool is a host runtime. A packaged runtime is not listed. Only the launch tool can carry a minimum version. | -| `initializationOptions` | Expanded options; absent when the server declares none. | -| `requiredDirectories` | `state`, `workspaceState`, `log`, and/or `temporary`: the directories the host must create before starting the server. | -| `requiredPackagePaths` | Sorted package-relative paths the launch points at. The host verifies each is inside the package and not a symbolic link before starting the server. | -| `settings` | Effective value of every declared setting that produced this plan; absent when the plugin declares none. | -| `resolveParams` | Present only for a backend-resolved launch: the params of the launch function, without the `context` and the optional `tools` the host adds. | -| `environment`, `writablePaths` | Present only in the plan `decodeLaunch` returns: the variables of the process, and the paths it writes. | -| `sessionPolicy` | Present for a language server of `languageServers` 3: the [session policy](#plugin-owned-sessions-languageservers-3) the host passes to `lsp.startServer` unchanged. | -| `buildProvider` | Present only for a `buildSystemID` selection: `{buildSystemID, executesProjectCode, mayUseNetwork, languageServer?}`. `languageServer` names the language whose server is the provider; the rest of the plan is then that server's plan, and the host reuses its running session instead of starting a second process. | -| `vcsProvider` | Present only for a `vcsProviderID` selection: the [provider descriptor](https://github.com/1lck/Lithe-IDEA/blob/preview/shared/contracts/vcs-provider-v1.md#provider-descriptor) the host keeps for the session. | -| `backend` | Present only for a `backend` selection: `{hostServices}`, the sorted [host services](#host-services-protocol-version-2) the plugin's permissions grant, plus `version: 2` for a [`backend` 2](#backend-2-workspace-contexts) process. The host passes `hostServices` to `lsp.startServer.hostServices` unchanged. | - -A language without a server, an undeclared build system, a build system -without a provider, an undeclared VCS provider, and a plugin without a -backend are `plugin.launch.unavailable`. Core never creates or -reads any of these paths. The command also serves API 1 -manifests, whose arguments are returned unchanged. - -#### Structured plugin diagnostics (logging protocol 1) - -Every plugin-owned process may negotiate `capabilities.experimental.litheLogging`: -the host offers `{ "versions": [1] }` in `initialize`, and the SDK answers -`{ "version": 1 }`. The current official SDKs require that offer. This protocol -is independent of function, build, VCS, and toolchain protocol versions. - -After successful initialization, the backend sends a JSON-RPC notification -`lithe/log`. Its params contain only these fields; unknown fields are rejected: - -| Field | Meaning | -| --- | --- | -| `kind` | `operationFinished`, `operationFailed`, `degraded`, or `recovered`. These select INFO, ERROR, WARN, and WARN catalog events respectively. | -| `operation` | A registered function ID (up to 64 bytes), `function-call` for a longer registered ID, a supported `lithe/build/*` or `lithe/vcs/*` request method, `lithe/keymap/import`, or the SDK-owned stages `initialize`, `shutdown`, `notification`, `result-encoding`. Arbitrary display labels and user input are refused. | -| `durationMs` | Required for finished/failed, absent for degraded/recovered. Monotonic elapsed integer milliseconds, 0 through 9007199254740991. | -| `code` | Required except for finished. Stable category, 1–64 ASCII bytes from letters, digits, `._:/-$`; never an exception message, command line, query, or response body. | -| `count` | Optional affected item count, a nonnegative JSON safe integer. | -| `operationId` | Optional originating wire operation ID, 1–128 ASCII token bytes. The SDK obtains it from the call context. Core resolves a still-active wire request to its host operation; unknown or retired IDs provide no correlation. | - -The notification must precede the corresponding RPC response so its wire ID -still belongs to the active host operation. Cancellation is an expected result -and does not produce an operation failure. The SDK owns automatic function and -domain request terminal facts; plugin handlers must not duplicate them. A -handler records a warning only when it actually recovers or returns a degraded -result. Frequently repeated read/preview/poll functions suppress successful -terminal facts; their failures remain observable. - -Core supplies the installed plugin ID and routes these facts to -`plugins//host`. Plugins cannot provide an event ID, channel, severity, -message, arbitrary fields, error body, or writer path. The fixed catalog events -are `plugins.operation.finished`, `plugins.operation.failed`, -`plugins.operation.fallback_selected`, and `plugins.operation.recovery_finished`. -Malformed or unnegotiated input produces one category-only -`plugins.diagnostics.rejected` warning per process session, without retaining -the rejected payload. Ingress admits at most 600 facts per minute per session, -then uses the existing bounded Core handoff to the host's single writer; -overload increments its dropped counter. No polling timer or extra writer is -created. Fixture: `fixtures/backend/plugin-logging.json`. - -Declarative contributions have no plugin process to send `lithe/log`, so whoever -executes the declared work records the same `plugins.operation.finished` and -`plugins.operation.failed` events on the same `plugins//host` channel. A -declarative plugin writes no logging code. Each start of a `languageServers[]` or -`debugAdapters[]` entry is one `languageServer/start` or `debugAdapter/start` -operation, from launch resolution until `initialize` succeeds. Each run of a -`buildSystems[]` model or dependencies command source is one `lithe/build/model` or -`lithe/build/dependencies` operation, using the SDK request names. A failure -carries one `code`: - -| Code | Meaning | -| --- | --- | -| `host.planFailed` | The declared command could not be planned | -| `host.executableUnavailable` | The declared executable or launch input could not be resolved | -| `host.launchFailed` | The resolved process could not be started | -| `host.initializeFailed` | A started server or adapter failed its `initialize` handshake | -| `host.timedOut` | The attempt exceeded its deadline | -| `host.exitedEarly` | A server or adapter exited before `initialize` succeeded | -| `host.commandFailed` | A build command exited unsuccessfully | -| `host.outputInvalid` | A build command's output is not a valid document | - -User cancellation and superseded attempts record nothing. Plugin output, paths, -and error text never appear in these facts. The executing owner and the -host-facing command are specified as `diagnostics.recordPluginOperation` in -[`rust-core-api.md`](https://github.com/1lck/Lithe-IDEA/blob/preview/shared/contracts/rust-core-api.md). - -Severity follows the actual result. An operation that failed for the user is -ERROR, a recovery or fallback is WARN, and a useful successful user operation -is INFO. The source stream is not a severity: unclassified stderr is DEBUG -evidence, while standard `window/logMessage`/`window/showMessage` types retain -their explicit error/warning/info/detail semantics through separate catalog -events. Raw stdout is reserved for protocol frames. Source code, credentials, -SQL, HTTP headers/bodies, terminal history, protocol payloads, and command -output must never be included in diagnostic fields. - -Native upstream files may use `${logDir}` only when the host supplies the -current local writable session directory. They remain separate files, not -structured catalog events. Keep metadata and caches in `${stateDir}` or -`${workspaceStateDir}`, and never infer a writable log path from `${pluginDir}`. -These runtime files do not modify installed resources or participate in build -resource reuse. Hosts without a local `logDirectory` reject launches requiring -`${logDir}`. The current macOS writer persists v2; Windows's writer migration -remains a separate platform task. - -#### Plugin settings (API 2) - -A plugin may declare options the user can change, one set per plugin and -shared by every workspace. The host shows them on the plugin's page, stores -the values, and passes the stored values as `settings` (setting ID to JSON -value) with each launch plan request. Hosts restart the plugin's language -servers when a value changes. - -```json -"settings": [ - { "id": "heapMB", "type": "integer", "title": "Maximum memory", - "default": 2048, "minimum": 512, "maximum": 8192, "unit": "MB" }, - { "id": "logLevel", "type": "enum", "title": "Log level", "default": "info", - "options": [{ "value": "info", "title": "Information" }, { "value": "debug", "title": "Debug" }] }, - { "id": "telemetry", "type": "boolean", "title": "Send usage data", "default": false } -] -``` - -| Field | Meaning | -| --- | --- | -| `id` | Starts with a lowercase letter, then letters and digits. Unique within the plugin. | -| `type` | `integer` (requires `minimum` and `maximum`, optional `unit`), `enum` (requires one to sixteen `options`, each `{value, title}`; values contain only letters, digits, `.`, `_`, `-`), or `boolean`. | -| `title`, `description` | Text the host shows; the host localizes only its own chrome. | -| `default` | Value used until the user changes it. Its JSON type follows `type`, and it must be accepted by the declaration. | - -Because every value is a number, a boolean, or one of the declared option -values, a setting can never inject extra arguments or change which package -file runs. A stored value the declaration no longer accepts (for example after -an update narrowed a range) is replaced by the default; a launch never fails -for it. Values for undeclared IDs are ignored. A template that is exactly one -`${setting:}` keeps the setting's JSON type, so an `initializationOptions` -value can be a number or boolean; inside longer text the value is substituted -as text. Declaring settings, or referring to an undeclared one, is refused -with `plugin.manifest.invalid` or `plugin.template.invalid`. The settings -declaration is not part of an install review's program list, because no value -can change what runs beyond what the templates already show. - -#### Settings v2: placement, scope, effect, and page buttons - -Version 2 of the `settings` capability (`requires.settings: 2`, level 3) lets -a plugin place its options anywhere in the host's settings without the host -knowing the plugin. Hosts keep only generic registration points: a page per -language and per build system, sections, one control per setting type, a -project/global layer switch, and buttons. What appears there comes from the -manifest. Fixture: `fixtures/settings/settings-v2.plugin.json`. - -```json -"settings": [ - { "id": "dialyzer", "type": "boolean", "title": "Dialyzer", "default": true, - "scope": "project", "effect": "immediate", "page": { "languageID": "elixir" } }, - { "id": "mixEnv", "type": "text", "title": "MIX_ENV", "default": "dev", "pattern": "[a-z]+", - "scope": "project", "page": { "languageID": "elixir" }, "section": "Server" } -], -"settingActions": [ - { "id": "rebuildPlt", "title": "Rebuild PLT", "function": "dialyzer.rebuild", - "page": { "languageID": "elixir" }, "confirm": true } -] -``` - -| Field | Meaning | -| --- | --- | -| `type` | Adds `multiSelect` (one to 32 `options`; the value is an array of distinct option values), `text` (requires `pattern`, matched against the whole value; optional `maxLength`, default 256 and at most 1024 Unicode scalars; optional `placeholder`), `file` and `directory` (an absolute path of at most 1024 Unicode scalars, or empty for "not set"; optional `placeholder`). Text and paths never start with `-` and contain no control characters. | -| `scope` | `global` (default): one value for every project. `project`: the open project may override it. | -| `effect` | When a change takes effect. `restart` (default): the next start of the plugin's processes. `immediate`: pushed to the running language server through `workspaceConfiguration`. `reload`: the next build-model reload; hosts reload the plugin's build models. `nextRun`: the next run or build command. | -| `page` | `{ "languageID": … }` or `{ "buildSystemID": … }`: the settings page that shows the setting besides the plugin's own page. Any plugin may add to a page; the host shows the page while an enabled plugin contributes to it. | -| `section` | Heading the setting is grouped under on its page. | - -`settingActions` (at most 16, sorted by unique `id`) are buttons the host -draws on the plugin's page and on their `page`. Each invokes the plugin -function `function` of the same plugin with empty params, served by the -plugin's own provider process for the open project (see -[plugin functions](#plugin-functions)). `confirm: true` makes the host ask -first. The host owns the button and knows nothing about what the function -does. Declaring actions counts as using `settings` and needs version 2. - -Placement and use rules, checked by Core at validation: - -- An `immediate` setting may appear only in a language server's - `workspaceConfiguration`; it never reaches a command line or - `initializationOptions`, so a change never needs a new process. -- A `text`, `file`, or `directory` setting is a whole template value or the - value of one `name=` argument, never part of a longer argument. -- Any v2 field or type, or any action, with `requires.settings` below 2 is - refused with `plugin.manifest.invalid`. - -**Layers.** Hosts store a global value per plugin and setting, and a project -value in the project's `.lithe/plugin-settings.json` -(`{pluginID: {settingID: value}}`, meant to be shared through version -control). They send both as `settings` and `projectSettings`; Core merges -them as project (for `scope: "project"` only), then global, then default, -skipping a stored value the declaration no longer accepts. -`plugins.declarative.resolveSettings` returns each effective value with -its `source` (`project`, `global`, or `default`). - -#### Workspace configuration (`languageServers` 2) - -A language server may declare `workspaceConfiguration`, an object whose -string leaves may be `${setting:}` templates. With -`requires.languageServers: 2`, Core expands it with the merged settings -(`plugins.declarative.workspaceConfiguration`, and the launch plan's -`workspaceConfiguration`), answers the server's `workspace/configuration` -requests by section path from it, and sends -`workspace/didChangeConfiguration` after `initialized`. Hosts send a new -value with `lsp.updateWorkspaceConfiguration` when an `immediate` setting -changes; the running server receives it without a restart. - -#### Backend-resolved launch (`serverProcess` 3) - -A server whose command line depends on what the plugin finds when it starts -(a version it resolves, a tool it bootstraps, options it derives from the -project) lets the plugin backend answer the command line each time instead of -declaring one: - -```json -"launch": {"kind": "backend", "function": "launch.resolve", "timeoutMilliseconds": 30000} -``` - -- Only a language server can use it. `requires.serverProcess` is `3`, the - lowest version covering it, or `4` when the manifest also lists - `requiresTools`; the plugin declares a `backend` of - version 2 or later, and `pluginAPIVersion` is at least 4. `function` is a - plugin function ID. `timeoutMilliseconds` is 1000 to 120000 and defaults to - 30000. -- The server declares none of `arguments`, `validationArguments`, - `runtimeDependencies`, `initializationOptions`, or `hostIntegration`: the - answer carries the first four, and a host integration is host code, which - this launch exists to avoid. `workspaceConfiguration` stays declarative - unless the answer carries its own. -- `plugins.declarative.languageServerLaunchPlan` for such a server returns the - first step, not a command line: `launch: {kind: "backend", function, - timeoutMilliseconds}`, `resolveParams`, `requiredDirectories` (always - `state`, `workspaceState`, `log`, and `temporary`), `settings`, and - `sessionPolicy`. Its request adds `temporaryDirectory`, an absolute scratch - directory of this start; the launch needs all four directories, so a request - without one is `plugin.launch.invalidRequest`. -- The host creates the directories, starts the plugin backend if it is not - running, and calls `function` through `lithe/function/invoke` with - `resolveParams` and the workspace `context`. A host may also send `tools`, - `{: {executable, home, version}}`, the resolution of each tool the - manifest lists in `requiresTools` that it could find; Core does not - validate it. The macOS host resolves each required tool as an installation - with the user's choice and discovery, and leaves out a tool that is - missing, unusable, or inside the project; `home` and `version` are present - when the installation has them. A function must not require `tools` or any - entry in it: it answers `{kind: "tool"}` and lets the host resolve the - tool, and treats a missing entry as "configure nothing". A backend uses - `tools` to point its server at the same installation the host runs, for - example as the default runtime of a language server whose Run goes through - the tool. A failed or timed-out call, or an answer for a context whose - generation has changed, ends this start without a process. -- The host passes `{manifest, languageID, request, result}` to - `plugins.languageServers.decodeLaunch`, which returns `{status: "ok", plan}` - or a rejection. The plan is an ordinary launch plan (`launch` is `packaged` - or `tool`) whose `sessionPolicy` also carries the answer's `gates`; the host - starts it like any other. A server that is not launched by the backend is - `plugin.launch.notBackend`, so a host never runs an answer it did not ask - for. - -`resolveParams`: - -| Field | Meaning | -| --- | --- | -| `serverID` | The server's `languageID`; also its ID in the `languageServer` host methods. | -| `platform` | `{os, arch}`: the host operating system and CPU architecture (`arm64` or `x86_64`). | -| `stateDirectory`, `workspaceStateDirectory`, `logDirectory`, `temporaryDirectory` | The writable directories of this start, absolute and outside the package and the application bundle. | -| `settings` | The effective value of every declared plugin setting. | - -The answer is an object with these fields; an unknown field is refused. - -| Field | Meaning | -| --- | --- | -| `executable` | `{kind: "packaged", path}` is a file inside the plugin package, read-only, listed in the plan's `requiredPackagePaths`. `{kind: "tool", tool}` names a tool definition of the plugin; the host resolves it like any tool launch. | -| `arguments` | At most 1024 strings of at most 32 KiB, without NUL. | -| `environment` | At most 256 variables; a name is non-empty without `=`, a value is at most 32 KiB. | -| `initializationOptions`, `workspaceConfiguration` | JSON objects of at most 1 MiB each. | -| `gates` | At most 8; see [Plugin-owned sessions](#plugin-owned-sessions-languageservers-3). | -| `writablePaths` | At most 32 paths the server writes. Each lies inside one of the four directories; `.` and `..` components are refused. The plan carries them sorted, and the host creates their parent directories before the start. | - -Rejections: `plugin.launch.invalidResult` for a malformed or oversized answer -or gate, `plugin.launch.outsidePackage` for a packaged path that leaves the -package, `plugin.launch.undeclaredTool` for a tool the plugin does not -define, `plugin.launch.unwritablePath` for a writable path outside the host -directories, `plugin.launch.invalidRequest` for a request without a usable -directory, `plugin.launch.unavailable` for a language without a server, and -`plugin.launch.notBackend`. See `fixtures/languages/language-server-backend-launch.plugin.json` -and `fixtures/languages/language-server-launch-resolution.json`. - -Host limits of the macOS host today: a `{kind: "tool"}` answer is resolved -with the user's tool choice and discovery, and a program that lies inside the -project is refused, because opening a project must not run it; a server whose -launch the backend resolves does not start in a remote workspace; and the -scratch `temporaryDirectory` is removed when the server process ends. - -#### Plugin-owned sessions (`languageServers` 3) - -A plugin backend drives its own server only through what the server -declares. With `requires.languageServers: 3` a server may declare: - -| Field | Meaning | -| --- | --- | -| `requestMethods` | LSP methods the backend may send with `languageServer/request` or `languageServer/notify`; at most 64. | -| `commands` | The `workspace/executeCommand` commands the backend may run; at most 128. Declared exactly when `requestMethods` lists `workspace/executeCommand`. | -| `serializedCommands` | A subset of `commands` that runs one at a time: a request for a command already running joins it and receives the same answer. | -| `forwardNotifications` | Server notifications the host forwards to the backend; at most 32. | -| `state` | `{scope: "workspace", retention: {maxEntries, maxAgeDays}}`. The host prunes the server's per-workspace state directories (see below). `maxEntries` is 1 to 64, `maxAgeDays` 1 to 365. | -| `remote` | `supported` (default) or `unsupported`. | - -- A name is non-empty text of at most 256 bytes without whitespace or control - characters, unique within its list. Names the host sends itself - (`initialize`, `initialized`, `shutdown`, `exit`, `textDocument/didOpen`, - `didChange`, `didClose`, `didSave`, `willSave`, `willSaveWaitUntil`, - `workspace/didChangeWorkspaceFolders`, and every `$/` method) cannot appear - in `requestMethods` or `forwardNotifications`. -- Below `languageServers` 3 each of these fields is `plugin.manifest.invalid`. - A server that lists `requestMethods` or `forwardNotifications` requires the - `languageServer.request` permission; declaring the permission without such a - server is `plugin.manifest.invalid`. -- The launch plan's `sessionPolicy` is these fields as sorted lists plus - `serverID` (the `languageID`) and `gates`. The host sends it unchanged as - `lsp.startServer.sessionPolicy`; Core's LSP engine enforces it, so a host - cannot widen it and a backend cannot step outside it. -- A server with `remote: "unsupported"` is not started for a remote - workspace: `lsp.startServer` answers `not_supported`. - -What the engine enforces on `lsp.pluginServerRequest` and -`lsp.pluginServerNotify`, the two commands behind the host methods: - -- A request must be in `requestMethods`, and a `workspace/executeCommand` - must carry a `params.command` in `commands`; anything else is - `plugin.host.methodNotDeclared`. A notification may be - `workspace/didChangeConfiguration` (the backend always knows the server's - settings; the value also becomes the settings the server reads through - `workspace/configuration`) or a `requestMethods` entry other than - `workspace/executeCommand`. The host's own methods stay refused. -- The session must belong to the calling plugin - (`plugin.host.foreignContribution` otherwise) and be running - (`plugin.host.languageServerUnavailable` otherwise, including every request - still pending when the process stops, crashes, restarts, or the plugin is - disabled). -- A request waits at most `timeoutMilliseconds` (default 60000, at most - 300000) and ends with `plugin.host.timeout`; cancelling it sends the server - `$/cancelRequest` and ends it with `plugin.host.cancelled`. A server's JSON-RPC - error is `plugin.host.languageServerError` with `details: {code, message}`; - the server's `data` is not forwarded. A result over the host's result bound - is `plugin.host.limitExceeded`. -- A **gate** is `{id, until: "notification", method, match}`, declared by the - launch answer. It opens when the server sends a notification with that - `method` whose params contain every member of `match` (nested objects match - the same way). Until every gate has opened, `request` calls wait in order, - at most 128; the 129th is `plugin.host.busy`. A waiting request still obeys - its timeout and cancellation. Notifications are never held. -- The first request for a `serializedCommands` command runs; a later request - for the same command, while the first is running or waiting, joins it and is - answered with the first one's outcome. Cancelling the first request ends the - joined requests with it. -- `forwardNotifications` reach the backend as - `lithe/host/languageServer/didReceiveNotification`. - `workspace/didChangeConfiguration` is the only notification Core consumes - itself. - -**State and retention.** The host keeps one state directory per workspace for -each server, under the plugin's storage (never under the package or application -bundle), and gives the server its own as `workspaceStateDirectory`. The -directories survive disabling and updating the plugin. The plugin chooses the -sub-directory names inside its `workspaceStateDirectory`; the host chooses the -names of the per-workspace directories themselves and never looks inside them. - -The host refreshes a workspace directory's modification time on every start of -the server and sweeps in the background after a start. It asks -`plugins.languageServers.stateRetention` with `{retention, nowUnixSeconds, -entries: [{name, lastModifiedUnixSeconds}], activeNames}`, where `entries` are -the per-workspace directories it found and `activeNames` are those of open -workspaces, and deletes the `expiredNames` it returns: a directory older than -`maxAgeDays` and, of the rest, all but the newest `maxEntries` that open -workspaces leave free. A workspace that is open is never pruned. Names that are -not a single path component are ignored, and the host deletes only names it -listed. A plugin that declares no `state.retention` keeps everything. - -The host can also discard the state of one workspace; the server rebuilds it -the next time it starts. In this version that is an engine path only, with no -user-facing action yet. - -**Preparation status.** `languageServer/setStatus` reports how ready the -server is. It exists because `lithe/function/progress` belongs to a call that -is running, while preparation (importing a build, indexing) outlives any call. - -Example package: `fixtures/languages/language-server-backend-launch.plugin.json`. - -### Execution providers - -`run` and `test` each name an `executable`: exactly one of a bare `command` -resolved on the host's tool path, or a host-owned project `toolchain` ID such -as `project-go`. The working directory is always the workspace root. - -`test` also declares: - -| Field | Meaning | -| --- | --- | -| `frameworkID` | Stable framework label such as `phpunit` or `go`. | -| `workspaceLabel` | Label of the "all tests" item and plan. | -| `projectMarkers` | File names, any one of which makes the workspace a test project. | -| `testFilePatterns` | Case-insensitive file-name patterns using only `*`. | -| `workspaceArguments`, `fileArguments`, `testCaseArguments` | Argument templates per scope. | - -Argument templates are argv elements, never shell text. Each element is a -string or `{"value": …, "when": "fileSelected" | "noFileSelected"}`; -conditional elements are only allowed in `testCaseArguments`, where a file is -optional. - -| Variable | Available in | Value | -| --- | --- | --- | -| `${file}` | run, file, test case | Workspace-relative file. A name starting with `-` becomes `./`. | -| `${fileDirectory}` | run, file, test case | `./` of the file, or `.` at the workspace root. | -| `${testName}` | test case | Test identifier with surrounding whitespace removed. | -| `${testName:regex}` | test case | The identifier with regular-expression metacharacters escaped. | -| `${userArguments}` | run | The user's program arguments; must be a whole element and may expand to zero elements. | - -In `testCaseArguments`, an element that uses `${file}` or `${fileDirectory}` -must be guarded with `"when": "fileSelected"`, and some element must use the -test name. - -Discovery returns `{id: ":workspace", kind: "workspace"}` followed by -`{id: ":file:", kind: "file", relativeFilePath}` for matching -files sorted by path, or an empty list when no project marker is present. - -## API levels - -| Level | Adds | -| --- | --- | -| `1` | Languages, `packaged` and `systemCommand` language servers, `node` and `go` runtime dependencies and [implicit tool-definition references](#tool-references-serverprocess-4), run and test providers. | -| `2` | `runtime` launches with a packaged or discovered runtime, host integrations, launch templates, `initializationOptions`, and plugin settings. | -| `3` | Capability versions (`requires`), `buildSystems`: declarative build tools with detection, options, a project model, tasks, run entries, tests, diagnostics, dependencies, and sync, and [`vcsProviders`](#api-level-3-vcs-providers). | -| `4` | [`debugAdapters`](#api-level-4-debug-adapters) and `serverProcess` 2 (`runSelectedRuntime`). | - -A level 2 feature in a level 1 manifest is refused with -`plugin.manifest.invalid`, -so a package cannot use a feature that hosts of its declared level would -reject for a different reason. Level 1 language-server arguments stay literal -at every host level. - -### Capability versions (level 3) - -Levels 1 and 2 version the whole manifest: a change to one section raised the -level of every plugin, and hid plugins that never use that section from older -hosts. Level 3 versions each section on its own. A level 3 manifest lists in -`requires` exactly the capabilities it uses: - -```json -"pluginAPIVersion": 3, -"requires": { "buildProviders": 1, "buildSystems": 1, "languageServers": 1, "languages": 1, "serverProcess": 1 } -``` - -| Capability | Covers | Versions | -| --- | --- | --- | -| `languages` | `languages[]` | `1`, `3` (adds a TextMate [`grammar` and `configuration`](#grammars-and-editor-configuration-languages-3)); `2`, a Monarch grammar, is withdrawn | -| `packageTrust` | `vendor.bundledSignatureRequirement`: origin-scoped trust for a host-sealed bundled copy of a publisher-signed plugin | `1` | -| `languageServers` | `languageServers[]` apart from their launch fields | `1`, `2` (adds [`workspaceConfiguration`](#workspace-configuration-languageservers-2)), `3` (adds the [session fields](#plugin-owned-sessions-languageservers-3)) | -| `serverProcess` | The launch fields of language servers, of build providers with a process of their own, of VCS providers, and of the plugin backend: `launch`, `arguments`, `validationArguments`, `runtimeDependencies`, `initializationOptions` | `1`, `2` (adds `runSelectedRuntime` for [debug adapters](#api-level-4-debug-adapters); level 4; v2 Core only), `3` (adds the [backend-resolved launch](#backend-resolved-launch-serverprocess-3) of a language server), `4` (names runtimes by [tool-definition ID](#tool-references-serverprocess-4)). Versions are cumulative: a manifest declares the lowest one covering every launch it uses. macOS advertises `1`, `3`, and `4`, Windows `1` | -| `executionProviders` | `executionProviders[]` | `1` | -| `settings` | `settings[]` and `settingActions[]` | `1`, `2` (adds [placement, scope, effect, page buttons](#settings-v2-placement-scope-effect-and-page-buttons)) | -| `ui` | `ui` | `1`, `2` (web content), `3` (native controls), `4` ([backend-only commands](#backend-only-commands-ui-4)) | -| `buildSystems` | Declarative build detection, models, and command plans; v2 executable setting adapter; v3 instance-scoped options; v4 declarative preparation roles | `1`, `2`, `3`, `4` | -| `buildProviders` | `buildSystems[].provider`, including own-process and shared language-server providers; v2 tasks, v3 tests, v4 run, v5 native debug preparation, v6 read-only model inputs, v7 native configuration, v8 inline test reports, v9 opaque semantic test selectors, v10 typed run options and service/task preparation, v11 registry connection debugging | `1`, `2`, `3`, `4`, `5`, `6`, `7`, `8`, `9`, `10`, `11` | -| `buildModelInputs` | Optional public model sharing between enabled workspace plugins | `1` | -| `vcsProviders` | `vcsProviders[]` | `1` | -| `debugAdapters` | [`debugAdapters[]`](#api-level-4-debug-adapters); v2 adds target arguments/environment; v3 adds [declared features and defaults](#adapter-features-and-defaults-debugadapters-3) | `1`, `2`, `3` | -| `outputLinkMatchers` | [`outputLinkMatchers[]`](#output-link-matchers-outputlinkmatchers-1): patterns that turn Run and Test console text into links | `1` | -| `projectGenerators` | [`projectGenerators[]`](#project-generators): entries of the New Project window; v2 adds the [`tool` field](#tool-fields) | `1`, `2` | -| `backend` | [`backend`](#plugin-backend): the plugin's own long-lived process | `1`, `2` (adds [start without a page and workspace contexts](#backend-2-workspace-contexts)) | -| `toolDefinitions` | [Tool identities, layouts, discovery and four-layer candidates](toolchains/README.md) | `1` (Core; macOS settings pages, Build and run tools) | -| `toolchainProviders` | [Provider declarations and permission-bound answer validation](toolchains/README.md) | `1` (Core; macOS settings pages, Build and run tools) | -| `pluginFunctions` | [`pluginFunctions`](#cross-plugin-calls-protocol-version-4): exported functions and declared calls between plugins | `1` (Core; macOS relays calls) | -| `executableResolution` | [Shared executable candidates](#shared-executable-candidates-executableresolution-12): candidate ordering and strict selection; v2 adds tool-definition candidates and canonical project/subproject toolchain registry bindings without changing existing Build candidate sets | `1`, `2` (v2 Core; macOS settings pages, Build and run tools) | -| `keymapImportProviders` | `keymapImportProviders[]`: independent shortcut import providers | `1` (macOS; Windows does not advertise it yet) | - -Version 1 of every capability means what its section means at level 2 -(runtime launches, launch templates, `initializationOptions`, and so on), so -moving a level 2 manifest to level 3 only adds `requires`. - -- `requires` is required at level 3 and refused below it - (`plugin.manifest.invalid`). IDs are lowerCamelCase identifiers of at most - 64 characters; versions are positive integers. -- Core reads `requires` before it decodes any section. A capability or - version this Core build does not support is `plugin.api.unsupported` with - `field: "requires."`, even when the manifest also holds a - section Core does not know, so the user learns which capability needs a - newer Lithe instead of seeing an unknown field. -- `requires` lists exactly the capabilities the manifest uses. Leaving out a - used one, or listing an unused one, is `plugin.manifest.invalid`. Every - language server, and every build provider with its own process, uses - `serverProcess`; a shared build provider does not add another process. Any - `buildSystems[].provider` requires `buildProviders: 1`, whether it starts its - own process or shares a language server. A template-only build plugin must - omit `buildProviders`. Launch support alone does not implement Provider - negotiation, requests, and lifecycle. Every VCS provider starts its own - process, so `vcsProviders` always comes with `serverProcess`, and so does - `backend`. -- The base fields (`schemaVersion`, `id`, `displayName`, `version`, `vendor`, - `permissions`, `activationEvents`, and `requires` itself) change only with a - new `pluginAPIVersion`. - -Validating a capability is not running it. Core validates every capability it -supports on every platform, but each host implements only some of them, so a -host states what it runs as `hostCapabilities: { "": [versions] }` -in `plugins.declarative.validate`, `plugins.marketplace.validateIndex`, and -`plugins.marketplace.installReview`: - -- `validate` and `installReview` refuse a level 3 manifest whose `requires` - names a version missing from `hostCapabilities` with - `plugin.api.unsupported` and `field: "requires."`. Without - `hostCapabilities` they check only what Core supports. -- `validateIndex` offers a level 3 version only when the host and this Core - build both support every entry of its `requires`; without - `hostCapabilities` it offers none. A plugin that uses no build systems is - therefore offered on a host that cannot run them. -- `hostCapabilities` has no effect on levels 1 and 2. - -The macOS host sends its capability table with validation, marketplace filtering -and install review. It advertises `buildSystems: [1, 2, 3, 4]` and -`buildProviders: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]`; native Provider models, dependencies, tasks, tests and launch preparation -share workspace-owned sessions. Backend and VCS support use their own entries -in the same table. Core validates supported versions without a host table, -but admission must use the actual host table. Windows does not yet advertise -Build Provider orchestration; Core protocol support alone does not enable it. - -Rules for publishing across levels and capability versions: - -- Levels and capability versions only add. A released version never changes - meaning, and hosts keep supporting older versions. -- A plugin declares the lowest level, and for each capability the lowest - version, it needs. Raising one without using what it adds only cuts off - older hosts. -- A new capability version is added only for a change an older host must not - ignore. Plugins that do not use the change keep the older version and stay - installable wherever they were. -- Raising a plugin's level or a capability version requires a new plugin - version, and its index entry keeps the last version with the previous - requirements so older hosts still have a version to install. Published - packages are signed and are never rewritten. -- A host release that supports a level or capability version ships before any - plugin version that declares it. -- The manifest holds only what a host must know before it starts a process: - what to start, with which permissions, for which files and projects. What a - running process can answer is negotiated over its own protocol (see - [Build providers](#build-providers)), never declared in the manifest. - -## Permissions and activation - -| Permission | Required when | -| --- | --- | -| `languageServer.launch` | `languageServers` or `vcsProviders` is not empty, or a build provider starts its own process | -| `process.run` | any provider declares `run` | -| `process.test` | any provider declares `test` | -| `process.build` | `buildSystems` is not empty | -| `process.vcs` | `vcsProviders` is not empty | -| `debug.launch` | `debugAdapters` is not empty | -| `debug.attach` | an adapter lists `attach` in `requests` (and only then); it also covers attaching to a remote host and port | -| `project.generate` | `projectGenerators` is not empty | -| `ui.contribute` | `ui` is declared | -| `ui.web` | a tool window shows [web content](#web-content-ui-2) | -| `backend.launch` | `backend` is declared | -| `keymaps.provide` | `keymapImportProviders` is nonempty; permits offering mappings, not reading files by itself | -| `keymaps.readSelectedSources` | `keymapImportProviders` is nonempty; permits reading only declared files in an explicitly selected import source | -| `credentials.store` | the backend uses the [credentials host service](#host-services-protocol-version-2); refused without a `backend` | -| `workspace.metadata` | the backend uses the [workspace host service](#workspace-contexts-and-capability-discovery-protocol-version-3); refused without `backend` 2 | -| `editor.actions` | the backend registers independent editor actions; requires `backend` 2 and `documents.read`, grants only `editor/registerActions`, not document edits or domain execution | -| `editor.providers` | the backend supplies [editor language features](#editor-language-feature-providers-protocol-version-3) for matching files; requires `backend` 2 and `documents.read`, grants only `editor/registerProviders`, not document edits | -| `terminal.create` | the backend creates and manages its own [native terminals](#plugin-owned-native-terminals-function-protocol-3), including bounded display history for reopen; requires `backend` 2 | -| `run.start` | the backend starts and stops host-owned [Run sessions](#run-and-debug-sessions-protocol-version-3); grants `lithe/host/run/start`, `lithe/host/run/stop` and the `lithe/host/run/didExit` notification; requires `backend` 2 | -| `debug.start` | the backend starts a [debug session](#run-and-debug-sessions-protocol-version-3) on one of its own adapters; grants only `lithe/host/debug/start`; requires `backend` 2 and a declared `debugAdapters` entry | -| `languageServer.request` | a `languageServers` 3 server lists `requestMethods` or `forwardNotifications`, and only then; requires `backend` 2. Grants the [`languageServer` host methods](#language-server-host-methods) for the plugin's own servers and their two notifications, nothing else | -| `documents.contentProvider` | the backend registers a [content provider](#content-providers); requires `backend` 2. Grants `documents/registerContentProvider` only, not reading or editing documents | - -| Activation event | Meaning | -| --- | --- | -| `onLanguage:` | Start the language server when a document of the language opens in a project. | -| `onRun:` | Activate the run provider when the user runs a file of the language. | -| `onTest:` | Activate the test provider when the user lists or runs tests. | -| `onBuildSystem:` | Activate the build system before its first plan, model, or decode. | -| `onVcsRoot:` | Start the VCS provider once a root of its VCS is detected in the workspace. | -| `onDebug:` | Start the debug adapter when a debug session needs it (API level 4). | -| `onWorkspaceOpen` | Start the [`backend` 2](#backend-2-workspace-contexts) process once a workspace is open. Optional, names no ID, refused without `backend` 2. | - -Each provider needs its event and each event needs a provider; the only -optional event is `onWorkspaceOpen`. There is no event that starts a plugin -on every launch (`onStartupFinished`, `*`): it is -`plugin.activation.invalid`. Enabling a -plugin only permits activation; nothing starts until its event occurs. - -## Trust - -- `publisherPackage`: the package must carry a valid publisher signature - (`lithe-plugin-signature.json`, Ed25519 over every file) from a key the host - trusts. Development builds may install an unsigned package from disk as a - local development package; release builds refuse it. -- `sameTeamAsHost`: only honored for a package shipped inside the host's own - signed installation, whose code signature already seals it. -- `none`: a community package without a required Lithe signature. A host may - install it from a third-party marketplace source after matching the archive - against the index checksum, or from a user-selected local ZIP or unpacked - directory after taking a private snapshot. Both paths require the user to - confirm the install review. IDs in the official namespace (`dev.lithe`, - `dev.lithe.*`) may not use it (`plugin.manifest.invalid`). Hosts that predate - this value refuse such packages as invalid manifests, which is intended. - A signature document, when present, must still be verified; community trust - cannot silently ignore an invalid signature. - -API level 3 packages can declare `requires.packageTrust: 1` and -`vendor.bundledSignatureRequirement: "sameTeamAsHost"`, together with -`vendor.signatureRequirement: "publisherPackage"`. Only official-namespace IDs -may use this declaration. Both the primary and bundled policies must match the -host's pinned official catalog. Only a package whose actual resolved path is -inside the host's sealed installation and whose origin is `bundled` may omit -the publisher signature. Every independently installed, imported or rolled-back -copy still needs the publisher signature. A present signature is always checked, -even inside the host seal. The optional declaration alone grants no trust. -Hosts without `packageTrust: 1` filter this version before download and reject -its manifest; no new application-version field is needed. An older manifest -without the declaration keeps its existing policy. The valid example is -`fixtures/package-trust/publisher-bundled.plugin.json`. - -A host pins the signature requirement of its official plugin IDs so a package -cannot downgrade itself. Selecting a file from disk never overrides that pin, -namespace restrictions, publisher-key checks, or the installation seal required -by `sameTeamAsHost`. On macOS only DEBUG permits an unsigned publisher package -as `localDevelopment`; release builds refuse that origin. Community `none` -packages use their own approval path in both build configurations and must not -be reclassified as development packages. - -## Marketplace - -A marketplace source is a JSON index (`plugin-index.schema.json`) that lists -plugins and their release archives. Hosts fetch, cache, and download; Rust -Core decides validity and availability through `plugins.marketplace.*` so -every product shows the same catalog and the same install review. - -### Sources - -- The host ships one **official** source: the index at - `Plugins/marketplace/index.json` in the Lithe repository. A copy is bundled - read-only with the application so the catalog works offline; refreshing - fetches the same file from - `https://raw.githubusercontent.com/Lithe-IDEA/Lithe-IDEA/HEAD/Plugins/marketplace/index.json`. -- Hosts also preset one **community** source, Lithe Store - (`https://github.com/Lithe-IDEA/Lithe-store`, index - `https://raw.githubusercontent.com/Lithe-IDEA/Lithe-store/HEAD/lithe-plugin-index.json`). - It is a third-party source in every respect (community trust, `dev.lithe` - IDs refused), enabled by default, and removable; a host remembers the - removal instead of adding it back. -- Users may add **third-party** sources. `plugins.marketplace.resolveSource` - turns what the user pasted into the index URL to fetch: an https index URL - is used as is (fragment removed); `https://github.com//` - resolves to `lithe-plugin-index.json` at the repository root on its default - branch (`HEAD`); a `…/blob//` page resolves to its raw file. - Plain http, embedded credentials, and other GitHub pages are refused with - `plugin.source.invalid`. -- Hosts cache fetched indexes in platform cache or application-support - storage, never inside the installation. - -### Index entries - -| Field | Meaning | -| --- | --- | -| `id` | Plugin ID; must equal the package's `plugin.json` `id`. | -| `name`, `author`, `description`, `license` | Display metadata; must not be empty. | -| `localizedDescriptions` | Optional translations of `description`, keyed by language tag such as `zh-Hans`. Hosts show the entry matching the interface language and fall back to `description`. | -| `repository` | `https://github.com//` that owns the plugin's releases and issue tracker. | -| `homepage` | Optional https URL. | -| `tags` | Optional single words, lowercased and sorted by Core. | -| `icon` | Optional `raw.githubusercontent.com` file of the same repository. | -| `versions[]` | `version`, required `pluginAPIVersion`, `requires` (level 3 only, and required there: the package manifest's `requires`; capability IDs this contract does not define are allowed and make the version unavailable), `releaseDate` (`YYYY-MM-DD`), and `downloads[]`. | -| `downloads[]` | `platforms` (for example `darwin-arm64`, `darwin-x64`, `windows-x64`, `windows-arm64`), `downloadURL`, and the archive's lowercase hex `sha256`. A platform may appear in at most one download of a version. | - -A `downloadURL` must be a `.zip` GitHub Release asset of the entry's own -repository (`https://github.com///releases/download//.zip`, -owner and repository compared case-insensitively), so an index cannot point a -plugin at another project's release. - -### Validation and availability - -`plugins.marketplace.validateIndex` accepts -`{ "index": object, "sourceKind": "official" | "thirdParty", "platform": string, "hostCapabilities"?: object }`. -A malformed index root or an unsupported `schemaVersion` rejects the whole -index. Otherwise it returns `{ "status": "ok", "index": { "plugins", "rejected" } }`: - -- `rejected` lists refused entries in index order with their `error`. - A third-party source listing an official-namespace ID is refused with - `plugin.index.officialNamespace`; a repeated ID keeps the first listing and - refuses later ones with `plugin.index.duplicate`. -- `plugins` is sorted by ID. Each accepted entry is normalized, lists - `versions` newest first (each with its `requires` at level 3), reports - `platforms`, `latestVersion`, and `latestReleaseDate` of the newest - version, and an `availability`: - - `{status: "available", version, pluginAPIVersion, releaseDate, downloadURL, sha256}` - for the newest version with this platform's archive that the host can - run: level 1, level 2 on a platform with the level 2 UI host (macOS), or - level 3 with every capability of its `requires` hosted (see - [Capability versions](#capability-versions-level-3)); - - `{status: "unsupported", code: "plugin.index.apiUnsupported", platform, message}` - when the platform is listed only by versions needing a newer plugin API - or a capability the host does not run; - - `{status: "unsupported", code: "plugin.index.platformUnsupported", platform, message}` - when no version lists the platform. Hosts show "not supported on - " instead of an install action. - -### Trust and install review - -- **Official**: an entry is official only when it comes from the official - source and its package passes the Lithe publisher signature. -- **Community marketplace**: entries from third-party sources. Hosts install - in this order: verify the archive SHA-256 against the index - (`plugin.archive.checksumMismatch`), validate the declaration and package, - run `plugins.marketplace.installReview`, show the review, and install only - after the user confirms. The index checksum proves a match to that index's - bytes, not an authenticated publisher identity. -- **Community local disk**: a user-selected ZIP or unpacked directory has no - marketplace index or authenticated repository. The host first copies a - private snapshot, then validates and reviews that snapshot with the same - Core command. A local checksum must never be shown as a repository match. - -`plugins.marketplace.installReview` accepts -`{ "manifest": object, "expectedID"?, "expectedVersion"?, "approvedPrograms"?: [object], "hostCapabilities"?: object }` -and returns `{ "status": "ok", "review": { id, version, permissions, programs, newPrograms } }`. -A package whose ID or version differs from the index entry is refused with -`plugin.package.mismatch`, and a level 3 package that requires a capability -missing from `hostCapabilities` with `plugin.api.unsupported`. `programs` lists everything the host may start for -the plugin, sorted by `kind`, language, and tool: - -| `kind` | Fields | Meaning | -| --- | --- | --- | -| `packagedLanguageServer` | `languageID`, `path`, `arguments`, `validationArguments` | Executable inside the package, with its launch arguments and validation probe | -| `systemLanguageServer` | `languageID`, `commands`, `arguments`, `validationArguments` | Command resolved by host tool discovery | -| `runtimeLanguageServer` | `languageID`, `tool`, `packagedRuntime`, `entry`, `runtimeArguments`, `arguments`, `validationArguments` | Package entry started by a runtime; `packagedRuntime` is `null` for a discovered runtime | -| `buildSystem` | `buildSystemID`, `invocation`, `options`, `tasks`, `run`, `test`, `model`, `dependencies`, `hostIntegration`?, `provider`? | Every command line the build system can plan; `provider` is the shared form, which sends build requests to a language server | -| `packagedBuildProvider`, `systemBuildProvider`, `runtimeBuildProvider` | the matching language-server fields with `buildSystemID`, `executesProjectCode`, `mayUseNetwork` instead of `languageID` | A build provider with a process of its own | -| `packagedVcsProvider`, `systemVcsProvider`, `runtimeVcsProvider` | the matching language-server fields with `vcs`, `vcsTool`, `mayUseNetwork` instead of `languageID` | A VCS provider process; `vcsTool` is the declared VCS client or `null` | -| `runtime` | `tool`, `minimumVersion`? | Runtime the host discovers and passes to a language server, build provider, or VCS provider | -| `run` | `languageID`, `executable`, `arguments` | Run command and its argument template | -| `test` | `languageID`, `executable`, `workspaceArguments`, `fileArguments`, `testCaseArguments` | Test command and its argument templates | -| `projectGenerator` | `generatorID`, `command`, `arguments`, `environment`, `collect`, `mayUseNetwork`, `timeoutSeconds`, `when` | A `command` step of a [project generator](#project-generators); `files` and `archive` steps start no program | - -Each entry carries everything that decides what actually runs, so an update -that keeps the same executable but changes its arguments, argument templates, -or validation probe is a new program; language-server and build-provider -entries also carry `initializationOptions` when declared. Hosts show all -`permissions` and the complete `programs`, and persist each approved program -as canonical JSON without dropping fields. A display may use readable labels -but must retain all canonical content, including a full JSON fallback for -program kinds it cannot describe completely. On macOS, recognized kinds keep -their readable summary and offer a native “Full Program Declaration” disclosure -with the complete canonical JSON; unknown kinds already render that JSON and -do not need a duplicate disclosure. - -Local disk community installation requires explicit confirmation on every first -install, update, reinstall, and same-version replacement, including unchanged -programs and permissions. An empty `newPrograms` never waives disk confirmation. -Marketplace installation retains its existing policy: first install, missing -previous approval, or nonempty `newPrograms` requires confirmation; a marketplace -update with no new programs may reuse its recorded approval. A host may pass -previous `approvedPrograms` to highlight differences, but a confirmation always -shows the complete current review. Core's review remains a pure description and -comparison, not an approval grant. -When several marketplace sources list the same ID, the user chooses the source -at install time and later updates come only from that source. Local disk -provenance is never a marketplace source or an automatic update subscription. - -### Local disk snapshots and installation provenance (macOS) - -The macOS disk entry accepts a ZIP or an unpacked package directory. It does -not run code from the selection. `MacPluginDiskPackageImporter` copies into a -fresh private directory (mode `0700`) before declaration validation, trust -checks, review, or installation. It refuses aliases, symbolic links, special -files, ambiguous manifests, and detected source changes during copying, and -applies archive/extracted-size and entry-count limits to the snapshot. Directory -copy depth is limited to 64, and its temporary root must stay outside the -selected source. Before extraction, ZIP preflight checks central and local -header paths/types and rejects duplicate or colliding paths. - -`MacServiceContainer` injects `fileStorage.temporaryDirectory()`. Within that -platform-owned writable root the importer creates -`lithe-plugin-disk-/archive.zip` for a ZIP and `package/` for copied or -extracted files. `archiveSHA256` is computed from the copied ZIP, not by reading -the original after review; an unpacked directory has no archive and this field -is absent/`nil`. The content digest covers the package files. Neither digest -authenticates a publisher or remote repository. - -Disk digesting, Rust review, and candidate validation run on a native worker, -with a worker-owned Store decoder and immutable validation policy. The UI actor -remains available to close the page or cancel. Cancellation is checked between -review stages and before publishing the prepared candidate; snapshot cleanup -waits for the worker to finish reading it. - -`PluginDiskProvenance` is host-owned local installation data, separate from -`PluginMarketplaceProvenance`; it is not a new field in `plugin.json` or the -marketplace index schema. A disk record contains the selected `fileName`, -optional `archiveSHA256`, `contentDigest`, and complete canonical -`approvedPrograms`. Marketplace provenance instead retains its source ID/name, -repository, index archive checksum, content digest, and approved programs. -Each community version must have exactly one of these provenance records; -missing or conflicting provenance is rejected. - -The store rechecks the content digest of the installation staging copy before -publishing it, on every installed-package scan, and before rollback. Changed, -added, or removed package files reject that candidate or version. Active and -previous versions retain their own origin and provenance (`disk` / -`previousDisk`, `marketplace` / `previousMarketplace`); rollback verifies the -restored version against its own approval. Replacing the active version with -the same version retains the existing previous-version history; it does not -create a second rollback slot for the overwritten same-version bytes. A -marketplace entry with the same ID must not automatically offer updates or -reinstall a disk-managed installation. - -The importer owns partial-copy cleanup on failure or cancellation. After -preparation the service owns the snapshot until review cancellation or install -success/failure and discards it in all these cases. Closing the plugin page -cancels its disk import and ends the installation session: pending snapshots -are discarded immediately and late prepared results are discarded rather than -installed. The package store owns its separate Application Support staging, -version directories, and installation records. None of these snapshots, staging files, installed versions, or approval -records are reusable worktree build resources: a content hash does not transfer -user consent or provide a version/platform/architecture/toolchain identity stamp. -They are excluded as `plugin-disk-install-state`. No runtime write targets the -signed app bundle or Windows installation resources, so these paths do not -change code signatures or Sparkle differential-update baselines. - -Windows has a narrower disk import. It copies a ZIP or unpacked directory into -a private snapshot under the application's local data directory -(`plugin-temp/lithe-plugin-disk-`), reviews it with -`plugins.marketplace.installReview`, and installs only after the user confirms. -Confirmation re-runs the review and refuses a snapshot whose `plugin.json` -changed after review. It does not verify publisher signatures, does not compute -or recheck a digest of the other package files, and does not record approved -programs or provenance; its installation record holds only the ID, active -version and enabled state. It has no marketplace install path. Its existing -worker-package import is a separate format. The feature matrix -therefore keeps Windows `partial` and macOS runtime verification `pending`; -static checks and Node resource tests alone do not verify the UI confirmation, -complete program rendering, cleanup, or bundle hashes in a real workflow. - -## API level 3: build systems - -`buildSystems` describes a project-level build tool (Cargo, Go, Gradle, -Maven, …) as data. Every build tool gets the same model and the same -commands: Core validates the declaration, detects instances, decodes the -model, and expands every command line; the host only runs the processes Core -planned and passes their output back. A community plugin therefore needs no -host change to add a build tool, and no host code branches on a build-system -ID. One complete fixture covers each model source: `build-static-file` reads -a project file, `build-command-stdout` decodes a command's standard output, -`build-command-output-file` decodes a file the command writes, and -`build-host-integration` hands the model to a host integration. They use -Cargo, Go, Gradle, and Maven as realistic inputs; they are not those -plugins. `build-provider` and `build-provider-language-server` show the two -forms of a build provider, and `fixtures/build-systems/build-plans.json` is the golden list -of plans and decoded outputs every host gets from them. - -A build system needs `pluginAPIVersion` 3 with `buildSystems` in `requires`, -the `process.build` permission, -and the activation event `onBuildSystem:`. IDs of build systems, tasks, -and run entries start with a lowercase letter and use lowercase letters, -digits, and hyphens. Option IDs are camelCase like setting IDs. Paths in a -declaration are relative, use `/`, and stay inside their base directory -(`plugin.path.invalid` otherwise). - -| Field | Meaning | -| --- | --- | -| `detection` | `markers` are file names; a directory holding one is a candidate root. `nesting: "outermost"` folds deeper candidates into the outer instance (Gradle builds, Maven reactors); `"separate"` (default) keeps each (Cargo packages). `priority` (0–100, default 50) decides between plugins declaring the same ID; ties go to the smaller plugin ID. | -| `invocation` | `executables` in preference order: `projectFile` (a wrapper inside the root, with `requires` files; always runs project code), `environment` (a path below a variable listed in `environmentInputs`), `command` (a bare name found on `PATH`), `runtime` (a declared runtime dependency itself). `platforms` limits a candidate. `globalArguments` precede every command. `version` probes the executable with literal `arguments` and a `pattern` whose first group is the version; `minimumVersion` needs a probe. | -| `runtimeDependencies` | `node` and `go` are host-managed: only `id` and `minimumVersion`, discovered with the user's runtime settings; `build.invocationPlan` returns the probe arguments Core reads their version with, so hosts keep no per-runtime probe. Any other runtime without `executables` names the [tool definition](toolchains/README.md) with the same ID, so its `id` must be a valid tool-definition ID and it declares only `minimumVersion`: `build.invocationPlan` returns it with `hostManaged: false`, `version: null`, and the single candidate `{ "kind": "toolchain", "toolchainID": , "root": }`, whose resolution checks `minimumVersion`, and `build.checkToolVersion` for it is `plugin.build.unavailable` because Core reads no version. This needs no `executableResolution` 2. Any other runtime describes its own `executables` and `version` probe, so the runtime list is open; a runtime whose only candidate is a `toolchain` candidate may omit the probe, since the definition checks the version. | -| `options` | Build dimensions the user chooses: `boolean`, `singleSelect`, `multiSelect`, `text`, `file`, `directory`. Each contributes `arguments` and `environment` (with `${value}`) when it has a value. Choices are declared, come from the model (`choicesFromModel`), or are free (`allowCustom`). | -| `provider` | The process that answers model and dependency requests when no command prints them; see [Build providers](#build-providers). | -| `model` | `static` (a `toml` file read during detection, no process), `command` (a command whose output Core decodes; it states `executesProjectCode` and `mayUseNetwork`), `provider`, or `hostIntegration`. | -| `tasks` | The task catalog. `scopes` say what a task runs on (`workspace`, `project`, `target`); `targetTags` restrict targets; `requiresUserArguments` makes the host ask for arguments. A `fromModel` task is the template for tasks the model lists. | -| `run` | Run entries from model targets (`fromTargets.tags`, with `arguments`) or model tasks (`fromTasks`, reusing the template task's arguments). | -| `test` | How tests run: `scopes`, `targetTags`, the `filters` (`suite`, `case`) it can select, and `results` (`junitXml` or `litheTestResults` report globs relative to the project, or `hostIntegration`). A workspace run reads the globs under the root and every model project. A requested filter must reach the command line through a template whose conditions hold; a `case` guarded by `suiteSelected` therefore needs its suite. | -| `diagnostics` | `lineMatcher` patterns with capture-group numbers, or `litheDiagnostics` lines. | -| `dependencies` | A command (with `scopes`) whose output Core decodes, as a flat list through a `map` or as a tree from `litheDependencies`; `provider` (with `scopes`, `workspace` and `project` only); or `hostIntegration`. | -| `sync` | Files whose change makes the model stale, relative to the root and to each project. | -| `layout` | `excluded` directories relative to each project, added to every project as `excluded` content roots. | - -With `requires.buildSystems: 3`, an option may declare `scope: "instance"`. -Omitted scope (or `"workspace"`) keeps workspace/build-system storage. Instance -values are independently persisted by normalized detected root: changing or -resetting `a` cannot change `b`, even when both accept the same choices. Explicit -`false`, `""`, and `[]` remain stored user values. The host merges only the -matching scope before detection, static run generation, model/dependency/task -requests, synchronization fingerprints, and language import. Instance data cannot -override workspace options, and workspace values cannot silently override an -instance option. When an existing option moves to instance scope, macOS copies its shared value -to each detected or previously stored root, preserving explicit instance values -and empty markers. It removes the shared representation only after readback, then -redetects static models. Failure retains the source and blocks publishing defaults -until retry; scope is not a fallback chain. See `fixtures/build-systems/build-instance-options.plugin.json`. - -### Presentation - -Each enabled build system gets a tool window of its own, titled with its -`displayName`; `icon` (a [UI icon](#ui-icons-macos-host)) is its activity-bar -icon. As for every tool window, the host owns the shell: dock, order, -visibility, layout, and lifecycle. The host draws the window body from the -model, and three optional fields tell it where an entry goes. None of them -changes a plan. - -- `options[].presentation: "toolbar"` puts a boolean option on the window's - toolbar as a toggle, for offline mode or skipping tests; it needs an - `icon`. `"tree"` shows a multiSelect option as a checklist node at the top - of the tree (Maven profiles). Without `presentation` the option appears only - in the option list. An icon on an option that is not `toolbar` is - `plugin.manifest.invalid`. -- `tasks[].category` lists 1–4 headings, outermost first, that file the task - in its project (`["Lifecycle"]`). Without it the host files the task by - `group`. On a `fromModel` template it is the default for the tasks the - model lists. -- A model task in a `litheBuildModel` document can carry its own `category`, - an array of strings. Core trims the headings. A category that is deeper - than four headings or has an empty heading falls back to the template's, so - a tool that reports a bad heading still has its task filed. - -The macOS host gives each detected build system its own tool window and uses -these presentation fields. The host-drawn windows share Build Output, docking, -layout restoration, activation, and lifecycle with other workbench contributions. -Windows has not integrated build-system windows yet. - -### Templates - -Arguments are template strings, or `{ "value": …, "when": condition }` with -one condition or a list that must all hold: `projectSelected`, -`nestedProjectSelected` (a project other than the root one), `targetSelected`, -`suiteSelected`, `caseSelected`, and their `no…` opposites. - -| Variable | Available in | -| --- | --- | -| `${root}` | every list | -| `${project.name}`, `${project.path}` (relative to the root), `${project.property:}` | lists with a project scope; guard with `projectSelected` when the project may be absent | -| `${target.name}`, `${target.property:}` | target-scoped tasks, tests, and target run entries; guard with `targetSelected` when the target may be absent | -| `${task.name}`, `${task.property:}` | `fromModel` tasks | -| `${test.suite}`, `${test.case}`, `${test.case:regex}` (regex-escaped) | `test.arguments`, guarded by `suiteSelected` / `caseSelected` | -| `${optionArguments}`, `${optionArguments:}` | every command list; a whole argument that expands to all options, or one option | -| `${userArguments}` | tasks and tests; a whole argument. A task with `requiresUserArguments` must pass it | -| `${pluginDir}`, `${workspaceStateDir}`, `${outputFile}` | model and dependency commands; `${outputFile}` exactly when `output` is `outputFile` | -| `${value}` | option `arguments` and `environment` | - -Each option's arguments are emitted once per command line: reference them -either in `globalArguments` or in the command's list, and only once within a -list, except under opposite conditions. An option that no list references -contributes nothing. Unknown, misplaced, unguarded, or repeated variables are -`plugin.template.invalid`. - -### Model and outputs - -A model or dependency command prints to `stdout` (default) or to the -host-allocated `${outputFile}`. Its decoder is `jsonStream` -(whitespace-separated JSON values such as NDJSON or `go list -json`, decoded -as an array; a single document becomes a one-element array) or a canonical -format that needs no `map`. A static model file is `toml`. - -A `map` only selects values. A model map turns a decoded document into -projects, each with its targets and content roots, and into option values; a -dependency map turns it into a flat list. Rules select elements with `each`, -filter them with `where` predicates (`{ "pointer", "equals" | "exists" }`), -apply only as a `fallback` or `whenFile` a file exists, and read fields with -selectors: `""` (the element), `@key` (its key), `/a/b` (relative to the -element), `$/a/b` (from the document root), `*` (each item). A field is a -selector, `{ "from", "transform": "lastSegment" }`, or a literal -`{ "value": "src" }`. Target `tags` are a literal list, and a project's -parent is the deepest project containing it. Paths are relative to the root -or absolute inside the workspace; anything else is dropped. A target `fallback` is -skipped only when a non-fallback target rule with an overlapping tag already -produced a target, so an explicit binary suppresses an implicit `src/main.rs` -target while explicit test or example targets do not. - -Whatever a map cannot express is the plugin's own work: other file formats, -tasks read from the tool, explicit parent links, tags computed from values, -and dependency trees. The plugin's command (a script under `${pluginDir}`, -or the tool itself with a plugin-supplied init script, as Gradle does) prints -`litheBuildModel` or `litheDependencies`, or a -[build provider](#build-providers) answers. Unlike a static file, a command -runs only when the host starts it on request. The map does not grow into a -transformation language: a later `buildSystems` version adds a rule only when -real plugins need it and it cannot reasonably live in the plugin. - -Canonical formats let a plugin's own script print the shape Core expects: - -| Format | Shape | -| --- | --- | -| `litheBuildModel` | `{ "format": "litheBuildModel", "version": 1, "projects", "targets", "tasks", "contentRoots", "optionValues" }` with the model's field names; `tasks[].category` is an array of headings | -| `litheTestResults` | `{ "format": "litheTestResults", "version": 1, "tests": [{ "suite", "case", "status", "message"?, "durationMillis"?, "path"?, "line"? }] }` | -| `litheDependencies` | `{ "format": "litheDependencies", "version": 1, "dependencies": [{ "name", "group"?, "version"?, "scope"?, "properties"?, "children" }] }` | -| `litheDiagnostics` | output lines `{ "lithe": "diagnostic", "path", "line", "column"?, "severity"?, "message" }` | - -Unknown fields in canonical documents are ignored so newer scripts work with -older hosts. Output that does not fit its decoder is `plugin.build.invalidOutput`. - -### Provider task execution (buildProviders 2) - -A task with `source: "provider"` requires `requires.buildProviders: 2` or newer. -It keeps the ordinary task ID, scopes, target tags and model selection, but -`arguments` must be `[]` and `execution` must be `task`. Application/service -launch and test discovery are separate capabilities. Provider model-task -templates cannot be referenced by `run[].fromTasks`; they need a typed Run -capability rather than an empty command plan. A provider task never -falls back to a host command or a plugin-private function. Command tasks -retain their current shape and omit `source`. - -`build.taskPlan` returns a `provider` request instead of argv for this source. -`lithe/build/execute` receives the effective `buildSystemID`, workspace-relative -`root`, `options`, `optionArguments`, option `environment`, `task` declaration ID, -bounded `userArguments`, and optional `project`, `target`, `modelTask` selections -(`name`, workspace-relative `path`, `tags`, `properties`). Scope/path validation -is identical to command tasks. The provider owns build semantics; options -are not a second host-generated command. As with model/dependency requests, -the host may add `tool: { executable: }` from the -same invocation resolver; explicit invalid tool/runtime selection is a failure, -never permission for independent discovery. It must reject stale project facts -rather than guess a target. - -The host offers `litheBuild.versions: [11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]`. Version 2 adds task execution -and its progress notification to the two version 1 methods. A process that -chooses version 1 cannot receive execution; unsupported negotiation fails -explicitly. A plugin that needs this behavior declares capability version 2 -so unsupported hosts refuse installation. The two version numbers serve -different purposes: installation admission and per-process negotiation. - -Core sets `params.operationID` to the unique JSON-RPC request ID (as a string); -callers cannot choose it. `lithe/build/progress` notifications echo that ID and -may include `message` (up to 4 KiB UTF-8), integer `percentage` (0–100), and -`output` (up to 64 KiB UTF-8 per notification). Malformed reports and reports -for ended, cancelled, timed-out or other requests are dropped. Core maps the -wire ID back to the host operation ID; reused host IDs cannot accept old -progress. No plugin-function negotiation is needed. - -The reply is `{ "exitCode": , "output": }`. -`output` is the complete bounded diagnostic text (at most 32 MiB UTF-8), -including text streamed in progress; the host displays progress output and -uses final output for the existing diagnostic decoder without duplicating it -in the console. Nonzero exit codes are completed tool failures, not protocol -errors. Malformed replies end with `plugin.build.invalidResult`; JSON-RPC -errors end with `plugin.build.failed`. Timeout and cancellation use the -existing request codes and `$/cancelRequest`. Request completion occurs once; -late replies/progress do not revive it. - -The host binds each call to the plugin package, build-system/workspace -session, current run, effective option fingerprint and watched configuration revision. -Settings, package replacement, disable, workspace close/reopen, cancellation -and backend failure invalidate or stop the owning operation. The existing -Provider session owns children and writable workspace state; no page, -additional runtime, directory or cross-plugin private cache is required. -Only public typed results may cross domain boundaries. - -Canonical examples: `fixtures/build-providers/build-provider-execution.plugin.json` and -`fixtures/build-providers/build-execution-protocol.json`. Protocol v2 is a construction -primitive for #1495; it does not by itself migrate Maven or Java consumers. - -### Provider test execution (buildProviders 3) - -A build system's `test` may declare `source: "provider"` with -`requires.buildProviders: 3`. It retains the existing scopes, target tags and -supported filters, but `arguments` must be `[]`. It requires a plugin-owned -Provider process; `results` may be omitted or use `junitXml`/`litheTestResults` -reports. `hostIntegration` is refused: the plugin owns test execution and -report production, and the host reuses the existing report decoder. - -`build.testPlan` returns `provider: { method: "lithe/build/test", params }` -and the usual `results` metadata instead of argv. The effective -`buildSystemID`, `root`, `options`, `optionArguments`, `environment`, bounded -`userArguments`, optional `project`/`target`, and optional `suite`/`case` are -typed fields. A case filter does not require a suite when the provider -supports it; providers must reject selectors they cannot honor rather than -widening the test run. Paths, scopes and declared filters are validated before -the request is sent. The host's report project list only resolves report globs; -it is not a second backend project model. - -Only a process choosing protocol version 3 or newer receives `lithe/build/test`. -Versions 1 and 2 explicitly refuse tests. Version 3 retains every version 2 -task behavior. Tests use the same Core-assigned operation identity, -`lithe/build/progress`, tool hint, bounded `{ exitCode, output }` result, -timeout, cancellation and late-result rules as task execution. Reports are -read after execution using the existing freshness, path and size checks. -Workspace-wide reports still require a current project model when the build -system has one. Configuration validity is retained through diagnostic and -report decoding; late results cannot update a changed workspace/configuration. - -Java/Maven migration remains separate. No new resource/cache location is introduced. -Canonical examples: `fixtures/build-providers/build-provider-tests.plugin.json` and -`fixtures/build-providers/build-test-protocol.json`. - -#### Test discovery - -Provider tests may additionally declare `discovery: true`. This requires both -`suite` and `case` filters: every discovered selector must be exactly runnable. -`build.testDiscoveryPlan` accepts the common plan fields and optional `refresh` -and `tool`, returning a request for the whole instance: -`lithe/build/discoverTests` with its effective options. Project/output-file -selection is refused. This method also requires protocol version 3 or newer and uses -the existing bounded request/cancellation lifecycle, without execution progress. - -The provider returns `{ "format": "litheTestDiscovery", "version": 1, -"tests": [{ "suite", "case", "project"?, "target"? }] }`. Project and target -are the usual typed selections with workspace-relative paths. There may be at -most 10,000 items and 32 MiB UTF-8 JSON. Unknown document/item fields are -ignored; malformed selectors, invalid paths/scopes, unsupported versions and -oversized lists reject the entire result with `plugin.build.invalidOutput`. -An empty array is a successful discovery with no tests. - -The host passes the reply and original plan configuration to -`build.decodeTestDiscovery`. Core validates every selector through the same -test-plan rules, deterministically orders the list, collapses exact duplicates, -and derives an opaque `id` including project/target identity. Equal suite/case -names in sibling modules therefore remain distinct. The returned `discovery` -contains `tests: [{ id, suite, case, project?, target? }]`. No source parsing, -framework detection, or second project graph occurs in the host/Core. - -Native discovery starts only on a user action, reuses the workspace Provider, -and is independent of plugin pages. Source edits, configuration changes, -package changes and workspace teardown revoke the cached list and in-flight -discovery. A native action must revalidate the selected ID against the current -list before submitting its exact selectors to `lithe/build/test`; stale -toolbar selections cannot run. The backend must reject a selector whose facts -have become stale externally. Canonical example: `fixtures/build-providers/build-test-discovery.json`. - -### Provider run preparation (buildProviders 4) - -A run declaration may use `source: "provider"` with -`requires.buildProviders: 4`. This increment supports application targets only: -`fromTargets.tags` is required; `fromTasks`, service execution, nonempty -`arguments`, and extension templates are refused. The optional `name` is a -literal display name. `workingDirectory` is supplied by the prepared result; -the declaration's command-source default has no effect. These declarations -never generate empty command-based persisted Run entries. - -`build.prepareRunPlan` validates a selected `run` declaration ID, required -`project` and `target` selections, effective options, and bounded -`userArguments`. It returns a provider request for `lithe/build/prepareRun`, -with the common instance fields, options/option arguments/environment, -`run`, `project`, `target`, and `userArguments`. An output file is refused. -The host may add the resolved build tool hint. The provider owns upstream -synchronization, build, classpath and launch facts; Core does not reconstruct -those facts from source files or build configuration. - -Protocol versions 4 and 5 accept this method. Version 4 retains task and test -support. Preparation shares the Core-assigned wire `operationID`, progress, -timeout, cancellation and stale-result handling of execution. It ends when -preparation finishes; the application is a separate host-owned process. -A JSON-RPC error aborts preparation and cannot launch an application. It retains -the common LSP `serverError` category; it is not an execution exit-code result -and does not forward a private-function `pluginErrorCode`. - -The successful result is a portable launch plan: - -```json -{ - "executable": { "kind": "toolchain", "value": "project-jdk" }, - "arguments": ["-cp", "classes", "example.Main"], - "workingDirectory": "app", - "environment": {} -} -``` - -The executable is either a host toolchain identifier (`toolchain`) or a bare -command resolved by the host (`command`); absolute paths and shell command -strings are refused. Arguments are separate strings, at most 1,024 entries -and 64 KiB UTF-8 each, without NUL. The environment has at most 64 entries; -keys match `[A-Za-z_][A-Za-z0-9_]*` with at most 128 bytes, values are strings -of at most 64 KiB without NUL. The complete JSON is bounded at 32 MiB. -`workingDirectory` must be an existing workspace-relative directory inside -the selected instance, including after resolving filesystem aliases. -Unknown fields are ignored. The host calls `build.decodeRunPreparation` -with its workspace root, instance root and raw result; any malformed plan -fails as `plugin.build.invalidOutput` before executable resolution. - -#### Typed run options and service/task preparation (version 10) - -Version 10 retains versions 1–9 and extends the same `lithe/build/prepareRun` -method. A provider run may declare `execution: "service"` or `"task"` only -with `requires.buildProviders: 10`. It still uses `fromTargets.tags`, never -host command or extension templates. Preparation ends before the host starts -the process; the host owns stdout/stderr, process identity, Stop and cleanup. -This version does not introduce provider-owned background services. - -The optional `launchOptions` object contains required `execution` -(`application`, `service` or `task`), `runtimeArguments` and `arguments` -(string arrays), and `environment` (a string map). Optional `entrypoint` is an -opaque nonempty string of at most 4,096 UTF-8 bytes without NUL; the owning -provider validates its meaning. Optional `workingDirectory` is a nonempty -workspace-relative directory, `.` allowed, without backslashes, absolute -paths, empty components or `..`. Unknown option fields are refused. Argument -and environment bounds match the launch result above, including empty argv -values. Options describe resolved user choices; providers must preserve -argument boundaries and cannot silently ignore unsupported choices. - -`execution` must match the run declaration (default `application`). Service -and task preparation require `launchOptions`; legacy application preparation -without it retains version 4 behavior. Hosts must reject options before -sending them to a session that negotiated a version below 10. Both SDKs -likewise reject unsupported or malformed options before invoking a handler. -Build options, resolved tool hints and native settings remain their existing -sources; launch options do not create a second profile or tool configuration. - -The host supplies `workspaceRoot` to `build.prepareRunPlan` when options contain -an explicit working directory. Core validates it against the canonical workspace, -including aliases, before preparation. The host passes the same options to -`build.decodeRunPreparation`; the result must use exactly that directory. -Only this explicit override may lie outside the selected instance. Without -an override the original instance containment rule still applies. Other -launch result validation and cancellation/stale-result behavior are unchanged. -Canonical fixtures: `fixtures/build-providers/build-provider-run-options.plugin.json` and -`fixtures/build-providers/build-run-options.json`. - -#### Registry connection debugging (buildProviders 11) - -Version 11 retains versions 1–10. A provider service run may declare -`debug: {"configurationType":"example"}`. This is a public DebugAdapter Registry -alias, not another plugin's private language server or a local adapter ID. -The host selects one currently enabled adapter advertising the type and `attach`, -respecting an explicit qualified adapter selection. Missing or ambiguous entries -fail before starting the provider process. It sends: - -```json -{"debug":{"adapterID":"dev.example/debug","configurationType":"example", - "target":{"kind":"connection","host":"127.0.0.1","port":51235}}} -``` - -These are the exact three debug fields and three target fields. The host owns -the port (integer 1–65535), process, readiness and cleanup. Explicit null, unknown -fields, remote hosts and application/task execution are rejected. The type must -match the selected run declaration. Both manifest and process agreement must -support v11; older SDKs reject before invoking a handler. The provider uses its -upstream engine to suspend the service until attachment; it owns runtime-specific -flags and fails if it cannot honor the request. It returns the ordinary portable -Run process plan, without selecting an endpoint or returning DAP arguments. - -The host retains the adapter's qualified identity, package and registry generation -through preparation, readiness and attach. Disable, replacement or stale input -revokes the operation and cleans its owned process. Adapter configuration is -produced by existing `debug.adapters.startArguments` with a `connection` target; -the selected registered adapter owns its transport. In particular, -`tcpLanguageServer` may refer only to a language server declared by that adapter's -own plugin. No built-in language debugger fallback is permitted. -This does not change same-package native `prepareDebug` (v5). -Canonical fixture: `fixtures/build-providers/build-connection-debug-options.json`. - -### Native debug preparation (version 5) - -A provider run may additionally declare `debug: {"adapter":"native"}` with -`requires.buildProviders: 5` and `requires.debugAdapters: 2`. `adapter` is a -local ID declared by this plugin; qualified cross-package references are refused. -The adapter must serve launch of executable targets, with bindings `program` ← -`target.path`, `cwd` ← `target.workingDirectory`, `args` ← `target.arguments`, -and `env` ← `target.environment`. These fields cannot be overridden by adapter -default arguments. This first increment covers native executable launch only; -it does not accept attach endpoints, backend-selected adapters or arbitrary DAP JSON. - -`build.prepareDebugPlan` validates the same selected run/project/target and -arguments as run preparation and returns `lithe/build/prepareDebug`. Only wire -version 5 accepts it. Progress, cancellation, timeouts, tool hints, workspace -ownership and JSON-RPC failure handling follow run preparation. A successful result -contains exactly these four fields: - -```json -{"program":"app/bin/sample","arguments":["a b","x#y"],"workingDirectory":"app","environment":{}} -``` - -The provider owns synchronization/build before returning. `program` is an existing -workspace-relative regular file contained in the selected instance, including -canonical symlink resolution. Arguments, environment and directory retain run -preparation's size and containment limits. Unknown fields are refused here; there -is no adapter process, socket, shell, private function or DAP argument channel. -`build.decodeDebugPreparation` takes the selected `run` separately and returns -`preparation` with its validated `root`, declaration-owned `adapter`, and these -four fields. Missing, malformed and escaping targets fail before adapter startup. - -The native host saves documents before preparation, retains model/configuration/ -source/plugin identity through decode, and drops stale results. It checks executable -permissions and canonical containment again at handoff. `debug.adapters.startArguments` -binds the validated target facts; the existing Registry launches the adapter using -its own permissions and package process declaration. The launch configuration retains -`pluginID/adapterID` for routing and retry. Stopping preparation cancels only its -operation; the Debug host owns launched sessions and plugin withdrawal cleanup. -Saved Run configurations keep their existing selectors and prepare again for Debug. - -Fixtures: [native declaration](fixtures/build-providers/build-provider-debug-preparation.plugin.json) -and [native result](fixtures/build-providers/build-debug-preparation.json). This does not provide -Java/JDT preparation, long-running services or cross-plugin collaboration. - - -The native Build tree re-resolves model IDs before preparation. Source/model, -option, settings, package and workspace changes revoke a pending preparation. -After validation the existing Run host resolves the executable and owns output, -stop, exit status, and argument-resource cleanup. Workspace teardown and plugin -disable stop the application by its exact host operation ID; an old owner -cannot stop a replacement process. The Run host can explicitly save a selector to the existing local Run v2 layer -as `provider: "build.provider"` with `extensions.build`. The reference contains -`pluginID`, `buildSystemID`, instance `root`, `run`, `projectID`, `targetID`, and -raw `userArguments`, never an executable, environment, or cached classpath. -Every restart re-resolves the enabled instance/model and sends a fresh preparation. -Missing plugins/targets/models fail explicitly; there is no command fallback. -Saving and running work before detector-generated Run configurations exist. -Service coordination, debug target registration and Java/Maven migration remain -separate. See `fixtures/build-providers/build-provider-run-preparation.plugin.json` -and `fixtures/build-providers/build-run-preparation.json`. - -### Optional native configuration (buildProviders 7) - -An own-process provider may opt into `buildSystems[].configuration: {"source":"provider"}` -with `requires.buildProviders: 7`. Shared language-server providers cannot opt in. -`build.configurationPlan` uses the same selected instance/options/environment/tool -snapshot as model loading and emits `lithe/build/configuration`. It has no project, -output file, or mutation parameters. Wire versions below 7 refuse the method. -The negotiated v7 server feature is `litheBuildConfiguration: true`; earlier methods -retain their existing admission rules. Configuration reads are bounded requests -with the existing cancellation, timeout, workspace and package ownership. - -`build.decodeConfiguration` validates `result` and returns `configuration`: -`{"format":"litheBuildConfiguration","version":1,"sources":[...]}`. There are at most -8 sources, each with a unique provider-owned `id`, `scope` (`installation`, `user`, -`workspace`), file `uri`, exact byte `revision` (`missing` or `sha256:` plus 64 lower-case -hex digits), `writable`, and up to 64 `fields`. -Installation sources are always read-only. Two scopes may alias one URI only when -both are read-only and have identical revision and fields. File URIs -cannot carry credentials, queries or fragments. - -Each field contains `id`, `kind` (`text`, `file`, `directory`, `boolean`, `stringList`), -`value` (raw native value, or null for absent), `effectiveValue`, `effectiveSource` -(an upstream technical origin ID). IDs are opaque bindings interpreted by the -provider; there is no document-format, XPath, XML root or element binding in the -host contract. Fields cannot duplicate or expose credential/secret fields; -values and identifiers are bounded and kind-checked. Full native documents, secret -values, credential-bearing URLs and private keys must never enter this response, -logs or normal controls. Source discovery, interpolation, precedence and effective -values belong to the selected upstream engine; Core does not infer them. - -The native host populates raw/inherited values, displays scope and target URI, -maintains drafts, and requires explicit Save. Opening, cancelling, losing focus -and leaving a page do not write native sources. Passive page reads refuse a -project-owned executable (such as a cold Wrapper), and cannot silently delegate -failed automatic tool discovery to the Provider. An explicit Read using project -tool action authorizes that tooling; explicit Save also owns its required read-back. The confirmed edit is -`{sourceID, revision, values:{:}}`; null removes only -that native override. Unchanged inherited values must not create overrides. - -`build.configurationEditPlan` takes the same instance/tool/options context, -`snapshot`, confirmed `edits`, and a fresh, empty, **already existing** `outputFile` -inside the host's isolated workspace state. It validates the bounded field IDs, -types and revision, then plans `lithe/build/editConfiguration` (protocol 7). -The provider owns its native format and uses an upstream/mature reader/writer; -Maven XML, JSON and TOML do not add host format cases. The provider verifies the -source revision and writes replacement bytes only to that private staging file. -Open without CREATE or following a symlink, validate that it is the empty staging -file before writing, and never truncate another file. A cancelled operation cannot -recreate removed staging. -Preserve unrelated content, format-supported comments and secrets privately. - -The reply is only `{format:"litheConfigurationEdit", version:1, sourceID, -revision, changed}`. `build.decodeConfigurationEdit` binds this receipt to the -same snapshot/draft and rejects extra fields. Full documents and private bytes -must never appear in RPC, UI, logs or model inputs. The native adapter validates -the staged bytes against the receipt SHA-256 before publication. A no-op creates -no source or native override. Providers never write the final source through -this workflow; publication remains the host's guarded atomic transaction. -The output uses the existing private outputs lifecycle, is never reusable across -worktrees, and is deleted on success, failure, cancellation, workspace/window -close and plugin revocation. A late backend may finish its already-open file -handle, but cannot resurrect a removed file. Installation resources stay read-only. - -The platform adapter denies app/plugin installation roots, validates the selected -file and canonical target, preserves metadata and performs guarded atomic publication -against the original bytes. Before commit the operation must still own its workspace, -package, settings and monotonic option revision. Conflicts retain the draft. After -save the host invalidates build/test/language import facts and re-queries the owning -provider; read-back must identify the saved source and exact published revision. -A failed read-back is not a successful effective-value publication. Native probes, -output files and mutable provider caches live only in workspace/platform state and -are not cross-worktree reusable. Installed packages remain byte-for-byte unchanged. - -Fixtures: [declaration](fixtures/build-providers/build-provider-configuration.plugin.json) and -[native facts](fixtures/build-providers/build-configuration.json). - -### Optional read-only model inputs (buildModelInputs 1) - -A producer opts into `buildSystems[].modelSharing: { options: [] }`. -Only normalized `projects`, `targets` and `contentRoots`, including their -ordinary public metadata, are published. Tasks, run entries, settings, -`optionValues`, process handles and private functions are excluded. The -options list names existing ordinary build options whose **effective values** -may be shared; omitted options stay private. A configuration fingerprint -identifies all effective options without publishing their values. - -A consumer declares `modelInputs: [{ pluginID, buildSystemID }]`, requires -`buildModelInputs: 1` and `buildProviders: 6`, and owns a provider and model. -Slots are exact optional identities; Core sorts them by plugin ID and build -system ID and rejects duplicates. Version 1 producers cannot also consume -inputs, so consumers cannot recursively re-export a model. - -The native host calls `build.resolveModelInputs` with the consumer manifest -and `{revision, sources: [{manifest, instances: [{buildSystemID, root, state, -model?, options?}]}]}`. Sources are enabled installed packages in the current -workspace activation, never identities supplied by another backend. -Input states are `ready`, `loading`, `stale`, or `failed`; only ready -instances include a complete normalized model. A truncated model becomes stale. -Core revalidates source manifests, ownership, shape and path containment and -returns `modelInputs: {version: 1, revision, inputs}`, where each input is: - -```json -{ - "pluginID": "dev.example.source", - "buildSystemID": "source", - "state": "available", - "instances": [{ - "root": "app", - "state": "ready", - "model": {"projects": [], "targets": [], "contentRoots": []}, - "configurationFingerprint": "<64 lowercase hex characters>", - "options": {} - }] -} -``` - -A missing, disabled, non-public or mismatched producer gives -`state: "unavailable", instances: []`. An installed public producer with no -detected instance is available with an empty list. A non-ready instance has -only `root` and `state`; no old model or options travel with it. Roots and -model paths remain workspace-relative, and instances are deterministically -ordered. There are at most 8 slots, 64 instances per source, 2,000 projects and -10,000 targets/content roots per instance, and 8 MiB of resolved JSON. The -revision is a nonnegative integer no larger than 9,007,199,254,740,991. - -The host supplies this snapshot as the common plan request's optional -`modelInputs`. It is required exactly for a consumer with declared slots. -Every Provider plan copies it unchanged into `params.modelInputs`; Core -revalidates the snapshot and rejects extra fields or mismatched slots. -The running backend must negotiate `litheBuild` version 6 independently of -manifest admission. Older versions reject an input-bearing request even for -an existing method such as `lithe/build/model`. - -A revision belongs to one workspace activation. The host revokes consumer -model/dependency loads, discovery and in-flight execution/preparation when a -producer's model, options, watched configuration or package availability -changes. Revisions also detect changing an option away and back before a reply -arrives. Guard the result after decoding as well as after the RPC; do not -publish an old reply merely because cancellation was ignored. Already launched -applications retain their existing native ownership. - -This facility never installs or activates a producer, invokes its private -functions, grants permissions, leases a process or resolves a package version. -There is no general plugin-dependency/export API. Backend authors must handle -unavailable and non-ready slots explicitly. Language integration and existing -Java/Maven business migration remain separate work. Shared fixtures: -`fixtures/build-systems/build-model-producer.plugin.json` and -`fixtures/build-systems/build-model-consumer.plugin.json`. - -### Inline provider test reports (buildProviders 8) - -A provider test may declare `results: { "decoder": "provider" }` with -`requires.buildProviders: 8`. Core adds `testResults: true` to the test request; -wire versions below 8 refuse it before invocation. The reply includes -`testResults: { "format": "litheTestResults", "version": 1, "tests": [...] }` -next to `exitCode` and `output`. Ordinary execute replies may include the same -report when the task also ran tests. Missing required or malformed reports fail -explicitly; there is no host report-file fallback. - -Each case has `suite`, `case`, `status` (`passed`, `failed`, `error`, `skipped`), -optional workspace-relative `project` and source `path`, one-based `line`, -`durationMillis`, `message`, and `invocations` (default 1). A report contains at -most 10,000 cases and 8 MiB UTF-8 JSON. Paths remain inside the selected build -root, durations are nonnegative safe integers, and messages are bounded. Core -validates and aggregates by project/suite/case, so identical names in distinct -projects remain distinct; it computes summary/success from the cases. Repeated -case durations are summed only if every invocation has a duration and the total -is a safe integer; otherwise the aggregate duration is omitted. - -An optional `coverage: [{ "project": "module", "suite"?: "Suite", "case"?: "method" }]` -records completed scopes. A missing case covers the entire suite; a missing suite -covers the project (and forbids case). Scopes use canonical workspace-relative -projects inside the instance root, at most 10,000 entries, and bounded nonempty -suite/case names. Core sorts and deduplicates them. Hosts may replace old outcomes -within those scopes; without coverage they replace only the returned exact cases. -Providers must not claim a complete suite when upstream filters or interruption -could have limited execution. Opaque selectors are never parsed by hosts to infer -coverage. - -The provider owns report discovery, freshness and upstream format semantics. -It must preserve reports from failing executions and reject unreadable/oversized -reports instead of returning empty success. The host passes the reply to -`build.decodeTestResults` as `request.result` with the same run/configuration -identity, checks ownership again after decode, and only presents the result. -Cancellation or configuration changes revoke late reports just like late output. -The report is operation state in a platform-provided writable directory, never -installed package state or a cross-worktree cache. Fixture: -`fixtures/build-providers/build-provider-reports.plugin.json`. - -### Build providers - -Some tools expose their model only through their own API (the Gradle Tooling -API, Mix inside the BEAM). Their plugin declares `provider`: a long-lived LSP -base-protocol process of the same kind as a language server, which answers -`lithe/build/model` and `lithe/build/dependencies`. It has one of two forms, -told apart by the `languageServer` key; mixing them is -`plugin.manifest.invalid`. - -| Form | Fields | -| --- | --- | -| Shared | `{ "languageServer": "", "executesProjectCode", "mayUseNetwork" }`. The named language must have a language server in the same plugin; the host sends the requests to that session. | -| Own process | The language-server process fields (`launch`, `arguments`, `validationArguments`, `runtimeDependencies`, `initializationOptions`) plus `executesProjectCode` and `mayUseNetwork`. Validation, launch templates, settings, and the install review are those of a language server, so it needs the `languageServer.launch` permission and is listed as a `packagedBuildProvider`, `systemBuildProvider`, or `runtimeBuildProvider` program with its `buildSystemID` and flags. | - -`model.source: "provider"` and `dependencies.source: "provider"` use it. A -provider no source uses, or a provider source without a provider, is -`plugin.manifest.invalid`. Detection never starts a provider: its instances -report `modelSource: "provider"` without a model. - -The host starts the process from `plugins.declarative.languageServerLaunchPlan` -with `buildSystemID`. For a provider source, `build.modelPlan` and -`build.dependencyPlan` return `provider: { method, params }` instead of -`arguments`, with the request's `decoder` (`litheBuildModel` or -`litheDependencies`) and the declared `executesProjectCode` and -`mayUseNetwork`: - -| Param | Meaning | -| --- | --- | -| `buildSystemID`, `root` | The instance. A model request always covers the whole instance. | -| `options` | Effective option values by option ID. | -| `optionArguments`, `environment` | Arguments from options, and selected runtime/tool environment merged with option contributions (options win). The host does not forward its complete environment. Providers use this environment for every invocation and cache identity. | -| `project` | Dependencies only: `{ name, path }` of the selected project, or `null` for the workspace. | -| `refresh` | Optional; `true` when the user asked to reload (Reload, Retry, a page's `build.refresh`) or the host reloads after a `sync` file changed. The provider must then recompute instead of answering from a cache or snapshot of its own. Absent or `false` for a first load, which a provider may answer from a snapshot it still trusts. | -| `tool` | Optional; `{ executable }`, the absolute path of the build tool the host resolved from the build system's `invocation` the same way a task run does (project wrapper, environment variable, `PATH`, the user's override), so the provider need not repeat the lookup. Absent when the host could not resolve it; the provider then looks the tool up itself. An explicit toolchain or path selection that cannot resolve fails before the Provider request; it cannot be dropped to trigger independent lookup. | - -The Core-only `tool` hint may include a bounded `environment` string map. Core merges it into the existing Provider `environment` parameter, with option contributions taking precedence; the wire `tool` remains `{ executable }`. This also applies to native configuration, tasks and tests. The backend process runtime and the selected build runtime are independent. - -The host passes `refresh` and `tool` in the `build.modelPlan` and -`build.dependencyPlan` requests; Core validates `tool.executable` as an -absolute path (`plugin.build.invalidSelection` otherwise) and copies both into -`params` only when they are set, so a request without them is the same as -before they existed. Command sources ignore both. Both are optional data -within protocol version 1. - -The host passes the JSON result of the request as `result` to -`build.decodeModel` or `build.decodeDependencies`, which decode it like the -canonical format of a command; a missing result is -`plugin.build.invalidSelection`, and a result over the output limit or of -another format is `plugin.build.invalidOutput`. - -The manifest only says how to start the provider and which sources use it. -Everything else is negotiated in the LSP `initialize` exchange, so a provider -can add optional data within a negotiated protocol version: - -- The host sends `capabilities.experimental.litheBuild: { "versions": [11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1] }`, - the build-provider protocol versions it speaks. Version 1 is the two - requests above with the params and result formats of this section; - version 2 adds typed task execution; version 3 adds typed test execution - and discovery; version 4 adds application run preparation; version 5 adds native debug preparation; - version 6 accepts the host's explicitly declared read-only model inputs; - version 7 adds source-backed native configuration; version 8 adds inline test reports; - version 9 adds opaque semantic test selectors; version 10 adds typed run options and - service/task run preparation; version 11 adds registry connection debugging. -- The provider answers `capabilities.experimental.litheBuild: { "version": 1 }` - with the version it chose from that list. A provider that answers no - version, or one the host did not offer, is not used for build requests; a - shared provider still serves its language. -- Both sides ignore fields they do not know in these objects and in request - params and results, so either side can add optional data within a version. - A change the other side must not ignore needs a new protocol version. - -A host that declares `buildProviders` keeps providers apart: - -- One process per plugin, build system, and workspace. Two plugins never - share a process, and the host never relays messages between processes; each - speaks JSON-RPC only with the host, over its own stdio. -- The shared form reuses a language server session of the same plugin only. -- A provider starts on the first build request, which only a user action - sends, and stops when its workspace closes, its plugin is disabled, or - before its package is replaced, rolled back, or uninstalled. A change of - the plugin's settings restarts it on the next request, so its launch - arguments always reflect the current values. A provider that exits is - started again by the next request. -- Installation refuses a package whose provider launch points at a missing - file, a path outside the package or through a symbolic link, or a packaged - executable or runtime that is not a regular executable file. -- Its writable state lives in the plugin's state directory for that build - system, never in the plugin package or the host's installation. - -### Host integrations - -`hostIntegration` names host code that owns one concern while a built-in tool -migrates onto this model. Only official plugins may name one, and only -`maven` exists; a model, test-result, or dependency source of -`hostIntegration` needs it. Anything else is -`plugin.integration.unsupported`. New build systems use the declarative -contract or a canonical format instead. - -### Commands - -The `build.*` Core commands (see `shared/contracts/rust-core-api.md`) take the -manifest, the build-system ID, and a request, and revalidate the manifest -every time. `build.detect` walks the workspace once for all enabled plugins -and returns instances, with the model of `static` and `hostIntegration` -sources. `build.invocationPlan` and `build.checkToolVersion` resolve the -executable; `build.resolveOptions` checks stored option values and returns -the configuration fingerprint; `build.modelPlan`, `build.taskPlan`, -`build.testPlan`, and `build.dependencyPlan` return argv plans, or provider -requests for a provider source; -`build.decodeModel`, `build.decodeTestResults`, `build.decodeDiagnostics`, -and `build.decodeDependencies` normalize output or a provider result; `build.syncFingerprint` -digests the watched files. A selection the declaration does not allow is -`plugin.build.invalidSelection`; an operation it does not declare is -`plugin.build.unavailable`. - -## API level 3: VCS providers - -`vcsProviders[]` declares version control systems the plugin implements, each -through its own LSP base-protocol process: the VCS ID, the static markers that -identify a root, metadata paths the host watches, the VCS client the provider -drives, and the shared [`serverProcess`](#capability-versions-level-3) launch -fields. The ID `git` is reserved for the built-in support -(`plugin.vcs.reserved`). Capabilities belong to the running process and are -negotiated in `initialize` under `experimental.litheVcs`, never declared in -the manifest. - -Detection never starts a process: `vcs.detectRoots` finds roots from the -markers, and the host starts a provider only after a root of its VCS is -found. The install review lists the provider as a `…VcsProvider` program with -its VCS client (`vcsTool`) and `mayUseNetwork`. Requests go through -`lsp.vcsRequest` by operation name and replies are normalized by -`vcs.decodeReply`. The fields, operations, reply shapes, and error codes are -defined in [the VCS provider contract](https://github.com/1lck/Lithe-IDEA/blob/preview/shared/contracts/vcs-provider-v1.md). - -## API level 4: debug adapters - -`debugAdapters[]` declares debug adapters the plugin implements. Each one is a -DAP process the host starts and talks to over stdio or a loopback TCP port, or -a debug server hosted by the plugin's own language server. -The declaration is data only: there is no resolver, workflow, host integration, -or `initializationOptions`, and any such field is refused. Requires -`requires.debugAdapters` 1, `debug.launch` (plus `debug.attach` when an -adapter serves `attach`), and one `onDebug:` activation event per adapter. -A manifest below level 4 may not declare `debugAdapters`, and a level 3 manifest may not require `debugAdapters` or `serverProcess` 2. - -| Field | Meaning | -| --- | --- | -| `id`, `displayName` | Plugin-local ID (unique in the plugin) and its title. | -| `adapterID` | DAP `initialize.adapterID`; defaults to `id`. | -| `requests` | `launch` (default) and/or `attach`. | -| `selectors[]` | Optional automatic matching by `targetKinds` and `languageIDs`; absent means explicit selection only. | -| `configurationTypes` | Imported `launch.json` `type` values the adapter answers to. | -| `configurations.launch/attach` | Default DAP `arguments`, a packaged `parametersSchema`, and `targetBindings` (`program` ← `target.path`, `processId` ← `target.processID`, `cwd` ← `target.workingDirectory`, and for `attach` only `connection` ← `target.host`, `target.port`, `target.pathMappings`; version 2 also supports bounded `args` ← `target.arguments` and `env` ← `target.environment`; see [Remote attach](#remote-attach)). A configuration for an undeclared request is refused. | -| `configurations.launch.executable` | For a target that is a source file the adapter cannot debug directly (C, C++, Swift): `setting` names a `file` setting of the plugin, `candidates[]` (up to 8) are the paths a host looks for when the user chose nothing. Each candidate starts with `${workspaceFolder}/` or `${fileDirectory}/`, may use `${fileBasenameNoExtension}`, and has no `..`. Declare it together with `targetBindings.program: "target.executable"` and neither without the other; a launch fills `program` with the path the host settled on. The user's setting always wins: a chosen path that is not a runnable file is an error, not a reason to try the candidates. The host shows the path it found in that setting, and the setting's `description` is where the plugin teaches how to produce the program. | -| `capabilities.disabled` | Standard DAP `supports*` names or `exceptionBreakpointFilters` the host treats as absent. | -| `features` | `debugAdapters` 3. Adapter-specific DAP extensions the adapter implements; see [Adapter features and defaults](#adapter-features-and-defaults-debugadapters-3). | -| `defaults` | `debugAdapters` 3. Values the adapter starts with when the user configured none. | -| `console.commandPrefix` | Text (1–8 characters, no spaces; for lldb-dap a backtick) the adapter's console reads as "what follows is a debugger command". The host puts it before the typed line only when it asks the adapter to complete, and moves the adapter's answer back, so the user never sees it. An adapter that treats a bare word as an expression (lldb-dap) otherwise mixes language keywords such as `long` into the first word's completions; the prefix limits them to commands. Declare at least this or `console.commands[]` when `console` is present. | -| `console.commands[]` | Debugger commands (`name`, optional one-line `description`) the Debug Console offers as completions. An adapter that answers the DAP `completions` request completes live, so list commands only for an adapter that does not (or whose live answers lack some commands); the host merges both. Names are inserted as written, unique, and not padded with spaces; descriptions are shown as written and not translated. | -| `launch.process` | The shared `serverProcess` launch fields without `initializationOptions`, or `{"launch": {"kind": "runSelectedRuntime", "tool": "python" \| "java" \| "node"}}`, which needs `serverProcess` 2 or later and is the only use of 2; from `serverProcess` 4 `tool` is a [tool-definition ID](#tool-references-serverprocess-4). Required for every transport except `tcpLanguageServer`, which must not have it. | -| `launch.transport` | `stdio`, `tcpAnnounced` (`endpoint`: `stream`, one-line `prefix`, `value` = `port` or `hostPort`), `tcpPort` (`endpoint.port`), or `tcpLanguageServer` (`endpoint`: `languageID`, `command`). TCP endpoints are loopback only. | -| `launch.endpoint` for `tcpLanguageServer` | For an adapter that lives inside a language server and has no process of its own (the Java Debug Server runs in JDT LS). `languageID` names a `languageServers[]` entry of the same plugin; `command` (1–128 characters of letters, digits, `.`, `_`, `:`, `-`) is the `workspace/executeCommand` the host sends to that server for each session. The server answers with the loopback port to connect to, as an integer or a numeric string from 1 to 65535. The host starts the language server for the workspace first, as it does for editing. The command is part of what the user reviews at install and update, and changing it asks again. | - -### Adapter features and defaults (`debugAdapters` 3) - -A host never recognizes an adapter by its ID. What is specific to an adapter -is declared, and the shared debug engine follows the declaration: - -```json -"features": { - "hotCodeReplace": { - "request": "script.reload", - "event": "script.reloaded", - "changedField": "modules", - "errorField": "error" - }, - "stepFilters": { "argument": "stepFilters" } -}, -"defaults": { - "stepFilters": { "classNameFilters": ["_vendor.*"], "skipSynthetics": true } -} -``` - -| Declaration | Meaning | -| --- | --- | -| `features.hotCodeReplace.request` | The DAP command the host sends to apply changed code to the running debuggee (the standard `redefineClasses` inspection). Present means the adapter supports hot code replace; absent means it does not. | -| `features.hotCodeReplace.event` | A DAP event whose `message` the Debug Console shows as progress. | -| `features.hotCodeReplace.changedField`, `errorField` | Fields of the response body: the list of replaced units, and a failure message the adapter reports in a successful response. A response without `changedField` replaces nothing visible. | -| `features.stepFilters.argument` | The launch argument through which the adapter receives stepping filters, shaped `{skipClasses, skipSynthetics, skipStaticInitializers, skipConstructors}`. An argument the user's configuration already sets is kept. | -| `defaults.stepFilters` | `classNameFilters` (up to 256 single-line patterns of at most 256 characters), `skipSynthetics`, `skipStaticInitializers`, `skipConstructors`, `hideFilteredStackFrames`. Used when neither the launch nor the user's settings name filters. | - -Names (`request`, `event`, fields, `argument`) are a letter followed by up to -63 letters, digits, `.`, `_`, or `-`. A declaration with a malformed name, or a -field this version does not define, is `plugin.manifest.invalid` with the -`field` that names it, and any `features` or `defaults` requires -`requires.debugAdapters` 3. The launch plan's `debugAdapter` descriptor carries -both so the host can pass them to `debug.createSession`. A plugin that declares -neither keeps the behavior of `debugAdapters` 1 and 2. - -### Remote attach - -An adapter that attaches to a debuggee on another machine (a JVM started with -`-agentlib:jdwp`, a Node inspector, gdbserver) is an -ordinary `attach` adapter whose `targetBindings` carry a `connection`. The -adapter itself still runs on this machine, stdio or loopback as before; only -the debuggee is remote. This is the adapter-to-debuggee endpoint, not the -IDE-to-adapter DAP endpoint. By default, debugpy `--listen` starts a DAP adapter -on the target machine: the IDE must connect to that adapter, not start another -local adapter and merely pass it `connect.host` and `connect.port`. - -`connection` does not declare an external DAP endpoint or remote adapter -execution (for example `ssh host gdb -i=dap`). These require separate host -integration; this contract and its validation do not establish that support. -The current transport scope is ordinary TCP connection and lifecycle, reusing -the existing socket implementation and retaining stdio. It does not add proxy, -tunnel, port-forwarding or SSH execution settings, or relax the loopback rule -for language-server-provided DAP endpoints. Adapter-native source mapping should -be reused where applicable, without translating the same path pair again in Core. - -The following illustrates nested argument binding and mapping shape, not a -complete debugpy `--listen` connection configuration: - -```json -"configurations": { - "attach": { - "arguments": { "timeout": 5000 }, - "targetBindings": { - "connection": { - "host": "connect.host", - "port": "connect.port", - "pathMappings": { "shape": "objects", "argument": "pathMappings", - "localKey": "localRoot", "remoteKey": "remoteRoot" } - } - } - } -} -``` - -- The values of `connection` are paths into the adapter's `arguments`, because - adapters name and nest them differently: java-debug takes `hostName` and - `port`, nested arguments may use `connect.host` and `connect.port`, js-debug - `address` and `port`, gdb one `host:port` string. A path is 1–4 dot-separated names of - letters, digits, `_`, and `-` (up to 64 characters each) and Core creates the - intermediate objects. -- `host` and `port` are declared together. `address` takes the endpoint as one - `host:port` string, with an IPv6 host in brackets (`[2001:db8::1]:2345`); it - stands in for `host` and `port`, or is a further destination beside them. - At least one of the two forms is required. -- `pathMappings` is optional and has four shapes, one per way adapters take - source roots: - - `objects` fills a list of objects, one per mapping: `argument` names the - list, `localKey` and `remoteKey` the keys of each object - (`[{ "localRoot": …, "remoteRoot": … }]`). - - `first` is for an adapter with a single pair of roots and fills `local` - and `remote` from the one mapping. It takes exactly one: a target with - more is refused rather than truncated. - - `dictionary` fills an object at `argument` whose keys are the roots of one - side and whose values are the other (`"keyedBy": "remote"` gives - `{ "": "" }`). A target with the same root twice on the - keyed side is refused, since an object holds one value per key. - - `pairs` fills a list of two-element arrays at `argument`, in the order - `"order": "remoteLocal"` (`[["", ""]]`) or `"localRemote"`. - An adapter whose mapping is none of these declares no `pathMappings`, and a - start that sends mappings to it is refused. -- A destination may not equal, contain, or sit inside another destination, the - `processId` or `cwd` argument a declared binding of the same configuration - fills, or a name that the configuration's own `arguments` already sets. Defaults win over bindings, so without this rule - the adapter would connect somewhere other than the endpoint the user - confirmed. A manifest that does it is `plugin.manifest.invalid`. -- `connection` is allowed under `attach` only. `selectors[].targetKinds` may - list `connection`, and only for an adapter that declares the binding. - -The target of a start is `{ "kind": "connection", "host", "port", -"pathMappings"?: [{ "local", "remote" }] }`. `host` is a DNS name or an IP -literal of 1–253 characters, with labels of up to 63 letters, digits, and -hyphens, none leading or trailing: no scheme, port, brackets, whitespace, or -user. A dotted run of digits must be a valid IPv4 address, and IPv6 zone IDs and -internationalized names (use punycode) are not accepted. `port` is 1–65535. -There are at most 16 mappings; each root is 1–1024 characters without control -characters, and a `local` root must be an absolute path on the host's -platform. - -`debug.adapters.startArguments` answers with the filled `arguments` and a -`connection: { host, port, remote }`. `remote` is `false` only for what -Core can prove local from the text: `localhost` (any case), `127.0.0.0/8`, and -`::1`. Every other host, including `0.0.0.0`, `::ffff:127.0.0.1`, and -`localhost.example.org`, is `remote: true`. A host asks the user to confirm each -`remote` endpoint it has not been told to trust, and does not remember the -answer by default. `debug.attach` covers remote attach; there is no separate -permission. `plan.debugAdapter.remoteAttach` in the launch plan is -`{ "pathMappings": boolean, "maxPathMappings": number }` for an adapter that -takes a connection (`maxPathMappings` is 0 without mappings, 1 for `first`, and -16 otherwise) and `null` otherwise, so a host knows whether to offer the -host-and-port form and the mapping list, and how many rows the list may hold. - -The cases in `fixtures/debug-adapters/debug-adapter-rejections.json` state the stable code and -field for each refusal and the layer that reports it: `schema`, -`coreManifest`, `corePlan` (one start: stale registration or runtime -selection, a target missing a fact a binding reads; the request defaults to -`launch` and `context.request` sets `attach`), and `coreInstall` -(a `parametersSchema` that is missing or links outside the package). -`fixtures/debug-adapters/debug-adapter.plugin.json` is a valid example, and -`fixtures/debug-adapters/debug-adapter-remote-attach.plugin.json` declares six adapters that -differ in how they take a connection. - -## Output link matchers (`outputLinkMatchers` 1) - -`outputLinkMatchers[]` lets a plugin make text in the Run and Test consoles -clickable, such as a traceback frame or a panic location. The host knows no -tool's output format: the plugin declares the pattern and Core finds the -matches. Requires `requires.outputLinkMatchers` 1. Matchers alone are a -complete plugin: one that declares nothing else is valid, and matchers without -`resolve` need no backend. - -```json -"outputLinkMatchers": [ - { "id": "traceback", "pattern": "File \"(?P[^\"]+)\", line (?P\\d+)", "scope": "run" } -] -``` - -| Field | Meaning | -| --- | --- | -| `id` | Plugin-local ID: a lowercase letter followed by up to 63 lowercase letters, digits, `.`, `_`, or `-`; unique in the plugin. At most 16 matchers per plugin. | -| `pattern` | A regular expression of 1 to 512 bytes matched against one console line. It uses the Rust `regex` syntax, so it has no backreferences and no look-around, and its compiled size is limited. It names at most 8 groups, each a camelCase name, and must not match empty text. | -| `scope` | `run` or `test`: the console the matcher applies to. Absent means both. | -| `resolve.function` | Optional ID of a function of the plugin's `backend` 2 process. Needs `backend` 2. | - -Without `resolve`, the pattern must capture a `path` group and may capture -`line` and `column` (1-based); no other group name is accepted. A relative -`path` becomes one candidate per workspace root, an absolute one counts only -inside a workspace root, and a path that leaves every root is not linked: a -console line can never open a file outside the workspace. With `resolve`, the -pattern may name any groups. The host calls the function when the user -clicks, with `{groups}` (the captured text by name) and the window's `context`, -and the backend answers `{uri, range?}` or `null`. - -Core owns the decision, so every host links the same text: - -- `outputLinks.match` takes `{scope, platform, caseSensitive?, workspaceRoots, - sources: [{pluginID, matchers}], lines}` and returns `{links}`. Each link is - `{line, start, length, pluginID, matcherID}` plus either `location` (`{paths, - line?, column?}`: the host opens the first existing path) or `resolve` - (`{function, groups}`). `start` and `length` count UTF-16 code units of the - line. Matches are found in source order and then declaration order, and a match - overlapping an earlier link is skipped. A request carries at most 256 lines, - 64 sources and 16 roots; a line is scanned up to 4096 bytes and links at most - 8 times. -- `outputLinks.decodeResolution` takes `{reply}` (what the function answered) - and returns the location to open, `{path, line?, column?}` with 1-based - positions, or `null`. A reply opens only a `file:` URI and only the members - `uri` and `range` are accepted; a 0-based `range.start` is converted. - -The host runs matching only for lines it displays, never for output a plugin -has not been enabled for, and ignores a link whose file does not exist. Fixtures: -`fixtures/run/output-link-matchers.json` and `fixtures/run/tool-reference-launch.plugin.json`. - -## Plugin backend - -A plugin with its own pages may need code that a page cannot run: database -drivers, network clients, file formats. `backend` declares one long-lived -process that serves only the plugin itself, independent of any build system, -language, or workspace: - -```json -"pluginAPIVersion": 3, -"requires": { "backend": 1, "serverProcess": 1, "ui": 2 }, -"permissions": ["backend.launch", "credentials.store", "ui.contribute", "ui.web"], -"backend": { "launch": { "kind": "packaged", "path": "bin/backend" }, "arguments": ["--state", "${stateDir}"] } -``` - -- `backend` holds exactly the [`serverProcess`](#capability-versions-level-3) - launch fields, with the same templates and install review; the review lists - it as `packagedBackend`, `systemCommandBackend`, or `runtimeBackend`. It - needs `pluginAPIVersion` 3, `requires.backend: 1`, `requires.serverProcess: - 1`, and the `backend.launch` permission. `fixtures/backend/backend.plugin.json` is - the example; the backend cases of `fixtures/manifest/invalid-manifests.json` are the - rejections. -- In `backend` 1 only the plugin's own [web pages](#web-content-ui-2) call it, - so a backend without a web tool window is `plugin.manifest.invalid`. -- It belongs to no workspace: `${workspaceStateDir}` is refused, and its - writable state is `${stateDir}`. The host starts it with `${stateDir}` as - root and working directory. -- The host keeps at most one backend process per plugin, starts it on the - first `functions.*` call from one of the plugin's pages, and ends it when - the plugin is disabled, updated, or uninstalled, and when the host quits. - Its consent is the install review: it needs no per-workspace prompt. -- The backend speaks the [plugin-function protocol](#plugin-functions) and, - from version 2, may ask the host for the - [host services](#host-services-protocol-version-2) its permissions grant. - It owns no domain contract: it never answers `lithe/build/*` or VCS - requests. -- A plugin publishes one archive per platform, so its packaged path does not - vary by `${arch}`; a macOS archive may carry a universal binary. - -### Backend 2: workspace contexts - -`requires.backend: 2` keeps every rule of version 1 and changes when the -process starts and what it learns about workspaces. -`fixtures/backend/backend-workspace.plugin.json` is the example. - -- It may start without a page. It needs at least one way to start: a web - tool window (first page call, as in version 1), a `ui.commands[]` entry - (its `onCommand:` also starts the backend), the `onWorkspaceOpen` - event, or a provider the host queries: a toolchain or keymap import - provider, or a language server with `launch.kind: "backend"`, whose start - asks the backend for its command line. A backend 2 with none of them is - `plugin.manifest.invalid`. -- It is still one process per plugin, shared by every open workspace and - window, on the machine that runs Lithe, also for remote workspaces. No - workspace is process state: each call names its workspace explicitly - (a context, below), so `${workspaceStateDir}` stays refused. -- Starting on `onWorkspaceOpen` never delays opening the workspace. The host - starts such backends after the window is shown, one plugin at a time, and - a backend that does not finish `initialize` within its initialize timeout - is stopped and reported like any failed server start. A failed or - disabled backend never blocks the workspace. -- The `workspace.metadata` permission grants the - [`workspace` host service](#workspace-contexts-and-capability-discovery-protocol-version-3). - It reveals the open workspaces' names, root folders and IDs, their - authority, and the plugin's per-workspace state directory; it reads no - file content. -- Activation is gated only by the plugin being installed, enabled, and - reviewed. Lithe has no workspace trust state at the moment: an operation - that runs or changes something asks the user per operation, as the host's - own controls do. -- A host that offers only `backend: [1]` refuses the manifest with - `plugin.api.unsupported` (`requires.backend`), so an older host never - starts a process that expects contexts. - -## Project generators - -`projectGenerators` (requires `projectGenerators` 1 or 2 and the -`project.generate` permission) adds entries to the host's New Project window. The host owns the -window: the entry list and its search, the project name and location, the -"create Git repository" option, the empty project, and the Create button. A -generator declares only its own fields, the languages and build systems the -result needs, and the steps that produce it. No host code branches on a -generator ID. - -```json -"projectGenerators": [{ - "id": "spring-boot", - "displayName": "Spring Boot", - "section": "generator", - "icon": {"path": "icons/spring-boot.svg", "mode": "original"}, - "fields": [ - {"id": "groupId", "type": "text", "title": "Group", "default": "com.example", "pattern": "[a-z][a-z0-9.]*"}, - {"id": "packageName", "type": "text", "title": "Package name", - "default": "${field.groupId}.${project.name|package}", "pattern": "[a-z][a-z0-9.]*"}, - {"id": "jdk", "type": "runtime", "title": "JDK", "runtime": "java", "minimumVersion": "17"} - ], - "requirements": [{"languageID": "java"}, {"buildSystemID": "maven"}], - "steps": [{"kind": "archive", "url": "https://start.spring.io/starter.zip", - "query": [{"name": "packageName", "value": "${field.packageName}"}]}] -}] -``` - -| Field | Meaning | -| --- | --- | -| `id` | Lowercase letters, digits, and hyphens; unique in the plugin. | -| `section` | `project` lists the entry under "New Project" (a plain project of a language); `generator` lists it under "Generators" (a framework or scaffolding tool). | -| `order` | 0–1000, default 100. Entries are sorted by section, `order`, then name. | -| `fields` | The generator's inputs, drawn and evaluated in order. A field may read only fields declared before it. | -| `requirements` | `languageID` or `buildSystemID` (optionally `when`) the created project needs. The catalog lists the installed plugins that provide each, with their enabled state, so the host can offer to enable one or open the marketplace. A requirement never blocks creation. | -| `steps` | Run in order in a staging directory that becomes the project root. | -| `openFiles` | Project-relative files the host opens after creating the project, optionally with `when`. | - -### Fields - -| `type` | Value | Properties | -| --- | --- | --- | -| `text` | A string | `default` (a template over `${project.name}` and earlier fields, re-evaluated until the user edits the field), `pattern` (matched as a whole), `maxLength` (default 256, at most 1024), `placeholder`, `optional`, `maximumVersion` | -| `enum` | One option | `options` (1–16 `{value, title}`), `default` (the first option otherwise), `presentation` (`segmented` or `menu`), `maximumVersion` | -| `boolean` | `true` or `false` | `default` | -| `multiSelect` | A list of options, kept in declaration order | `options` (1–128, each with an optional `group` heading), `default` | -| `runtime` | A host-discovered installation (`projectGenerators` 1 only) | `runtime` (a valid tool-definition ID; any other value is `plugin.manifest.invalid`), `minimumVersion`, `optional`. The host chooses the initial value. | -| `tool` | An installation of a [tool definition](toolchains/README.md), by home directory (`projectGenerators` 2 only) | `tool` (a tool definition ID), `minimumVersion`, `pinAs`, `optional`. See [Tool fields](#tool-fields). | - -`maximumVersion` is a template over earlier fields naming the highest version -the value may be, compared numerically by dotted components. A target Java -release that must not exceed the selected JDK declares -`"maximumVersion": "${field.jdk.major}"`; while the bound expands to an empty -string (no JDK chosen yet) nothing is checked. - -Every field takes `id` (lowerCamelCase), `title`, `description` (shown behind -an info tip), `advanced` (listed under the collapsed "Advanced Settings" -group), and `visibleWhen`. A hidden field is not validated, and templates and -conditions read it as absent. - -Text values never start with `-` and never contain control characters, so a -value cannot become an option or split a line. A project name is one -directory name: not empty, at most 128 characters, no `/`, `\`, `:`, or -control characters, not `.` or `..`, no leading `-`, and no surrounding -spaces. - -### Tool fields - -A `tool` field (requires `projectGenerators` 2) lets the user pick one -installation of any tool that a plugin declares in -[`toolDefinitions`](toolchains/README.md), such as a Python interpreter, a Node.js -runtime, or a JDK. The generator names no host feature and no language: the -host lists installations through its generic tool discovery and the user's -tool settings, exactly as the tool's own settings page does. - -```json -{"id": "sdk", "type": "tool", "title": "Python", "tool": "python", - "minimumVersion": "3.11", "pinAs": "project"} -``` - -| Property | Meaning | -| --- | --- | -| `tool` | Required. A tool definition ID: a short ID such as `compiler` defined by exactly one enabled plugin, or `:`. There is no closed list; a tool nobody declares has no installations, and neither has a short ID several enabled plugins define, because it belongs to none of them. | -| `minimumVersion` | Optional, one to three dotted numbers. An installation below it is not selectable. | -| `pinAs` | Optional. `project` saves the selection as the created project's own tool choice (the same per-directory pin the tool's settings page edits), so the project builds and runs with the installation picked here. Without it the selection only feeds the steps. | -| `optional` | Optional. Without a usable installation an optional field stays empty and leaves no pin; otherwise the form reports `required`. An installation below `minimumVersion` is not usable. | - -A tool field has no `default`; the host chooses the initial value. Core picks, -among the installations the host listed, the user's choice if it is still -listed and otherwise the newest version (the host's first among equal -versions). Versions compare as releases, so trailing zeros do not count: -`3.11`, `3.11.0`, and `3.11.0.0` are equal. An installation below -`minimumVersion` is marked in the field's `installations`, so the host can -show it disabled. When the selection is below `minimumVersion` the form -reports `toolTooOld`, except that an optional field the user has not set -stays empty rather than picking an installation that is too old. - -A generator with `projectGenerators` 2 must not declare a `runtime` field, and -a generator with `projectGenerators` 1 must not declare a `tool` field -(`plugin.manifest.invalid`). Version 1 generators keep working unchanged. -A host that lacks `projectGenerators` 2 refuses the whole manifest with -`plugin.api.unsupported` (`requires.projectGenerators`). - -### Conditions - -`when` and `visibleWhen` take one condition or a list that must all hold: -`{"field": "", "equals" | "notEquals": }` or `{"field": "", -"oneOf": [, …]}`. Values are option values for `enum`, `true`/`false` -for `boolean`, and strings for `text`, `runtime`, and `tool` (`notEquals: ""` -tests that an optional field is filled; a tool field compares as its home -directory). A condition on a hidden field is false. - -### Templates - -Strings in the manifest use `${…}`: `${project.name}`, `${field.}` (a -text or option value, `true`/`false`, a comma-separated list, or the home -directory of a runtime or tool), `${field..version}` and -`${field..major}` (runtime fields only; `21` for `21.0.4`, `8` for -`1.8.0_412`), and `${field..executable}` (tool fields only: the path of -the tool's executable in the chosen installation). Modifiers follow `|` and -apply in order: `path` turns dots into `/`, `package` makes a valid package name -(`com.Example.my-app` → `com.example.myapp`), and `lower` lowercases. - -Template files use `{{ … }}` with the same variables, because POMs, Gradle -scripts, and properties files already contain `${…}` that must reach the -project unchanged. Only `{{` followed by `project.` or `field.` is a -variable; any other `{{` is copied as text. A file name may also contain -`${…}` variables, although a step's `target` is the portable place for them. -A path segment that starts with `dot-` becomes a dotfile (`dot-gitignore` → -`.gitignore`), because packages keep no hidden files. Hidden files in a -template directory are skipped; symbolic links are refused. - -### Steps - -| `kind` | Properties | The host… | -| --- | --- | --- | -| `files` | `source` (package-relative directory), `target` (project-relative directory template), `when` | writes the files of the plan, setting the executable bit where the template file has one. | -| `command` | `command` (a bare executable name), `arguments` (strings or `{value, when}`), `environment`, `collect`, `mayUseNetwork`, `timeoutSeconds` (default 600, at most 1800), `when` | resolves the executable like a build tool, runs it with the staging directory as the working directory, and, with `collect`, moves the contents of that subdirectory up into the project root. Arguments that expand to an empty string are left out. | -| `archive` | `url` (no query or fragment), `query` (`{name, value, when, omitEmpty}`), `when` | downloads the zip and calls `project.extractArchive` into the staging directory. | - -Archive addresses must expand to HTTPS URLs (HTTP only for `localhost`, -`127.0.0.1`, or `[::1]`) without credentials. The URL may come from a field, -such as a configurable Spring Initializr server; the host shows the server -before creating. Template directories are limited to 1024 files, 1 MiB per -file, and 8 MiB in total; archives to 20,000 entries and 512 MiB extracted. - -### Commands - -| Command | Payload | Result | -| --- | --- | --- | -| `project.generatorCatalog` | `{plugins: [{manifest, enabled}], hostCapabilities?}` | `catalog: {generators: [{pluginID, pluginName, pluginEnabled, generator, requirements: [{languageID or buildSystemID, providers: [{pluginID, pluginName, enabled}]}], tools: [{fieldID, tool, providers: [{pluginID, pluginName, enabled}]}], usesNetwork}], issues: [{pluginID, error}]}` | -| `project.generatorForm` | `{manifest, generatorID, form}` | `form: {projectName: {problem}, fields: [{id, visible, value, problem?, installations?}], activeRequirements, valid}` | -| `project.generationPlan` | `{manifest, generatorID, packagePath, form}` | `plan: {projectName, steps, openFiles, runtimes: [{field, runtime, home, version}], toolPins: [{field, tool, pinAs, home, executable}], usesNetwork}` | -| `project.checkName` | `{projectName}` | `name: {problem}` | -| `project.extractArchive` | `{archivePath, destination}` | `extracted: {files}` | - -`form` is `{projectName, values, edited, runtimes, tools}`. `values` maps field -IDs to values; a text value counts only when its ID is in `edited`, so derived -defaults keep following the fields they read. `runtimes` maps runtime field -IDs to `{home, version}` of the user's selection. `tools` maps tool field IDs -to the installations the host found for the field's tool, in the order the -host prefers them, as `[{home, executable, version}]`; the field's `values` -entry is the `home` of the user's choice. A tool field in the result carries -`installations: [{home, executable, version, meetsMinimum}]`, so the host -draws its picker from Core's answer, and its `value` is the installation Core -selected. A field `problem` is one of `required`, `tooLong`, `invalidFormat`, -`unsupportedValue`, `runtimeTooOld`, `toolTooOld`, and `versionTooHigh`; hosts -localize by code. Plan steps are `{kind: -"writeFiles", files: [{path, contents, executable}]}`, `{kind: "command", -command, arguments, environment, collect, mayUseNetwork, timeoutSeconds}`, and -`{kind: "archive", url, host, format: "zip"}`. `toolPins` lists, for each -visible tool field with `pinAs` and an installation, the tool and the chosen -`home` and `executable` that the host saves as the project's pin. - -The catalog entry's `tools` lists, for each tool field, the plugins that -declare the field's tool and whether they are enabled, in the same way as -`requirements`: the host can offer to enable one, or open the marketplace, -when the field has no installation. Core only names declarations; whether a -definition is trusted, and whether the tool is installed, is decided by the -host's tool registry and discovery. - -After the steps, the host moves the staging directory to its final location -(refusing an existing one), may record a `java` runtime as the project's JDK -(version 1 runtime fields only), saves the `toolPins` as the project's tool -choices through the same store the tool settings page edits, creates the Git -repository when asked, and opens the project. A failure or cancellation -removes the staging directory and leaves nothing behind -(`plugin.project.generationFailed`). - -## Plugin functions - -A plugin backend (a language server, build provider, or -[plugin backend](#plugin-backend) process the plugin starts) can offer -**plugin functions**: actions with -serializable params and results. A function is private to its plugin unless -the manifest exports it: the host invokes a private function on behalf of the -same plugin, for example from that plugin's own window, and another plugin -can call only an [exported function](#cross-plugin-calls-protocol-version-4). -Functions complement the -typed domain protocols; they never replace them. Versions 1 to 4 of the protocol are -implemented in Rust Core (`rust/lithe-core/src/lsp/interface/plugin_function.rs`, -`function_relay.rs`). -macOS starts every build provider process as a session of the plugin that -owns it and invokes its functions from that plugin's web pages (the -`functions.*` bridge methods below). A provider served by a shared language -server is started by the host for every plugin of its language, so it serves -no plugin's functions. Windows has no plugin backend host. The -[official SDKs](#official-backend-sdk) implement the backend side. - -### Capability ownership - -Every capability has one owner, who defines its contract, and one direction: - -| Direction | Contract owner | Implemented by | Travels as | Examples | -| --- | --- | --- | --- | --- | -| Plugin provides a domain capability | Lithe: the typed domain contract | The plugin, declaratively or by its backend | A manifest `source`, Core plans and decodes, a typed `lithe/build/*` request | Build model, dependency tree; later task execution | -| Plugin provides a plugin function | The plugin: its own params and results | The plugin's backend | `lithe/function/invoke` | Refresh a private snapshot, a step behind a button of the plugin's own UI | -| Plugin calls a host capability | The host | The host | `lithe/host/*` requests, offered per protocol version | Run a process through the host's runner, write output, store state | -| Plugin calls another plugin's exported function | The exporting plugin: its own params and results, under an exported version | The exporting plugin's backend | `lithe/host/functions/invoke`, relayed by Core as `lithe/function/invoke` | A language plugin asks a build plugin for the options it contributes | - -Two rules keep these directions from forming a loop: - -- A backend never asks the host to dispatch a domain operation or a function. - The host could route that request to the same backend, whose handler would - then wait for itself. A backend request for `lithe/function/invoke` or any - `lithe/build/*` method is refused with `plugin.function.recursiveCall`. - A handler that needs, say, a Maven run asks for the host's process - capability, never for the task that its own plugin implements. The - [relay methods](#cross-plugin-calls-protocol-version-4) are a different - request: they name another plugin's exported function, Core refuses a call - that would come back to a plugin already waiting on the call chain, and - the old refusals above stay in force. -- Host capabilities are primitive host services, never another entry into a - domain registry. Each is added to a protocol version together with its - params, permission, and the operation it must belong to. Version 1 offers - none: every `lithe/host/*` request is refused with `plugin.host.unavailable`. - Version 2 adds the [credentials](#host-services-protocol-version-2) service. - -### Declarative or backend implementation - -- A domain operation has exactly one implementation, chosen in the manifest - (`source`: `static`, `command`, `hostIntegration`, or `provider`). Core plans - only that one. There is no runtime fallback from a backend to a template or - back: the two may differ in meaning, and a fallback would hide the failure. -- A backend implements a domain operation through its typed method and Core's - plan and decode commands, never through a plugin function, so IDE - workflows, presentation, and other hosts keep a single contract. -- A plugin-private function needs no manifest field. What a running process - can answer is negotiated, as for [build providers](#build-providers); so - declaring, adding, or removing private functions changes neither - `pluginAPIVersion` nor any `requires` version. Only a function that - another plugin may call, and a call to such a function, are declared, in - [`pluginFunctions`](#cross-plugin-calls-protocol-version-4). -- A new kind of domain implementation, such as a provider for tasks, is a new - version of the capability that owns it (`buildProviders`), so only plugins - that use it are filtered from hosts that cannot run it. - -### Negotiation - -For a session owned by a plugin (`lsp.startServer.pluginId`), the host offers -`capabilities.experimental.litheFunctions: { "versions": [1, 2, 3, 4] }` in -`initialize`, next to and independent of `litheBuild`. Host-owned sessions do -not offer or accept this protocol, retain no plugin-function registry, and -reject register/unregister with `-32601`. A plugin backend that offers -functions answers: - -```json -"experimental": { "litheFunctions": { "version": 1, "functions": [{ "id": "snapshot.refresh" }] } } -``` - -`functions` is optional and defaults to none. An answer with a version the -host did not offer, or a malformed or duplicate function ID, does not -negotiate the protocol at all, so a session never starts with half a -registry. Unknown fields of the answer and of descriptors are ignored. -After a plugin-owned session successfully negotiates the protocol in -`initialize`, Core publishes its initial -registry as `functionsChanged { functions: [], removed: [] }`, -including when the negotiated registry is empty. Hosts can discover the -functions from events without issuing an invocation first. - -### References and IDs - -A function reference is `{ "pluginID", "functionID" }`. The host routes by -plugin first: only a session the plugin started (`lsp.startServer` with -`pluginId`) serves its functions, and a reference to another plugin is -`plugin.function.wrongPlugin`. Host-owned servers serve none. - -A function ID is dot-separated lowerCamelCase segments -(`snapshot.refresh`), at most 128 bytes, unique within the session. A -session holds at most 256 functions. - -### Registration and withdrawal - -After `initialize` a backend may send: - -| Request | Params | Effect | -| --- | --- | --- | -| `lithe/function/register` | `{ "functions": [{ "id" }] }`, nonempty | Adds the functions. | -| `lithe/function/unregister` | `{ "ids": ["…"] }`, nonempty | Removes them and revokes their running calls. | - -Each request is all or nothing: a malformed ID, a function listed twice, an -already registered ID, an unregistered ID, or exceeding the limit refuses the -whole request with JSON-RPC error `-32602` and -`data.code: "plugin.function.invalidRegistration"`. A successful change -answers `null` and publishes `functionsChanged` with the sorted IDs. A -backend that did not negotiate the protocol gets `-32601` for both. - -### Invocation - -`lsp.functionRequest { sessionId, operationId?, function, params?, -timeoutMilliseconds?, context? }` (`context` from protocol version 3, see -[workspace contexts](#workspace-contexts-and-capability-discovery-protocol-version-3)) returns `{ operationId }` and sends: - -```json -{ "method": "lithe/function/invoke", "params": { "functionID": "snapshot.refresh", "operationID": "…", "params": { … } } } -``` - -`params` must be a JSON object and defaults to `{}`. Core assigns every -backend invocation a unique, opaque `operationID`. The backend must echo it -unchanged in progress notifications; it must not derive it from the host's -`operationId`. The host continues to cancel and receive events using its own -`operationId`, which can be reused after a call ends. Core translates progress -back to that host ID, including `requestProgress.result.operationID`. This -prevents a late report for an earlier call from being attributed to a new call. -Core checks, in this order, and refuses without writing anything: - -| Check | Core error | `details` | -| --- | --- | --- | -| Plugin or function ID malformed | `invalid_request` | `plugin.function.invalidReference` | -| `params` not an object | `invalid_request` | `plugin.function.invalidParams` | -| Session belongs to no plugin | `not_supported` | `plugin.function.unavailable` | -| Session belongs to another plugin | `permission_denied` | `plugin.function.wrongPlugin` | -| Protocol not negotiated | `not_supported` | `plugin.function.unavailable` | -| Function not registered | `not_supported` | `plugin.function.unknown` | - -The call ends with exactly one `requestCompleted` event: - -| Outcome | Event | -| --- | --- | -| Result | `result: { "value": }`; `null` is a result. | -| Backend error | `error.code: "plugin.function.failed"`, the backend's `message` (at most 1024 bytes), and `error.pluginErrorCode` from `error.data.code` when it is an identifier of at most 64 bytes. The plugin code is for the plugin's own UI; Lithe never branches on it. | -| No `result`, or a result over 1 MiB serialized | `plugin.function.invalidResult` | -| Function withdrawn while running | `plugin.function.revoked`; the host also sends `$/cancelRequest` | -| Cancelled through `lsp.cancelOperation` | `requestCancelled`; the host sends `$/cancelRequest` | -| Deadline passed | `requestTimeout`; the host sends `$/cancelRequest`. `timeoutMilliseconds` is capped at one hour and defaults to the session's request timeout. | -| Process exited or the transport failed | The session's terminal error, as for every pending request | - -After a call has ended, its late reply is ignored, and so is any progress -report for it. Every terminal path removes its function/request association; -withdrawing that function later cannot cancel a new operation reusing the -host ID, including a build request. A backend should stop work on -`$/cancelRequest`, but the host does not rely on it. - -### Progress - -A backend reports progress of a running call with the notification -`lithe/function/progress { operationID, message?, percentage? }`, where -`message` is cut to 1024 bytes and `percentage` is a whole number from 0 to -100. Core publishes it as `requestProgress` with the operation ID and the -normalized report. A malformed report, or one for an operation that is not -running on that session, is dropped. - -### Host services (protocol version 2) - -A backend that negotiated version 2 may send these requests to the host. -Each service is granted by one manifest permission; Core receives the -granted services as `lsp.startServer.hostServices` (from the launch plan's -`backend.hostServices`) and checks every request before the host sees it. - -| Request | Params | Result | Permission | -| --- | --- | --- | --- | -| `lithe/host/credentials/get` | `{ key }` | `{ secret }`, `null` when nothing is stored | `credentials.store` | -| `lithe/host/credentials/set` | `{ key, secret }` | `null` | `credentials.store` | -| `lithe/host/credentials/delete` | `{ key }` | `null`, also when nothing was stored | `credentials.store` | - -- A `key` is 1–128 ASCII letters, digits, `.`, `_`, `:`, or `-`; a `secret` - is a string of at most 16 KiB. Unknown params are refused so a later - version can add them. -- Credentials are private to the plugin ID: the host stores them in the - platform's secret store (the Keychain on macOS) in a namespace of that ID, - never in `${stateDir}` or the package. They survive disabling and updating - the plugin and are deleted when it is uninstalled. -- Core refuses, without involving the host, in this order: a session that - negotiated version 1 or a method version 2 does not define (`-32601`, - `plugin.host.unavailable`), a service the plugin is not granted (`-32601` - in version 2, `-32010` from version 3, `plugin.host.permissionDenied`), - and malformed params (`-32602`, `plugin.host.invalidParams`; from - version 3 a field the method does not define is `-32018`, - `plugin.host.unsupportedOption`, see - [Extending version 3](#extending-version-3)). The code is in - `error.data.code`. -- An accepted request becomes the runtime event `hostRequest` with `method` - and `result: { hostRequestID, service, params }`. The host answers it with - `lsp.hostResponse { sessionId, hostRequestID, result? | error: { message } }`; - Core sends `result` (or `null`) to the backend, or `-32603` with - `plugin.host.failed` and the host's message cut to 1024 bytes. An unknown - `hostRequestID`, including one already answered, is `invalid_request`. -- A session holds at most 16 unanswered host requests; a further one is - refused with `plugin.host.failed`. Unanswered requests end with the session. -- `hostServices` needs `pluginId` and names only services this Core defines - (`credentials`, `workspace`, or registered method-grant names); otherwise `lsp.startServer` is - `invalid_request`. - -### Workspace contexts and capability discovery (protocol version 3) - -Version 3 keeps every rule of version 2 and adds capability discovery, -subscription disposal, workspace contexts, a context on each call, typed host -failures with details, cancellation of host requests, and host -notifications. - -| Request | Params | Result | Granted by | -| --- | --- | --- | --- | -| `lithe/host/getCapabilities` | none or `{}` | `{ protocolVersion, backendAuthority, services, limits }` | every plugin-owned session | -| `lithe/host/subscriptions/dispose` | `{ subscriptionID }` | `null`, also for an unknown or already disposed ID | every plugin-owned session | -| `lithe/host/workspace/listContexts` | none or `{}` | `{ revision, contexts: [] }` | `workspace.metadata` | -| `lithe/host/workspace/getContext` | `{ context: { contextID, generation } }` | `` | `workspace.metadata` | -| `lithe/host/workspace/getFolders` | `{ context: { contextID, generation } }` | `{ folders: [] }` | `workspace.metadata` | - -- Core answers `getCapabilities` itself. `services` maps each service the - session may use (the implicit `host`, `subscriptions`, and `commands`, and - the granted ones) to `{ methods, notifications }`: the requests it may - send and the [host notifications](#host-notifications-protocol-version-3) - it may receive. It lists nothing the session may not use, and a host - grants only the services it has handlers for, so a listed method never - fails for want of one. `backendAuthority` is `"local"`: the backend runs on - the machine that runs Lithe. `limits` gives `pendingHostRequests`, - `functionResultBytes`, `hostRequestBytes`, `hostResultBytes`, `errorMessageBytes` (the cut of a host failure's - message), `errorDetailsBytes`, and `notificationBytes`. A backend must - check `services` instead of assuming a method from the version. -- A service entry may also carry `options`: what the host declared for that - service. When `editor/registerActions` is granted, `services.editor.options` - has `actionIcons` (the icon tokens the host draws) and `limits` gains - `editorActionSourceBytes` (the largest document the host sends a - collector). When `editor/registerProviders` is granted, - `services.editor.options.providerTypes` lists the provider types the host - routes. A host that omits `actionIcons` accepts only the first editor-action - shape. -- A context is one open workspace in one window: - - ```json - { - "contextID": "w-3f2a9c", - "generation": 2, - "name": "orders", - "authority": { "kind": "local" }, - "folders": [{ "rootID": "r0c1d2e3f4a5b6c7d", "name": "orders", "path": "/Users/me/orders" }], - "stateDirectory": "/Users/me/Library/Application Support/Lithe/PluginState//backend/workspaces/" - } - ``` - - `contextID` uses the key alphabet and lives as long as the window shows - that workspace: a window that switches to another workspace closes the - context and opens one with a new `contextID`, so state a backend keyed by - the ID never carries over to a different workspace. `generation` starts at - 1 and grows every time the same workspace's folders or authority change; a - request naming an older generation, or a closed context, is - `plugin.host.contextExpired`, and the backend asks again. `revision` of - `listContexts` grows whenever a context opens, closes, or changes. -- `rootID` identifies one root folder stably for the same location, across - restarts, without revealing the path. It is keyed per plugin with a host - secret, so two plugins see different IDs for the same folder and an ID - cannot be computed from a guessed path. `path` is present only for a - `local` authority. -- `authority.kind` is `local` or `remote` (a remote workspace, which also - has `authority.id`, an opaque connection ID). For a `remote` context the - folders carry no `path`: the local directory the host keeps for a remote - workspace is an empty placeholder, not the workspace. File, search, and - process services answer a request for a context whose authority they do - not implement with `plugin.host.authorityUnsupported`; they never read the - placeholder or run the operation locally instead. -- `stateDirectory` is private to the plugin and the workspace, outside the - plugin package and the application bundle. Only `getContext` returns it, - and creates it then; `listContexts` entries carry every other field and - create nothing, so listing many windows leaves no directories behind. - `${stateDir}` is the plugin-wide state. Both survive disabling and - updating the plugin and are deleted when it is uninstalled. -- A page call may name its context: `lsp.functionRequest.context` - (`{ contextID, generation }`) reaches a version 3 backend as - `params.context` of `lithe/function/invoke`. A malformed reference is - `plugin.function.invalidParams`; a backend that negotiated version 1 or 2 - receives the call without it. The host fills it from the page's window. -- A host failure may carry a code and details: - `lsp.hostResponse.error: { message, code?, details? }`. Core passes these - codes to a version 3 backend, each with its own JSON-RPC error code so a - backend can branch on the number alone; any other code, no code, or a - version 2 backend gets `plugin.host.failed`. `details` is an object of at - most 4 KiB serialized (for example `{ currentVersion }` with - `versionConflict`, or `{ retryAfterMilliseconds }` with `rateLimited`); - it reaches a version 3 backend as `error.data.details` and is dropped - otherwise. Details that are not an object, or larger, are dropped too; - the failure itself still reaches the backend. `fixtures/backend/function-protocol.json` (`hostFailures`) - lists the mapping. - - | Code | JSON-RPC | Meaning | - | --- | --- | --- | - | `plugin.host.unavailable` | `-32601` | The host offers no such service or method | - | `plugin.host.invalidParams` | `-32602` | Params malformed or out of range | - | `plugin.host.failed` | `-32603` | Any other failure | - | `plugin.host.cancelled` | `-32800` | The request was cancelled | - | `plugin.host.permissionDenied` | `-32010` | Permission not declared, or the user withheld consent | - | `plugin.host.contextExpired` | `-32011` | The context is closed or its generation replaced | - | `plugin.host.authorityUnsupported` | `-32012` | The service does not support the workspace authority | - | `plugin.host.versionConflict` | `-32013` | A document or resource version differs from the expected one | - | `plugin.host.limitExceeded` | `-32014` | A host limit was exceeded | - | `plugin.host.timeout` | `-32015` | The host's deadline passed | - | `plugin.host.notFound` | `-32016` | The named resource does not exist | - | `plugin.host.readOnly` | `-32017` | The resource or workspace cannot be written | - | `plugin.host.unsupportedOption` | `-32018` | The host does not implement a requested option; `details.option` names the field | - | `plugin.host.preconditionFailed` | `-32019` | A state the request requires does not hold, such as a missing user confirmation | - | `plugin.host.busy` | `-32020` | The resource is in use; retry later | - | `plugin.host.rateLimited` | `-32021` | Too many requests in a period; retry after `details.retryAfterMilliseconds` when given | - | `plugin.host.languageServerUnavailable` | `-32022` | The plugin's language server is not running for the context, or stopped while the request was in flight | - | `plugin.host.languageServerError` | `-32023` | The language server answered with a JSON-RPC error; `details` is `{code, message}` | - | `plugin.host.methodNotDeclared` | `-32024` | The method, or the `workspace/executeCommand` command, is not in the server's declared session | - | `plugin.host.toolUnresolved` | `-32025` | A tool definition the request names resolves to no executable for this workspace; `details` is `{ tool, reason }`, `reason` being `notFound` (no candidate of the four layers meets the definition and its minimum version) or `unusable` (a chosen executable cannot be used) | - | `plugin.host.foreignContribution` | `-32026` | The named server or contribution belongs to another plugin | - - JSON-RPC reserves `-32768` to `-32000` for the protocol and lets - implementations define `-32099` to `-32000` as server errors. `-32000` - to `-32009` stay free for backends' own failures, which many JSON-RPC - libraries already use from `-32000`, so host codes start at `-32010` and - grow by one; a code is never reused for another meaning. Versions 1 and - 2 keep their numbers. -- A backend may cancel its own pending host request with `$/cancelRequest`. - Core answers it at once with `-32800` and `plugin.host.cancelled`, frees - the slot, and publishes `hostRequestCancelled { hostRequestID }` so the host - stops the work; a later `lsp.hostResponse` for that ID is - `invalid_request`. The 17th pending request of a version 3 session is - `plugin.host.limitExceeded`. -- A service that creates a subscription returns a `subscriptionID` of the key - alphabet; its notifications name it. Ending the session, disabling the - plugin, or closing the subscription's context disposes it. -- A backend still cannot ask the host to call a function or a domain - operation (`plugin.function.recursiveCall`), so a page call never waits on - itself through the host. - -### Host notifications (protocol version 3) - -The host tells a version 3 backend about changes with JSON-RPC -notifications; the backend answers none of them. The host sends them through -Core with `lsp.hostNotify { sessionId, method, params }`, which returns -`{ delivered }`: `false` when the session negotiated an older version, which -then never sees them. - -| Notification | Params | Granted by | -| --- | --- | --- | -| `lithe/host/workspace/didChangeContexts` | `{ revision }` | `workspace.metadata` | -| `lithe/host/subscriptions/notify` | `{ subscriptionID, sequence, event }` | every plugin-owned session | -| `lithe/host/commands/didRun` | `{ commandID, context? }` | every plugin-owned session | -| `lithe/host/run/didExit` | `{ runID, exitCode?, signal? }` | `run.start` | -| `lithe/host/languageServer/didChangeState` | `{ context, serverID, state, generation }` | `languageServer.request` | -| `lithe/host/languageServer/didReceiveNotification` | `{ context, serverID, generation, method, params?, truncated? }` | `languageServer.request` | - -- `didChangeContexts` follows every change `revision` of `listContexts` - counts; the backend calls `listContexts` for the contexts. A backend that - starts later reads them itself. -- `subscriptions/notify` carries one `event` object of the named - subscription. `sequence` starts at 1 and grows by one per subscription, so - a backend can detect a gap; nothing follows a disposal. -- `commands/didRun` reaches the plugin's backend when the user runs one of - the plugin's commands. `commandID` is the command's ID; `context` - (`{ contextID, generation }`) is the window's context when it has one. A - running backend receives it in order with the other notifications; a - stopped one is started for it only when it declares - `onCommand:`, and receives it once ready. -- `run/didExit` reports the end of a Run session the backend started with - [`run/start`](#run-and-debug-sessions-protocol-version-3). `exitCode` is the - process's exit status and `signal` (1 to 127) the signal that ended it; both - are absent when the host lost the process. It is sent once per run, only - to a session that holds the `run.start` grant. -- `revision` and `sequence` are positive integers, `event` is an object, - and serialized params are at most `limits.notificationBytes`. Core refuses - any other method, a service the session is not granted, malformed params, - a session that is not plugin-owned, or one that is not ready, with - `invalid_request`. `fixtures/backend/function-protocol.json` - (`hostNotifications`) holds the cases. - -### Extending version 3 - -From version 3, host capabilities are added within the version, and a -backend discovers them with `getCapabilities` instead of a version number. A later host adds, without a -new version: - -- a service with its methods and notifications, granted by a new manifest - permission, or a method or notification of an existing service; -- an optional field of request params (an *option*) whose absence keeps the - earlier behavior, or a field of a result, a notification, `details`, or - `limits`; -- a failure code, which takes the next unused JSON-RPC number after - `-32021`; a number never changes meaning. - -A new protocol version is needed only for a change an existing backend -would misread: removing or renaming a method, notification, or field, -changing a field's meaning or type, making an option required, changing a -code's number, or weakening an ordering or lifecycle guarantee above. - -So that a version 3 backend works with every host of version 3: - -- It calls a method only when `getCapabilities.services` lists it; another - is `-32601`, `plugin.host.unavailable`. -- It ignores result, notification, `details`, and `limits` fields it does - not know, and any `lithe/host/*` notification it does not know. -- Core refuses a field the method does not define with `-32018`, - `plugin.host.unsupportedOption`, and `details: { option }` naming it, before - the host sees the request; the backend may retry without that option. A - service whose params Core does not type answers the same way itself. -- It treats a JSON-RPC number it does not know as a host failure, and - branches on `error.data.code` when it knows that code. -- A package whose backend needs a new service declares the new permission. - A host that does not know the permission refuses the package at install - (`plugin.permission.unknown`), so a permission is never granted or - ignored silently. - -`fixtures/backend/function-protocol.json` (`hostRequests`) holds the -unsupported-option cases. - -### Public document, file and window methods (protocol version 3) - -These methods are implemented by the macOS host. Windows does not advertise -`backend` support. `getCapabilities` lists only the intersection of the plugin's -permission-derived grants and this host's registered method handlers. - -New grants in `lsp.startServer.hostServices` use **full method names**, not service -names. The legacy `workspace` grant still admits only `listContexts`, `getContext` -and `getFolders`; it never grants file reads. The legacy `credentials` grant is -unchanged. Registering another handler cannot replace a method already registered. - -All methods below require `context: {contextID, generation}`. Resource arguments -use `{rootID, path}` from that plugin's `getFolders` response; paths use `/` and -are relative to the root. A root ID is not a lifetime or an authorization token. -Opening the same folder in two windows creates independent context-owned leases; -closing one does not invalidate the other, and reopening works with generation 1 -in its new context. Remote contexts are explicitly refused by this first set of -methods. Unknown options fail before side effects with `unsupportedOption`. - -| Methods (prefix `lithe/host/`) | Permission | Params in addition to `context` | Result | -| --- | --- | --- | --- | -| `documents/list` | `documents.read` | none | `{documents:[]}` | -| `documents/getSnapshot` | `documents.read` | `documentID` | `{document:, text}` from the dirty live buffer | -| `editor/registerActions` | `editor.actions` (+ `documents.read`) | `id,function,selector` | `{subscriptionID}`; independent editor actions, see below | -| `editor/registerProviders` | `editor.providers` (+ `documents.read`) | `id,selector,providers` | `{subscriptionID}`; editor language-feature providers, see below | -| `editor/getActive` | `documents.read` | none | summary of the foreground text tab, or `null` | -| `editor/getSelections` | `documents.read` | `documentID` | `{documentID,version,selections:[{anchor,active}],primaryIndex}` | -| `editor/applyEdits` | `editor.edit` | `documentID,expectedVersion,edits:[{range,text}]` | `{documentID,version,applied}` | -| `editor/replaceSelections` | `editor.edit` | `documentID,expectedVersion,selections:[{anchor,active}],replacements:[string]` | same; one replacement for all selections or one per selection | -| `editor/insertText` | `editor.edit` | `documentID,expectedVersion,at,text` | same | -| `workspace/readDirectory` | `workspace.files.read` | `resource,cursor?,limit?` | `{entries:[{name,resource,kind}],nextCursor}` | -| `workspace/stat` | `workspace.files.read` | `resource` | `{resource,kind,size,modifiedMilliseconds}` | -| `workspace/readFile` | `workspace.files.read` | `resource,maximumBytes?` | `{resource,source:"disk",byteCount,isTruncated,identity,text?,encoding?,base64?}` | -| `workspace/watch` | `workspace.files.watch` | `resource,recursive?` (default false) | `{subscriptionID}`; events contain `{rootID,changedPaths,requiresRescan}` | -| `workspace/findFiles` | `workspace.search` | `resource` naming the root (`path:""`), `query,fileMask?,cursor?,limit?` | `{matches:[],nextCursor,isTruncated,source:"disk"}` | -| `workspace/findText` | `workspace.search` | root `resource,pattern,fileMask?,caseSensitive?,wholeWords?,regularExpression?,cursor?,limit?` | same envelope, matches `{resource,line,preview,range:null}`; the upstream search owner currently reports lines, not exact match spans | -| `editor/open`, `editor/reveal` | `editor.open` | `resource,activation?` (`select` or `background`), `range?,tab?` (`regular` only) | document identity/version and state, `wasAlreadyOpen,windowIsForeground,appliedSelection` | -| `preview/openHTML` | `preview.open` | HTML `resource,presentation?` (`editorAndPreview` or `previewOnly`), `range?` | open result plus `usesLiveBuffer:true,presentation`; explicitly changes the existing tab's presentation | -| `browser/openExternal` | `browser.open` | exactly one of HTTP(S) `url` or HTML `resource`; `unsaved?` (`openSavedFile` or `requireSaved`) for a resource | `{opened:true,source:"web"|"disk",hasUnsavedChanges?}` | -| `window/showInformation`, `window/showWarning`, `window/showError` | `window.messages` | `text,actions?` | `{selectedIndex}`; zero-based, or `null` on dismissal | - -A document summary has `documentID,version,path,languageID,isReadOnly,isDirty, -encoding,lineEnding`. `path` is workspace-relative or null for a document outside -the root; `languageID` may be null. Positions `{line,column}` are one-based UTF-16; -ranges `{start,end}` are half-open and cannot split a surrogate pair. Selections -keep anchor/active direction. Batches are atomic and one Monaco undo step. Stale -versions, read-only buffers, pending editor synchronization and IME composition -are refused. Background documents without a mounted editor can be listed/read, -but edits/selections may return `busy`; opening a foreground tab does not imply -that its web editor is already ready. Retry reads after readiness, not edits -blindly. `editor.open/reveal` currently applies a range's start as a caret and -reports `{kind:"caret",line,column}`, not a fabricated full selection. - -Limits: snapshots and file reads expose at most 128 KiB of source text/bytes per -call; oversized snapshots return `limitExceeded`, file reads report truncation. -This leaves room for worst-case JSON escaping under the 1 MiB serialized host -request/result budget. Batches contain at most 1,000 edits/selections. Directory -pages default to 200 and cap at 1,000; search pages default to 100 and cap at 200, -with the search owner's overall 200-result cap. Explicit file reads use -component-wise `O_NOFOLLOW`; listings omit symlinks. Hidden-file rules affect -listing/search/watch, not authorization for explicit reads. Open/browser paths -retain the existing canonical containment checks and their documented -check-to-open race; native backends are not OS-sandboxed. - -Machine host requests have a 30-second host deadline. User-choice messages wait -until the user answers, the request is cancelled, or the context/session closes. -Messages retain the per-plugin/window rate and queue limits (5/10 seconds, -3 pending per plugin, 10 per window, 2,000 text characters, 3 actions of 40 -characters). Session exit revokes grants and cancels requests/subscriptions; -old session callbacks cannot affect a replacement. Closing a context cancels its -requests with `contextExpired`. Notifications have a 128-entry per-session queue; -context revisions coalesce to the latest, and overflow ends the session instead -of allowing unbounded memory or silently losing commands. Notification/response -writes share the process write watchdog and stop cleanup with function requests. - -Cancellation or timeout **does not promise rollback**: an edit or external open -may already have committed. The SDK must not replay a mutation on these failures. -On `versionConflict`, reread and recompute; on `contextExpired`, resolve the -original target again, never substitute the focused window. `busy`/`rateLimited` -may be retried with bounds; `permissionDenied`/`readOnly` need user intervention. - -### Run and debug sessions (protocol version 3) - -A backend can start a session that the host presents as its own: a Run session -in the Run tool window, or a debug session on one of the plugin's own adapters. -The backend decides what to start; the host owns the process, the console, the -Stop button and the end of the session. A Run session adds host presentation -(a Run window entry the user can stop, the console, the exit status) on top of -what `process.run` already allows; it grants no other capability. `run/start` -and `debug/start` take `context: {contextID, generation}` and the permission -shown. `run/stop` takes no `context`, so a run can still be stopped after the -context it started in has closed. - -| Method (prefix `lithe/host/`) | Permission | Params | Result | -| --- | --- | --- | --- | -| `run/start` | `run.start` | `context, label, process, temporaryFiles?, debug?, rerun?` | `{runID}` | -| `run/stop` | `run.start` | `{runID}` or `{sessionID}` | `null` | -| `debug/start` | `debug.start` | `context, label, adapter, request, configuration` | `{sessionID}` | - -`run/start`: - -- `label` is 1 to 256 characters without control characters. It titles the - Run window entry. -- `process` is `{executable, arguments, workingDirectory, environment}`, all - four required. `executable` is `{kind: "tool", tool}`, a tool that the - manifest lists in `requiresTools` (the host resolves it through the - [tool-definition layers](toolchains/README.md)), or `{kind: "packaged", path}`, a - normalized relative path of a file inside the plugin package. Arguments, the - working directory (relative to the workspace root and an existing directory - inside it) and the environment have the bounds of - [run preparation](#provider-run-preparation-buildproviders-4). An unknown - `process` field is refused. -- `temporaryFiles` is at most four `{name, contents}` files of up to 4 MiB of - text each. The host writes them into its own temporary directory before the - process starts, removes them when the run ends, and replaces - `${temporaryFile:}` in `process.arguments` and `process.environment` - with the file's path. A name is unique, 1 to 64 letters, digits, `.`, `_` or - `-`, and starts with a letter or digit. A plugin therefore never needs to - know where the host keeps temporary files. -- `debug` is `{configurationType, target}` and makes the run a debug session. - `configurationType` is a public debug adapter alias, as in - [registry connection debugging](#registry-connection-debugging-buildproviders-11). - `target` is `{kind: "connection", port}`: the process listens for a debugger on - `port` (1 to 65535; the backend puts it into the arguments), the host waits - for it and attaches the adapter. Or `{kind: "launch"}`: the adapter starts the - process itself, taking program, arguments, directory and environment from - `process` through its `targetBindings`. -- `rerun` is `{function, data}`: one of the plugin's registered functions and - its params, a JSON object of up to 64 KiB. When the user chooses Run again, - the host invokes the function with `data` as the params and the current - `context`, and the backend answers with a new `run/start`, so the backend - prepares the restart. Without `rerun` the entry cannot be rerun. -- The reply carries an opaque `runID`. The host sends - [`run/didExit`](#host-notifications-protocol-version-3) when the process ends. - -`run/stop` stops a run by `runID` or a debug session by `sessionID` and answers -`null`, also when it already ended. Cancelling the host request is the same as -stopping. A backend can stop only runs and sessions it started. - -`debug/start`: - -- `label` is as in `run/start`. `adapter` is one of the plugin's own adapters, - by its local ID or its qualified `/` ID. An adapter of - another plugin is refused with `plugin.host.notFound`, and one the plugin does - not declare is `plugin.host.notFound` too. -- `request` is `launch` or `attach`, and the adapter must serve it. -- `configuration` is a JSON object of at most 256 KiB that the host passes to - the adapter as the DAP launch or attach arguments, on top of the adapter's - declared defaults. `noDebug` and every key that starts with `__` belong to - the host and are refused. - -Both methods refuse malformed params with `plugin.host.invalidParams`; the -rejection from Core (`plugin.run.invalidStart` or `plugin.debug.invalidStart`, -with the `field`) is in `details.code` and `details.field`. A closed context is -`plugin.host.contextExpired`, and a `tool` that resolves to no executable is -`plugin.host.toolUnresolved`. - -The host keeps running processes when the plugin is disabled or its backend -exits; it only stops telling the backend. The run then ends the way a run -without a backend ends. A backend that starts again does not receive -`run/didExit` for a run it did not see begin. - -Fixtures: `fixtures/run/run-start.json` (what `run.decodeStart` returns for each -case, including the rejections) and `fixtures/debug-adapters/debug-start.json` (the same for -`debug.decodeBackendConfiguration`). Temporary files depend on the host's -temporary directory and are covered by Core's own tests. - -### Language server host methods - -The `languageServer` host service lets a plugin backend talk to the language -servers its own plugin declares. It is granted by the `languageServer.request` -permission, only for a `languageServers` 3 server that lists `requestMethods` -or `forwardNotifications`, and each method is granted by its full name. -`getCapabilities` lists the methods this host implements. Windows does not -advertise `backend` support. - -Every method takes `context: {contextID, generation}` and `serverID`, the -`languageID` of one of the calling plugin's servers. A server of another -plugin is `plugin.host.foreignContribution`. - -| Methods (prefix `lithe/host/languageServer/`) | Params in addition to `context`, `serverID` | Result | -| --- | --- | --- | -| `request` | `method`, `params?` (an object, default `{}`), `timeoutMilliseconds?` (1 to 300000, default 60000) | `{value}`: the server's JSON-RPC `result`, which may be `null`. | -| `notify` | `method`, `params?` | `{delivered}`. `false` only for `workspace/didChangeConfiguration` sent before the server is initialized; the value is then sent with `initialized`. | -| `setStatus` | `state` (`preparing`, `ready`, `degraded`, or `failed`), `message?`, `percentage?` (a whole number from 0 to 100) | `{}` | - -- `request` and `notify` are checked by the [session policy](#plugin-owned-sessions-languageservers-3): - `plugin.host.methodNotDeclared` for a method or command the server did not - declare, `plugin.host.languageServerUnavailable` when the server is not - running for this context, `plugin.host.languageServerError` when the server - answers with an error (`details: {code, message}`), `plugin.host.timeout`, - `plugin.host.cancelled`, `plugin.host.busy` for the 129th waiting request, - and `plugin.host.limitExceeded` for a result over the host's result bound. - Cancelling the host request (`$/cancelRequest`) cancels the server request. -- `setStatus` shows the plugin's own preparation state next to the server in - the host's status UI: `preparing` with an optional `message` and - `percentage` while the plugin imports a project or indexes, `ready` when the - server can answer, `degraded` when it works with reduced results, and - `failed` when it cannot. `message` is user-facing text of the plugin, shown - as given and cut to 1024 bytes on a character boundary. The latest status - replaces the earlier one of the same server; a new - server `generation` starts without one, and the host removes it when the - server stops. It is not `lithe/function/progress`, which belongs to the - function call that is running, while preparation outlives every call. -- The language server keeps no state of its own in the host: when the process - stops or crashes, every request in flight ends with - `plugin.host.languageServerUnavailable`, and the backend asks again after - `didChangeState` reports `running` with a new `generation`. - -Notifications to the backend, granted by the same permission: - -| Notification | Params | Meaning | -| --- | --- | --- | -| `lithe/host/languageServer/didChangeState` | `{context, serverID, state, generation}` | `state` is `starting`, `running`, `stopped`, or `crashed`. | -| `lithe/host/languageServer/didReceiveNotification` | `{context, serverID, generation, method, params?, truncated?}` | A notification the server sent and `forwardNotifications` lists. | - -`generation` is a positive integer the host raises each time it starts the -server for this context, so a backend can tell which process a state or a -notification belongs to; the host never delivers one of a replaced process -after the new one has started. A forwarded notification larger than -`limits.notificationBytes` is delivered once with `truncated: true` and -without `params`. Core enforces the request policy (whitelist, gates, -serialization, timeouts) when it relays a request, and -`fixtures/backend/function-protocol.json` holds the request, response, and -notification shapes every host must reproduce. - -### Content providers - -A plugin whose server hands out documents that have no file (for example the -decompiled source of a library class) serves them as a URI scheme: - -```json -{ - "context": {"contextID": "w1", "generation": 1}, - "scheme": "metals-library", - "function": "documents.read" -} -``` - -`lithe/host/documents/registerContentProvider`, granted by -`documents.contentProvider`, returns `{subscriptionID}`; dispose it with the -existing subscription API. Registration only records the binding and never -calls the backend; the function must already be registered on the session. - -- A scheme is 1 to 64 lowercase ASCII letters, digits, `+`, `-`, or `.`, and - starts with a letter. The schemes the host or the platform resolves are - refused: `about`, `blob`, `data`, `file`, `ftp`, `http`, `https`, - `javascript`, `lithe`, `mailto`, `untitled`, `ws`, and `wss`. A scheme has - one provider per workspace window; registering it again is - `plugin.host.preconditionFailed`. -- When a document whose URI has that scheme is opened, the host calls the - function through `lithe/function/invoke` with the workspace `context` and - `{uri}`. The answer is a string, or `{content: string}`, of at most 1 MiB. - The document opens read-only; any other answer, a failure, or a timeout - (the host waits 30 seconds) shows the user an error and opens nothing. -- The provider is the only source of the text. The host keeps no copy once - the document closes, and it asks again when the document is reopened. - Ending the session or closing the context withdraws the provider. - -### Backend-only commands (`ui` 4) - -`requires.ui:4` permits `ui.commands` without `toolWindowID` and allows an empty -or omitted `toolWindows` array. Such a command requires `backend:2`, the existing -`ui.contribute` and `backend.launch` permissions, and its `onCommand:` event. -Versions 1-3 retain their window-required behavior. An old host rejects ui 4 at -installation, rather than accepting a command it cannot execute. See -`fixtures/backend/command-backend.plugin.json`. - -The command appears through the ordinary workbench command contributions and -sends `commands/didRun` without opening a dummy tool window. Commands arriving -while initialize is pending wait until ready; a crashed backend can start again -on its declared command event. Background workspace activation has two concurrent -start slots; explicit command activation does not wait for unrelated background -plugins. `didRun` remains an event, not an acknowledgement that the command's -business action succeeded; a future result-bearing execute API must use the -existing request lifecycle rather than infer success from notification delivery. - -### Independent editor actions (protocol version 3) - -Editor actions are a host presentation capability of an ordinary tool backend, -not an LSP, Build, Run, Test or Debug provider. A play icon is presentation, not -an execution kind. The host understands the bounded range/title/icon/invocation -shape; HTTP/SQL parsing and execution remain private to the plugin. Native domain -workflows still use their own typed contracts, never a private-function substitute. - -A backend declares `backend: 2`, `documents.read` and `editor.actions`, discovers -`lithe/host/editor/registerActions` with `getCapabilities`, then registers per -workspace context: - -```json -{ - "context": {"contextID": "w1", "generation": 1}, - "id": "requestActions", - "function": "requests.collectActions", - "selector": {"fileExtensions": ["http", "rest"], "fileNames": []} -} -``` - -- Registration returns `{subscriptionID}`. Dispose with the existing subscription - API. It only records the binding and never calls the backend while answering; - collection runs later. The function must already be registered on that session. -- No manifest `runMarkers` section or capability, no special command notification, - and no language-server/Run declaration is added. The first implementation starts - through existing `onWorkspaceOpen` (or an existing explicit entry); registration - cannot discover a backend that has not started. Backend installation still needs - restart. Standalone backends have an application-scoped enablement module, - without a fake UI or language provider; safe mode/quarantine/disable still veto - their startup. Example package: `fixtures/editor/editor-actions.plugin.json`. -- A selector has 1 to 32 literal names/extensions; extensions accept an optional - leading dot. Matching is case-insensitive. At most 32 bindings per plugin across - contexts; duplicate registration IDs in a context are refused. -- The host invokes the collection function via existing `lithe/function/invoke` - with workspace context and `{document:{documentID,version,path},text}`. Version - is the same public buffer version as `documents/getSnapshot`, not a WebView - revision. Source is the dirty live buffer, capped at the host's - `limits.editorActionSourceBytes` (1 MiB on macOS; 128 KiB when the host does - not report the limit). Remote workspaces and read-only preview surfaces are not - served by this first implementation. -- Collection is read-only by contract: no network request or business execution. - Edits invalidate the old actions immediately and cancel older collection work; - the host debounces fresh collection and rejects stale or withdrawn results. - macOS bounds the whole collection batch to eight seconds, not eight seconds per - binding. Refresh acknowledges scheduling without waiting for collectors; a slow - or failed collector must not fail editing or the save synchronization barrier. -- Return `{actions:[{id,range:{start:{line,column},end:{line,column}},title,icon, - invoke:{functionID,params?}}]}`. Positions are one-based UTF-16, half-open and - cannot split surrogate pairs. Each range stays in the exact input document. - `id` is 1 to 128 bytes without controls, unique per answer; `title` is 1 to 200 - characters on one line. `icon` is a host-owned presentation token from - `services.editor.options.actionIcons` (`run` or `run-all` when the host does not - report the list). At most 1000 actions and 1 MiB serialized; malformed answers - are refused whole. Same-line actions share a menu rather than silently replacing - each other. -- An action may carry `alternatives`: at most 4 `{id,title,icon,invoke}` entries - with the same rules and IDs unique within the action, offered in the action's - menu after the action itself (for example Debug or Test beside Run). Hosts that - omit `actionIcons` refuse an answer with alternatives. -- The macOS host draws `run`, `run-all`, `debug`, `test`, `test-passed`, - `test-failed`, `test-skipped`, `navigate-super` and `navigate-implementations`. - An icon names a picture, not an operation: a test icon does not make the - action a test, and the host never starts anything because of an icon. -- Each invocation target is a currently registered function of the same plugin; - `params` is a plugin-private JSON object. The host stores it behind an opaque - per-batch action key, never accepts invocation payloads from the web editor, and - validates document/context/session/registration again on click. It calls the - function with `{documentID,expectedVersion,actionID,data:}` through the - ordinary invocation lifecycle; a chosen alternative adds `alternativeID` and - passes that alternative's `params` as `data`. The plugin validates/re-reads the - live document before side effects. -- A click result may carry `{reveal:{locations:[{uri,range}]}}`: 1 to 100 - absolute URIs with zero-based LSP ranges. The host opens a single location and - lists several in its navigation results. Other result members stay the - plugin's own. Hosts that omit `actionIcons` ignore the result. -- A click that runs or debugs code starts it through the host's run and debug - methods (`lithe/host/run/start`, `lithe/host/debug/start`) once - `getCapabilities` lists them, so the run appears in the host's Run and Debug - windows. A private process started by the plugin is not a substitute. Click executions are not cancelled by unrelated re-parsing; - withdrawing the binding, ending its session/context or tearing down the owning - editor cancels them. The host never retries side effects automatically. -- Toolbar and menu Run/Debug on macOS reuse these actions for a language the - package declares in `languages` without an execution or debug module and - without the matching `hostCapabilities` entry: with a current-file Run - configuration the host saves the document, collects the document's actions as - the gutter does, and invokes the first action (ordered by range start) whose - icon is `run` or `run-all`; Debug invokes that action's first alternative whose - icon is `debug`, else the first action whose own icon is `debug`. No matching - action, a stale document or a withdrawn binding produces a user-visible notice - and nothing starts. This is only a different entry point to the plugin's own - function; the host still never starts code because of an icon, so the plugin - decides what the action does and still uses `lithe/host/run/start` or - `lithe/host/debug/start` to run it. -- Registration/collection validation is shared Core command - `plugins.editorActions.decode`; `version: 2` with the host's icons and source - bound admits alternatives and click results (`kind: invokeResult`), and version 1 - keeps the first shape. Cases: `fixtures/editor/editor-actions-v2.json`. Public host - failures retain protocol 3's existing - distinct codes (`invalidParams`, `permissionDenied`, `versionConflict`, etc.). - No tool-private error or result is interpreted as a build/test result. -- Existing `commands/didRun {commandID,context?}` is unchanged. A command-palette - entry can read the document/selection and call the same plugin implementation. -- This is an additive host method within protocol 3, not a protocol-version bump. - Old hosts do not advertise it. A plugin can retain its existing command/window - entry point; a package requiring `editor.actions` is deliberately refused by an - older host that does not recognize that permission, rather than silently granted. - Grammar capability admission is separate. SDK/contract mirrors still need sync. - -### Editor language-feature providers (protocol version 3) - -A provider adds a language feature the file's language server does not -supply: a cross-file fact only the plugin knows, such as a key in a template -that names an entry in a message bundle, or a framework declaration in a -configuration file that names a method in source. It never replaces the -language server. Where a language server answers, its answer comes first and -plugin results only add to it; a plugin that repeats what the server already -says shows the user the same thing twice. - -A backend declares `backend: 2`, `documents.read` and `editor.providers`, -finds `lithe/host/editor/registerProviders` and -`services.editor.options.providerTypes` with `getCapabilities`, then registers -per workspace context: - -```json -{ - "context": {"contextID": "w1", "generation": 1}, - "id": "message-keys", - "selector": {"languages": ["html"], "fileExtensions": ["properties"], "fileNames": []}, - "providers": { - "definition": {"function": "keys.definition"}, - "hover": {"function": "keys.hover"}, - "completion": {"function": "keys.complete", "triggerCharacters": ["."]}, - "semanticTokens": {"function": "keys.tokens", - "legend": {"tokenTypes": ["property", "string"], "tokenModifiers": ["declaration"]}} - } -} -``` - -- Registration returns `{subscriptionID}`; dispose it with the subscription - API. Ending the session, the context or the plugin's activation withdraws - every registration it made, and a plugin activated later registers again. - Each named function must already be registered on that session. -- A selector has 1 to 32 entries in total: language IDs, literal extensions - (optional leading dot) and literal file names, matched case-insensitively. - A document matches when any entry matches. At most 32 registrations per - plugin across contexts; duplicate IDs in a context are refused. -- `providers` maps a provider type to `{function}`. The macOS host routes - `definition`, `hover`, `completion`, `codeLens`, `foldingRange`, - `semanticTokens` and `documentLink`. Completion may add 1 to 16 - single-character `triggerCharacters`; semantic tokens must add their - `legend` (at most 64 types and 64 modifiers). A type outside the host's - `providerTypes` fails with `unsupportedOption` and - `details.option: "providers."` before anything is registered. - Diagnostics are not a provider type. -- The host calls the function through `lithe/function/invoke` with the - workspace context and `{documentID,version}`; definition, hover and - completion add `position: {line,character}` (zero-based, UTF-16), and - completion adds `triggerCharacter` when typing started it. The plugin reads - the text with `documents/getSnapshot` and answers for that version. -- Results use the LSP 3.17 shapes of the matching request: definition - `Location | Location[] | LocationLink[] | null`, `Hover | null`, - `CompletionItem[] | CompletionList | null` (no `data`, `command` or resolve - round trip), `CodeLens[] | null`, `FoldingRange[] | null`, - `SemanticTokens | null` indexed by the registered legend, and - `DocumentLink[] | null` with absolute targets. Every code lens carries its - `command`, whose `command` is a function of the same plugin and whose - `arguments` holds at most one params object; a click calls that function - with `{documentID,expectedVersion,data:}`. A malformed result is - dropped whole. -- Budgets are the host's: hover and completion 400 ms, definition 1500 ms, - the rest 2000 ms. A late answer, or one for an older document version, is - dropped without an error. A registration cannot set its own budget. -- The host merges: hover sections and completion items follow the language - server's; definitions add plugin locations to the server's (a location at - the requested position itself yields to the plugin's); code lenses, folding - ranges and links are added; semantic tokens apply only to files whose - language server has none. A plugin location equal to one already kept is - dropped. The merge is Core command `plugins.editorProviders.decode` with - `kind: "mergeDefinitions"`, so every host merges definitions alike. -- Validation is shared Core command `plugins.editorProviders.decode`. Cases: - `fixtures/editor/editor-providers.json`. Example package: - `fixtures/editor/editor-providers.plugin.json`. -- This is an additive host method within protocol 3, not a version bump. A - package requiring `editor.providers` is refused by an older host that does - not recognize the permission. - -### Cross-plugin calls (protocol version 4) - -A plugin function is private to its plugin unless the plugin exports it. An -exported function can be called by another enabled plugin whose manifest -declares that call. Core relays every call: the calling backend never -reaches the provider's process, the provider's backend never learns more than -the call it serves, and the host takes part only by starting a provider's -backend that is not running (see below). The relay is Rust Core logic, the same -on every platform that runs plugin backends. -`fixtures/backend/plugin-functions-exporter.plugin.json` and -`fixtures/backend/plugin-functions-caller.plugin.json` are the examples. - -#### Declaring exports and calls - -```json -"requires": { "pluginFunctions": 1, "backend": 2, "serverProcess": 1 }, -"pluginFunctions": { - "exports": [{ "id": "document.format", "version": 1, "context": "workspace" }], - "calls": [{ "id": "project.describe", "version": 2 }] -} -``` - -- `pluginFunctions` needs `pluginAPIVersion` 3 or later, a `backend`, and - `requires.pluginFunctions: 1`, `backend: 2` and `serverProcess: 1`. The - section holds at least one of `exports` and `calls`, each at most 32 - entries sorted by `id`, with no `id` twice. Anything else, including an - unknown field, is `plugin.manifest.invalid`. `requires` lists - `pluginFunctions` exactly when the section exists. -- An export is an object, never a bare function ID. `id` is a function ID - as in [References and IDs](#references-and-ids). `version` is the - exported contract version, an integer from 1 to 1000; an incompatible - change to the params or result takes a new version. `context` is a closed - set; version 1 knows only `"workspace"`: the function runs only for a - local workspace context, on a call Core relays. A missing or unknown - `context` refuses the whole manifest with `plugin.manifest.invalid`, so a - function whose context is unstated is never callable. -- A call is `{ id, version }`. It names a function ID and the version the - caller was written against, never the providing plugin's ID: the caller - discovers providers at run time. Core requires the versions to be equal; - otherwise the call fails with `plugin.function.versionMismatch`. -- Declaring an export does not register it. The provider's backend still - registers the function with `lithe/function/register`, and a function it - has not registered, or has withdrawn, is `plugin.function.notExported`. - A function the manifest does not export is private whatever the backend - registers, and a reference to it keeps answering - `plugin.function.wrongPlugin`. -- A plugin that exports needs no page, command or `onWorkspaceOpen` to start - its backend: a call starts it. A plugin that only calls needs one of - those, as every [`backend` 2](#backend-2-workspace-contexts) does. -- `pluginFunctions` grants no manifest permission. The caller's `calls` - and the provider's `exports` are the two sides' consent, and the host - grants a plugin that declares `calls` the `functions` host service, - through `backend.hostServices` of its launch plan, like every other - service. A host without `pluginFunctions` in `hostCapabilities` refuses - such a manifest with `plugin.api.unsupported`. - -#### What an exported function must and must not do - -- **Trust is not transitive.** The provider runs with its own permissions, - its own state directory and its own credentials. The caller gains none of - them, and the provider gains none of the caller's. Core never writes the - caller's plugin ID into the provider's session; it appears only in the - `caller` field of one request, below. -- **The provider owns its resources and processes.** An exported function - must not accept an executable path, command line or script from its caller - and start a process with it, nor read or write a path the caller chose - without checking it against what the provider itself may access. If a - caller needs the provider to run something, the function takes a request - the provider interprets (a task name, a document) and the provider decides - the executable. -- A function that decides by who asks reads the `caller` field below, never - a plugin ID in `params`, which any caller can write. - -#### Discovery and invocation - -A backend that negotiated protocol version 4, and whose plugin declares at -least one call, may send two requests. A backend on version 3 or earlier gets -`-32601`, `plugin.host.unavailable`; a plugin that declares no call gets -`-32010`, `plugin.host.permissionDenied`. `getCapabilities` lists the -methods the session may call under the `functions` service. - -| Request | Params | Result | -| --- | --- | --- | -| `lithe/host/functions/providers` | `{ functionID }` | `{ providers: [{ pluginID, version }] }` | -| `lithe/host/functions/invoke` | `{ pluginID, functionID, context: { contextID, generation }, params?, timeoutMilliseconds?, parentOperationID? }` | `{ value }` | - -- `providers` lists the enabled plugins other than the caller that export - `functionID`, sorted by plugin ID, each with its exported `version`. - Disabling, enabling, replacing and uninstalling a plugin take effect for - the list at once; a host that registers backend plugins only when it - launches (macOS today) lists a newly installed or updated backend plugin - only after a restart of Lithe (see [Hot activation](#hot-activation)). The - caller must have declared the function, otherwise - `plugin.function.notDeclared`. A listed provider's backend need not be - running. -- `invoke` calls one provider. `context` is required: a workspace context - the caller learned from the [workspace service](#workspace-contexts-and-capability-discovery-protocol-version-3), - checked like every call context. `params` is a JSON object and defaults - to `{}`. `timeoutMilliseconds` is a positive integer, defaults to 60 000 - and is capped at 600 000. A field the method does not define is `-32018`, - `plugin.host.unsupportedOption`. The reply is `{ value }`, where `value` - is the provider's result (`null` is a result). -- `parentOperationID` is optional: a string of 1 to 128 bytes, otherwise - `-32602`, `plugin.host.invalidParams`. A backend that makes a nested call - while it serves a relayed call sets it to the `operationID` of the - `lithe/function/invoke` it is serving (the field shown in - [The caller field](#the-caller-field)), so Core knows which call the new - one belongs to. Its effects are described in - [The call chain](#the-call-chain). A backend should always set it: without - it Core treats the new call as a child of every relayed call the backend is - serving. -- The caller cancels a call with `$/cancelRequest` for its `invoke` request - id; it fails with `plugin.host.cancelled`. - -Core checks, in this order, and refuses a call before anything is written to -the provider; the first failing check wins: - -| Check | Code | -| --- | --- | -| The caller declared the function | `plugin.function.notDeclared` | -| The provider is installed and enabled | `plugin.function.providerDisabled` | -| The provider exports the function | `plugin.function.notExported` | -| The declared and exported versions are equal | `plugin.function.versionMismatch` | -| The context is open, and has this generation | `plugin.host.contextExpired` | -| The context is a local workspace | `plugin.host.authorityUnsupported` | -| The params are at most 256 KiB | `plugin.function.payloadTooLarge` | -| The call named by `parentOperationID` is still running | `plugin.host.cancelled` | -| The provider is not on the call chain, the caller included | `plugin.function.callCycle` | -| The chain has at most 4 calls | `plugin.function.depthExceeded` | -| The caller has at most 8 relayed calls running | `plugin.function.tooManyCalls` | - -A provider's own failure keeps its meaning. The reply is a JSON-RPC error -with `data: { "code", "details" }`; when the provider's function answered with -an error, `code` is `plugin.function.failed` (`-32070`), `message` is the -provider's message cut to 1024 bytes, and `details.pluginErrorCode` is the -provider's own `error.data.code`. A reply with no `result`, or with one over -1 MiB serialized, is `plugin.function.invalidResult` (`-32071`); any other -result over 256 KiB is `plugin.function.payloadTooLarge`. Neither number is -`-32603`, which stays `plugin.host.failed`, a failure inside Core. The relay's deadline passing is -`plugin.host.timeout`. A call that is running normally ends through the -provider session's own timeout; if the provider has still not answered 2 -seconds after the deadline, the relay ends the call with -`plugin.host.timeout` itself and cancels the provider's operation. A -provider whose backend exits, or that withdraws -the function, while the call runs ends it with -`plugin.function.providerUnavailable`; a provider that is disabled or -uninstalled, or whose update stops exporting the function or changes its -version, ends it with `plugin.function.providerDisabled`. A caller whose -update stops declaring the call ends it with `plugin.function.notDeclared`. -A workspace context that the host closes, or replaces with a newer -generation, ends the relayed calls that carry it with -`plugin.host.contextExpired`: both the calls still waiting for a provider and -the calls already running, whose provider also receives `$/cancelRequest`. -Core never restarts a backend or retries a call to finish one. - -`fixtures/backend/function-protocol.json` holds the cases: the host requests -(`hostRequests`), the numbers of every failure (`relayErrors`) and the -`caller` field (`invocationCallers`). - -#### The call chain - -Core records the chain a call belongs to. A provider that makes a call while it -serves a relayed call names that call in `parentOperationID`. The new call is -then a child of that call only: - -- Its chain is the chain of that call plus the caller. -- Cancelling that call, its timing out, or its ending cancels the new call. - -A call to a plugin already on the chain, including a plugin calling itself, is -`plugin.function.callCycle`: the plugin on the chain is waiting for the call -that would reach it. A chain has at most 4 calls. So a provider that is asked -to apply values must not call back the plugin that asked inside that call; it -records the values, or calls after the call ends. - -- If `parentOperationID` names a call the host started directly, not a relayed - one, the new call starts a new chain. -- If it names a call this backend is not serving (one that has finished, or - one that never existed), the call is refused with `plugin.host.cancelled` - and the message "The call this request belongs to is not running." -- If it is omitted, the call counts as a child of every relayed call the - backend is serving at that moment. This is kept for compatibility with - backends written before the field; SDKs should always fill it in. - -Cancelling a call, its timing out or ending, or the end of its caller's -session, cancels the calls made as its children, down the chain, and each -provider receives `$/cancelRequest`. The relay never retries a call. - -#### Isolation between backends - -Core writes to each backend session through a queue of its own. A backend -that stops reading its standard -input only delays the calls and replies sent to it; the relayed calls of other -plugins continue. If a write to a backend stays blocked past the request -timeout, Core ends that backend's session as a transport failure -(`transportFailed`, stage `relayWrite`), and the calls of that session end like -those of any session failure. - -#### The caller field - -For every relayed call Core forwards `lithe/function/invoke` to the provider -as for any call (see [Invocation](#invocation)) and adds one top-level field: - -```json -{ - "functionID": "project.describe", - "operationID": "7", - "context": { "contextID": "w1", "generation": 1 }, - "params": { "project": "app" }, - "caller": { "pluginID": "dev.lithe.fixture.python" } -} -``` - -- `caller.pluginID` is written by Core from the identity of the calling - session. It is a sibling of `functionID`, `operationID`, `params` and - `context`, never inside `params`, and the caller cannot supply it: a - `lithe/host/functions/invoke` request carrying a top-level `caller` is - refused with `-32018`, `plugin.host.unsupportedOption`. A `caller` key - inside the caller's own `params` is ordinary data and is passed unchanged. -- A call the host itself started has no `caller` field. Absent means the - host. -- A provider that negotiated version 3 or earlier never receives the field. - A provider that relies on it must negotiate version 4; a provider that - keeps per-caller state (for example a slot per calling plugin) keys it by - this ID, which cannot be forged. - -#### Providers that are not running - -If the provider's backend is not running, Core waits for it and emits the -runtime event `functionProviderStartRequired` with -`result: { "pluginID" }` on the calling session, once per waiting provider. -The host starts that plugin's backend as an ordinary plugin start, and Core -dispatches the call when the provider has negotiated the protocol and registered -the function. If that takes longer than 30 seconds the call fails with -`plugin.function.providerUnavailable`; the relay's deadline still applies. -A host that cannot start the backend ignores the event, and the call ends the -same way. - -#### Remote workspaces - -The relay is a local-workspace feature. A call whose context is a remote -workspace is refused with `plugin.host.authorityUnsupported`, and the -exported `context` value `"workspace"` means a local workspace only. Backends -still run on the machine that runs Lithe. - -#### Hot activation - -Disabling, enabling, replacing and uninstalling a plugin take effect for the -relay at once and need no restart of Lithe or of any other plugin. -The host sends the plugin and workspace-context snapshot with the Core -command `lsp.configureFunctionRelay` -([Rust Core API](https://github.com/1lck/Lithe-IDEA/blob/preview/shared/contracts/rust-core-api.md)), -and calls the new snapshot no longer allows end at once with the errors above. - -Installing or updating a plugin that has a backend is different on a host that -registers backend plugins only when it launches (macOS today): that host lists -a newly installed or updated backend plugin in `providers` only after a -restart of Lithe. - -### Compatibility - -- Packages of every API level are unchanged: private functions add no - manifest field. `pluginFunctions` is a new capability - (`requires.pluginFunctions: 1`), so only a plugin that exports or calls - functions is refused by a host that cannot relay them. -- A backend written before this protocol does not answer `litheFunctions`. - It keeps serving its language and its `litheBuild` requests, receives no - function calls, and its function requests are answered with `-32601`. -- Up to version 3, every protocol version added host capabilities. From - version 3 a new host capability or optional field is added within the - version ([Extending version 3](#extending-version-3)); only a change an - existing backend would misread needs a new protocol version, offered next - to the old one. -- A backend that answers `version: 1` keeps working unchanged: version 2 - only adds host services. A backend that answers `version: 2` keeps - working unchanged: version 3 only adds methods, notifications, the call - context, and failure codes and details, all of which it never sees. A - backend that answers `version: 3` keeps working unchanged: version 4 only - adds the relay methods, which it must not call, and the `caller` field - of a relayed call, which it never receives. -- `requires.backend: 1` packages keep their meaning; a new behavior of the - backend capability is `backend` 2, never a silent change of version 1. -- `fixtures/backend/function-protocol.json` holds the golden cases, including the - host requests (`hostRequests`), call contexts (`invocationContexts`), the - caller of a relayed call (`invocationCallers`), host - failure codes (`hostFailures`), relay failure codes (`relayErrors`), and - host notifications (`hostNotifications`). Rust Core tests run them, and a scripted backend covers routing, result, failure, cancellation, - deadline, late reply, revocation, and compatibility with a build-only - backend. - -### Official backend SDK - -The official SDKs live in -[lithe-plugin-docs](https://github.com/Lithe-IDEA/lithe-plugin-docs), which -also releases them; they implement this contract and never define protocol. - -[`sdk/node`](https://github.com/Lithe-IDEA/lithe-plugin-docs/blob/main/sdk/node/README.md) is the official SDK for backends -started through a `node` runtime launch. It implements this protocol with -its host services, `litheBuild`, and VCS providers, so a plugin author writes -only handlers. It is released (`sdk-node-v`) as a `.tgz` with its -SHA-256 for plugins to vendor into their package. It enforces the rules above on the backend side: `lithe/*` methods are never sent, stdout -carries only protocol frames, `PluginError` is the only way to set a -`pluginErrorCode`, processes started for a call end with it, and its state -store refuses the plugin package. - -[`sdk/java`](https://github.com/Lithe-IDEA/lithe-plugin-docs/blob/main/sdk/java/README.md) is the Java twin for backends -started through a `java` runtime launch. It implements this protocol with -its host services and `litheBuild`, but not VCS providers. It needs Java 8 or -newer, has no runtime dependencies, and is released as a JAR with its SHA-256 -for plugins to shade into their backend. It enforces the same rules with the same error -mapping, with one difference: on Java 8 it stops only a cancelled tool's -direct child, and the host's process scope ends the rest. - -[`sdk/rust`](https://github.com/Lithe-IDEA/lithe-plugin-docs/blob/main/sdk/rust/README.md) is the SDK for -[plugin backends](#plugin-backend), which ship as packaged executables. It -implements this protocol with its host services, but neither build nor VCS -providers. It needs Rust 1.87 or newer, depends only on `serde_json`, and is -released (`sdk-rust-v`) as a `.crate` archive with its SHA-256, or -used as a Git dependency pinned by the tag. It enforces the same rules: on Unix it -points stdout at stderr so only protocol frames reach the host, and a panic -ends only its call, reported like any unexpected failure. - -The Node.js and Java SDKs each have a sample build provider -(`sdk/*/examples/sample-build`) that answers one end-to-end scenario driven -through a real Core session; the Rust SDK's sample backend -(`sdk/rust/examples/sample-backend`) answers a plugin backend scenario in which -the test plays the host: it serves the credential requests and the protocol 3 -workspace, file watch and window requests, delivers a command and a context -change, and checks that cancellation reaches the host. That repository runs -them against the Lithe commit its contract copy pins, and weekly against the -latest `preview`, the branch Lithe changes merge into. - -No SDK adds a wire field: a backend written without one is equally valid. - -## Outcomes and error codes - -`plugins.declarative.*`, `plugins.marketplace.*`, `build.*`, `vcs.*`, and `project.*` commands return `{"status": "ok", …}` or -`{"status": "rejected", "error": {"code", "message", "field"?}}`. A malformed -command payload is a Core `invalid_request` failure instead. - -| Code | Reported by | Meaning | -| --- | --- | --- | -| `plugin.manifest.invalid` | Core | Malformed manifest, unknown field, or broken cross reference | -| `plugin.schema.unsupported` | Core | `schemaVersion` is not `2` | -| `plugin.api.unsupported` | Core | `pluginAPIVersion`, or a capability version in `requires`, is not supported by this Core build or, when the host sent `hostCapabilities`, by the host | -| `plugin.permission.unknown` | Core | Unknown permission | -| `plugin.permission.undeclared` | Core | A provider or build system is declared without its permission | -| `plugin.activation.invalid` | Core | Missing or orphan activation event | -| `plugin.runtime.unsupported` | Core | Unknown runtime dependency, or a launch runtime that cannot start an entry file | -| `plugin.runtime.undeclared` | Core | From `serverProcess` 4, a runtime tool that `requiresTools` does not list; `field` names where it is used | -| `plugin.run.invalidStart` | Core | The params of `lithe/host/run/start` are malformed, name a tool the manifest does not require, or leave the workspace or package; `field` names the part | -| `plugin.debug.invalidStart` | Core | The params of `lithe/host/debug/start` are malformed, or `configuration` holds a key the host reserves; `field` names the part | -| `plugin.debug.unknownAdapter` | Core | `lithe/host/debug/start` names an adapter the plugin does not declare | -| `plugin.debug.foreignAdapter` | Core | `lithe/host/debug/start` names an adapter of another plugin | -| `plugin.debug.limitExceeded` | Core | A `debug/start` configuration is larger than 256 KiB | -| `plugin.toolchain.launchMismatch` | Core | A tool definition's `launch` template cannot carry the entry, runtime arguments or arguments a launch supplies, or needs a part the launch left out | -| `plugin.template.invalid` | Core | Unknown, misplaced, or unguarded template variable | -| `plugin.path.invalid` | Core | A request path leaves the workspace, or a declared path leaves its base directory | -| `plugin.test.invalidIdentifier` | Core | Empty or multi-line test identifier | -| `plugin.test.unsupportedProject` | Core | No project marker in the workspace | -| `plugin.execution.unavailable` | Core | The plugin has no run/test provider for the language | -| `plugin.integration.unsupported` | Core | A host integration the host does not implement, or a build system's host integration requested by a plugin outside the official namespace | -| `plugin.launch.unavailable` | Core | The plugin has no language server for the language, no provider process for the build system, or no such VCS provider | -| `plugin.build.unavailable` | Core | The plugin declares no such build system, or the build system does not declare the requested operation | -| `plugin.build.invalidSelection` | Core | A build request selects a scope, target, filter, or argument the declaration does not allow, or misses a required path | -| `plugin.build.invalidOutput` | Core | Build-tool output or a report does not fit its decoder | -| `plugin.launch.invalidRequest` | Core | A launch plan request has an unusable directory or an unknown architecture | -| `plugin.launch.notBackend` | Core | `decodeLaunch` named a language server that the plugin backend does not launch | -| `plugin.launch.invalidResult` | Core | A [backend-resolved launch](#backend-resolved-launch-serverprocess-3) answer is malformed, unknown in a field, or over a bound | -| `plugin.launch.outsidePackage` | Core | The answer's packaged executable leaves the plugin package | -| `plugin.launch.undeclaredTool` | Core | The answer's tool is not one of the plugin's tool definitions | -| `plugin.launch.unwritablePath` | Core | The answer writes outside the state, workspace state, log, and temporary directories | -| `plugin.grammar.invalid` | Core | A language's grammar file is not a TextMate grammar Core accepts; `field` names the failing part | -| `plugin.grammar.unavailable` | Core | The plugin declares no grammar for the language | -| `plugin.vcs.reserved` | Core | A VCS provider claims the ID of the built-in Git support | -| `plugin.vcs.invalidOutput` | Core | A VCS provider's reply does not fit the [VCS provider contract](https://github.com/1lck/Lithe-IDEA/blob/preview/shared/contracts/vcs-provider-v1.md) | -| `plugin.index.invalid` | Core | Malformed index root or entry, or an invalid URL, checksum, platform, version, or date | -| `plugin.index.schemaUnsupported` | Core | The index `schemaVersion` is not `1` | -| `plugin.index.officialNamespace` | Core | A third-party source lists a `dev.lithe` ID | -| `plugin.index.duplicate` | Core | An index lists the same plugin ID more than once | -| `plugin.index.platformUnsupported` | Core | No version has an archive for this platform (availability, not a rejection) | -| `plugin.index.apiUnsupported` | Core | Only versions needing a newer plugin API, or a capability the host does not run, list this platform (availability, not a rejection) | -| `plugin.source.invalid` | Core | A marketplace source URL cannot be used | -| `plugin.package.mismatch` | Core | A downloaded package's ID or version differs from its index entry | -| `plugin.archive.checksumMismatch` | Host | A downloaded archive does not match the index SHA-256 | -| `plugin.download.failed` | Host | An index or archive could not be downloaded | -| `plugin.signature.missing`, `plugin.signature.invalid`, `plugin.signature.untrusted` | Host | Package signature problems | -| `plugin.launch.missing` | Host | The packaged language server is missing or not executable | -| `plugin.runtime.missing` | Host | A declared runtime (for example Node.js) cannot be found, or is older than its `minimumVersion`, when the server starts | -| `plugin.legacyNative.updateRequired` | Host | An installed schema-1 native package must be replaced by its declarative version | -| `plugin.web.unknownMethod` | Host | A plugin page called a bridge method the host does not implement | -| `plugin.web.invalidRequest` | Host | A bridge call has malformed parameters | -| `plugin.web.forbidden` | Host | A bridge call names an instance, run, or path outside the page's plugin or workspace, or the page is closed | -| `plugin.function.invalidReference`, `plugin.function.invalidParams`, `plugin.function.unavailable`, `plugin.function.wrongPlugin`, `plugin.function.unknown` | Core | A [plugin-function](#plugin-functions) call is refused before it reaches the backend | -| `plugin.function.failed`, `plugin.function.invalidResult`, `plugin.function.revoked` | Core | A plugin-function call ended without a usable result | -| `plugin.function.invalidRegistration` | Core | A backend's register or unregister request was refused as a whole | -| `plugin.function.notDeclared`, `plugin.function.notExported`, `plugin.function.providerDisabled`, `plugin.function.versionMismatch` | Core | A [relayed call](#cross-plugin-calls-protocol-version-4) is refused: the caller did not declare it, the provider does not export (or has not registered) the function, the provider is not enabled, or the declared and exported versions differ | -| `plugin.function.callCycle`, `plugin.function.depthExceeded`, `plugin.function.tooManyCalls`, `plugin.function.payloadTooLarge` | Core | A relayed call is refused by a bound: the provider is already on the call chain, the chain is too long, the caller has too many relayed calls running, or the params or result are too large | -| `plugin.function.providerUnavailable` | Core | The provider's backend did not start in time, exited, or withdrew the function while a relayed call waited for it | -| `plugin.project.unavailable` | Core | The plugin declares no such project generator | -| `plugin.project.invalidInput` | Core | The project name or a field value is not accepted; `field` is `projectName` or `values.`, or a step whose expanded path leaves the project | -| `plugin.project.templateInvalid` | Core | A template directory is missing, too large, contains a symbolic link or non-UTF-8 file, or uses an unknown variable | -| `plugin.project.invalidURL` | Core | An archive address does not expand to an HTTPS URL (HTTP only for loopback hosts) without credentials, query, or fragment | -| `plugin.project.archiveInvalid` | Core | A downloaded archive is not a zip, has an entry outside the destination, a symbolic link, a file that already exists, or expands beyond the size limit | -| `plugin.project.generationFailed` | Host | A command step failed or timed out, a download failed, or the project could not be moved into place | -| `plugin.function.recursiveCall` | Core | A backend asked the host to dispatch a domain operation or function | -| `plugin.host.unavailable` | Core | A backend asked for a host capability the negotiated protocol does not offer | -| `plugin.host.permissionDenied` | Core | A backend asked for a [host service](#host-services-protocol-version-2) its plugin's permissions do not grant | -| `plugin.host.invalidParams` | Core | A host-service request has malformed params, or (before version 3) unknown ones | -| `plugin.host.unsupportedOption` | Core, Host | From version 3, a host-service request names a field the host does not implement; `details.option` names it | -| `plugin.host.failed` | Core | The host could not complete a host-service request, or (before version 3) too many were unanswered | -| `plugin.host.contextExpired` | Host | The request names a workspace context that closed or has a newer generation | -| `plugin.host.authorityUnsupported` | Host | The context's authority (for example a remote workspace) does not implement the operation | -| `plugin.host.versionConflict` | Host | A versioned write names an older version than the current one | -| `plugin.host.limitExceeded` | Core, Host | A host limit on size, count, or rate was exceeded | -| `plugin.host.cancelled` | Core, Host | The backend cancelled the host request, or the host stopped it | -| `plugin.host.timeout` | Host | The host's own deadline for the operation passed | -| `plugin.host.notFound` | Host | The named resource does not exist | -| `plugin.host.toolUnresolved` | Host | A tool definition the request names resolves to no executable; `details` is `{ tool, reason }` | -| `plugin.host.readOnly` | Host | The resource or workspace cannot be written | -| `plugin.host.preconditionFailed` | Host | A state the request requires does not hold | -| `plugin.host.busy` | Host | The resource is in use; retry later | -| `plugin.host.rateLimited` | Host | Too many requests in a period | -| `plugin.host.languageServerUnavailable` | Core | The plugin's language server is not running for the context, or stopped while a request was in flight | -| `plugin.host.languageServerError` | Core | The language server answered a forwarded request with an error; `details` is `{code, message}` | -| `plugin.host.methodNotDeclared` | Core | A forwarded method or command is not in the server's declared session | -| `plugin.host.foreignContribution` | Core | The named language server belongs to another plugin | -| `plugin.backend.exited` | Host | A page's call, or a host operation for the backend, ended because the backend process exited | - -Host-facing plugin states are `notInstalled`, `installed` (enabled or -disabled), `running`, `restartRequired`, `updateRequired`, and `failed`. - -## Windows mapping - -The Windows extension manifest (`Plugins/win/Official/*/plugin.json`) predates -this contract. Its adapter maps `languages[].extensions` to -`languages[].fileExtensions`, `lsp.server`/`lsp.args` to `languageServers[]`, -`lsp.requiredExecutables: ["node"]` to `runtimeDependencies`, and -`runActions.manifestFiles` to `test.projectMarkers`. Composer script discovery -is Windows-only behavior outside v1. - -## API level 2: first-stage host-owned workbench UI - -`pluginAPIVersion: 2` adds optional `ui` contributions and the `ui.contribute` -permission. API level 1 language packages continue to work. UI-only packages may -omit `languages`; every package must still declare a language provider or a -nonempty UI catalog. See `fixtures/manifest/hello-lithe.plugin.json` and the UI cases in -`fixtures/manifest/invalid-manifests.json`. - -- `ui.toolWindows`: 1–64 entries with stable `id`, `title`, initial `placement` - (`left`, `bottom` or `right`), integer `order` (default 0), and plain `text`. -- `ui.commands`: up to 128 entries with stable `id`, `title`, `toolWindowID`, - integer `order` (default 0), and nonempty `placements` (`commandPalette`, - `toolbar`, `menu`). A command opens one of the same plugin's tool windows. -- IDs use the plugin ID followed by a dot and a suffix. Duplicate or foreign - identities, invalid references, unsupported placements and executable UI - fields are rejected with `plugin.manifest.invalid`. -- Titles are at most 256 UTF-8 bytes and window text at most 65536 UTF-8 bytes. - Text is displayed literally; it is never evaluated as HTML or a script. - A window shows exactly one of `text` and, from `ui` 2 on, - [`web`](#web-content-ui-2). -- Declare `onView:` and `onCommand:` for every window and - command, plus `ui.contribute`. The existing permission and activation error - codes apply. IDs and presentation order are normalized deterministically. -- The host exposes metadata without instantiating the module. Opening an - entry activates the plugin's UI module on demand; a disabled, quarantined - or safe-mode-suppressed module has no executable UI entries. Disabling it - removes the entries and closes its visible content. -- The host owns header controls, widgets, menus, theme, ordering and layout. - Saved workspace preferences override a declaration's initial placement and - order. Moving or hiding content does not create a new module or session. - Unknown and temporarily absent contributions never execute an action; - placement/order preferences remain available if the plugin returns. - -API level 2 is the first UI Contribution infrastructure stage. Its static text -windows and open-own-window commands are a supported subset, not the final public -extension API. The required window/text/command-target fields and rejection of -packages without language or UI contributions remain unchanged for v2 compatibility. -The macOS host supports mouse docking through the existing shared dock state; -that presentation behavior does not grant additional plugin execution capabilities. - -### Web content (`ui` 2) - -A plugin does not have to bring a UI: build systems get a host-drawn window -(see [Presentation](#presentation)), and text windows need no code. A plugin -that wants its own UI can show its own page in a tool window instead of -`text`: - -```json -"requires": { "ui": 2 }, -"permissions": ["ui.contribute", "ui.web"], -"ui": { "toolWindows": [{ "id": "…", "title": "…", "placement": "right", "web": { "entry": "ui/index.html" } }] } -``` - -- `web` needs `pluginAPIVersion` 3, `requires.ui: 2`, and the `ui.web` - permission, which the install review lists like every permission. - `requires.ui: 2` without a web window is `plugin.manifest.invalid`, so a - text-only plugin stays installable on hosts that run only `ui` 1. -- `entry` is a package-relative `.html` path. `fixtures/ui/web-panel.plugin.json` - is the example; the web cases of `fixtures/manifest/invalid-manifests.json` are the - rejections. - -The window shell stays the host's: dock, title, activity-bar entry, order, -visibility, layout, and lifecycle are declared or managed exactly as for a -text window. The page fills the body only and cannot open, place, size, or -title a window. - -Hosts load a page under these rules: - -- Only files of the installed package are served, read-only, from an origin - private to the plugin. The host's content security policy refuses network - connections, remote resources, frames, inline scripts, and `eval`. - Navigation away from the package, popups, and downloads are blocked. -- Web storage is not persistent. A page keeps its state through the bridge. -- The package path `.lithe-host/` is reserved: the host answers - `.lithe-host/bridge.js` with its own bridge script and serves no package - file under it. -- The host creates the page when the window is first shown. It may destroy - the page whenever the window is hidden, and does destroy it when the plugin - is disabled, updated, or uninstalled. A page restores itself from its - state. -- The root element carries `data-theme` (`light` or `dark`) and the host's - `--lithe-*` CSS colour and font variables, updated with the theme. - -Before the page's scripts run, the host defines `window.lithe`: -`lithe.version`, the bridge version (2 on current macOS hosts; version 2 -adds the file dialogs to version 1, so a page checks it before offering -them), `lithe.context` (`pluginID`, `windowID`, `platform`, `locale`, -`theme`), `lithe.request(method, params)`, which returns a promise of the -result or rejects with `{ code, message }`, and `lithe.on(event, listener)`, -which returns an unsubscribe function. A page reaches only its own plugin's -build systems and the open workspace. Requests that run anything ask for the -same per-operation consent as the host's own controls (Lithe has no workspace -trust state at the moment), and -their output appears in the host's Build output window. - -| Method | Parameters | Result | -| --- | --- | --- | -| `build.instances` | none | `{ instances: [{ id, buildSystemID, root, state, model?, options, error? }] }`: this plugin's detected instances, `model` as `build.decodeModel` returns it, `options` the stored values | -| `build.refresh` | `{ instance }` | `{}`; reloads the model | -| `build.runTask` | `{ instance, task, project?, target?, modelTask?, userArguments? }`, the selection of `build.taskPlan` | `{ run }` | -| `build.runTests` | `{ instance, project?, target?, suite?, case? }`, the selection of `build.testPlan` | `{ run }` | -| `build.cancel` | `{ run }` | `{}` | -| `build.dependencies` | `{ instance, project? }` | the tree `build.decodeDependencies` returns | -| `build.setOptions` | `{ instance, values }` | `{ options }`, checked by `build.resolveOptions` and stored like values set in the host's option list | -| `workspace.openFile` | `{ path, line?, column? }`, a path inside the workspace | `{}` | -| `ui.getState`, `ui.setState` | none, `{ state }` | `{ state }`, `{}`; JSON of at most 64 KiB per window and workspace | -| `functions.list` | `{ instance? }` | `{ functions }`: sorted IDs of the functions the instance's provider, or without `instance` the plugin's [backend](#plugin-backend), currently offers; starts that process | -| `functions.invoke` | `{ instance?, function, params?, call? }`, without `instance` a call to the plugin's backend; `params` an object, `call` a page-chosen ID of at most 128 characters that the page never used before | `{ value }`, the function's result | -| `functions.cancel` | `{ call }` | `{}`; a call still awaiting consent never starts, a call waiting for its provider to start ends at once while the start goes on, and a call that already ended is ignored | -| `dialog.openFile` (bridge 2) | `{ title?, extensions? }` | `{ path }`: the absolute path of the file the user chose, or `null` when the dialog was cancelled | -| `dialog.saveFile` (bridge 2) | `{ title?, suggestedName?, extensions? }` | `{ path }` as for `dialog.openFile`; the host has asked before replacing an existing file, and nothing is written | - -| Event | Payload | -| --- | --- | -| `build.instancesChanged` | `{ instances }`, as `build.instances` returns them | -| `build.runChanged` | `{ run, instance, state, exitCode? }`, `state` one of `running`, `succeeded`, `failed`, `cancelled` | -| `functions.progress` | `{ call, instance?, function, message?, percentage? }`, only for a call made with `call`; `instance` absent for a backend call | -| `ui.themeChanged` | `{ theme }` | - -The file dialogs are the host's: they name the plugin that asks, a page -has at most one open at a time, and the page learns only the path the user -chose. `extensions` are up to 16 file name extensions without the dot; -`suggestedName` is a file name, not a path. A page passes the path to its -backend, which reads or writes the file; the page itself still reaches no -file. - -Bridge errors are `plugin.web.unknownMethod`, `plugin.web.invalidRequest`, -and `plugin.web.forbidden`. Build requests also report the `build.*` codes. -Function requests report Core's codes unchanged (`plugin.function.*`, -`requestCancelled`, `requestTimeout`); a failure the plugin reported also -carries its own `pluginErrorCode`, which the host never interprets. A call -Core could not deliver, such as a write to a backend that exited, keeps -Core's transport code (`processFailed`) and carries the OS diagnostic only in -its message. A backend that stops reading its input is ended when a write to -it stays blocked past the call's timeout, or briefly after the call was -cancelled or the provider stopped. A page -has at most 16 function calls accepted at once, counting calls still awaiting -consent, and closing it cancels them. Reusing a `call` ID is -`plugin.web.invalidRequest`, also after that call ended. -`functions.list` and `functions.invoke` with an `instance` ask for the same -consent as the host's provider requests: once given for a plugin and -workspace, it holds until the project is closed. Calls to the plugin's -backend ask for none; the install review covered it. -macOS implements web content with WKWebView and advertises `ui: [1, 2, 3]` -(including the native controls described below). -Windows implements web content with WebView2 under a plugin-private -`lithe-plugin://` origin and also advertises `ui: [1, 2]`; its bridge v0 -answers `ui.getState`, `ui.setState`, and `workspace.openFile`, and returns -`plugin.web.unknownMethod` for `build.*` and `functions.*` until the Windows -build-system capability lands. Windows does not advertise `ui` 3. - -### Future public extension direction (not implemented in API level 2) - -- Plugins may bring their own UI as [web content](#web-content-ui-2) inside - host-owned windows. Native trees/lists and panel actions now use the separately versioned - [native schema](#host-rendered-native-content-ui-3-native-schema-1). - Forms and broader component composition remain follow-up work. Built-in or trusted native modules may - register Native View/Renderer Factories under the same host window - management. This does not restore arbitrary dynamic third-party Swift - Bundle loading; ABI, signing and isolation need separate design. -- Actions declare handlers and availability/context conditions independently of - Tool Windows. Commands, menus/context menus, toolbars, status bars and settings - contributions must not require dummy windows. Opening a window is one action kind. -- A new, explicitly versioned Extension Contract will cover Language/LSP, - BuildSystem/Task, RunConfiguration/Test, DebugAdapter and ServiceProvider, - including pure Build/Debug/Services packages with no UI or language declaration. - Exact version numbers, handler transport and fields are not published here. -- Built-in and plugin providers should use the same typed domain registries. - Providers supply behavior/processes/data; hosts own scheduling, permission, - presentation and lifecycle. Reuse existing language, build, run/test and DAP - backends instead of duplicating them or branching by plugin name in composition. -- Services will accept general resources with provider/descriptor/instance/status/ - actions/logs semantics. Disabling unregisters contributions and releases - plugin-owned resources; it must not implicitly stop independently running - external services. An explicit stop action requires its own authorization. -- API level 2 remains supported unchanged. UI Schema evolves independently; - domain extension points need a new contract version and compatibility fixtures. - Windows implements its own host adapter over shared data, not SwiftUI types. - -Planned end-to-end samples are a native Tree with an independent refresh command, -Build Task in existing Build, ServiceProvider in Services, and third-party DAP in -existing Debug UI. Each must verify disable/re-enable, resource ownership and -restoration; view-bearing samples also verify layout persistence. These samples -are future acceptance criteria, not claims about current runtime support. - -The design source is the [proposed public Extension Contract and Provider API](https://github.com/1lck/Lithe-IDEA/blob/preview/.agents/notes/proposed/architecture/2026-10-13-public-extension-contract-and-provider-api.md). -Current runtime behavior is recorded in the [first-stage workbench UI Note](https://github.com/1lck/Lithe-IDEA/blob/preview/.agents/notes/implemented/architecture/2026-10-12-workbench-ui-contributions.md). - -### Current Windows availability -Windows advertises `ui` 1 and 2: it renders host tool windows, commands and -package web content. It does not advertise `ui` 3 (native controls) or 4 -(backend-only commands), so Core refuses packages that require them there. -Windows installs declarative packages from disk only and has no marketplace -browser yet. Core's `plugins.marketplace.validateIndex` marks level 2 versions -without `requires` available only on `darwin-*` platforms. - -### Existing community store and Lua template - -The community index is [Lithe Store](https://github.com/Lithe-IDEA/Lithe-store). -The [Lua plugin template](https://github.com/Lithe-IDEA/lithe-plugin-lua) uses -schema 2 / API level 1 for language-server and run providers; those declarations -remain valid. To add a host-rendered view to that template: - -1. Set `pluginAPIVersion` to 2. Keep the existing language and execution fields. -2. Add `ui.contribute` to the existing permissions and the new `onView` / - `onCommand` events to the existing activation events. -3. Add `ui.toolWindows` and `ui.commands`; prefix every ID with the plugin ID, - for example `io.github.lithe-idea.lua-support.tools`. -4. Keep `vendor.signatureRequirement: "none"` for community packages. The - existing package checksum, user install review and content digest still - apply; UI does not bypass them. -5. Set the new Store version entry's `pluginAPIVersion` to 2. The index schema, - release archive format and SHA-256 rules stay unchanged. Only list `darwin-*` - platforms: `plugins.marketplace.validateIndex` marks a level 2 version without - `requires` unsupported on every other platform. - -`fixtures/manifest/hello-lithe.plugin.json` is a contract fixture in the reserved test -namespace, not a ready-to-publish community package. Change its ID and all -references to your own namespace before using it in Lithe Store. - -### UI icons (macOS host) - -API level 2 tool windows and commands accept an optional `icon`. Prefer a stable -host icon ID; it resolves through Lithe's existing icon library, not SF Symbols: - -```json -"icon": { "host": "database" } -``` - -Supported host IDs: `tool-window`, `plugin`, `database`, `services`, `terminal`, -`search`, `refresh`, `run`, `debug`, `settings`, `add`, `remove`, `git`, `problems`. -These IDs are public; bundled SVG paths remain implementation details. - -Custom SVG and PNG icons are relative to the plugin package root: - -```json -"icon": { - "path": "icons/database.svg", - "darkPath": "icons/database-dark.svg", - "mode": "template" -} -``` - -`mode` defaults to `template`: the host tints the image using the containing -control's theme and selected/hover state. `original` preserves brand colors; -control backgrounds and disabled opacity still follow the host. `darkPath` is -optional; without it the same resource is used in both themes. Brand authors -must make that resource legible in both themes or provide a dark variant. -`host` cannot be combined with resource paths or original-color mode. - -The host owns icon size: 20pt tool-window rail and 16pt actions/menus/palette. -Panel titles are text-only: no title icon, outline or bottom divider. A declared -window icon remains available in the activity rail and management menus. -Aspect ratio is preserved inside each icon slot. Plugin-specified -size, color, stroke, arbitrary style, remote URLs and SF Symbol names are rejected. -Stroke geometry belongs to the asset; authors should follow the host icon -weight, rather than expecting the host to rewrite paths or PNG pixels. - -Window and toolbar management submenus reuse the same declared icons at the -host menu size. Template icons in the command palette use the host selected-text token on the -selected row; brand icons retain their theme variant when keyboard selection moves. - -Files must be regular files inside the verified package, without symbolic links -in their path. Each resource is limited to 256 KiB and 1024×1024; unique icon -bytes per package are limited to 8 MiB, with at most 4,194,304 total image pixels. PNG is decoded as a single image. SVG -accepts static shapes, groups, gradients, clip paths and the standard SVG version attribute; scripts, event handlers, -external references, embedded images, style elements/attributes, entities and -DOCTYPEs are refused. Use explicit presentation attributes for SVG colors. -Unknown fields and unsupported formats are rejected at installation and launch. - -Window entries without an icon use the shared generic tool-window icon. Commands -without an icon remain text actions (palette retains its existing action marker). -Missing/unreadable declared resources reject the package instead of silently -using a different image. Assets are read-only and held in process memory; no -runtime disk cache or app-bundle write is created. Installed icon bytes follow -the existing package signature/digest, update and rollback lifecycle. - -macOS 宿主布局菜单允许把已注册工具窗口移到左侧、右侧或底部,并保存入口 -顺序与显隐;`ui.toolWindows[].placement` 仍只声明首次使用的 `bottom`/`right` -位置,未新增插件契约值。项目、提交和搜索采用相同的工具窗口注册路径, -原生业务内容保持宿主所有;左侧恢复插件窗口仍按 `onView` 激活所属模块。 - -macOS 动作的可见、可用、勾选和激活中状态由宿主计算,不接受清单中的可执行 -条件脚本。窗口尚在激活时,其打开命令在工具栏、菜单和命令面板禁用;窗口入口 -仍可取消显示。多个窗口同时请求同一插件模块时只构造一次;禁用或关闭会取消 -并清理在途激活,旧的菜单或命令引用不能重新调用已禁用的贡献。 - -#### Shared executable candidates (`executableResolution` 1/2) - -Declare executable sources in `invocation.executables`, in preference order. -Array order is the recommended form; no custom path setting is required for a -plugin that only needs automatic discovery. Existing `projectFile`, `environment`, -`command` and `runtime` sources retain their v1 behavior. The shared -`executableResolution: 1` capability adds `setting` and ordering metadata: - -```json -"executables": [ - { "id": "selected", "kind": "setting", "settingID": "toolPath" }, - { "id": "wrapper", "kind": "projectFile", "path": "mvnw" }, - { "id": "system", "kind": "command", "command": "mvn" } -] -``` - -A `setting` references a declared **global file** setting with `effect: "reload"` -or `"nextRun"` (`settings: 2`). Core receives raw `request.settings`. An absent -value uses the declared default; an explicit empty string emits a setting candidate -with `path: null`, which skips. A nonempty value must satisfy the setting rules, -be absolute, and have no surrounding whitespace or controls. Invalid stored -values reject the invocation instead of invoking the normal settings display -resolver's fallback-to-default behavior. Project overrides never select tools. -The host checks file permissions and versions: a configured failure is terminal, -including a failure to probe, and must not fall back to subsequent candidates or -a Provider's own lookup. Paths with spaces remain single paths. The selected -setting's directory precedes PATH. Runtime candidates construct their environment -before version probing and reuse it for execution; a rejected candidate's -environment does not leak into the next choice. Provider hints and task/test -execution use this same plan/selection mechanism. If resolution fails before a -configured candidate is reached (for example, an earlier Runtime is missing), -any nonempty setting in the tool or Runtime candidate sets still forbids the -Provider's independent lookup. All-empty settings retain automatic-discovery -fallback. This check applies after failure, so an earlier successful candidate -is unaffected by a later unused setting. - -Optional metadata applies within **one candidate set owned by one plugin**: - -- `id` is a unique stable identifier; anonymous candidates cannot be anchors. -- `priority` is a signed 32-bit integer; higher wins, absent means 0. Ties retain - original array order. -- `insertBefore` or `insertAfter` names an ID in this set. One candidate cannot - combine either with `priority`, or declare both insertion fields. Constraints - mean relative order, not immediate adjacency. -- Normalize the complete set into a directed graph before platform filtering. - Repeatedly select a zero-indegree node by descending priority, then original - index; emit it and remove its edges. Explicit edges take precedence over - priority. Duplicate/invalid IDs, unknown anchors, cycles/self-edges and - conflicting metadata are manifest errors. Filter platforms only after sorting, - so anchors remain valid even if they do not apply to the current platform. - -`plugins::executables` owns the reusable source types and deterministic order; -`ExecutableCandidateResolver` receives file-system, Setting (already validated by -Core), Environment, Runtime and command-discovery capabilities from the host. -Results distinguish `skip`, `resolved` and `terminalFailure`; plugins declare data -and cannot inject host native code. Each operation uses a value snapshot for its -settings/environment and ordered plan. Passive import does not resolve/probe -runtimes or execute project wrappers. A project candidate remains project code -and is only executed through the consumer's existing trust/user-action workflow. - -This PR connects Build Systems and their custom Runtime Dependencies. Own Build -Providers already adapt command/runtime launches through BuildToolResolver and -receive the selected build tool as `tool.executable`; their ServerProcess protocol -is unchanged. Language Servers, Execution Providers, and other ServerProcess -launch forms can later adapt into this same resolver without changing their -manifest structure all at once: preserve package-realpath/executable checks, -per-operation consent (there is no workspace trust state yet), auto-start -restrictions, runtime ownership and cancellation. -They do **not** advertise support for new candidate declarations until their -adapter is implemented; this capability currently authorizes the Build candidate -positions only. Windows does not advertise it yet. - -Compatibility: Cargo 0.1.1 already shipped as a preview with `buildSystems: 2` -and `invocation.executableSetting`. That field is deprecated and supported only -as a v2 input adapter: prepend an equivalent setting candidate to the normal -list; never emit `configuredExecutable` or use a separate resolution branch. -New plugins use the fifth candidate and `executableResolution: 1` (Build v1 -remains sufficient). Legacy manifests do not need the new capability; hosts -without it reject new-style plugins before decoding unknown fields. Published -0.1.0/0.1.1 archives remain immutable; migration is a new plugin version. - -See [`build-tool-path.plugin.json`](fixtures/build-systems/build-tool-path.plugin.json). - -With `executableResolution: 2`, a candidate may use -`{ "kind": "toolchain", "toolchainID": "org.example.compiler:compiler" }`. -Core accepts the same short/qualified ID grammar as tool definitions and adds the -normalized instance `root`. The macOS adapter resolves installed definitions -against fresh native evidence and directory pins. Existing host registry IDs -remain only for their unmigrated consumers. Unavailable selections are terminal, -including when a prerequisite runtime fails first; they cannot silently fall -back to Provider discovery. -A host-managed `node` or `go` dependency may select one such candidate, -while retaining Core's version probe. Any other dependency that declares no -`executables` is already this candidate for the definition with its own ID, and -that definition checks `minimumVersion`. Maven declares its namespace-owned tool -and uses the short `java` definition for its Java prerequisite; no Maven-specific -JDK registry entry is added. Its backend bootstrap remains a separate consumer. -Passive import performs no version or runtime probes; a definition that requires -verification is not reported as an already verified import executable. -A toolchain that resolves to a project file remains project code, -including through a symlink, and native configuration requires explicit Read -before running it. See [`build-toolchains.plugin.json`](fixtures/build-systems/build-toolchains.plugin.json). - - -### Host-rendered native content (`ui` 3, native schema 1) - -macOS supports `requires.ui: 3` for a tool window whose sole body is `native`. -Text and Web windows retain their existing behavior. Windows does not advertise -ui 3 and rejects these packages before installing them. The independently -versioned [native schema](native-ui.schema.json) has no style, script, HTML or -host-action fields. The host renders every control with its shared theme. - -See [native-panel.plugin.json](fixtures/ui/native-panel.plugin.json) and the runnable -[Node SDK Sample Explorer](https://github.com/Lithe-IDEA/lithe-plugin-docs/blob/main/sdk/node/examples/sample-build/plugin.json). -`native.kind` is `tree`, `list` or `form`; `nodes` contains literal `id`, `label` and -optional `children`. IDs are stable, case-sensitive ASCII letters/digits plus -`._-` (1–128 bytes). The component, initial nodes and actions have distinct IDs. -The entire node set is limited to 2000 nodes and depth 16 (root depth 0); labels -are nonblank and at most 1024 UTF-8 bytes. Lists reject nested children. - -A `form` declares `nodes: []`, an empty `contextMenu`, at most 32 `controls` -and 16 `buttons`; at least one control or button is required. -Tree/list panels cannot contain controls. Each control has a unique `id`, literal -`label` (1–256 UTF-8 bytes), `kind`, initial `value`, optional `enabled` (default -true), and optional `onCommit` referencing a declared `invoke` action that does -not require a selection. An optional literal `info` (1–1024 UTF-8 bytes) renders the shared information -icon beside the label; tooltip timing, pinning, accessibility and styling are host-owned. - -- `input` / `search`: string `value` (at most 1024 UTF-8 bytes), optional `placeholder` - (at most 256 UTF-8 bytes), no options. Uses the IDE settings text-field owner. -- `select`: string `value` equal to one of 1–128 unique `options: [{id,label}]`; - option IDs use the standard identifier rule, labels are 1–256 UTF-8 bytes. - No placeholder. Uses `LitheSettingsSelect`, including its popup and keyboard behavior. -- `segmented`: string value and 1–8 options, using the same option contract and - the shared segmented selector; no placeholder. -- `editor`: string value up to 8192 UTF-8 bytes, optional `rows` (2–12, default 4), - no placeholder/options/onCommit. Reuses the shared multiline editor; Enter inserts - a newline and form buttons submit its current value. -- `stepper`: finite numeric value, required `minimum`, `maximum` and positive - `step`; bounds and step are limited to ±1e9/1e9, and value must fit the range. - No placeholder/options. Uses the shared settings stepper and bound behavior. -- `checkbox`: boolean `value`, no options or placeholder. Uses `LitheSettingsCheckbox`. - -Forms may declare `layout: {"columns":12}` (1–12 columns). Each control may -provide `span` (1–columns); omitted span fills a row. Controls pack in declaration -order, wrapping before a span would exceed the row. Without layout, the form -retains its original single-column presentation and must omit span. Layout is -form-only. Gaps, alignment and breakpoints remain host-owned; plugins cannot -supply pixels, CSS or gap values. macOS uses a native `Layout`, 12pt gaps, -top-aligned variable-height rows, and switches to one column below 640pt of -content width. Reflow preserves the same controls, local values and focus. - -Buttons reference an existing non-selection action through `action`, have stable -`id`, literal `label`, optional `primary`, `enabled` and `info`. -Text actions reuse the host's shared natural-width button style and 6pt action -spacing; a narrow action group falls back to vertical stacking. Deprecated -`buttons[].width` (`content`/`fill`) and `buttons[].span` are accepted for older -experimental packages, but do not change button width or action-group layout. -Grid spans continue to apply to value controls. The declaration cannot override -button colors, fonts, chrome, padding or fixed/max widths. - -Input/search editing saves local values without executing plugin code; Return commits. -Selectors, segmented selectors, steppers and checkboxes commit after a changed value. Omit `onCommit` to keep -a field local. Commits pass **all** current fields as `params.values` (strings, -booleans and numbers keyed by stable control ID), together with `selectedID: null`. -The subsequent form source call also receives `{values}` and returns `{nodes: []}`. -Disabled fields still contribute their values; they cannot edit or commit. -A pending call disables all fields. Values use the existing 64 KiB per-plugin, -per-window, per-workspace state store; removed fields, invalid types and removed -options are discarded when restoring. Provider replies never overwrite local -fields. Form declarations and choices are static in this version. -See [native-form.plugin.json](fixtures/ui/native-form.plugin.json) and -[host UI acceptance fixture](https://github.com/1lck/Lithe-IDEA/blob/preview/macos/Tests/Fixtures/native-ui-lab/README.md) for acceptance. - -An optional `source` names this plugin's `buildSystemID` and a function returning -`{ nodes: [...] }`. This phase uses the existing provider transport; it adds no -new backend, provider registry, or process protocol. There must be exactly one -detected instance of that build system in the workspace; zero or multiple -matches produce an error instead of silently targeting a different root. -Static panels omit `source` and declare empty actions and placements. - -`actions` declares at most 64 independent handlers with `id`, literal `title`, -`kind` (`refresh` or `invoke`) and `requiresSelection`. A refresh reloads the -source and cannot require selection or name a function. An invoke names a -`function` and receives `{ selectedID: string | null }` (forms also include `values`). Invocations return an -optional `{ message }`, then the host reloads the source. `toolbar` and -`contextMenu` contain distinct references to declared action IDs in display -order. Toolbar actions are icon-only and appear when the pointer enters the whole -panel, like the host hide control; keyboard and accessibility focus also reveal them. -An optional `icon: {"host":"search"}` reuses the host icon vocabulary (including -`reset`); native actions do not load custom package icons. Without an icon, refresh -uses the refresh icon and invoke uses the generic run icon. The literal title is -the tooltip and accessibility name. A context-menu action selects its clicked row before running; selecting -a row alone never starts a provider function. These are panel-local actions; -this phase does not change API-v2 commands into arbitrary function handlers. - -The host allows one operation per panel, disables actions while busy, and -shows loading, empty, failure and success feedback. A source reply is at most -1 MiB and follows the same node limits; invalid data preserves the last valid -rows. Selection and expansion use stable IDs and the existing per-plugin, -window and workspace state store (at most 64 KiB). Arrow keys move selection, -expand/collapse nodes and select a parent; hidden/reopened panels restore state. -Provider calls retain existing consent, scope checks, timeout and cancellation. -Hiding a native panel cancels its pending operation. Disable, package replacement -and workspace close synchronously invalidate it through the existing shared -plugin-page lifecycle; late replies cannot publish. All state is outside the -installed package and application bundle. - -Schema 1 loads the complete node set on refresh. Forms, lazy child data sources, -multi-instance selectors, global function commands, native renderer factories -and Windows rendering remain follow-up work under #1209; this subset does not -claim completion of that whole issue. - -### Opaque semantic test selectors (buildProviders 9) - -Provider test declarations may advertise `selectorKinds`, up to 16 distinct public -namespace identifiers (120 bytes each). These require `buildProviders: 9`. A test -request may then carry `selectorKind` and `selectors` instead of `suite`/`case`. -The namespace must be declared; at most 64 nonempty, control-free UTF-8 values of -4096 bytes each are allowed. An empty list explicitly selects all tests within the -request's normal project/workspace scope. Values remain opaque to the host and -Core: only the owning language engine supplies semantic identities and the build -backend translates them into its upstream runner's selection syntax. Providers -must reject identities they cannot represent exactly, rather than widen execution. - -The wire session must explicitly negotiate version 9. Core and both SDKs reject -these fields on older versions before dispatch; ignoring a filter is unsafe even -when version 8 inline reports are supported. The operation identity, source/model -and configuration validity, cancellation, progress, and inline report rules still -apply. The shared example is `fixtures/build-providers/build-provider-selectors.plugin.json`. - -### Declarative project preparation (buildSystems 4) - -A project task may declare `preparation: { "purpose": "run", "sourceRoles": -["source", "generatedSource"] }` with `requires.buildSystems: 4`. Purpose is -an opaque workflow identifier; `run` identifies preparation before resolving a -language launch. Roles are the canonical model content-root kinds. A provider -can declare a different task for `testSource`/`generatedTestSource`, with any -private task IDs. Hosts never prescribe task names or infer a role from a file -extension, build descriptor, class name or missing model entry. - -Bindings are unique by purpose/role within each build system. Preparation -requires a project-scoped task, task execution, no argument prompt, and no -`fromModel`. Empty, overlapping, duplicate or unknown roles are rejected. -Hosts select the deepest owning project and its deepest content root from the -current model, then require exactly one declared matching task. Missing or -ambiguous declarations fail; they do not fall back to a conventional task ID. -The selected ID travels through the existing execute plan and backend method. -An older host rejects the capability before invocation. No new RPC version is -needed, so buildProviders 8–10 are unchanged. Shared fixture: -`fixtures/build-providers/build-provider-preparation.plugin.json`. - -The build backend owns filtering, custom resource directories, profiles and -reactor semantics. Hosts await successful completion, retain one operation -identity through cancellation/configuration changes, and only then resolve and -launch Java. Per-run option/tool overrides are ephemeral host inputs to the -existing validated plan; they never mutate saved build defaults or claim that -the persistent model reflects a different configuration. - -### Plugin-owned native terminals (function protocol 3) - -[`terminal-backend.plugin.json`](fixtures/backend/terminal-backend.plugin.json) is the -minimal manifest. `terminal.create` grants `lithe/host/terminal/create`, `show`, `close`, `reopen`, -`dispose`, and `onExit`. It requires `backend:2`; discover the individual -methods through `getCapabilities` before using them. macOS implements this -service. Windows has no handler and does not advertise its methods. The -plugin's web page calls its backend through `functions.invoke`; the backend -uses these host requests with the invocation's workspace context. There is -no direct web `terminal.*` bridge and no new protocol version. - -| Method (prefix `lithe/host/terminal/`) | Params, in addition to `context` | Result | -| --- | --- | --- | -| `create` | `executable`, optional `arguments`, `title`, `cwd`, `environment`, `show`, `retainedContextBytes` | `{terminalID,generation:1}` | -| `show` | `terminalID` | `null` | -| `close` | `terminalID`, optional `retainedContextBytes` | `{retainedContextBytes}` after bounded native cleanup | -| `reopen` | `terminalID`, optional `show` | `{terminalID,generation,restoredContextBytes}` | -| `dispose` | `terminalID` | `null` after closing and forgetting the handle | -| `onExit` | `terminalID` | `{subscriptionID}` | - -`executable` is an absolute path or a bare command resolved by the native -terminal's PATH lookup; relative paths containing separators are refused. -`arguments` is an argv array, never shell text. `cwd` is a `{rootID,path}` -workspace directory resource (an empty path selects the folder root); without -it, the workspace root is used. The native adapter rejects a canonical cwd -outside that workspace. `environment` maps variable names to string overrides -or `null` removals. Process-ownership scope variables cannot be overridden. -`show` defaults to true; it selects the terminal in its own window without -raising a background window. With `show:false`, creation and reopening preserve -the current terminal selection and do not reveal the terminal panel or request -input focus; the native tab is mounted when the plugin explicitly calls `show`. -Unknown options fail before any side effect. - -Creation and reopening ask for execution consent with the program, argv and -working directory, all available in a scrollable, selectable native text view, -then revalidate context and cancellation before launching -through the existing PTY terminal module. The response waits for user choice -without a machine-operation deadline, but cancellation/session/context closure -still ends it. Native launch and process cleanup retain their own bounds. -The host never types a launch into an existing shell or reads other terminals. -There is no `sendText`, user-terminal enumeration, web emulator, or Docker -special case. First release is local authority only; a remote context fails -with `plugin.host.authorityUnsupported` instead of starting anything locally. - -Each handle belongs to one plugin backend session and one context generation. -A handle from another plugin, context or replacement backend is `notFound`. -At most eight handles per plugin are retained, including closed handles; -`dispose` releases one. Limits are 256 arguments, 16 KiB per argument or -environment value, 64 environment entries, 64 KiB combined launch data, and -128 UTF-8 bytes in a nonempty single-line title. `busy` refuses concurrent -close/reopen/dispose on the same handle. Reopening a running terminal is -`preconditionFailed`; showing a closed terminal asks the plugin to reopen it. - -#### Close, retained context and reopen - -`close` ends the process tree and removes the native tab, keeping the handle's -launch configuration and a plain-text suffix of its displayed terminal output. -`retainedContextBytes` is a nonnegative UTF-8 byte budget: default **16384**, -maximum **262144**, and **0** disables history. It can be chosen at create or -changed at close; over-limit values are refused, never silently expanded. -The result reports actual retained bytes, which can be smaller to avoid cutting -a Unicode scalar. The history is a rendering snapshot, not input events, raw -escape sequences, a resumable process image, or shell state. Secrets already -printed or echoed by a program can be part of that display; choose 0 when no -history should be retained. - -`reopen` uses the saved executable, argv, cwd and environment in a **new** PTY -process. It feeds retained plain text to the display before spawning, never to -stdin. Shell variables, unsubmitted input, process state and automatic command -replay are not restored. Natural exit and user tab close are also reopenable; -the snapshot is bounded by the same budget. It keeps `terminalID` and increments -`generation`; late exit callbacks of previous generations are ignored. These -handles/history exist only in memory, not across app/backend restart or -workspace close. No state is written to the app bundle or plugin package. - -Natural exit and user tab close run the same bounded native cleanup before -retaining the budgeted snapshot and releasing the complete native session and -render buffer. The handle is `busy` during cleanup; its exit notification is -sent after cleanup, so a subscriber can reopen immediately. A zero-byte budget -retains no display text on any close or exit path. - -`dispose` closes any live process and permanently forgets the launch settings -and history. Ending the backend session, disabling/updating the plugin or -closing/replacing its workspace does the same for only its owned terminals; -user-created terminals are unaffected. Closing a page alone does not close a -completed terminal creation. Cancellation before launch creates nothing; -cancellation or context loss during launch closes the newly created process. -Cancelled creation/reopen is not safe to retry automatically. - -`onExit` supports one live subscription per handle. Its event is -`{type:"exit",terminalID,generation,exitCode,reason}`, with an integer or null -exit code and `reason:"exited"|"closed"`. Each generation publishes one outcome. -Subscribing after exit delivers its recorded outcome once; the subscription -continues across reopen. Disposing it stops notifications and keeps the -terminal open. A disposed terminal has no further events. - -The executable and argv remain plugin-owned semantics. A container plugin can -launch the user's Docker CLI with an explicit engine and container ID; another -tool can launch its interactive client through exactly the same service. -Neither requires a fake Build/Run provider. diff --git a/shared/contracts/plugins/v1/fixtures/backend/backend-workspace.plugin.json b/shared/contracts/plugins/v1/fixtures/backend/backend-workspace.plugin.json deleted file mode 100644 index 8799688bed..0000000000 --- a/shared/contracts/plugins/v1/fixtures/backend/backend-workspace.plugin.json +++ /dev/null @@ -1,34 +0,0 @@ -{ - "schemaVersion": 2, - "id": "dev.lithe.fixture.workspacebackend", - "displayName": "Workspace Backend", - "version": "1.0.0", - "pluginAPIVersion": 3, - "requires": { - "backend": 2, - "serverProcess": 1 - }, - "vendor": { - "id": "org.example", - "displayName": "Example", - "signatureRequirement": "publisherPackage" - }, - "permissions": [ - "backend.launch", - "workspace.metadata" - ], - "activationEvents": [ - "onWorkspaceOpen" - ], - "languages": [], - "backend": { - "launch": { - "kind": "packaged", - "path": "bin/backend" - }, - "arguments": [ - "--state", - "${stateDir}" - ] - } -} diff --git a/shared/contracts/plugins/v1/fixtures/backend/backend.plugin.json b/shared/contracts/plugins/v1/fixtures/backend/backend.plugin.json deleted file mode 100644 index b5bd06b179..0000000000 --- a/shared/contracts/plugins/v1/fixtures/backend/backend.plugin.json +++ /dev/null @@ -1,49 +0,0 @@ -{ - "schemaVersion": 2, - "id": "dev.lithe.fixture.backend", - "displayName": "Backend", - "version": "1.0.0", - "pluginAPIVersion": 3, - "requires": { - "backend": 1, - "serverProcess": 1, - "ui": 2 - }, - "vendor": { - "id": "org.example", - "displayName": "Example", - "signatureRequirement": "publisherPackage" - }, - "permissions": [ - "backend.launch", - "credentials.store", - "ui.contribute", - "ui.web" - ], - "activationEvents": [ - "onView:dev.lithe.fixture.backend.window" - ], - "languages": [], - "ui": { - "toolWindows": [ - { - "id": "dev.lithe.fixture.backend.window", - "title": "Backend", - "placement": "bottom", - "web": { - "entry": "ui/index.html" - } - } - ] - }, - "backend": { - "launch": { - "kind": "packaged", - "path": "bin/backend" - }, - "arguments": [ - "--state", - "${stateDir}" - ] - } -} diff --git a/shared/contracts/plugins/v1/fixtures/backend/command-backend.plugin.json b/shared/contracts/plugins/v1/fixtures/backend/command-backend.plugin.json deleted file mode 100644 index 31fdec6565..0000000000 --- a/shared/contracts/plugins/v1/fixtures/backend/command-backend.plugin.json +++ /dev/null @@ -1,50 +0,0 @@ -{ - "schemaVersion": 2, - "id": "dev.lithe.fixture.workspacebackend", - "displayName": "Workspace Backend", - "version": "1.0.0", - "pluginAPIVersion": 3, - "requires": { - "backend": 2, - "serverProcess": 1, - "ui": 4 - }, - "vendor": { - "id": "org.example", - "displayName": "Example", - "signatureRequirement": "publisherPackage" - }, - "permissions": [ - "backend.launch", - "workspace.metadata", - "ui.contribute", - "documents.read", - "editor.edit" - ], - "activationEvents": [ - "onCommand:dev.lithe.fixture.workspacebackend.transform" - ], - "languages": [], - "backend": { - "launch": { - "kind": "packaged", - "path": "bin/backend" - }, - "arguments": [ - "--state", - "${stateDir}" - ] - }, - "ui": { - "toolWindows": [], - "commands": [ - { - "id": "dev.lithe.fixture.workspacebackend.transform", - "title": "Transform selection", - "placements": [ - "commandPalette" - ] - } - ] - } -} diff --git a/shared/contracts/plugins/v1/fixtures/backend/function-protocol.json b/shared/contracts/plugins/v1/fixtures/backend/function-protocol.json deleted file mode 100644 index 65dd318353..0000000000 --- a/shared/contracts/plugins/v1/fixtures/backend/function-protocol.json +++ /dev/null @@ -1,751 +0,0 @@ -{ - "schemaVersion": 1, - "protocol": "litheFunctions", - "offer": { "versions": [1, 2, 3, 4] }, - "negotiation": [ - { - "name": "no answer leaves the protocol off", - "capabilities": { "hoverProvider": true }, - "expected": { "functions": null } - }, - { - "name": "an answer next to litheBuild is independent of it", - "capabilities": { - "experimental": { - "litheBuild": { "version": 1 }, - "litheFunctions": { "version": 1, "functions": [{ "id": "snapshot.refresh" }] } - } - }, - "expected": { "functions": ["snapshot.refresh"] } - }, - { - "name": "a version without functions starts with an empty registry", - "capabilities": { "experimental": { "litheFunctions": { "version": 1 } } }, - "expected": { "functions": [] } - }, - { - "name": "unknown descriptor and answer fields are ignored", - "capabilities": { - "experimental": { - "litheFunctions": { - "version": 1, - "future": true, - "functions": [{ "id": "install.prepare", "title": "Prepare" }, { "id": "install.finish" }] - } - } - }, - "expected": { "functions": ["install.finish", "install.prepare"] } - }, - { - "name": "version 2 negotiates the same registry and adds host services", - "capabilities": { "experimental": { "litheFunctions": { "version": 2, "functions": [{ "id": "query.run" }] } } }, - "expected": { "functions": ["query.run"], "version": 2 } - }, - { - "name": "version 3 negotiates the same registry and adds contexts and capability discovery", - "capabilities": { "experimental": { "litheFunctions": { "version": 3, "functions": [{ "id": "query.run" }] } } }, - "expected": { "functions": ["query.run"], "version": 3 } - }, - { - "name": "version 4 negotiates the same registry and adds the cross-plugin relay", - "capabilities": { "experimental": { "litheFunctions": { "version": 4, "functions": [{ "id": "query.run" }] } } }, - "expected": { "functions": ["query.run"], "version": 4 } - }, - { - "name": "a version the host never offered is not negotiated", - "capabilities": { "experimental": { "litheFunctions": { "version": 5 } } }, - "expected": { "functions": null } - }, - { - "name": "a version list is the offer shape, not an answer", - "capabilities": { "experimental": { "litheFunctions": { "versions": [1] } } }, - "expected": { "functions": null } - }, - { - "name": "a malformed function ID rejects the whole answer", - "capabilities": { - "experimental": { - "litheFunctions": { "version": 1, "functions": [{ "id": "ok" }, { "id": "Not-Valid" }] } - } - }, - "expected": { "functions": null } - }, - { - "name": "a duplicate function ID rejects the whole answer", - "capabilities": { - "experimental": { - "litheFunctions": { "version": 1, "functions": [{ "id": "refresh" }, { "id": "refresh" }] } - } - }, - "expected": { "functions": null } - } - ], - "registration": [ - { - "name": "register adds functions", - "method": "lithe/function/register", - "registered": ["snapshot.refresh"], - "params": { "functions": [{ "id": "snapshot.clear" }] }, - "expected": { "status": "accepted", "functions": ["snapshot.clear", "snapshot.refresh"], "removed": [] } - }, - { - "name": "registering an existing ID is refused", - "method": "lithe/function/register", - "registered": ["snapshot.refresh"], - "params": { "functions": [{ "id": "snapshot.clear" }, { "id": "snapshot.refresh" }] }, - "expected": { "status": "rejected", "code": "plugin.function.invalidRegistration" } - }, - { - "name": "an empty registration is refused", - "method": "lithe/function/register", - "registered": [], - "params": { "functions": [] }, - "expected": { "status": "rejected", "code": "plugin.function.invalidRegistration" } - }, - { - "name": "a function ID with a separator other than a dot is refused", - "method": "lithe/function/register", - "registered": [], - "params": { "functions": [{ "id": "snapshot/refresh" }] }, - "expected": { "status": "rejected", "code": "plugin.function.invalidRegistration" } - }, - { - "name": "unregister withdraws functions", - "method": "lithe/function/unregister", - "registered": ["snapshot.clear", "snapshot.refresh"], - "params": { "ids": ["snapshot.refresh"] }, - "expected": { "status": "accepted", "functions": ["snapshot.clear"], "removed": ["snapshot.refresh"] } - }, - { - "name": "unregistering an unknown ID is refused as a whole", - "method": "lithe/function/unregister", - "registered": ["snapshot.clear"], - "params": { "ids": ["snapshot.clear", "snapshot.refresh"] }, - "expected": { "status": "rejected", "code": "plugin.function.invalidRegistration" } - } - ], - "invocations": [ - { - "name": "a registered function of the session's plugin is sent", - "session": { "pluginID": "dev.lithe.fixture.maven", "negotiated": true, "functions": ["snapshot.refresh"] }, - "request": { - "function": { "pluginID": "dev.lithe.fixture.maven", "functionID": "snapshot.refresh" }, - "params": { "project": "app" } - }, - "expected": { - "status": "sent", - "method": "lithe/function/invoke", - "params": { "functionID": "snapshot.refresh", "operationID": "operation-1", "params": { "project": "app" } } - } - }, - { - "name": "a malformed reference is refused before the session is consulted", - "session": { "pluginID": "dev.lithe.fixture.maven", "negotiated": true, "functions": ["snapshot.refresh"] }, - "request": { - "function": { "pluginID": "dev.lithe.fixture.maven", "functionID": "lithe/build/model" }, - "params": {} - }, - "expected": { "status": "refused", "code": "plugin.function.invalidReference" } - }, - { - "name": "params must be an object", - "session": { "pluginID": "dev.lithe.fixture.maven", "negotiated": true, "functions": ["snapshot.refresh"] }, - "request": { - "function": { "pluginID": "dev.lithe.fixture.maven", "functionID": "snapshot.refresh" }, - "params": ["app"] - }, - "expected": { "status": "refused", "code": "plugin.function.invalidParams" } - }, - { - "name": "a session of another plugin is never reached", - "session": { "pluginID": "dev.lithe.fixture.gradle", "negotiated": true, "functions": ["snapshot.refresh"] }, - "request": { - "function": { "pluginID": "dev.lithe.fixture.maven", "functionID": "snapshot.refresh" }, - "params": {} - }, - "expected": { "status": "refused", "code": "plugin.function.wrongPlugin" } - }, - { - "name": "a host-owned session serves no plugin functions", - "session": { "pluginID": null, "negotiated": true, "functions": ["snapshot.refresh"] }, - "request": { - "function": { "pluginID": "dev.lithe.fixture.maven", "functionID": "snapshot.refresh" }, - "params": {} - }, - "expected": { "status": "refused", "code": "plugin.function.unavailable" } - }, - { - "name": "a backend that did not negotiate keeps serving its domain protocol only", - "session": { "pluginID": "dev.lithe.fixture.maven", "negotiated": false, "functions": [] }, - "request": { - "function": { "pluginID": "dev.lithe.fixture.maven", "functionID": "snapshot.refresh" }, - "params": {} - }, - "expected": { "status": "refused", "code": "plugin.function.unavailable" } - }, - { - "name": "an unregistered function is unknown", - "session": { "pluginID": "dev.lithe.fixture.maven", "negotiated": true, "functions": ["snapshot.clear"] }, - "request": { - "function": { "pluginID": "dev.lithe.fixture.maven", "functionID": "snapshot.refresh" }, - "params": {} - }, - "expected": { "status": "refused", "code": "plugin.function.unknown" } - } - ], - "outcomes": [ - { - "name": "a result is wrapped as value", - "response": { "jsonrpc": "2.0", "id": 4, "result": { "snapshot": 3 } }, - "expected": { "result": { "value": { "snapshot": 3 } } } - }, - { - "name": "a null result is a result", - "response": { "jsonrpc": "2.0", "id": 4, "result": null }, - "expected": { "result": { "value": null } } - }, - { - "name": "a response without result is invalid", - "response": { "jsonrpc": "2.0", "id": 4 }, - "expected": { - "error": { "code": "plugin.function.invalidResult", "message": "The plugin function returned no result." } - } - }, - { - "name": "an error keeps the backend message and a well-formed plugin code", - "response": { - "jsonrpc": "2.0", - "id": 4, - "error": { "code": -32000, "message": "Snapshot is locked.", "data": { "code": "maven.snapshotLocked" } } - }, - "expected": { - "error": { - "code": "plugin.function.failed", - "message": "Snapshot is locked.", - "pluginErrorCode": "maven.snapshotLocked" - } - } - }, - { - "name": "a malformed plugin code is dropped and an empty message replaced", - "response": { - "jsonrpc": "2.0", - "id": 4, - "error": { "code": -32000, "message": "", "data": { "code": "not a code" } } - }, - "expected": { - "error": { "code": "plugin.function.failed", "message": "The plugin function failed." } - } - } - ], - "progress": [ - { - "name": "message and percentage are reported", - "params": { "operationID": "operation-1", "message": "Reading snapshot", "percentage": 40 }, - "expected": { "operationID": "operation-1", "message": "Reading snapshot", "percentage": 40 } - }, - { - "name": "both fields are optional", - "params": { "operationID": "operation-1" }, - "expected": { "operationID": "operation-1" } - }, - { - "name": "a percentage over 100 drops the report", - "params": { "operationID": "operation-1", "percentage": 101 }, - "expected": null - }, - { - "name": "a report without operation ID is dropped", - "params": { "message": "Working" }, - "expected": null - } - ], - "backendRequests": [ - { - "name": "a backend cannot ask the host to invoke a function", - "method": "lithe/function/invoke", - "expected": { "code": "plugin.function.recursiveCall" } - }, - { - "name": "a backend cannot ask the host for a build-domain operation", - "method": "lithe/build/model", - "expected": { "code": "plugin.function.recursiveCall" } - }, - { - "name": "version 1 offers no host capability", - "method": "lithe/host/process.run", - "expected": { "code": "plugin.host.unavailable" } - }, - { - "name": "other methods keep the ordinary JSON-RPC answer", - "method": "workspace/applyEdit", - "expected": { "code": null } - } - ], - "hostRequests": [ - {"name": "workspace metadata never authorizes file reads", "version": 3, "hostServices": ["workspace"], "method": "lithe/host/workspace/readFile", "params": {"context": {"contextID": "w1", "generation": 1}}, "expected": {"rpcCode": -32010, "code": "plugin.host.permissionDenied"}}, - {"name": "editor read method grant never authorizes edits", "version": 3, "hostServices": ["lithe/host/editor/getSelections"], "method": "lithe/host/editor/applyEdits", "params": {}, "expected": {"rpcCode": -32010, "code": "plugin.host.permissionDenied"}}, - {"name": "only the explicit file method is forwarded", "version": 3, "hostServices": ["lithe/host/workspace/readFile"], "method": "lithe/host/workspace/readFile", "params": {"context": {"contextID": "w1", "generation": 1}, "resource": {"rootID": "r1", "path": "hello.txt"}}, "expected": {"forward": "workspace"}}, - { - "name": "version 1 sessions get no host service even when granted", - "version": 1, - "hostServices": ["credentials"], - "method": "lithe/host/credentials/get", - "params": { "key": "connection.prod" }, - "expected": { "rpcCode": -32601, "code": "plugin.host.unavailable" } - }, - { - "name": "a granted credential read is forwarded to the host", - "version": 2, - "hostServices": ["credentials"], - "method": "lithe/host/credentials/get", - "params": { "key": "connection.prod" }, - "expected": { "forward": "credentials" } - }, - { - "name": "a credential write carries the secret", - "version": 2, - "hostServices": ["credentials"], - "method": "lithe/host/credentials/set", - "params": { "key": "connection.prod:password", "secret": "s3cret" }, - "expected": { "forward": "credentials" } - }, - { - "name": "a credential delete names only the key", - "version": 2, - "hostServices": ["credentials"], - "method": "lithe/host/credentials/delete", - "params": { "key": "connection.prod" }, - "expected": { "forward": "credentials" } - }, - { - "name": "a service the plugin's permissions do not grant is refused", - "version": 2, - "hostServices": [], - "method": "lithe/host/credentials/get", - "params": { "key": "connection.prod" }, - "expected": { "rpcCode": -32601, "code": "plugin.host.permissionDenied" } - }, - { - "name": "a host method version 2 does not define is unavailable", - "version": 2, - "hostServices": ["credentials"], - "method": "lithe/host/process.run", - "params": {}, - "expected": { "rpcCode": -32601, "code": "plugin.host.unavailable" } - }, - { - "name": "a key outside the alphabet is invalid", - "version": 2, - "hostServices": ["credentials"], - "method": "lithe/host/credentials/get", - "params": { "key": "../other-plugin" }, - "expected": { "rpcCode": -32602, "code": "plugin.host.invalidParams" } - }, - { - "name": "an empty key is invalid", - "version": 2, - "hostServices": ["credentials"], - "method": "lithe/host/credentials/delete", - "params": { "key": "" }, - "expected": { "rpcCode": -32602, "code": "plugin.host.invalidParams" } - }, - { - "name": "a write without a string secret is invalid", - "version": 2, - "hostServices": ["credentials"], - "method": "lithe/host/credentials/set", - "params": { "key": "connection.prod", "secret": 42 }, - "expected": { "rpcCode": -32602, "code": "plugin.host.invalidParams" } - }, - { - "name": "version 2 answers an unknown field as invalid params", - "version": 2, - "hostServices": ["credentials"], - "method": "lithe/host/credentials/get", - "params": { "key": "connection.prod", "scope": "global" }, - "expected": { "rpcCode": -32602, "code": "plugin.host.invalidParams" } - }, - { - "name": "from version 3 an unknown field is an option this host does not support", - "version": 3, - "hostServices": ["credentials"], - "method": "lithe/host/credentials/get", - "params": { "key": "connection.prod", "scope": "global" }, - "expected": { "rpcCode": -32018, "code": "plugin.host.unsupportedOption", "details": { "option": "scope" } } - }, - { - "name": "a context method names the option it does not support", - "version": 3, - "hostServices": ["workspace"], - "method": "lithe/host/workspace/getFolders", - "params": { "context": { "contextID": "w-3f2a", "generation": 1 }, "includeHidden": true }, - "expected": { "rpcCode": -32018, "code": "plugin.host.unsupportedOption", "details": { "option": "includeHidden" } } - }, - { - "name": "capability discovery needs version 3", - "version": 2, - "hostServices": ["credentials"], - "method": "lithe/host/getCapabilities", - "expected": { "rpcCode": -32601, "code": "plugin.host.unavailable" } - }, - { - "name": "Core answers capability discovery with only the session's grants", - "version": 3, - "hostServices": ["workspace"], - "method": "lithe/host/getCapabilities", - "params": {}, - "expected": { - "answer": { - "protocolVersion": 3, - "backendAuthority": "local", - "services": { - "commands": { "methods": [], "notifications": ["lithe/host/commands/didRun"] }, - "host": { "methods": ["lithe/host/getCapabilities"], "notifications": [] }, - "subscriptions": { - "methods": ["lithe/host/subscriptions/dispose"], - "notifications": ["lithe/host/subscriptions/notify"] - }, - "workspace": { - "methods": [ - "lithe/host/workspace/listContexts", - "lithe/host/workspace/getContext", - "lithe/host/workspace/getFolders" - ], - "notifications": ["lithe/host/workspace/didChangeContexts"] - } - }, - "limits": { - "pendingHostRequests": 16, - "functionResultBytes": 1048576, - "hostRequestBytes": 1048576, - "hostResultBytes": 1048576, - "errorMessageBytes": 1024, - "errorDetailsBytes": 4096, - "notificationBytes": 1048576 - } - } - } - }, - { - "name": "capability discovery takes no options yet", - "version": 3, - "hostServices": [], - "method": "lithe/host/getCapabilities", - "params": { "services": ["credentials"] }, - "expected": { "rpcCode": -32018, "code": "plugin.host.unsupportedOption", "details": { "option": "services" } } - }, - { - "name": "listing workspace contexts is forwarded when workspace.metadata is granted", - "version": 3, - "hostServices": ["workspace"], - "method": "lithe/host/workspace/listContexts", - "expected": { "forward": "workspace" } - }, - { - "name": "workspace contexts need the workspace.metadata grant", - "version": 3, - "hostServices": ["credentials"], - "method": "lithe/host/workspace/listContexts", - "params": {}, - "expected": { "rpcCode": -32010, "code": "plugin.host.permissionDenied" } - }, - { - "name": "workspace contexts need version 3 even when granted", - "version": 2, - "hostServices": ["workspace"], - "method": "lithe/host/workspace/listContexts", - "params": {}, - "expected": { "rpcCode": -32601, "code": "plugin.host.unavailable" } - }, - { - "name": "a context's folders are asked for by context ID and generation", - "version": 3, - "hostServices": ["workspace"], - "method": "lithe/host/workspace/getFolders", - "params": { "context": { "contextID": "w-3f2a", "generation": 2 } }, - "expected": { "forward": "workspace" } - }, - { - "name": "one context is asked for by context ID and generation", - "version": 3, - "hostServices": ["workspace"], - "method": "lithe/host/workspace/getContext", - "params": { "context": { "contextID": "w-3f2a", "generation": 2 } }, - "expected": { "forward": "workspace" } - }, - { - "name": "a context without a generation is invalid", - "version": 3, - "hostServices": ["workspace"], - "method": "lithe/host/workspace/getFolders", - "params": { "context": { "contextID": "w-3f2a" } }, - "expected": { "rpcCode": -32602, "code": "plugin.host.invalidParams" } - }, - { - "name": "a generation is positive", - "version": 3, - "hostServices": ["workspace"], - "method": "lithe/host/workspace/getContext", - "params": { "context": { "contextID": "w-3f2a", "generation": 0 } }, - "expected": { "rpcCode": -32602, "code": "plugin.host.invalidParams" } - }, - { - "name": "a context ID outside the alphabet is invalid", - "version": 3, - "hostServices": ["workspace"], - "method": "lithe/host/workspace/getContext", - "params": { "context": { "contextID": "../w", "generation": 1 } }, - "expected": { "rpcCode": -32602, "code": "plugin.host.invalidParams" } - }, - { - "name": "a context reference has no other fields", - "version": 3, - "hostServices": ["workspace"], - "method": "lithe/host/workspace/getContext", - "params": { "context": { "contextID": "w-3f2a", "generation": 1, "path": "/tmp" } }, - "expected": { "rpcCode": -32602, "code": "plugin.host.invalidParams" } - }, - { - "name": "a subscription is disposed by its ID without any grant", - "version": 3, - "hostServices": [], - "method": "lithe/host/subscriptions/dispose", - "params": { "subscriptionID": "watch-1" }, - "expected": { "forward": "subscriptions" } - }, - { - "name": "disposing needs a subscription ID", - "version": 3, - "hostServices": [], - "method": "lithe/host/subscriptions/dispose", - "params": {}, - "expected": { "rpcCode": -32602, "code": "plugin.host.invalidParams" } - }, - { - "name": "credentials keep their version 2 rules in version 3", - "version": 3, - "hostServices": ["credentials"], - "method": "lithe/host/credentials/get", - "params": { "key": "connection.prod" }, - "expected": { "forward": "credentials" } - }, - { - "name": "a method no version defines is unavailable", - "version": 3, - "hostServices": ["credentials", "workspace"], - "method": "lithe/host/process/run", - "params": {}, - "expected": { "rpcCode": -32601, "code": "plugin.host.unavailable" } - }, - {"name": "editor actions are a discoverable independent host service", "method": "lithe/host/editor/registerActions", "version": 3, "hostServices": ["lithe/host/editor/registerActions"], "params": {"context": {"contextID": "w1", "generation": 1}, "id": "actions", "function": "actions.collect", "selector": {"fileExtensions": ["http"]}}, "expected": {"forward": "editor"}}, - {"name": "document reads do not grant editor action contribution", "method": "lithe/host/editor/registerActions", "version": 3, "hostServices": ["lithe/host/documents/getSnapshot"], "params": {}, "expected": {"code": "plugin.host.permissionDenied", "rpcCode": -32010}}, - {"name": "protocol 2 does not expose independent editor actions", "method": "lithe/host/editor/registerActions", "version": 2, "hostServices": ["lithe/host/editor/registerActions"], "params": {}, "expected": {"code": "plugin.host.unavailable", "rpcCode": -32601}}, - {"name": "terminal create is an individually granted protocol 3 method", "version": 3, "hostServices": ["lithe/host/terminal/create"], "method": "lithe/host/terminal/create", "params": {"context": {"contextID": "w-terminal", "generation": 1}, "executable": "example-tool"}, "expected": {"forward": "terminal"}}, - {"name": "terminal show is an individually granted protocol 3 method", "version": 3, "hostServices": ["lithe/host/terminal/show"], "method": "lithe/host/terminal/show", "params": {"context": {"contextID": "w-terminal", "generation": 1}, "terminalID": "owned"}, "expected": {"forward": "terminal"}}, - {"name": "terminal close is an individually granted protocol 3 method", "version": 3, "hostServices": ["lithe/host/terminal/close"], "method": "lithe/host/terminal/close", "params": {"context": {"contextID": "w-terminal", "generation": 1}, "terminalID": "owned"}, "expected": {"forward": "terminal"}}, - {"name": "terminal onExit is an individually granted protocol 3 method", "version": 3, "hostServices": ["lithe/host/terminal/onExit"], "method": "lithe/host/terminal/onExit", "params": {"context": {"contextID": "w-terminal", "generation": 1}, "terminalID": "owned"}, "expected": {"forward": "terminal"}}, - {"name": "terminal aggregate grant cannot authorize terminal creation", "version": 3, "hostServices": ["terminal"], "method": "lithe/host/terminal/create", "params": {}, "expected": {"code": "plugin.host.permissionDenied", "rpcCode": -32010}}, - {"name": "an older protocol cannot create a native terminal", "version": 2, "hostServices": ["lithe/host/terminal/create"], "method": "lithe/host/terminal/create", "params": {}, "expected": {"code": "plugin.host.unavailable", "rpcCode": -32601}}, - {"name": "terminal reopen is granted on protocol 3", "version": 3, "hostServices": ["lithe/host/terminal/reopen"], "method": "lithe/host/terminal/reopen", "params": {"context": {"contextID": "w-terminal", "generation": 1}, "terminalID": "owned"}, "expected": {"forward": "terminal"}}, - {"name": "terminal dispose is granted on protocol 3", "version": 3, "hostServices": ["lithe/host/terminal/dispose"], "method": "lithe/host/terminal/dispose", "params": {"context": {"contextID": "w-terminal", "generation": 1}, "terminalID": "owned"}, "expected": {"forward": "terminal"}}, - { "name": "a run start is granted on protocol 3", "version": 3, "hostServices": ["lithe/host/run/start"], "method": "lithe/host/run/start", "params": { "context": { "contextID": "w-run", "generation": 1 }, "label": "Run app" }, "expected": { "forward": "run" } }, - { "name": "a run stop is granted on protocol 3", "version": 3, "hostServices": ["lithe/host/run/stop"], "method": "lithe/host/run/stop", "params": { "context": { "contextID": "w-run", "generation": 1 }, "runID": "r1" }, "expected": { "forward": "run" } }, - { "name": "a run start needs its own grant", "version": 3, "hostServices": ["lithe/host/run/stop"], "method": "lithe/host/run/start", "params": { "context": { "contextID": "w-run", "generation": 1 } }, "expected": { "code": "plugin.host.permissionDenied", "rpcCode": -32010 } }, - { "name": "a run start takes an object", "version": 3, "hostServices": ["lithe/host/run/start"], "method": "lithe/host/run/start", "params": [], "expected": { "code": "plugin.host.invalidParams", "rpcCode": -32602 } }, - { "name": "an older protocol cannot start a run", "version": 2, "hostServices": ["lithe/host/run/start"], "method": "lithe/host/run/start", "params": {}, "expected": { "code": "plugin.host.unavailable", "rpcCode": -32601 } }, - { "name": "a debug start is granted on protocol 3", "version": 3, "hostServices": ["lithe/host/debug/start"], "method": "lithe/host/debug/start", "params": { "context": { "contextID": "w-run", "generation": 1 }, "label": "Debug app" }, "expected": { "forward": "debug" } }, - { "name": "a debug start is not covered by the run grant", "version": 3, "hostServices": ["lithe/host/run/start", "lithe/host/run/stop"], "method": "lithe/host/debug/start", "params": { "context": { "contextID": "w-run", "generation": 1 } }, "expected": { "code": "plugin.host.permissionDenied", "rpcCode": -32010 } }, - {"name": "a language server request is forwarded when languageServer.request is granted", "version": 3, "hostServices": ["lithe/host/languageServer/request"], "method": "lithe/host/languageServer/request", "params": {"context": {"contextID": "w1", "generation": 1}, "serverID": "metals", "method": "metals/doctorRun", "params": {"verbose": true}}, "expected": {"forward": "languageServer"}}, - {"name": "a language server request may bound its own timeout", "version": 3, "hostServices": ["lithe/host/languageServer/request"], "method": "lithe/host/languageServer/request", "params": {"context": {"contextID": "w1", "generation": 1}, "serverID": "rust-analyzer", "method": "rust-analyzer/expandMacro", "params": {}, "timeoutMilliseconds": 300000}, "expected": {"forward": "languageServer"}}, - {"name": "a language server request may run a declared command", "version": 3, "hostServices": ["lithe/host/languageServer/request"], "method": "lithe/host/languageServer/request", "params": {"context": {"contextID": "w1", "generation": 1}, "serverID": "metals", "method": "workspace/executeCommand", "params": {"command": "metals.build-import"}}, "expected": {"forward": "languageServer"}}, - {"name": "a language server notification is forwarded", "version": 3, "hostServices": ["lithe/host/languageServer/notify"], "method": "lithe/host/languageServer/notify", "params": {"context": {"contextID": "w1", "generation": 1}, "serverID": "metals", "method": "workspace/didChangeConfiguration", "params": {"settings": {}}}, "expected": {"forward": "languageServer"}}, - {"name": "a language server status is forwarded", "version": 3, "hostServices": ["lithe/host/languageServer/setStatus"], "method": "lithe/host/languageServer/setStatus", "params": {"context": {"contextID": "w1", "generation": 1}, "serverID": "metals", "state": "preparing", "message": "Importing build", "percentage": 40}, "expected": {"forward": "languageServer"}}, - {"name": "a language server status may omit the message and the percentage", "version": 3, "hostServices": ["lithe/host/languageServer/setStatus"], "method": "lithe/host/languageServer/setStatus", "params": {"context": {"contextID": "w1", "generation": 1}, "serverID": "rust-analyzer", "state": "ready"}, "expected": {"forward": "languageServer"}}, - {"name": "a language server request needs the languageServer.request grant", "version": 3, "hostServices": [], "method": "lithe/host/languageServer/request", "params": {"context": {"contextID": "w1", "generation": 1}, "serverID": "metals", "method": "metals/doctorRun"}, "expected": {"rpcCode": -32010, "code": "plugin.host.permissionDenied"}}, - {"name": "another service's grant never authorizes a language server request", "version": 3, "hostServices": ["workspace"], "method": "lithe/host/languageServer/request", "params": {"context": {"contextID": "w1", "generation": 1}, "serverID": "metals", "method": "metals/doctorRun"}, "expected": {"rpcCode": -32010, "code": "plugin.host.permissionDenied"}}, - {"name": "the aggregate service name never authorizes a language server request", "version": 3, "hostServices": ["languageServer"], "method": "lithe/host/languageServer/request", "params": {"context": {"contextID": "w1", "generation": 1}, "serverID": "metals", "method": "metals/doctorRun"}, "expected": {"rpcCode": -32010, "code": "plugin.host.permissionDenied"}}, - {"name": "a notify grant never authorizes a language server request", "version": 3, "hostServices": ["lithe/host/languageServer/notify"], "method": "lithe/host/languageServer/request", "params": {"context": {"contextID": "w1", "generation": 1}, "serverID": "metals", "method": "metals/doctorRun"}, "expected": {"rpcCode": -32010, "code": "plugin.host.permissionDenied"}}, - {"name": "a language server request is unavailable before protocol 3", "version": 2, "hostServices": ["lithe/host/languageServer/request"], "method": "lithe/host/languageServer/request", "params": {"context": {"contextID": "w1", "generation": 1}, "serverID": "metals", "method": "metals/doctorRun"}, "expected": {"rpcCode": -32601, "code": "plugin.host.unavailable"}}, - {"name": "a language server request needs a context", "version": 3, "hostServices": ["lithe/host/languageServer/request"], "method": "lithe/host/languageServer/request", "params": {"serverID": "metals", "method": "metals/doctorRun"}, "expected": {"rpcCode": -32602, "code": "plugin.host.invalidParams"}}, - {"name": "a language server request names a server", "version": 3, "hostServices": ["lithe/host/languageServer/request"], "method": "lithe/host/languageServer/request", "params": {"context": {"contextID": "w1", "generation": 1}, "method": "metals/doctorRun"}, "expected": {"rpcCode": -32602, "code": "plugin.host.invalidParams"}}, - {"name": "a language server request names a method", "version": 3, "hostServices": ["lithe/host/languageServer/request"], "method": "lithe/host/languageServer/request", "params": {"context": {"contextID": "w1", "generation": 1}, "serverID": "metals"}, "expected": {"rpcCode": -32602, "code": "plugin.host.invalidParams"}}, - {"name": "a language server request refuses an empty method", "version": 3, "hostServices": ["lithe/host/languageServer/request"], "method": "lithe/host/languageServer/request", "params": {"context": {"contextID": "w1", "generation": 1}, "serverID": "metals", "method": ""}, "expected": {"rpcCode": -32602, "code": "plugin.host.invalidParams"}}, - {"name": "a language server request timeout is positive", "version": 3, "hostServices": ["lithe/host/languageServer/request"], "method": "lithe/host/languageServer/request", "params": {"context": {"contextID": "w1", "generation": 1}, "serverID": "metals", "method": "metals/doctorRun", "timeoutMilliseconds": 0}, "expected": {"rpcCode": -32602, "code": "plugin.host.invalidParams"}}, - {"name": "a language server request timeout has an upper bound", "version": 3, "hostServices": ["lithe/host/languageServer/request"], "method": "lithe/host/languageServer/request", "params": {"context": {"contextID": "w1", "generation": 1}, "serverID": "metals", "method": "metals/doctorRun", "timeoutMilliseconds": 300001}, "expected": {"rpcCode": -32602, "code": "plugin.host.invalidParams"}}, - {"name": "a language server request names the option it does not support", "version": 3, "hostServices": ["lithe/host/languageServer/request"], "method": "lithe/host/languageServer/request", "params": {"context": {"contextID": "w1", "generation": 1}, "serverID": "metals", "method": "metals/doctorRun", "workspaceFolder": "/tmp"}, "expected": {"rpcCode": -32018, "code": "plugin.host.unsupportedOption", "details": {"option": "workspaceFolder"}}}, - {"name": "a language server notification takes no timeout", "version": 3, "hostServices": ["lithe/host/languageServer/notify"], "method": "lithe/host/languageServer/notify", "params": {"context": {"contextID": "w1", "generation": 1}, "serverID": "metals", "method": "workspace/didChangeConfiguration", "timeoutMilliseconds": 5}, "expected": {"rpcCode": -32018, "code": "plugin.host.unsupportedOption", "details": {"option": "timeoutMilliseconds"}}}, - {"name": "a language server status state is a closed set", "version": 3, "hostServices": ["lithe/host/languageServer/setStatus"], "method": "lithe/host/languageServer/setStatus", "params": {"context": {"contextID": "w1", "generation": 1}, "serverID": "metals", "state": "importing"}, "expected": {"rpcCode": -32602, "code": "plugin.host.invalidParams"}}, - {"name": "a language server status percentage stops at one hundred", "version": 3, "hostServices": ["lithe/host/languageServer/setStatus"], "method": "lithe/host/languageServer/setStatus", "params": {"context": {"contextID": "w1", "generation": 1}, "serverID": "metals", "state": "preparing", "percentage": 101}, "expected": {"rpcCode": -32602, "code": "plugin.host.invalidParams"}}, - {"name": "a language server status percentage is a whole number", "version": 3, "hostServices": ["lithe/host/languageServer/setStatus"], "method": "lithe/host/languageServer/setStatus", "params": {"context": {"contextID": "w1", "generation": 1}, "serverID": "metals", "state": "preparing", "percentage": 12.5}, "expected": {"rpcCode": -32602, "code": "plugin.host.invalidParams"}}, - {"name": "a language server status message is text", "version": 3, "hostServices": ["lithe/host/languageServer/setStatus"], "method": "lithe/host/languageServer/setStatus", "params": {"context": {"contextID": "w1", "generation": 1}, "serverID": "metals", "state": "failed", "message": {"text": "x"}}, "expected": {"rpcCode": -32602, "code": "plugin.host.invalidParams"}}, - {"name": "a language server status has no method field", "version": 3, "hostServices": ["lithe/host/languageServer/setStatus"], "method": "lithe/host/languageServer/setStatus", "params": {"context": {"contextID": "w1", "generation": 1}, "serverID": "metals", "state": "ready", "method": "x"}, "expected": {"rpcCode": -32018, "code": "plugin.host.unsupportedOption", "details": {"option": "method"}}}, - {"name": "a content provider is registered with the documents.contentProvider grant", "version": 3, "hostServices": ["lithe/host/documents/registerContentProvider"], "method": "lithe/host/documents/registerContentProvider", "params": {"context": {"contextID": "w1", "generation": 1}, "scheme": "metals-library", "function": "documents.read"}, "expected": {"forward": "documents"}}, - {"name": "the aggregate documents name never authorizes a content provider", "version": 3, "hostServices": ["documents"], "method": "lithe/host/documents/registerContentProvider", "params": {"context": {"contextID": "w1", "generation": 1}, "scheme": "metals-library", "function": "documents.read"}, "expected": {"rpcCode": -32010, "code": "plugin.host.permissionDenied"}}, - {"name": "a content provider needs its own grant", "version": 3, "hostServices": ["lithe/host/languageServer/request"], "method": "lithe/host/documents/registerContentProvider", "params": {"context": {"contextID": "w1", "generation": 1}, "scheme": "metals-library", "function": "documents.read"}, "expected": {"rpcCode": -32010, "code": "plugin.host.permissionDenied"}}, - {"name": "a content provider cannot serve a scheme the host owns", "version": 3, "hostServices": ["lithe/host/documents/registerContentProvider"], "method": "lithe/host/documents/registerContentProvider", "params": {"context": {"contextID": "w1", "generation": 1}, "scheme": "file", "function": "documents.read"}, "expected": {"rpcCode": -32602, "code": "plugin.host.invalidParams"}}, - {"name": "a content provider cannot serve the lithe scheme", "version": 3, "hostServices": ["lithe/host/documents/registerContentProvider"], "method": "lithe/host/documents/registerContentProvider", "params": {"context": {"contextID": "w1", "generation": 1}, "scheme": "lithe", "function": "documents.read"}, "expected": {"rpcCode": -32602, "code": "plugin.host.invalidParams"}}, - {"name": "a content scheme is lowercase", "version": 3, "hostServices": ["lithe/host/documents/registerContentProvider"], "method": "lithe/host/documents/registerContentProvider", "params": {"context": {"contextID": "w1", "generation": 1}, "scheme": "Metals", "function": "documents.read"}, "expected": {"rpcCode": -32602, "code": "plugin.host.invalidParams"}}, - {"name": "a content scheme starts with a letter", "version": 3, "hostServices": ["lithe/host/documents/registerContentProvider"], "method": "lithe/host/documents/registerContentProvider", "params": {"context": {"contextID": "w1", "generation": 1}, "scheme": "1metals", "function": "documents.read"}, "expected": {"rpcCode": -32602, "code": "plugin.host.invalidParams"}}, - {"name": "a content provider names a plugin function", "version": 3, "hostServices": ["lithe/host/documents/registerContentProvider"], "method": "lithe/host/documents/registerContentProvider", "params": {"context": {"contextID": "w1", "generation": 1}, "scheme": "metals-library", "function": "not a function"}, "expected": {"rpcCode": -32602, "code": "plugin.host.invalidParams"}}, - {"name": "a content provider needs a context", "version": 3, "hostServices": ["lithe/host/documents/registerContentProvider"], "method": "lithe/host/documents/registerContentProvider", "params": {"scheme": "metals-library", "function": "documents.read"}, "expected": {"rpcCode": -32602, "code": "plugin.host.invalidParams"}}, - {"name": "a declared caller lists the providers of a function", "version": 4, "hostServices": ["functions"], "method": "lithe/host/functions/providers", "params": {"functionID": "languageImport.settings"}, "expected": {"relay": true}}, - {"name": "a declared caller invokes another plugin's function through the relay", "version": 4, "hostServices": ["functions"], "method": "lithe/host/functions/invoke", "params": {"pluginID": "dev.lithe.fixture.go", "functionID": "languageImport.settings", "context": {"contextID": "w1", "generation": 1}, "params": {"project": "app"}, "timeoutMilliseconds": 5000}, "expected": {"relay": true}}, - {"name": "a nested invocation names the relayed call it belongs to", "version": 4, "hostServices": ["functions"], "method": "lithe/host/functions/invoke", "params": {"pluginID": "dev.lithe.fixture.go", "functionID": "languageImport.settings", "context": {"contextID": "w1", "generation": 1}, "params": {"project": "app"}, "timeoutMilliseconds": 5000, "parentOperationID": "17"}, "expected": {"relay": true}}, - {"name": "an invocation's parent operation ID is a string", "version": 4, "hostServices": ["functions"], "method": "lithe/host/functions/invoke", "params": {"pluginID": "dev.lithe.fixture.go", "functionID": "languageImport.settings", "context": {"contextID": "w1", "generation": 1}, "params": {"project": "app"}, "timeoutMilliseconds": 5000, "parentOperationID": 17}, "expected": {"rpcCode": -32602, "code": "plugin.host.invalidParams"}}, - {"name": "the relay needs protocol version 4", "version": 3, "hostServices": ["functions"], "method": "lithe/host/functions/invoke", "params": {"pluginID": "dev.lithe.fixture.go", "functionID": "languageImport.settings", "context": {"contextID": "w1", "generation": 1}}, "expected": {"rpcCode": -32601, "code": "plugin.host.unavailable"}}, - {"name": "the relay needs the manifest's pluginFunctions calls", "version": 4, "hostServices": [], "method": "lithe/host/functions/providers", "params": {"functionID": "languageImport.settings"}, "expected": {"rpcCode": -32010, "code": "plugin.host.permissionDenied"}}, - {"name": "an invocation names the workspace context it runs in", "version": 4, "hostServices": ["functions"], "method": "lithe/host/functions/invoke", "params": {"pluginID": "dev.lithe.fixture.go", "functionID": "languageImport.settings"}, "expected": {"rpcCode": -32602, "code": "plugin.host.invalidParams"}}, - {"name": "an invocation's function ID is well formed", "version": 4, "hostServices": ["functions"], "method": "lithe/host/functions/invoke", "params": {"pluginID": "dev.lithe.fixture.go", "functionID": "Not-Valid", "context": {"contextID": "w1", "generation": 1}}, "expected": {"rpcCode": -32602, "code": "plugin.host.invalidParams"}}, - {"name": "an invocation's params are an object", "version": 4, "hostServices": ["functions"], "method": "lithe/host/functions/invoke", "params": {"pluginID": "dev.lithe.fixture.go", "functionID": "languageImport.settings", "context": {"contextID": "w1", "generation": 1}, "params": [1]}, "expected": {"rpcCode": -32602, "code": "plugin.host.invalidParams"}}, - {"name": "an invocation's timeout is positive", "version": 4, "hostServices": ["functions"], "method": "lithe/host/functions/invoke", "params": {"pluginID": "dev.lithe.fixture.go", "functionID": "languageImport.settings", "context": {"contextID": "w1", "generation": 1}, "timeoutMilliseconds": 0}, "expected": {"rpcCode": -32602, "code": "plugin.host.invalidParams"}}, - {"name": "a caller cannot choose who the callee thinks called", "version": 4, "hostServices": ["functions"], "method": "lithe/host/functions/invoke", "params": {"pluginID": "dev.lithe.fixture.go", "functionID": "languageImport.settings", "context": {"contextID": "w1", "generation": 1}, "caller": {"pluginID": "dev.lithe.fixture.other"}}, "expected": {"rpcCode": -32018, "code": "plugin.host.unsupportedOption", "details": {"option": "caller"}}} - ], - "invocationCallers": [ - { - "name": "a version 4 callee receives the plugin that called it", - "version": 4, - "params": { "functionID": "languageImport.settings", "operationID": "7", "params": {} }, - "caller": "dev.lithe.fixture.python", - "expected": { - "params": { - "functionID": "languageImport.settings", - "operationID": "7", - "params": {}, - "caller": { "pluginID": "dev.lithe.fixture.python" } - } - } - }, - { - "name": "an older callee never receives a caller", - "version": 3, - "params": { "functionID": "languageImport.settings", "operationID": "7", "params": {} }, - "caller": "dev.lithe.fixture.python", - "expected": { "params": { "functionID": "languageImport.settings", "operationID": "7", "params": {} } } - }, - { - "name": "a call the host started has no caller, which means the host", - "version": 4, - "params": { "functionID": "languageImport.settings", "operationID": "7", "params": {} }, - "expected": { "params": { "functionID": "languageImport.settings", "operationID": "7", "params": {} } } - }, - { - "name": "Core's caller replaces any field the params already carried", - "version": 4, - "params": { "functionID": "languageImport.settings", "operationID": "7", "params": {}, "caller": { "pluginID": "dev.lithe.fixture.other" } }, - "caller": "dev.lithe.fixture.python", - "expected": { - "params": { - "functionID": "languageImport.settings", - "operationID": "7", - "params": {}, - "caller": { "pluginID": "dev.lithe.fixture.python" } - } - } - } - ], - "relayErrors": [ - { "name": "the caller did not declare the call", "code": "plugin.function.notDeclared", "rpcCode": -32027 }, - { "name": "the provider does not export the function", "code": "plugin.function.notExported", "rpcCode": -32028 }, - { "name": "the provider is not enabled", "code": "plugin.function.providerDisabled", "rpcCode": -32029 }, - { "name": "the declared and exported contract versions differ", "code": "plugin.function.versionMismatch", "rpcCode": -32030 }, - { "name": "the provider is already on the call chain", "code": "plugin.function.callCycle", "rpcCode": -32065 }, - { "name": "the call chain is too long", "code": "plugin.function.depthExceeded", "rpcCode": -32066 }, - { "name": "the caller has too many relayed calls running", "code": "plugin.function.tooManyCalls", "rpcCode": -32067 }, - { "name": "the params or result exceed the relay's bound", "code": "plugin.function.payloadTooLarge", "rpcCode": -32068 }, - { "name": "the provider's backend could not serve the call", "code": "plugin.function.providerUnavailable", "rpcCode": -32069 }, - { "name": "the provider's function answered with an error", "code": "plugin.function.failed", "rpcCode": -32070 }, - { "name": "the provider answered without a result Core can pass on", "code": "plugin.function.invalidResult", "rpcCode": -32071 }, - { "name": "the relay's own deadline passed", "code": "plugin.host.timeout", "rpcCode": -32015 }, - { "name": "the caller or an upstream caller cancelled", "code": "plugin.host.cancelled", "rpcCode": -32800 }, - { "name": "the workspace context is unknown or replaced", "code": "plugin.host.contextExpired", "rpcCode": -32011 }, - { "name": "the workspace is remote", "code": "plugin.host.authorityUnsupported", "rpcCode": -32012 } - ], - "invocationContexts": [ - { - "name": "a version 3 backend receives the call's context", - "version": 3, - "params": { "functionID": "query.run", "operationID": "7", "params": {} }, - "context": { "contextID": "w-3f2a", "generation": 2 }, - "expected": { - "params": { "functionID": "query.run", "operationID": "7", "params": {}, "context": { "contextID": "w-3f2a", "generation": 2 } } - } - }, - { - "name": "an older backend receives the call unchanged", - "version": 2, - "params": { "functionID": "query.run", "operationID": "7", "params": {} }, - "context": { "contextID": "w-3f2a", "generation": 2 }, - "expected": { "params": { "functionID": "query.run", "operationID": "7", "params": {} } } - }, - { - "name": "a call without a context is unchanged", - "version": 3, - "params": { "functionID": "query.run", "operationID": "7", "params": {} }, - "expected": { "params": { "functionID": "query.run", "operationID": "7", "params": {} } } - }, - { - "name": "a malformed context never leaves Core", - "version": 3, - "params": { "functionID": "query.run", "operationID": "7", "params": {} }, - "context": { "contextID": "w-3f2a", "generation": -1 }, - "expected": { "code": "plugin.function.invalidParams" } - } - ], - "hostFailures": [ - { "name": "no code is a generic failure", "code": null, "expected": { "code": "plugin.host.failed", "rpcCode": -32603 } }, - { "name": "a closed or replaced context", "code": "plugin.host.contextExpired", "expected": { "code": "plugin.host.contextExpired", "rpcCode": -32011 } }, - { "name": "a remote authority without the operation", "code": "plugin.host.authorityUnsupported", "expected": { "code": "plugin.host.authorityUnsupported", "rpcCode": -32012 } }, - { "name": "a stale versioned edit", "code": "plugin.host.versionConflict", "expected": { "code": "plugin.host.versionConflict", "rpcCode": -32013 } }, - { "name": "a host limit", "code": "plugin.host.limitExceeded", "expected": { "code": "plugin.host.limitExceeded", "rpcCode": -32014 } }, - { "name": "the host stopped the request", "code": "plugin.host.cancelled", "expected": { "code": "plugin.host.cancelled", "rpcCode": -32800 } }, - { "name": "the host's deadline passed", "code": "plugin.host.timeout", "expected": { "code": "plugin.host.timeout", "rpcCode": -32015 } }, - { "name": "params the service itself refuses", "code": "plugin.host.invalidParams", "expected": { "code": "plugin.host.invalidParams", "rpcCode": -32602 } }, - { "name": "the user withheld consent", "code": "plugin.host.permissionDenied", "expected": { "code": "plugin.host.permissionDenied", "rpcCode": -32010 } }, - { "name": "a service the host turned off", "code": "plugin.host.unavailable", "expected": { "code": "plugin.host.unavailable", "rpcCode": -32601 } }, - { "name": "the target does not exist", "code": "plugin.host.notFound", "expected": { "code": "plugin.host.notFound", "rpcCode": -32016 } }, - { "name": "the target cannot be written", "code": "plugin.host.readOnly", "expected": { "code": "plugin.host.readOnly", "rpcCode": -32017 } }, - { "name": "an option this host does not support", "code": "plugin.host.unsupportedOption", "expected": { "code": "plugin.host.unsupportedOption", "rpcCode": -32018 } }, - { "name": "a state the operation needs is missing", "code": "plugin.host.preconditionFailed", "expected": { "code": "plugin.host.preconditionFailed", "rpcCode": -32019 } }, - { "name": "the host is busy and the request may be retried", "code": "plugin.host.busy", "expected": { "code": "plugin.host.busy", "rpcCode": -32020 } }, - { "name": "the plugin sent requests too often", "code": "plugin.host.rateLimited", "expected": { "code": "plugin.host.rateLimited", "rpcCode": -32021 } }, - { "name": "a host cannot borrow a function code", "code": "plugin.function.unknown", "expected": { "code": "plugin.host.failed", "rpcCode": -32603 } }, - { "name": "a host cannot report a backend exit to the backend", "code": "plugin.backend.exited", "expected": { "code": "plugin.host.failed", "rpcCode": -32603 } }, - { "name": "a tool the host cannot resolve", "code": "plugin.host.toolUnresolved", "expected": { "code": "plugin.host.toolUnresolved", "rpcCode": -32025 } }, - {"name": "the plugin's language server is not running", "code": "plugin.host.languageServerUnavailable", "expected": {"code": "plugin.host.languageServerUnavailable", "rpcCode": -32022}}, - {"name": "the language server answered with an error", "code": "plugin.host.languageServerError", "expected": {"code": "plugin.host.languageServerError", "rpcCode": -32023}}, - {"name": "the method is not in the language server's declared session", "code": "plugin.host.methodNotDeclared", "expected": {"code": "plugin.host.methodNotDeclared", "rpcCode": -32024}}, - {"name": "the server belongs to another plugin", "code": "plugin.host.foreignContribution", "expected": {"code": "plugin.host.foreignContribution", "rpcCode": -32026}} - ], - "hostNotifications": [ - { "name": "changed contexts reach a workspace session", "version": 3, "hostServices": ["workspace"], "method": "lithe/host/workspace/didChangeContexts", "params": { "revision": 4 }, "expected": { "delivered": true } }, - { "name": "a version 2 backend is skipped", "version": 2, "hostServices": ["workspace"], "method": "lithe/host/workspace/didChangeContexts", "params": { "revision": 4 }, "expected": { "delivered": false } }, - { "name": "changed contexts need the workspace grant", "version": 3, "hostServices": [], "method": "lithe/host/workspace/didChangeContexts", "params": { "revision": 4 }, "expected": { "code": "plugin.host.permissionDenied" } }, - { "name": "a revision is positive", "version": 3, "hostServices": ["workspace"], "method": "lithe/host/workspace/didChangeContexts", "params": { "revision": 0 }, "expected": { "code": "plugin.host.invalidParams" } }, - { "name": "a subscription event", "version": 3, "hostServices": [], "method": "lithe/host/subscriptions/notify", "params": { "subscriptionID": "s1", "sequence": 1, "event": { "kind": "changed" } }, "expected": { "delivered": true } }, - { "name": "a subscription event is an object", "version": 3, "hostServices": [], "method": "lithe/host/subscriptions/notify", "params": { "subscriptionID": "s1", "sequence": 1, "event": "changed" }, "expected": { "code": "plugin.host.invalidParams" } }, - { "name": "a command run in a window", "version": 3, "hostServices": [], "method": "lithe/host/commands/didRun", "params": { "commandID": "db.refresh", "context": { "contextID": "w1", "generation": 2 } }, "expected": { "delivered": true } }, - { "name": "a command without a window", "version": 3, "hostServices": [], "method": "lithe/host/commands/didRun", "params": { "commandID": "db.refresh" }, "expected": { "delivered": true } }, - { "name": "extra command params are refused", "version": 3, "hostServices": [], "method": "lithe/host/commands/didRun", "params": { "commandID": "db.refresh", "path": "/etc" }, "expected": { "code": "plugin.host.invalidParams" } }, - { "name": "the host cannot call the backend's own protocol", "version": 3, "hostServices": [], "method": "lithe/functions/invoke", "params": {}, "expected": { "code": "plugin.host.unavailable" } }, - { "name": "a run exit with a status", "version": 3, "hostServices": ["lithe/host/run/start"], "method": "lithe/host/run/didExit", "params": { "runID": "r1", "exitCode": 0 }, "expected": { "delivered": true } }, - { "name": "a run exit by signal", "version": 3, "hostServices": ["lithe/host/run/start"], "method": "lithe/host/run/didExit", "params": { "runID": "r1", "signal": 9 }, "expected": { "delivered": true } }, - { "name": "a run exit the host lost track of", "version": 3, "hostServices": ["lithe/host/run/start"], "method": "lithe/host/run/didExit", "params": { "runID": "r1" }, "expected": { "delivered": true } }, - { "name": "a run exit needs the run grant", "version": 3, "hostServices": ["lithe/host/debug/start"], "method": "lithe/host/run/didExit", "params": { "runID": "r1", "exitCode": 0 }, "expected": { "code": "plugin.host.permissionDenied" } }, - { "name": "a run exit status is a 32-bit integer", "version": 3, "hostServices": ["lithe/host/run/start"], "method": "lithe/host/run/didExit", "params": { "runID": "r1", "exitCode": 4294967296 }, "expected": { "code": "plugin.host.invalidParams" } }, - { "name": "a run exit signal is a signal number", "version": 3, "hostServices": ["lithe/host/run/start"], "method": "lithe/host/run/didExit", "params": { "runID": "r1", "signal": 0 }, "expected": { "code": "plugin.host.invalidParams" } }, - { "name": "a run exit names its run", "version": 3, "hostServices": ["lithe/host/run/start"], "method": "lithe/host/run/didExit", "params": { "exitCode": 0 }, "expected": { "code": "plugin.host.invalidParams" } }, - {"name": "a language server changed state", "version": 3, "hostServices": ["lithe/host/languageServer/request"], "method": "lithe/host/languageServer/didChangeState", "params": {"context": {"contextID": "w1", "generation": 1}, "serverID": "metals", "state": "running", "generation": 3}, "expected": {"delivered": true}}, - {"name": "a language server state is a closed set", "version": 3, "hostServices": ["lithe/host/languageServer/request"], "method": "lithe/host/languageServer/didChangeState", "params": {"context": {"contextID": "w1", "generation": 1}, "serverID": "metals", "state": "ready", "generation": 3}, "expected": {"code": "plugin.host.invalidParams"}}, - {"name": "a language server state names its generation", "version": 3, "hostServices": ["lithe/host/languageServer/request"], "method": "lithe/host/languageServer/didChangeState", "params": {"context": {"contextID": "w1", "generation": 1}, "serverID": "metals", "state": "stopped"}, "expected": {"code": "plugin.host.invalidParams"}}, - {"name": "a language server state generation is positive", "version": 3, "hostServices": ["lithe/host/languageServer/request"], "method": "lithe/host/languageServer/didChangeState", "params": {"context": {"contextID": "w1", "generation": 1}, "serverID": "metals", "state": "crashed", "generation": 0}, "expected": {"code": "plugin.host.invalidParams"}}, - {"name": "a language server state needs the languageServer.request grant", "version": 3, "hostServices": [], "method": "lithe/host/languageServer/didChangeState", "params": {"context": {"contextID": "w1", "generation": 1}, "serverID": "metals", "state": "running", "generation": 1}, "expected": {"code": "plugin.host.permissionDenied"}}, - {"name": "a version 2 backend skips language server state", "version": 2, "hostServices": ["lithe/host/languageServer/request"], "method": "lithe/host/languageServer/didChangeState", "params": {"context": {"contextID": "w1", "generation": 1}, "serverID": "metals", "state": "running", "generation": 1}, "expected": {"delivered": false}}, - {"name": "a forwarded server notification carries its params", "version": 3, "hostServices": ["lithe/host/languageServer/request"], "method": "lithe/host/languageServer/didReceiveNotification", "params": {"context": {"contextID": "w1", "generation": 1}, "serverID": "metals", "generation": 2, "method": "metals/status", "params": {"text": "Importing"}}, "expected": {"delivered": true}}, - {"name": "an oversized server notification is marked truncated without params", "version": 3, "hostServices": ["lithe/host/languageServer/request"], "method": "lithe/host/languageServer/didReceiveNotification", "params": {"context": {"contextID": "w1", "generation": 1}, "serverID": "metals", "generation": 2, "method": "metals/status", "truncated": true}, "expected": {"delivered": true}}, - {"name": "a truncated server notification drops its params", "version": 3, "hostServices": ["lithe/host/languageServer/request"], "method": "lithe/host/languageServer/didReceiveNotification", "params": {"context": {"contextID": "w1", "generation": 1}, "serverID": "metals", "generation": 2, "method": "metals/status", "params": {}, "truncated": true}, "expected": {"code": "plugin.host.invalidParams"}}, - {"name": "a server notification names its method", "version": 3, "hostServices": ["lithe/host/languageServer/request"], "method": "lithe/host/languageServer/didReceiveNotification", "params": {"context": {"contextID": "w1", "generation": 1}, "serverID": "metals", "generation": 2}, "expected": {"code": "plugin.host.invalidParams"}}, - {"name": "a server notification names its generation", "version": 3, "hostServices": ["lithe/host/languageServer/request"], "method": "lithe/host/languageServer/didReceiveNotification", "params": {"context": {"contextID": "w1", "generation": 1}, "serverID": "metals", "method": "metals/status", "params": {}}, "expected": {"code": "plugin.host.invalidParams"}}, - {"name": "a server notification needs the languageServer.request grant", "version": 3, "hostServices": [], "method": "lithe/host/languageServer/didReceiveNotification", "params": {"context": {"contextID": "w1", "generation": 1}, "serverID": "metals", "generation": 2, "method": "metals/status", "params": {}}, "expected": {"code": "plugin.host.permissionDenied"}} - ] -} diff --git a/shared/contracts/plugins/v1/fixtures/backend/plugin-functions-caller.plugin.json b/shared/contracts/plugins/v1/fixtures/backend/plugin-functions-caller.plugin.json deleted file mode 100644 index 301571b76f..0000000000 --- a/shared/contracts/plugins/v1/fixtures/backend/plugin-functions-caller.plugin.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "schemaVersion": 2, - "id": "dev.lithe.fixture.functioncaller", - "displayName": "Plugin function caller fixture", - "version": "1.0.0", - "pluginAPIVersion": 3, - "requires": {"pluginFunctions": 1, "backend": 2, "serverProcess": 1}, - "vendor": {"id": "org.example", "displayName": "Fixture publisher", "signatureRequirement": "publisherPackage"}, - "permissions": ["backend.launch"], - "activationEvents": ["onWorkspaceOpen"], - "pluginFunctions": { - "calls": [ - {"id": "document.format", "version": 1} - ] - }, - "backend": {"launch": {"kind": "packaged", "path": "bin/backend"}, "arguments": ["--stdio"]} -} diff --git a/shared/contracts/plugins/v1/fixtures/backend/plugin-functions-exporter.plugin.json b/shared/contracts/plugins/v1/fixtures/backend/plugin-functions-exporter.plugin.json deleted file mode 100644 index dedf1e4ca6..0000000000 --- a/shared/contracts/plugins/v1/fixtures/backend/plugin-functions-exporter.plugin.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "schemaVersion": 2, - "id": "dev.lithe.fixture.functionexporter", - "displayName": "Plugin function exporter fixture", - "version": "1.0.0", - "pluginAPIVersion": 3, - "requires": {"pluginFunctions": 1, "backend": 2, "serverProcess": 1}, - "vendor": {"id": "org.example", "displayName": "Fixture publisher", "signatureRequirement": "publisherPackage"}, - "permissions": ["backend.launch"], - "pluginFunctions": { - "exports": [ - {"id": "document.format", "version": 1, "context": "workspace"}, - {"id": "symbols.list", "version": 2, "context": "workspace"} - ] - }, - "backend": {"launch": {"kind": "packaged", "path": "bin/backend"}, "arguments": ["--stdio"]} -} diff --git a/shared/contracts/plugins/v1/fixtures/backend/plugin-logging.json b/shared/contracts/plugins/v1/fixtures/backend/plugin-logging.json deleted file mode 100644 index e606b4cae3..0000000000 --- a/shared/contracts/plugins/v1/fixtures/backend/plugin-logging.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "version": 1, - "offer": { "litheLogging": { "versions": [1] } }, - "answer": { "litheLogging": { "version": 1 } }, - "notifications": [ - { "kind": "operationFinished", "operation": "database.call", "durationMs": 18, "operationId": "7" }, - { "kind": "operationFailed", "operation": "database.call", "durationMs": 20, "code": "database.unavailable", "operationId": "8" }, - { "kind": "degraded", "operation": "database.call", "code": "result_size_limited", "count": 1000, "operationId": "9" }, - { "kind": "recovered", "operation": "database.call", "code": "connection_restored" } - ], - "rejected": [ - { "kind": "operationFinished", "operation": "database.call", "durationMs": -1 }, - { "kind": "operationFailed", "operation": "database.call", "durationMs": 1, "code": "database.failed", "message": "private request contents" }, - { "kind": "operationFinished", "operation": "unregistered.query", "durationMs": 1 }, - { "kind": "degraded", "operation": "database.call", "code": "query failed with private data" }, - { "kind": "degraded", "operation": "database.call", "code": "limit", "count": 9007199254740992 } - ], - "registeredFunctions": ["database.call"], - "plugin": "io.example.database", - "events": [ - "plugins.operation.finished", - "plugins.operation.failed", - "plugins.operation.fallback_selected", - "plugins.operation.recovery_finished" - ], - "levels": ["INFO", "ERROR", "WARN", "WARN"], - "channel": "plugins/io.example.database/host" -} diff --git a/shared/contracts/plugins/v1/fixtures/backend/terminal-backend.plugin.json b/shared/contracts/plugins/v1/fixtures/backend/terminal-backend.plugin.json deleted file mode 100644 index 18c20e00d0..0000000000 --- a/shared/contracts/plugins/v1/fixtures/backend/terminal-backend.plugin.json +++ /dev/null @@ -1,35 +0,0 @@ -{ - "schemaVersion": 2, - "id": "dev.lithe.fixture.terminalbackend", - "displayName": "Native Terminal Backend", - "version": "1.0.0", - "pluginAPIVersion": 3, - "requires": { - "backend": 2, - "serverProcess": 1 - }, - "vendor": { - "id": "org.example", - "displayName": "Example", - "signatureRequirement": "publisherPackage" - }, - "permissions": [ - "backend.launch", - "workspace.metadata", - "terminal.create" - ], - "activationEvents": [ - "onWorkspaceOpen" - ], - "languages": [], - "backend": { - "launch": { - "kind": "packaged", - "path": "bin/backend" - }, - "arguments": [ - "--state", - "${stateDir}" - ] - } -} diff --git a/shared/contracts/plugins/v1/fixtures/build-providers/build-configuration.json b/shared/contracts/plugins/v1/fixtures/build-providers/build-configuration.json deleted file mode 100644 index c1944cdd9b..0000000000 --- a/shared/contracts/plugins/v1/fixtures/build-providers/build-configuration.json +++ /dev/null @@ -1,34 +0,0 @@ -{ - "format": "litheBuildConfiguration", - "version": 1, - "sources": [ - { - "id": "user", - "scope": "user", - "uri": "file:///fixture/user/settings.xml", - "revision": "sha256:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", - "writable": true, - "fields": [ - { - "id": "localRepository", - "kind": "directory", - "value": null, - "effectiveValue": "/fixture/repository", - "effectiveSource": "installation" - }, - { - "id": "activeProfiles", - "kind": "stringList", - "value": [ - "ci" - ], - "effectiveValue": [ - "ci", - "offline" - ], - "effectiveSource": "commandLine" - } - ] - } - ] -} diff --git a/shared/contracts/plugins/v1/fixtures/build-providers/build-connection-debug-options.json b/shared/contracts/plugins/v1/fixtures/build-providers/build-connection-debug-options.json deleted file mode 100644 index e3beac1d77..0000000000 --- a/shared/contracts/plugins/v1/fixtures/build-providers/build-connection-debug-options.json +++ /dev/null @@ -1,46 +0,0 @@ -{ - "format": "litheBuildRunOptions", - "version": 1, - "launchOptions": { - "execution": "service", - "runtimeArguments": [ - "-Dmessage=hello world", - "-Dquote=\"value\"", - "-Dpath=C:\\Users\\example" - ], - "arguments": [ - "--message=hello world", - "雪", - "" - ], - "environment": { - "EXAMPLE": "hello world" - }, - "workingDirectory": "tools", - "entrypoint": "example.Main", - "debug": { - "adapterID": "dev.lithe.plugin.java-support/java", - "configurationType": "java", - "target": { - "kind": "connection", - "host": "127.0.0.1", - "port": 51235 - } - } - }, - "result": { - "executable": { - "kind": "command", - "value": "engine" - }, - "arguments": [ - "serve", - "--root", - "app" - ], - "workingDirectory": "tools", - "environment": { - "EXAMPLE": "hello world" - } - } -} diff --git a/shared/contracts/plugins/v1/fixtures/build-providers/build-debug-preparation.json b/shared/contracts/plugins/v1/fixtures/build-providers/build-debug-preparation.json deleted file mode 100644 index e7cf3e8e40..0000000000 --- a/shared/contracts/plugins/v1/fixtures/build-providers/build-debug-preparation.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "result": { - "program": "app/bin/sample", - "arguments": [ - "a b", - "x#y" - ], - "workingDirectory": "app", - "environment": { - "SAMPLE": "debug" - } - }, - "invalidResults": [ - { - "program": "../sample", - "arguments": [], - "workingDirectory": "app", - "environment": {} - }, - { - "program": "app/bin/sample", - "arguments": [], - "workingDirectory": "app", - "environment": {}, - "adapter": "other/native" - } - ] -} diff --git a/shared/contracts/plugins/v1/fixtures/build-providers/build-execution-protocol.json b/shared/contracts/plugins/v1/fixtures/build-providers/build-execution-protocol.json deleted file mode 100644 index 0faea862a1..0000000000 --- a/shared/contracts/plugins/v1/fixtures/build-providers/build-execution-protocol.json +++ /dev/null @@ -1,51 +0,0 @@ -{ - "version": 2, - "request": { - "method": "lithe/build/execute", - "params": { - "buildSystemID": "gradle", - "root": ".", - "task": "build", - "options": {}, - "optionArguments": [], - "environment": {}, - "userArguments": [] - } - }, - "result": { - "exitCode": 0, - "output": "built\n" - }, - "progress": { - "operationID": "42", - "message": "Building", - "percentage": 50, - "output": "compiling\n" - }, - "invalidResults": [ - {}, - { - "exitCode": true, - "output": "" - }, - { - "exitCode": 2147483648, - "output": "" - }, - { - "exitCode": 0, - "output": false - } - ], - "invalidProgress": [ - {}, - { - "operationID": "42", - "percentage": 101 - }, - { - "operationID": "42", - "output": false - } - ] -} diff --git a/shared/contracts/plugins/v1/fixtures/build-providers/build-provider-configuration.plugin.json b/shared/contracts/plugins/v1/fixtures/build-providers/build-provider-configuration.plugin.json deleted file mode 100644 index ea4d15d349..0000000000 --- a/shared/contracts/plugins/v1/fixtures/build-providers/build-provider-configuration.plugin.json +++ /dev/null @@ -1,178 +0,0 @@ -{ - "schemaVersion": 2, - "id": "dev.lithe.fixture.build-provider-configuration", - "displayName": "Native Configuration Fixture", - "version": "0.1.0", - "pluginAPIVersion": 3, - "requires": { - "buildProviders": 7, - "buildSystems": 1, - "serverProcess": 1, - "settings": 1 - }, - "vendor": { - "id": "org.example", - "displayName": "Example", - "signatureRequirement": "publisherPackage" - }, - "permissions": [ - "languageServer.launch", - "process.build" - ], - "activationEvents": [ - "onBuildSystem:gradle" - ], - "languages": [], - "settings": [ - { - "id": "providerHeapMB", - "type": "integer", - "title": "Provider memory", - "description": "Upper bound of the Gradle provider's heap.", - "default": 1024, - "minimum": 256, - "maximum": 8192, - "unit": "MB" - } - ], - "buildSystems": [ - { - "id": "gradle", - "displayName": "Gradle", - "detection": { - "markers": [ - "build.gradle", - "build.gradle.kts", - "settings.gradle", - "settings.gradle.kts" - ], - "nesting": "outermost", - "priority": 60 - }, - "invocation": { - "executables": [ - { - "kind": "projectFile", - "path": "gradlew", - "requires": [ - "gradle/wrapper/gradle-wrapper.properties" - ], - "platforms": [ - "macos", - "linux" - ] - }, - { - "kind": "projectFile", - "path": "gradlew.bat", - "requires": [ - "gradle/wrapper/gradle-wrapper.properties" - ], - "platforms": [ - "windows" - ] - }, - { - "kind": "command", - "command": "gradle" - } - ], - "runtimeDependencies": [ - { - "id": "java", - "minimumVersion": "17" - } - ], - "globalArguments": [ - "--console=plain", - "${optionArguments}" - ] - }, - "provider": { - "launch": { - "kind": "runtime", - "tool": "java", - "minimumVersion": "17", - "runtimeArguments": [ - "-Xmx${setting:providerHeapMB}m" - ], - "entry": "provider/gradle-tooling-provider.jar" - }, - "arguments": [ - "--stdio", - "--cache", - "${workspaceStateDir}/tooling" - ], - "initializationOptions": { - "initScript": "${pluginDir}/provider/lithe-model.init.gradle" - }, - "executesProjectCode": true, - "mayUseNetwork": true - }, - "options": [ - { - "id": "offline", - "displayName": "Offline", - "kind": "boolean", - "arguments": [ - "--offline" - ] - } - ], - "model": { - "source": "provider" - }, - "tasks": [ - { - "id": "build", - "displayName": "Build", - "group": "build", - "scopes": [ - "workspace", - "project", - "target" - ], - "source": "provider", - "arguments": [] - }, - { - "id": "custom", - "displayName": "Custom", - "group": "other", - "scopes": [ - "workspace" - ], - "source": "provider", - "requiresUserArguments": true, - "arguments": [] - } - ], - "dependencies": { - "source": "provider", - "scopes": [ - "workspace", - "project" - ] - }, - "sync": { - "watch": [ - "build.gradle", - "build.gradle.kts", - "gradle.properties", - "gradle/libs.versions.toml", - "settings.gradle", - "settings.gradle.kts" - ] - }, - "layout": { - "excluded": [ - ".gradle", - "build" - ] - }, - "configuration": { - "source": "provider" - } - } - ] -} diff --git a/shared/contracts/plugins/v1/fixtures/build-providers/build-provider-debug-preparation.plugin.json b/shared/contracts/plugins/v1/fixtures/build-providers/build-provider-debug-preparation.plugin.json deleted file mode 100644 index e6d09985e3..0000000000 --- a/shared/contracts/plugins/v1/fixtures/build-providers/build-provider-debug-preparation.plugin.json +++ /dev/null @@ -1,254 +0,0 @@ -{ - "schemaVersion": 2, - "id": "dev.lithe.fixture.build-provider-debug-preparation", - "displayName": "Native Debug Preparation Fixture", - "version": "0.1.0", - "pluginAPIVersion": 4, - "requires": { - "buildProviders": 5, - "buildSystems": 1, - "serverProcess": 1, - "settings": 1, - "debugAdapters": 2 - }, - "vendor": { - "id": "org.example", - "displayName": "Example", - "signatureRequirement": "publisherPackage" - }, - "permissions": [ - "languageServer.launch", - "process.build", - "debug.launch" - ], - "activationEvents": [ - "onBuildSystem:gradle", - "onDebug:native" - ], - "languages": [], - "settings": [ - { - "id": "providerHeapMB", - "type": "integer", - "title": "Provider memory", - "description": "Upper bound of the Gradle provider's heap.", - "default": 1024, - "minimum": 256, - "maximum": 8192, - "unit": "MB" - } - ], - "buildSystems": [ - { - "id": "gradle", - "displayName": "Gradle", - "detection": { - "markers": [ - "build.gradle", - "build.gradle.kts", - "settings.gradle", - "settings.gradle.kts" - ], - "nesting": "outermost", - "priority": 60 - }, - "invocation": { - "executables": [ - { - "kind": "projectFile", - "path": "gradlew", - "requires": [ - "gradle/wrapper/gradle-wrapper.properties" - ], - "platforms": [ - "macos", - "linux" - ] - }, - { - "kind": "projectFile", - "path": "gradlew.bat", - "requires": [ - "gradle/wrapper/gradle-wrapper.properties" - ], - "platforms": [ - "windows" - ] - }, - { - "kind": "command", - "command": "gradle" - } - ], - "runtimeDependencies": [ - { - "id": "java", - "minimumVersion": "17" - } - ], - "globalArguments": [ - "--console=plain", - "${optionArguments}" - ] - }, - "provider": { - "launch": { - "kind": "runtime", - "tool": "java", - "minimumVersion": "17", - "runtimeArguments": [ - "-Xmx${setting:providerHeapMB}m" - ], - "entry": "provider/gradle-tooling-provider.jar" - }, - "arguments": [ - "--stdio", - "--cache", - "${workspaceStateDir}/tooling" - ], - "initializationOptions": { - "initScript": "${pluginDir}/provider/lithe-model.init.gradle" - }, - "executesProjectCode": true, - "mayUseNetwork": true - }, - "options": [ - { - "id": "offline", - "displayName": "Offline", - "kind": "boolean", - "arguments": [ - "--offline" - ] - } - ], - "model": { - "source": "provider" - }, - "tasks": [ - { - "id": "build", - "displayName": "Build", - "group": "build", - "scopes": [ - "workspace", - "project", - "target" - ], - "source": "provider", - "arguments": [] - }, - { - "id": "custom", - "displayName": "Custom", - "group": "other", - "scopes": [ - "workspace" - ], - "source": "provider", - "requiresUserArguments": true, - "arguments": [] - } - ], - "dependencies": { - "source": "provider", - "scopes": [ - "workspace", - "project" - ] - }, - "sync": { - "watch": [ - "build.gradle", - "build.gradle.kts", - "gradle.properties", - "gradle/libs.versions.toml", - "settings.gradle", - "settings.gradle.kts" - ] - }, - "layout": { - "excluded": [ - ".gradle", - "build" - ] - }, - "test": { - "source": "provider", - "scopes": [ - "workspace", - "project", - "target" - ], - "filters": [ - "suite", - "case" - ], - "arguments": [], - "results": { - "decoder": "junitXml", - "reports": [ - "build/test-results/**/*.xml" - ] - }, - "discovery": true - }, - "run": [ - { - "id": "application", - "source": "provider", - "name": "Run Application", - "fromTargets": { - "tags": [ - "application" - ] - }, - "arguments": [], - "debug": { - "adapter": "native" - } - } - ] - } - ], - "debugAdapters": [ - { - "id": "native", - "displayName": "Native DAP", - "requests": [ - "launch" - ], - "selectors": [ - { - "targetKinds": [ - "executable" - ] - } - ], - "configurationTypes": [ - "native" - ], - "configurations": { - "launch": { - "targetBindings": { - "program": "target.path", - "cwd": "target.workingDirectory", - "args": "target.arguments", - "env": "target.environment" - } - } - }, - "launch": { - "process": { - "launch": { - "kind": "systemCommand", - "commands": [ - "example-dap" - ] - } - }, - "transport": "stdio" - } - } - ] -} diff --git a/shared/contracts/plugins/v1/fixtures/build-providers/build-provider-execution.plugin.json b/shared/contracts/plugins/v1/fixtures/build-providers/build-provider-execution.plugin.json deleted file mode 100644 index 725065e3e3..0000000000 --- a/shared/contracts/plugins/v1/fixtures/build-providers/build-provider-execution.plugin.json +++ /dev/null @@ -1,175 +0,0 @@ -{ - "schemaVersion": 2, - "id": "dev.lithe.fixture.build-provider-execution", - "displayName": "Build Provider Execution Fixture", - "version": "0.1.0", - "pluginAPIVersion": 3, - "requires": { - "buildProviders": 2, - "buildSystems": 1, - "serverProcess": 1, - "settings": 1 - }, - "vendor": { - "id": "org.example", - "displayName": "Example", - "signatureRequirement": "publisherPackage" - }, - "permissions": [ - "languageServer.launch", - "process.build" - ], - "activationEvents": [ - "onBuildSystem:gradle" - ], - "languages": [], - "settings": [ - { - "id": "providerHeapMB", - "type": "integer", - "title": "Provider memory", - "description": "Upper bound of the Gradle provider's heap.", - "default": 1024, - "minimum": 256, - "maximum": 8192, - "unit": "MB" - } - ], - "buildSystems": [ - { - "id": "gradle", - "displayName": "Gradle", - "detection": { - "markers": [ - "build.gradle", - "build.gradle.kts", - "settings.gradle", - "settings.gradle.kts" - ], - "nesting": "outermost", - "priority": 60 - }, - "invocation": { - "executables": [ - { - "kind": "projectFile", - "path": "gradlew", - "requires": [ - "gradle/wrapper/gradle-wrapper.properties" - ], - "platforms": [ - "macos", - "linux" - ] - }, - { - "kind": "projectFile", - "path": "gradlew.bat", - "requires": [ - "gradle/wrapper/gradle-wrapper.properties" - ], - "platforms": [ - "windows" - ] - }, - { - "kind": "command", - "command": "gradle" - } - ], - "runtimeDependencies": [ - { - "id": "java", - "minimumVersion": "17" - } - ], - "globalArguments": [ - "--console=plain", - "${optionArguments}" - ] - }, - "provider": { - "launch": { - "kind": "runtime", - "tool": "java", - "minimumVersion": "17", - "runtimeArguments": [ - "-Xmx${setting:providerHeapMB}m" - ], - "entry": "provider/gradle-tooling-provider.jar" - }, - "arguments": [ - "--stdio", - "--cache", - "${workspaceStateDir}/tooling" - ], - "initializationOptions": { - "initScript": "${pluginDir}/provider/lithe-model.init.gradle" - }, - "executesProjectCode": true, - "mayUseNetwork": true - }, - "options": [ - { - "id": "offline", - "displayName": "Offline", - "kind": "boolean", - "arguments": [ - "--offline" - ] - } - ], - "model": { - "source": "provider" - }, - "tasks": [ - { - "id": "build", - "displayName": "Build", - "group": "build", - "scopes": [ - "workspace", - "project", - "target" - ], - "source": "provider", - "arguments": [] - }, - { - "id": "custom", - "displayName": "Custom", - "group": "other", - "scopes": [ - "workspace" - ], - "source": "provider", - "requiresUserArguments": true, - "arguments": [] - } - ], - "dependencies": { - "source": "provider", - "scopes": [ - "workspace", - "project" - ] - }, - "sync": { - "watch": [ - "build.gradle", - "build.gradle.kts", - "gradle.properties", - "gradle/libs.versions.toml", - "settings.gradle", - "settings.gradle.kts" - ] - }, - "layout": { - "excluded": [ - ".gradle", - "build" - ] - } - } - ] -} diff --git a/shared/contracts/plugins/v1/fixtures/build-providers/build-provider-language-server.plugin.json b/shared/contracts/plugins/v1/fixtures/build-providers/build-provider-language-server.plugin.json deleted file mode 100644 index 39967483b8..0000000000 --- a/shared/contracts/plugins/v1/fixtures/build-providers/build-provider-language-server.plugin.json +++ /dev/null @@ -1,71 +0,0 @@ -{ - "schemaVersion": 2, - "id": "dev.lithe.fixture.build-provider-language-server", - "displayName": "Build Provider With Language Server Fixture", - "version": "0.1.0", - "pluginAPIVersion": 3, - "requires": { "buildProviders": 1, "buildSystems": 1, "languageServers": 1, "languages": 1, "serverProcess": 1 }, - "vendor": { - "id": "org.example", - "displayName": "Example", - "signatureRequirement": "publisherPackage" - }, - "permissions": [ - "languageServer.launch", - "process.build" - ], - "activationEvents": [ - "onBuildSystem:mix", - "onLanguage:elixir" - ], - "languages": [ - { - "id": "elixir", - "displayName": "Elixir", - "fileExtensions": ["ex", "exs"], - "projectFileNames": ["mix.exs"] - } - ], - "languageServers": [ - { - "languageID": "elixir", - "launch": { "kind": "systemCommand", "commands": ["elixir-ls"] }, - "arguments": ["--stdio"] - } - ], - "buildSystems": [ - { - "id": "mix", - "displayName": "Mix", - "detection": { "markers": ["mix.exs"], "nesting": "outermost" }, - "invocation": { - "executables": [{ "kind": "command", "command": "mix" }] - }, - "provider": { - "languageServer": "elixir", - "executesProjectCode": true, - "mayUseNetwork": false - }, - "model": { "source": "provider" }, - "tasks": [ - { - "id": "compile", - "displayName": "Compile", - "group": "build", - "scopes": ["workspace"], - "arguments": ["compile"] - }, - { - "id": "deps-get", - "displayName": "Fetch Dependencies", - "group": "other", - "scopes": ["workspace"], - "arguments": ["deps.get"] - } - ], - "dependencies": { "source": "provider", "scopes": ["workspace"] }, - "sync": { "watch": ["mix.exs", "mix.lock"] }, - "layout": { "excluded": ["_build", "deps"] } - } - ] -} diff --git a/shared/contracts/plugins/v1/fixtures/build-providers/build-provider-preparation.plugin.json b/shared/contracts/plugins/v1/fixtures/build-providers/build-provider-preparation.plugin.json deleted file mode 100644 index 7da03c34e5..0000000000 --- a/shared/contracts/plugins/v1/fixtures/build-providers/build-provider-preparation.plugin.json +++ /dev/null @@ -1,186 +0,0 @@ -{ - "schemaVersion": 2, - "id": "dev.lithe.fixture.build-provider-preparation", - "displayName": "Declarative Preparation Fixture", - "version": "0.1.0", - "pluginAPIVersion": 3, - "requires": { - "buildProviders": 2, - "buildSystems": 4, - "serverProcess": 1, - "settings": 1 - }, - "vendor": { - "id": "org.example", - "displayName": "Example", - "signatureRequirement": "publisherPackage" - }, - "permissions": [ - "languageServer.launch", - "process.build" - ], - "activationEvents": [ - "onBuildSystem:gradle" - ], - "languages": [], - "settings": [ - { - "id": "providerHeapMB", - "type": "integer", - "title": "Provider memory", - "description": "Upper bound of the Gradle provider's heap.", - "default": 1024, - "minimum": 256, - "maximum": 8192, - "unit": "MB" - } - ], - "buildSystems": [ - { - "id": "gradle", - "displayName": "Gradle", - "detection": { - "markers": [ - "build.gradle", - "build.gradle.kts", - "settings.gradle", - "settings.gradle.kts" - ], - "nesting": "outermost", - "priority": 60 - }, - "invocation": { - "executables": [ - { - "kind": "projectFile", - "path": "gradlew", - "requires": [ - "gradle/wrapper/gradle-wrapper.properties" - ], - "platforms": [ - "macos", - "linux" - ] - }, - { - "kind": "projectFile", - "path": "gradlew.bat", - "requires": [ - "gradle/wrapper/gradle-wrapper.properties" - ], - "platforms": [ - "windows" - ] - }, - { - "kind": "command", - "command": "gradle" - } - ], - "runtimeDependencies": [ - { - "id": "java", - "minimumVersion": "17" - } - ], - "globalArguments": [ - "--console=plain", - "${optionArguments}" - ] - }, - "provider": { - "launch": { - "kind": "runtime", - "tool": "java", - "minimumVersion": "17", - "runtimeArguments": [ - "-Xmx${setting:providerHeapMB}m" - ], - "entry": "provider/gradle-tooling-provider.jar" - }, - "arguments": [ - "--stdio", - "--cache", - "${workspaceStateDir}/tooling" - ], - "initializationOptions": { - "initScript": "${pluginDir}/provider/lithe-model.init.gradle" - }, - "executesProjectCode": true, - "mayUseNetwork": true - }, - "options": [ - { - "id": "offline", - "displayName": "Offline", - "kind": "boolean", - "arguments": [ - "--offline" - ] - } - ], - "model": { - "source": "provider" - }, - "tasks": [ - { - "id": "prepare-assets", - "displayName": "Prepare assets", - "group": "build", - "scopes": [ - "project" - ], - "source": "provider", - "preparation": { - "purpose": "run", - "sourceRoles": [ - "source", - "generatedSource" - ] - }, - "arguments": [] - }, - { - "id": "prepare-specs", - "displayName": "Prepare test assets", - "group": "build", - "scopes": [ - "project" - ], - "source": "provider", - "preparation": { - "purpose": "run", - "sourceRoles": [ - "testSource", - "generatedTestSource" - ] - }, - "arguments": [] - } - ], - "dependencies": { - "source": "provider", - "scopes": [ - "workspace", - "project" - ] - }, - "sync": { - "watch": [ - "build.gradle", - "build.gradle.kts", - "gradle.properties", - "gradle/libs.versions.toml", - "settings.gradle", - "settings.gradle.kts" - ] - }, - "layout": { - "excluded": [ - ".gradle", - "build" - ] - } - } - ] -} diff --git a/shared/contracts/plugins/v1/fixtures/build-providers/build-provider-reports.plugin.json b/shared/contracts/plugins/v1/fixtures/build-providers/build-provider-reports.plugin.json deleted file mode 100644 index 4b7fc7db91..0000000000 --- a/shared/contracts/plugins/v1/fixtures/build-providers/build-provider-reports.plugin.json +++ /dev/null @@ -1,192 +0,0 @@ -{ - "schemaVersion": 2, - "id": "dev.lithe.fixture.build-provider-reports", - "displayName": "Build Provider Tests Fixture", - "version": "0.1.0", - "pluginAPIVersion": 3, - "requires": { - "buildProviders": 8, - "buildSystems": 1, - "serverProcess": 1, - "settings": 1 - }, - "vendor": { - "id": "org.example", - "displayName": "Example", - "signatureRequirement": "publisherPackage" - }, - "permissions": [ - "languageServer.launch", - "process.build" - ], - "activationEvents": [ - "onBuildSystem:gradle" - ], - "languages": [], - "settings": [ - { - "id": "providerHeapMB", - "type": "integer", - "title": "Provider memory", - "description": "Upper bound of the Gradle provider's heap.", - "default": 1024, - "minimum": 256, - "maximum": 8192, - "unit": "MB" - } - ], - "buildSystems": [ - { - "id": "gradle", - "displayName": "Gradle", - "detection": { - "markers": [ - "build.gradle", - "build.gradle.kts", - "settings.gradle", - "settings.gradle.kts" - ], - "nesting": "outermost", - "priority": 60 - }, - "invocation": { - "executables": [ - { - "kind": "projectFile", - "path": "gradlew", - "requires": [ - "gradle/wrapper/gradle-wrapper.properties" - ], - "platforms": [ - "macos", - "linux" - ] - }, - { - "kind": "projectFile", - "path": "gradlew.bat", - "requires": [ - "gradle/wrapper/gradle-wrapper.properties" - ], - "platforms": [ - "windows" - ] - }, - { - "kind": "command", - "command": "gradle" - } - ], - "runtimeDependencies": [ - { - "id": "java", - "minimumVersion": "17" - } - ], - "globalArguments": [ - "--console=plain", - "${optionArguments}" - ] - }, - "provider": { - "launch": { - "kind": "runtime", - "tool": "java", - "minimumVersion": "17", - "runtimeArguments": [ - "-Xmx${setting:providerHeapMB}m" - ], - "entry": "provider/gradle-tooling-provider.jar" - }, - "arguments": [ - "--stdio", - "--cache", - "${workspaceStateDir}/tooling" - ], - "initializationOptions": { - "initScript": "${pluginDir}/provider/lithe-model.init.gradle" - }, - "executesProjectCode": true, - "mayUseNetwork": true - }, - "options": [ - { - "id": "offline", - "displayName": "Offline", - "kind": "boolean", - "arguments": [ - "--offline" - ] - } - ], - "model": { - "source": "provider" - }, - "tasks": [ - { - "id": "build", - "displayName": "Build", - "group": "build", - "scopes": [ - "workspace", - "project", - "target" - ], - "source": "provider", - "arguments": [] - }, - { - "id": "custom", - "displayName": "Custom", - "group": "other", - "scopes": [ - "workspace" - ], - "source": "provider", - "requiresUserArguments": true, - "arguments": [] - } - ], - "dependencies": { - "source": "provider", - "scopes": [ - "workspace", - "project" - ] - }, - "sync": { - "watch": [ - "build.gradle", - "build.gradle.kts", - "gradle.properties", - "gradle/libs.versions.toml", - "settings.gradle", - "settings.gradle.kts" - ] - }, - "layout": { - "excluded": [ - ".gradle", - "build" - ] - }, - "test": { - "source": "provider", - "scopes": [ - "workspace", - "project", - "target" - ], - "filters": [ - "suite", - "case" - ], - "arguments": [], - "results": { - "decoder": "provider" - }, - "discovery": true - } - } - ] -} diff --git a/shared/contracts/plugins/v1/fixtures/build-providers/build-provider-run-options.plugin.json b/shared/contracts/plugins/v1/fixtures/build-providers/build-provider-run-options.plugin.json deleted file mode 100644 index 12b980f537..0000000000 --- a/shared/contracts/plugins/v1/fixtures/build-providers/build-provider-run-options.plugin.json +++ /dev/null @@ -1,209 +0,0 @@ -{ - "schemaVersion": 2, - "id": "dev.lithe.fixture.build-provider-run-options", - "displayName": "Provider Run Options Fixture", - "version": "0.1.0", - "pluginAPIVersion": 3, - "requires": { - "buildProviders": 10, - "buildSystems": 1, - "serverProcess": 1, - "settings": 1 - }, - "vendor": { - "id": "org.example", - "displayName": "Example", - "signatureRequirement": "publisherPackage" - }, - "permissions": [ - "languageServer.launch", - "process.build" - ], - "activationEvents": [ - "onBuildSystem:gradle" - ], - "languages": [], - "settings": [ - { - "id": "providerHeapMB", - "type": "integer", - "title": "Provider memory", - "description": "Upper bound of the Gradle provider's heap.", - "default": 1024, - "minimum": 256, - "maximum": 8192, - "unit": "MB" - } - ], - "buildSystems": [ - { - "id": "gradle", - "displayName": "Gradle", - "detection": { - "markers": [ - "build.gradle", - "build.gradle.kts", - "settings.gradle", - "settings.gradle.kts" - ], - "nesting": "outermost", - "priority": 60 - }, - "invocation": { - "executables": [ - { - "kind": "projectFile", - "path": "gradlew", - "requires": [ - "gradle/wrapper/gradle-wrapper.properties" - ], - "platforms": [ - "macos", - "linux" - ] - }, - { - "kind": "projectFile", - "path": "gradlew.bat", - "requires": [ - "gradle/wrapper/gradle-wrapper.properties" - ], - "platforms": [ - "windows" - ] - }, - { - "kind": "command", - "command": "gradle" - } - ], - "runtimeDependencies": [ - { - "id": "java", - "minimumVersion": "17" - } - ], - "globalArguments": [ - "--console=plain", - "${optionArguments}" - ] - }, - "provider": { - "launch": { - "kind": "runtime", - "tool": "java", - "minimumVersion": "17", - "runtimeArguments": [ - "-Xmx${setting:providerHeapMB}m" - ], - "entry": "provider/gradle-tooling-provider.jar" - }, - "arguments": [ - "--stdio", - "--cache", - "${workspaceStateDir}/tooling" - ], - "initializationOptions": { - "initScript": "${pluginDir}/provider/lithe-model.init.gradle" - }, - "executesProjectCode": true, - "mayUseNetwork": true - }, - "options": [ - { - "id": "offline", - "displayName": "Offline", - "kind": "boolean", - "arguments": [ - "--offline" - ] - } - ], - "model": { - "source": "provider" - }, - "tasks": [ - { - "id": "build", - "displayName": "Build", - "group": "build", - "scopes": [ - "workspace", - "project", - "target" - ], - "source": "provider", - "arguments": [] - }, - { - "id": "custom", - "displayName": "Custom", - "group": "other", - "scopes": [ - "workspace" - ], - "source": "provider", - "requiresUserArguments": true, - "arguments": [] - } - ], - "dependencies": { - "source": "provider", - "scopes": [ - "workspace", - "project" - ] - }, - "sync": { - "watch": [ - "build.gradle", - "build.gradle.kts", - "gradle.properties", - "gradle/libs.versions.toml", - "settings.gradle", - "settings.gradle.kts" - ] - }, - "layout": { - "excluded": [ - ".gradle", - "build" - ] - }, - "test": { - "source": "provider", - "scopes": [ - "workspace", - "project", - "target" - ], - "filters": [ - "suite", - "case" - ], - "arguments": [], - "results": { - "decoder": "junitXml", - "reports": [ - "build/test-results/**/*.xml" - ] - }, - "discovery": true - }, - "run": [ - { - "id": "service", - "source": "provider", - "name": "Run Service", - "fromTargets": { - "tags": [ - "application" - ] - }, - "arguments": [], - "execution": "service" - } - ] - } - ] -} diff --git a/shared/contracts/plugins/v1/fixtures/build-providers/build-provider-run-preparation.plugin.json b/shared/contracts/plugins/v1/fixtures/build-providers/build-provider-run-preparation.plugin.json deleted file mode 100644 index eb5422c65f..0000000000 --- a/shared/contracts/plugins/v1/fixtures/build-providers/build-provider-run-preparation.plugin.json +++ /dev/null @@ -1,208 +0,0 @@ -{ - "schemaVersion": 2, - "id": "dev.lithe.fixture.build-provider-run-preparation", - "displayName": "Provider Run Preparation Fixture", - "version": "0.1.0", - "pluginAPIVersion": 3, - "requires": { - "buildProviders": 4, - "buildSystems": 1, - "serverProcess": 1, - "settings": 1 - }, - "vendor": { - "id": "org.example", - "displayName": "Example", - "signatureRequirement": "publisherPackage" - }, - "permissions": [ - "languageServer.launch", - "process.build" - ], - "activationEvents": [ - "onBuildSystem:gradle" - ], - "languages": [], - "settings": [ - { - "id": "providerHeapMB", - "type": "integer", - "title": "Provider memory", - "description": "Upper bound of the Gradle provider's heap.", - "default": 1024, - "minimum": 256, - "maximum": 8192, - "unit": "MB" - } - ], - "buildSystems": [ - { - "id": "gradle", - "displayName": "Gradle", - "detection": { - "markers": [ - "build.gradle", - "build.gradle.kts", - "settings.gradle", - "settings.gradle.kts" - ], - "nesting": "outermost", - "priority": 60 - }, - "invocation": { - "executables": [ - { - "kind": "projectFile", - "path": "gradlew", - "requires": [ - "gradle/wrapper/gradle-wrapper.properties" - ], - "platforms": [ - "macos", - "linux" - ] - }, - { - "kind": "projectFile", - "path": "gradlew.bat", - "requires": [ - "gradle/wrapper/gradle-wrapper.properties" - ], - "platforms": [ - "windows" - ] - }, - { - "kind": "command", - "command": "gradle" - } - ], - "runtimeDependencies": [ - { - "id": "java", - "minimumVersion": "17" - } - ], - "globalArguments": [ - "--console=plain", - "${optionArguments}" - ] - }, - "provider": { - "launch": { - "kind": "runtime", - "tool": "java", - "minimumVersion": "17", - "runtimeArguments": [ - "-Xmx${setting:providerHeapMB}m" - ], - "entry": "provider/gradle-tooling-provider.jar" - }, - "arguments": [ - "--stdio", - "--cache", - "${workspaceStateDir}/tooling" - ], - "initializationOptions": { - "initScript": "${pluginDir}/provider/lithe-model.init.gradle" - }, - "executesProjectCode": true, - "mayUseNetwork": true - }, - "options": [ - { - "id": "offline", - "displayName": "Offline", - "kind": "boolean", - "arguments": [ - "--offline" - ] - } - ], - "model": { - "source": "provider" - }, - "tasks": [ - { - "id": "build", - "displayName": "Build", - "group": "build", - "scopes": [ - "workspace", - "project", - "target" - ], - "source": "provider", - "arguments": [] - }, - { - "id": "custom", - "displayName": "Custom", - "group": "other", - "scopes": [ - "workspace" - ], - "source": "provider", - "requiresUserArguments": true, - "arguments": [] - } - ], - "dependencies": { - "source": "provider", - "scopes": [ - "workspace", - "project" - ] - }, - "sync": { - "watch": [ - "build.gradle", - "build.gradle.kts", - "gradle.properties", - "gradle/libs.versions.toml", - "settings.gradle", - "settings.gradle.kts" - ] - }, - "layout": { - "excluded": [ - ".gradle", - "build" - ] - }, - "test": { - "source": "provider", - "scopes": [ - "workspace", - "project", - "target" - ], - "filters": [ - "suite", - "case" - ], - "arguments": [], - "results": { - "decoder": "junitXml", - "reports": [ - "build/test-results/**/*.xml" - ] - }, - "discovery": true - }, - "run": [ - { - "id": "application", - "source": "provider", - "name": "Run Application", - "fromTargets": { - "tags": [ - "application" - ] - }, - "arguments": [] - } - ] - } - ] -} diff --git a/shared/contracts/plugins/v1/fixtures/build-providers/build-provider-selectors.plugin.json b/shared/contracts/plugins/v1/fixtures/build-providers/build-provider-selectors.plugin.json deleted file mode 100644 index e36cd3b4a5..0000000000 --- a/shared/contracts/plugins/v1/fixtures/build-providers/build-provider-selectors.plugin.json +++ /dev/null @@ -1,195 +0,0 @@ -{ - "schemaVersion": 2, - "id": "dev.lithe.fixture.build-provider-selectors", - "displayName": "Build Provider Tests Fixture", - "version": "0.1.0", - "pluginAPIVersion": 3, - "requires": { - "buildProviders": 9, - "buildSystems": 1, - "serverProcess": 1, - "settings": 1 - }, - "vendor": { - "id": "org.example", - "displayName": "Example", - "signatureRequirement": "publisherPackage" - }, - "permissions": [ - "languageServer.launch", - "process.build" - ], - "activationEvents": [ - "onBuildSystem:gradle" - ], - "languages": [], - "settings": [ - { - "id": "providerHeapMB", - "type": "integer", - "title": "Provider memory", - "description": "Upper bound of the Gradle provider's heap.", - "default": 1024, - "minimum": 256, - "maximum": 8192, - "unit": "MB" - } - ], - "buildSystems": [ - { - "id": "gradle", - "displayName": "Gradle", - "detection": { - "markers": [ - "build.gradle", - "build.gradle.kts", - "settings.gradle", - "settings.gradle.kts" - ], - "nesting": "outermost", - "priority": 60 - }, - "invocation": { - "executables": [ - { - "kind": "projectFile", - "path": "gradlew", - "requires": [ - "gradle/wrapper/gradle-wrapper.properties" - ], - "platforms": [ - "macos", - "linux" - ] - }, - { - "kind": "projectFile", - "path": "gradlew.bat", - "requires": [ - "gradle/wrapper/gradle-wrapper.properties" - ], - "platforms": [ - "windows" - ] - }, - { - "kind": "command", - "command": "gradle" - } - ], - "runtimeDependencies": [ - { - "id": "java", - "minimumVersion": "17" - } - ], - "globalArguments": [ - "--console=plain", - "${optionArguments}" - ] - }, - "provider": { - "launch": { - "kind": "runtime", - "tool": "java", - "minimumVersion": "17", - "runtimeArguments": [ - "-Xmx${setting:providerHeapMB}m" - ], - "entry": "provider/gradle-tooling-provider.jar" - }, - "arguments": [ - "--stdio", - "--cache", - "${workspaceStateDir}/tooling" - ], - "initializationOptions": { - "initScript": "${pluginDir}/provider/lithe-model.init.gradle" - }, - "executesProjectCode": true, - "mayUseNetwork": true - }, - "options": [ - { - "id": "offline", - "displayName": "Offline", - "kind": "boolean", - "arguments": [ - "--offline" - ] - } - ], - "model": { - "source": "provider" - }, - "tasks": [ - { - "id": "build", - "displayName": "Build", - "group": "build", - "scopes": [ - "workspace", - "project", - "target" - ], - "source": "provider", - "arguments": [] - }, - { - "id": "custom", - "displayName": "Custom", - "group": "other", - "scopes": [ - "workspace" - ], - "source": "provider", - "requiresUserArguments": true, - "arguments": [] - } - ], - "dependencies": { - "source": "provider", - "scopes": [ - "workspace", - "project" - ] - }, - "sync": { - "watch": [ - "build.gradle", - "build.gradle.kts", - "gradle.properties", - "gradle/libs.versions.toml", - "settings.gradle", - "settings.gradle.kts" - ] - }, - "layout": { - "excluded": [ - ".gradle", - "build" - ] - }, - "test": { - "source": "provider", - "scopes": [ - "workspace", - "project", - "target" - ], - "filters": [ - "suite", - "case" - ], - "arguments": [], - "results": { - "decoder": "provider" - }, - "discovery": true, - "selectorKinds": [ - "org.example.semantic" - ] - } - } - ] -} diff --git a/shared/contracts/plugins/v1/fixtures/build-providers/build-provider-tests.plugin.json b/shared/contracts/plugins/v1/fixtures/build-providers/build-provider-tests.plugin.json deleted file mode 100644 index 3749a7a3fd..0000000000 --- a/shared/contracts/plugins/v1/fixtures/build-providers/build-provider-tests.plugin.json +++ /dev/null @@ -1,195 +0,0 @@ -{ - "schemaVersion": 2, - "id": "dev.lithe.fixture.build-provider-tests", - "displayName": "Build Provider Tests Fixture", - "version": "0.1.0", - "pluginAPIVersion": 3, - "requires": { - "buildProviders": 3, - "buildSystems": 1, - "serverProcess": 1, - "settings": 1 - }, - "vendor": { - "id": "org.example", - "displayName": "Example", - "signatureRequirement": "publisherPackage" - }, - "permissions": [ - "languageServer.launch", - "process.build" - ], - "activationEvents": [ - "onBuildSystem:gradle" - ], - "languages": [], - "settings": [ - { - "id": "providerHeapMB", - "type": "integer", - "title": "Provider memory", - "description": "Upper bound of the Gradle provider's heap.", - "default": 1024, - "minimum": 256, - "maximum": 8192, - "unit": "MB" - } - ], - "buildSystems": [ - { - "id": "gradle", - "displayName": "Gradle", - "detection": { - "markers": [ - "build.gradle", - "build.gradle.kts", - "settings.gradle", - "settings.gradle.kts" - ], - "nesting": "outermost", - "priority": 60 - }, - "invocation": { - "executables": [ - { - "kind": "projectFile", - "path": "gradlew", - "requires": [ - "gradle/wrapper/gradle-wrapper.properties" - ], - "platforms": [ - "macos", - "linux" - ] - }, - { - "kind": "projectFile", - "path": "gradlew.bat", - "requires": [ - "gradle/wrapper/gradle-wrapper.properties" - ], - "platforms": [ - "windows" - ] - }, - { - "kind": "command", - "command": "gradle" - } - ], - "runtimeDependencies": [ - { - "id": "java", - "minimumVersion": "17" - } - ], - "globalArguments": [ - "--console=plain", - "${optionArguments}" - ] - }, - "provider": { - "launch": { - "kind": "runtime", - "tool": "java", - "minimumVersion": "17", - "runtimeArguments": [ - "-Xmx${setting:providerHeapMB}m" - ], - "entry": "provider/gradle-tooling-provider.jar" - }, - "arguments": [ - "--stdio", - "--cache", - "${workspaceStateDir}/tooling" - ], - "initializationOptions": { - "initScript": "${pluginDir}/provider/lithe-model.init.gradle" - }, - "executesProjectCode": true, - "mayUseNetwork": true - }, - "options": [ - { - "id": "offline", - "displayName": "Offline", - "kind": "boolean", - "arguments": [ - "--offline" - ] - } - ], - "model": { - "source": "provider" - }, - "tasks": [ - { - "id": "build", - "displayName": "Build", - "group": "build", - "scopes": [ - "workspace", - "project", - "target" - ], - "source": "provider", - "arguments": [] - }, - { - "id": "custom", - "displayName": "Custom", - "group": "other", - "scopes": [ - "workspace" - ], - "source": "provider", - "requiresUserArguments": true, - "arguments": [] - } - ], - "dependencies": { - "source": "provider", - "scopes": [ - "workspace", - "project" - ] - }, - "sync": { - "watch": [ - "build.gradle", - "build.gradle.kts", - "gradle.properties", - "gradle/libs.versions.toml", - "settings.gradle", - "settings.gradle.kts" - ] - }, - "layout": { - "excluded": [ - ".gradle", - "build" - ] - }, - "test": { - "source": "provider", - "scopes": [ - "workspace", - "project", - "target" - ], - "filters": [ - "suite", - "case" - ], - "arguments": [], - "results": { - "decoder": "junitXml", - "reports": [ - "build/test-results/**/*.xml" - ] - }, - "discovery": true - } - } - ] -} diff --git a/shared/contracts/plugins/v1/fixtures/build-providers/build-provider.plugin.json b/shared/contracts/plugins/v1/fixtures/build-providers/build-provider.plugin.json deleted file mode 100644 index 512f7010f8..0000000000 --- a/shared/contracts/plugins/v1/fixtures/build-providers/build-provider.plugin.json +++ /dev/null @@ -1,122 +0,0 @@ -{ - "schemaVersion": 2, - "id": "dev.lithe.fixture.build-provider", - "displayName": "Build Provider Fixture", - "version": "0.1.0", - "pluginAPIVersion": 3, - "requires": { "buildProviders": 1, "buildSystems": 1, "serverProcess": 1, "settings": 1 }, - "vendor": { - "id": "org.example", - "displayName": "Example", - "signatureRequirement": "publisherPackage" - }, - "permissions": [ - "languageServer.launch", - "process.build" - ], - "activationEvents": [ - "onBuildSystem:gradle" - ], - "languages": [], - "settings": [ - { - "id": "providerHeapMB", - "type": "integer", - "title": "Provider memory", - "description": "Upper bound of the Gradle provider's heap.", - "default": 1024, - "minimum": 256, - "maximum": 8192, - "unit": "MB" - } - ], - "buildSystems": [ - { - "id": "gradle", - "displayName": "Gradle", - "detection": { - "markers": ["build.gradle", "build.gradle.kts", "settings.gradle", "settings.gradle.kts"], - "nesting": "outermost", - "priority": 60 - }, - "invocation": { - "executables": [ - { - "kind": "projectFile", - "path": "gradlew", - "requires": ["gradle/wrapper/gradle-wrapper.properties"], - "platforms": ["macos", "linux"] - }, - { - "kind": "projectFile", - "path": "gradlew.bat", - "requires": ["gradle/wrapper/gradle-wrapper.properties"], - "platforms": ["windows"] - }, - { "kind": "command", "command": "gradle" } - ], - "runtimeDependencies": [ - { "id": "java", "minimumVersion": "17" } - ], - "globalArguments": ["--console=plain", "${optionArguments}"] - }, - "provider": { - "launch": { - "kind": "runtime", - "tool": "java", - "minimumVersion": "17", - "runtimeArguments": ["-Xmx${setting:providerHeapMB}m"], - "entry": "provider/gradle-tooling-provider.jar" - }, - "arguments": ["--stdio", "--cache", "${workspaceStateDir}/tooling"], - "initializationOptions": { - "initScript": "${pluginDir}/provider/lithe-model.init.gradle" - }, - "executesProjectCode": true, - "mayUseNetwork": true - }, - "options": [ - { "id": "offline", "displayName": "Offline", "kind": "boolean", "arguments": ["--offline"] } - ], - "model": { "source": "provider" }, - "tasks": [ - { - "id": "gradle-task", - "displayName": "Gradle Task", - "group": "other", - "fromModel": true, - "arguments": ["${task.property:path}", "${userArguments}"] - }, - { - "id": "build", - "displayName": "Build", - "group": "build", - "scopes": ["workspace", "project"], - "arguments": [ - { "value": "${project.property:taskPrefix}build", "when": "projectSelected" }, - { "value": "build", "when": "noProjectSelected" } - ] - } - ], - "run": [ - { - "id": "task", - "fromTasks": { "templates": ["gradle-task"], "executions": ["application", "service"] }, - "workingDirectory": "root" - } - ], - "dependencies": { "source": "provider", "scopes": ["workspace", "project"] }, - "sync": { - "watch": [ - "build.gradle", - "build.gradle.kts", - "gradle.properties", - "gradle/libs.versions.toml", - "settings.gradle", - "settings.gradle.kts" - ] - }, - "layout": { "excluded": [".gradle", "build"] } - } - ] -} diff --git a/shared/contracts/plugins/v1/fixtures/build-providers/build-run-options.json b/shared/contracts/plugins/v1/fixtures/build-providers/build-run-options.json deleted file mode 100644 index b8644d81cb..0000000000 --- a/shared/contracts/plugins/v1/fixtures/build-providers/build-run-options.json +++ /dev/null @@ -1,37 +0,0 @@ -{ - "format": "litheBuildRunOptions", - "version": 1, - "launchOptions": { - "execution": "service", - "runtimeArguments": [ - "-Dmessage=hello world", - "-Dquote=\"value\"", - "-Dpath=C:\\Users\\example" - ], - "arguments": [ - "--message=hello world", - "雪", - "" - ], - "environment": { - "EXAMPLE": "hello world" - }, - "workingDirectory": "tools", - "entrypoint": "example.Main" - }, - "result": { - "executable": { - "kind": "toolchain", - "value": "project-maven" - }, - "arguments": [ - "--file", - "app/pom.xml", - "framework:run" - ], - "workingDirectory": "tools", - "environment": { - "EXAMPLE": "hello world" - } - } -} diff --git a/shared/contracts/plugins/v1/fixtures/build-providers/build-run-preparation.json b/shared/contracts/plugins/v1/fixtures/build-providers/build-run-preparation.json deleted file mode 100644 index bacabb6781..0000000000 --- a/shared/contracts/plugins/v1/fixtures/build-providers/build-run-preparation.json +++ /dev/null @@ -1,39 +0,0 @@ -{ - "request": { - "root": ".", - "run": "application", - "project": { - "name": "app", - "path": "app" - }, - "target": { - "name": "Main", - "path": "app", - "tags": [ - "application" - ] - }, - "options": { - "offline": true - }, - "userArguments": [ - "a b" - ] - }, - "result": { - "executable": { - "kind": "toolchain", - "value": "project-jdk" - }, - "arguments": [ - "-cp", - "classes", - "example.Main", - "a b" - ], - "workingDirectory": "app", - "environment": { - "APP_ENV": "test" - } - } -} diff --git a/shared/contracts/plugins/v1/fixtures/build-providers/build-test-discovery.json b/shared/contracts/plugins/v1/fixtures/build-providers/build-test-discovery.json deleted file mode 100644 index 32b0496deb..0000000000 --- a/shared/contracts/plugins/v1/fixtures/build-providers/build-test-discovery.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "result": { - "format": "litheTestDiscovery", - "version": 1, - "tests": [ - { - "suite": "ExampleSuite", - "case": "checks spaces # [exact]", - "project": { - "name": "app", - "path": "app" - } - }, - { - "suite": "ExampleSuite", - "case": "checks spaces # [exact]", - "project": { - "name": "lib", - "path": "lib" - } - } - ] - } -} diff --git a/shared/contracts/plugins/v1/fixtures/build-providers/build-test-durations.json b/shared/contracts/plugins/v1/fixtures/build-providers/build-test-durations.json deleted file mode 100644 index 5e156fe2af..0000000000 --- a/shared/contracts/plugins/v1/fixtures/build-providers/build-test-durations.json +++ /dev/null @@ -1,45 +0,0 @@ -{ - "version": 1, - "cases": [ - { - "name": "sum", - "values": [ - 10, - 20 - ], - "durationMillis": 30 - }, - { - "name": "zero", - "values": [ - 0, - 0 - ], - "durationMillis": 0 - }, - { - "name": "missing-first", - "values": [ - null, - 20 - ], - "durationMillis": null - }, - { - "name": "missing-second", - "values": [ - 10, - null - ], - "durationMillis": null - }, - { - "name": "unsafe-total", - "values": [ - 9007199254740990, - 2 - ], - "durationMillis": null - } - ] -} diff --git a/shared/contracts/plugins/v1/fixtures/build-providers/build-test-protocol.json b/shared/contracts/plugins/v1/fixtures/build-providers/build-test-protocol.json deleted file mode 100644 index bd010d1110..0000000000 --- a/shared/contracts/plugins/v1/fixtures/build-providers/build-test-protocol.json +++ /dev/null @@ -1,48 +0,0 @@ -{ - "request": { - "root": ".", - "options": { - "offline": true - }, - "project": { - "name": "app", - "path": "app" - }, - "suite": "ExampleSuite", - "case": "checks spaces # [exact]", - "userArguments": [ - "--rerun-tasks" - ] - }, - "provider": { - "method": "lithe/build/test", - "params": { - "buildSystemID": "gradle", - "root": ".", - "options": { - "offline": true - }, - "optionArguments": [ - "--offline" - ], - "environment": {}, - "project": { - "name": "app", - "path": "app", - "tags": [], - "properties": {} - }, - "suite": "ExampleSuite", - "case": "checks spaces # [exact]", - "userArguments": [ - "--rerun-tasks" - ] - } - }, - "results": { - "decoder": "junitXml", - "reports": [ - "app/build/test-results/**/*.xml" - ] - } -} diff --git a/shared/contracts/plugins/v1/fixtures/build-systems/build-command-output-file.plugin.json b/shared/contracts/plugins/v1/fixtures/build-systems/build-command-output-file.plugin.json deleted file mode 100644 index 7d5c974c0b..0000000000 --- a/shared/contracts/plugins/v1/fixtures/build-systems/build-command-output-file.plugin.json +++ /dev/null @@ -1,168 +0,0 @@ -{ - "schemaVersion": 2, - "id": "dev.lithe.fixture.build-command-output-file", - "displayName": "Command Output File Build Fixture", - "version": "0.1.0", - "pluginAPIVersion": 3, - "requires": { "buildSystems": 1 }, - "vendor": { - "id": "org.example", - "displayName": "Example", - "signatureRequirement": "publisherPackage" - }, - "permissions": [ - "process.build" - ], - "activationEvents": [ - "onBuildSystem:gradle" - ], - "languages": [], - "buildSystems": [ - { - "id": "gradle", - "displayName": "Gradle", - "detection": { - "markers": ["build.gradle", "build.gradle.kts", "settings.gradle", "settings.gradle.kts"], - "nesting": "outermost" - }, - "invocation": { - "executables": [ - { - "kind": "projectFile", - "path": "gradlew", - "requires": ["gradle/wrapper/gradle-wrapper.properties"], - "platforms": ["macos", "linux"] - }, - { - "kind": "projectFile", - "path": "gradlew.bat", - "requires": ["gradle/wrapper/gradle-wrapper.properties"], - "platforms": ["windows"] - }, - { "kind": "environment", "variable": "GRADLE_HOME", "path": "bin/gradle", "platforms": ["macos", "linux"] }, - { "kind": "environment", "variable": "GRADLE_HOME", "path": "bin/gradle.bat", "platforms": ["windows"] }, - { "kind": "command", "command": "gradle" } - ], - "environmentInputs": ["GRADLE_HOME"], - "runtimeDependencies": [ - { "id": "java", "minimumVersion": "17" } - ], - "globalArguments": ["--console=plain", "${optionArguments}"], - "version": { "arguments": ["--version"], "pattern": "Gradle (\\d+(?:\\.\\d+){1,2})" }, - "minimumVersion": "7.6" - }, - "options": [ - { "id": "offline", "displayName": "Offline", "kind": "boolean", "arguments": ["--offline"] }, - { "id": "buildCache", "displayName": "Build Cache", "kind": "boolean", "arguments": ["--build-cache"] } - ], - "model": { - "source": "command", - "arguments": [ - "-q", - "--init-script", - "${pluginDir}/lithe-model.init.gradle", - "litheModel", - "-PlitheModelOutput=${outputFile}" - ], - "output": "outputFile", - "decoder": "litheBuildModel", - "executesProjectCode": true, - "mayUseNetwork": true - }, - "tasks": [ - { - "id": "gradle-task", - "displayName": "Gradle Task", - "group": "other", - "fromModel": true, - "arguments": ["${task.property:path}", "${userArguments}"] - }, - { - "id": "build", - "displayName": "Build", - "group": "build", - "scopes": ["workspace", "project"], - "arguments": [ - { "value": "${project.property:taskPrefix}build", "when": "projectSelected" }, - { "value": "build", "when": "noProjectSelected" } - ] - }, - { - "id": "tasks", - "displayName": "Run Gradle Tasks…", - "group": "other", - "scopes": ["workspace"], - "requiresUserArguments": true, - "arguments": ["${userArguments}"] - } - ], - "run": [ - { - "id": "task", - "fromTasks": { "templates": ["gradle-task"], "executions": ["application", "service"] }, - "workingDirectory": "root" - } - ], - "test": { - "scopes": ["workspace", "project"], - "filters": ["suite", "case"], - "arguments": [ - { "value": "${project.property:taskPrefix}test", "when": "projectSelected" }, - { "value": "test", "when": "noProjectSelected" }, - { "value": "--tests", "when": "suiteSelected" }, - { "value": "${test.suite}", "when": ["suiteSelected", "noCaseSelected"] }, - { "value": "${test.suite}.${test.case}", "when": ["suiteSelected", "caseSelected"] } - ], - "results": { "decoder": "junitXml", "reports": ["build/test-results/test/*.xml"] } - }, - "diagnostics": { - "decoder": "lineMatcher", - "patterns": [ - { - "regex": "^(.+\\.java):(\\d+): (error|warning): (.+)$", - "file": 1, - "line": 2, - "severity": 3, - "message": 4 - }, - { - "regex": "^([ew]): file://(.+?):(\\d+):(\\d+) (.+)$", - "file": 2, - "line": 3, - "column": 4, - "message": 5, - "severity": 1, - "severities": { "e": "error", "w": "warning" } - } - ] - }, - "dependencies": { - "source": "command", - "scopes": ["workspace", "project"], - "arguments": [ - "-q", - "--init-script", - "${pluginDir}/lithe-model.init.gradle", - { "value": "${project.property:taskPrefix}litheDependencies", "when": "projectSelected" }, - { "value": "litheDependencies", "when": "noProjectSelected" }, - "-PlitheDependenciesOutput=${outputFile}" - ], - "output": "outputFile", - "decoder": "litheDependencies", - "executesProjectCode": true, - "mayUseNetwork": true - }, - "sync": { - "watch": [ - "build.gradle", - "build.gradle.kts", - "gradle.properties", - "gradle/libs.versions.toml", - "settings.gradle", - "settings.gradle.kts" - ] - }, - "layout": { "excluded": [".gradle", "build"] } - } - ] -} diff --git a/shared/contracts/plugins/v1/fixtures/build-systems/build-command-stdout.plugin.json b/shared/contracts/plugins/v1/fixtures/build-systems/build-command-stdout.plugin.json deleted file mode 100644 index 8ed8855eca..0000000000 --- a/shared/contracts/plugins/v1/fixtures/build-systems/build-command-stdout.plugin.json +++ /dev/null @@ -1,145 +0,0 @@ -{ - "schemaVersion": 2, - "id": "dev.lithe.fixture.build-command-stdout", - "displayName": "Command Stdout Build Fixture", - "version": "0.1.0", - "pluginAPIVersion": 3, - "requires": { "buildSystems": 1 }, - "vendor": { - "id": "org.example", - "displayName": "Example", - "signatureRequirement": "publisherPackage" - }, - "permissions": [ - "process.build" - ], - "activationEvents": [ - "onBuildSystem:go" - ], - "languages": [], - "buildSystems": [ - { - "id": "go", - "displayName": "Go Modules", - "detection": { - "markers": ["go.mod"] - }, - "invocation": { - "executables": [ - { "kind": "runtime", "runtime": "go" } - ], - "runtimeDependencies": [ - { "id": "go", "minimumVersion": "1.21" } - ] - }, - "options": [ - { "id": "tags", "displayName": "Build Tags", "kind": "text", "arguments": ["-tags", "${value}"] }, - { "id": "race", "displayName": "Race Detector", "kind": "boolean", "arguments": ["-race"] } - ], - "model": { - "source": "command", - "arguments": ["list", "-json", "./..."], - "decoder": "jsonStream", - "executesProjectCode": false, - "mayUseNetwork": true, - "map": { - "projects": [ - { - "each": "/0/Module", - "name": "/Path", - "path": "/Dir", - "properties": { "goVersion": "/GoVersion" }, - "targets": [ - { - "each": "$/*", - "where": [{ "pointer": "/Name", "equals": "main" }], - "name": "/ImportPath", - "path": "/Dir", - "tags": ["application"], - "properties": { "short": { "from": "/ImportPath", "transform": "lastSegment" } } - }, - { - "each": "$/*", - "where": [{ "pointer": "/TestGoFiles", "exists": true }], - "name": "/ImportPath", - "path": "/Dir", - "tags": ["test"] - } - ] - } - ] - } - }, - "tasks": [ - { - "id": "build", - "displayName": "Build", - "group": "build", - "scopes": ["project"], - "arguments": ["build", "${optionArguments}", "./..."] - }, - { - "id": "vet", - "displayName": "Vet", - "group": "verification", - "scopes": ["project", "target"], - "arguments": [ - "vet", - "${optionArguments}", - { "value": "./...", "when": "noTargetSelected" }, - { "value": "${target.name}", "when": "targetSelected" } - ] - } - ], - "run": [ - { - "id": "main", - "fromTargets": { "tags": ["application"] }, - "name": "${target.property:short}", - "arguments": ["run", "${optionArguments}", "${target.name}"] - } - ], - "test": { - "scopes": ["project", "target"], - "filters": ["case"], - "arguments": [ - "test", - "${optionArguments}", - { "value": "./...", "when": "noTargetSelected" }, - { "value": "${target.name}", "when": "targetSelected" }, - { "value": "-run", "when": "caseSelected" }, - { "value": "^${test.case:regex}$", "when": "caseSelected" } - ] - }, - "diagnostics": { - "decoder": "lineMatcher", - "patterns": [ - { - "regex": "^(\\S+\\.go):(\\d+):(?:(\\d+):)? (.+)$", - "file": 1, - "line": 2, - "column": 3, - "message": 4, - "defaultSeverity": "error" - } - ] - }, - "dependencies": { - "source": "command", - "scopes": ["project"], - "arguments": ["list", "-m", "-json", "all"], - "decoder": "jsonStream", - "executesProjectCode": false, - "mayUseNetwork": true, - "map": { - "each": "/*", - "where": [{ "pointer": "/Main", "exists": false }], - "name": "/Path", - "version": "/Version", - "properties": { "indirect": "/Indirect" } - } - }, - "sync": { "watch": ["go.mod", "go.sum", "go.work"] } - } - ] -} diff --git a/shared/contracts/plugins/v1/fixtures/build-systems/build-instance-options.plugin.json b/shared/contracts/plugins/v1/fixtures/build-systems/build-instance-options.plugin.json deleted file mode 100644 index 9aa8cf6823..0000000000 --- a/shared/contracts/plugins/v1/fixtures/build-systems/build-instance-options.plugin.json +++ /dev/null @@ -1,312 +0,0 @@ -{ - "schemaVersion": 2, - "id": "dev.lithe.fixture.build-instance-options", - "displayName": "Instance Options Build Fixture", - "version": "0.1.0", - "pluginAPIVersion": 3, - "requires": { - "buildSystems": 3 - }, - "vendor": { - "id": "org.example", - "displayName": "Example", - "signatureRequirement": "publisherPackage" - }, - "permissions": [ - "process.build" - ], - "activationEvents": [ - "onBuildSystem:cargo" - ], - "languages": [], - "buildSystems": [ - { - "id": "cargo", - "displayName": "Cargo", - "detection": { - "markers": [ - "Cargo.toml" - ] - }, - "invocation": { - "executables": [ - { - "kind": "command", - "command": "cargo" - } - ], - "version": { - "arguments": [ - "--version" - ], - "pattern": "cargo (\\d+\\.\\d+\\.\\d+)" - }, - "minimumVersion": "1.70" - }, - "options": [ - { - "id": "release", - "displayName": "Release Profile", - "kind": "boolean", - "arguments": [ - "--release" - ], - "scope": "instance" - }, - { - "id": "features", - "displayName": "Features", - "kind": "multiSelect", - "choicesFromModel": true, - "arguments": [ - "--features", - "${value}" - ], - "scope": "instance" - }, - { - "id": "offline", - "displayName": "Offline", - "kind": "boolean", - "arguments": [ - "--offline" - ] - }, - { - "id": "settingsFile", - "displayName": "Settings File", - "kind": "file", - "scope": "instance", - "arguments": [ - "--config", - "${value}" - ] - }, - { - "id": "cacheDirectory", - "displayName": "Cache Directory", - "kind": "directory", - "scope": "instance", - "arguments": [ - "--cache", - "${value}" - ] - }, - { - "id": "label", - "displayName": "Label", - "kind": "text", - "scope": "instance", - "arguments": [ - "--label", - "${value}" - ] - } - ], - "model": { - "source": "static", - "file": "Cargo.toml", - "decoder": "toml", - "map": { - "projects": [ - { - "each": "/package", - "name": "/name", - "properties": { - "version": "/version", - "edition": "/edition" - }, - "targets": [ - { - "each": "$/bin/*", - "name": "/name", - "tags": [ - "application" - ] - }, - { - "fallback": true, - "whenFile": "src/main.rs", - "name": "/name", - "tags": [ - "application" - ] - }, - { - "each": "$/test/*", - "name": "/name", - "tags": [ - "test" - ] - }, - { - "each": "$/example/*", - "name": "/name", - "tags": [ - "example" - ] - } - ], - "contentRoots": [ - { - "path": { - "value": "src" - }, - "kind": "source" - }, - { - "path": { - "value": "tests" - }, - "kind": "testSource" - } - ] - } - ], - "optionValues": { - "features": { - "each": "/features/*", - "value": "@key" - } - } - } - }, - "tasks": [ - { - "id": "build", - "displayName": "Build", - "group": "build", - "scopes": [ - "project" - ], - "arguments": [ - "build", - "--message-format=short", - "${optionArguments}" - ] - }, - { - "id": "check", - "displayName": "Check", - "group": "verification", - "scopes": [ - "project" - ], - "arguments": [ - "check", - "--message-format=short", - "${optionArguments}" - ] - }, - { - "id": "clean", - "displayName": "Clean", - "group": "build", - "scopes": [ - "project" - ], - "arguments": [ - "clean" - ] - }, - { - "id": "example", - "displayName": "Run Example", - "group": "run", - "execution": "application", - "scopes": [ - "target" - ], - "targetTags": [ - "example" - ], - "arguments": [ - "run", - "--example", - "${target.name}", - "${optionArguments}" - ] - } - ], - "run": [ - { - "id": "binary", - "fromTargets": { - "tags": [ - "application" - ] - }, - "arguments": [ - "run", - "--bin", - "${target.name}", - "${optionArguments}" - ], - "extension": { - "bin": "${target.name}" - } - } - ], - "test": { - "scopes": [ - "project", - "target" - ], - "targetTags": [ - "test" - ], - "filters": [ - "case" - ], - "arguments": [ - "test", - "${optionArguments}", - { - "value": "--test", - "when": "targetSelected" - }, - { - "value": "${target.name}", - "when": "targetSelected" - }, - { - "value": "--", - "when": "caseSelected" - }, - { - "value": "${test.case}", - "when": "caseSelected" - }, - { - "value": "--exact", - "when": "caseSelected" - } - ] - }, - "diagnostics": { - "decoder": "lineMatcher", - "patterns": [ - { - "regex": "^([^\\s:][^:]*\\.rs):(\\d+):(\\d+): (error|warning)(?:\\[\\w+\\])?: (.+)$", - "file": 1, - "line": 2, - "column": 3, - "severity": 4, - "message": 5 - } - ] - }, - "sync": { - "watch": [ - "Cargo.toml", - "Cargo.lock" - ] - }, - "layout": { - "excluded": [ - "target" - ] - } - } - ] -} diff --git a/shared/contracts/plugins/v1/fixtures/build-systems/build-model-consumer.plugin.json b/shared/contracts/plugins/v1/fixtures/build-systems/build-model-consumer.plugin.json deleted file mode 100644 index 57fc3c55c3..0000000000 --- a/shared/contracts/plugins/v1/fixtures/build-systems/build-model-consumer.plugin.json +++ /dev/null @@ -1,170 +0,0 @@ -{ - "schemaVersion": 2, - "id": "dev.lithe.fixture.model-consumer", - "displayName": "Model Consumer Fixture", - "version": "0.1.0", - "pluginAPIVersion": 3, - "requires": { - "buildProviders": 6, - "buildSystems": 1, - "serverProcess": 1, - "settings": 1, - "buildModelInputs": 1 - }, - "vendor": { - "id": "org.example", - "displayName": "Example", - "signatureRequirement": "publisherPackage" - }, - "permissions": [ - "languageServer.launch", - "process.build" - ], - "activationEvents": [ - "onBuildSystem:gradle" - ], - "languages": [], - "settings": [ - { - "id": "providerHeapMB", - "type": "integer", - "title": "Provider memory", - "description": "Upper bound of the Gradle provider's heap.", - "default": 1024, - "minimum": 256, - "maximum": 8192, - "unit": "MB" - } - ], - "buildSystems": [ - { - "id": "gradle", - "displayName": "Gradle", - "detection": { - "markers": [ - "build.gradle", - "build.gradle.kts", - "settings.gradle", - "settings.gradle.kts" - ], - "nesting": "outermost", - "priority": 60 - }, - "invocation": { - "executables": [ - { - "kind": "projectFile", - "path": "gradlew", - "requires": [ - "gradle/wrapper/gradle-wrapper.properties" - ], - "platforms": [ - "macos", - "linux" - ] - }, - { - "kind": "projectFile", - "path": "gradlew.bat", - "requires": [ - "gradle/wrapper/gradle-wrapper.properties" - ], - "platforms": [ - "windows" - ] - }, - { - "kind": "command", - "command": "gradle" - } - ], - "runtimeDependencies": [ - { - "id": "java", - "minimumVersion": "17" - } - ], - "globalArguments": [ - "--console=plain", - "${optionArguments}" - ] - }, - "provider": { - "launch": { - "kind": "runtime", - "tool": "java", - "minimumVersion": "17", - "runtimeArguments": [ - "-Xmx${setting:providerHeapMB}m" - ], - "entry": "provider/gradle-tooling-provider.jar" - }, - "arguments": [ - "--stdio", - "--cache", - "${workspaceStateDir}/tooling" - ], - "initializationOptions": { - "initScript": "${pluginDir}/provider/lithe-model.init.gradle" - }, - "executesProjectCode": true, - "mayUseNetwork": true - }, - "options": [ - { - "id": "offline", - "displayName": "Offline", - "kind": "boolean", - "arguments": [ - "--offline" - ] - } - ], - "model": { - "source": "provider" - }, - "tasks": [ - { - "id": "build", - "displayName": "Build", - "source": "provider", - "group": "build", - "scopes": [ - "workspace" - ], - "arguments": [] - } - ], - "run": [], - "dependencies": { - "source": "provider", - "scopes": [ - "workspace", - "project" - ] - }, - "sync": { - "watch": [ - "build.gradle", - "build.gradle.kts", - "gradle.properties", - "gradle/libs.versions.toml", - "settings.gradle", - "settings.gradle.kts" - ] - }, - "layout": { - "excluded": [ - ".gradle", - "build" - ] - }, - "modelInputs": [ - { - "pluginID": "dev.lithe.fixture.model-producer", - "buildSystemID": "source" - } - ] - } - ] -} diff --git a/shared/contracts/plugins/v1/fixtures/build-systems/build-model-producer.plugin.json b/shared/contracts/plugins/v1/fixtures/build-systems/build-model-producer.plugin.json deleted file mode 100644 index 92055e41d6..0000000000 --- a/shared/contracts/plugins/v1/fixtures/build-systems/build-model-producer.plugin.json +++ /dev/null @@ -1,158 +0,0 @@ -{ - "schemaVersion": 2, - "id": "dev.lithe.fixture.model-producer", - "displayName": "Model Producer Fixture", - "version": "0.1.0", - "pluginAPIVersion": 3, - "requires": { - "buildProviders": 1, - "buildSystems": 1, - "serverProcess": 1, - "settings": 1, - "buildModelInputs": 1 - }, - "vendor": { - "id": "org.example", - "displayName": "Example", - "signatureRequirement": "publisherPackage" - }, - "permissions": [ - "languageServer.launch", - "process.build" - ], - "activationEvents": [ - "onBuildSystem:source" - ], - "languages": [], - "settings": [ - { - "id": "providerHeapMB", - "type": "integer", - "title": "Provider memory", - "description": "Upper bound of the Gradle provider's heap.", - "default": 1024, - "minimum": 256, - "maximum": 8192, - "unit": "MB" - } - ], - "buildSystems": [ - { - "id": "source", - "displayName": "Source", - "detection": { - "markers": [ - "build.gradle", - "build.gradle.kts", - "settings.gradle", - "settings.gradle.kts" - ], - "nesting": "outermost", - "priority": 60 - }, - "invocation": { - "executables": [ - { - "kind": "projectFile", - "path": "gradlew", - "requires": [ - "gradle/wrapper/gradle-wrapper.properties" - ], - "platforms": [ - "macos", - "linux" - ] - }, - { - "kind": "projectFile", - "path": "gradlew.bat", - "requires": [ - "gradle/wrapper/gradle-wrapper.properties" - ], - "platforms": [ - "windows" - ] - }, - { - "kind": "command", - "command": "gradle" - } - ], - "runtimeDependencies": [ - { - "id": "java", - "minimumVersion": "17" - } - ], - "globalArguments": [ - "--console=plain", - "${optionArguments}" - ] - }, - "provider": { - "launch": { - "kind": "runtime", - "tool": "java", - "minimumVersion": "17", - "runtimeArguments": [ - "-Xmx${setting:providerHeapMB}m" - ], - "entry": "provider/gradle-tooling-provider.jar" - }, - "arguments": [ - "--stdio", - "--cache", - "${workspaceStateDir}/tooling" - ], - "initializationOptions": { - "initScript": "${pluginDir}/provider/lithe-model.init.gradle" - }, - "executesProjectCode": true, - "mayUseNetwork": true - }, - "options": [ - { - "id": "offline", - "displayName": "Offline", - "kind": "boolean", - "arguments": [ - "--offline" - ] - } - ], - "model": { - "source": "provider" - }, - "tasks": [], - "run": [], - "dependencies": { - "source": "provider", - "scopes": [ - "workspace", - "project" - ] - }, - "sync": { - "watch": [ - "build.gradle", - "build.gradle.kts", - "gradle.properties", - "gradle/libs.versions.toml", - "settings.gradle", - "settings.gradle.kts" - ] - }, - "layout": { - "excluded": [ - ".gradle", - "build" - ] - }, - "modelSharing": { - "options": [ - "offline" - ] - } - } - ] -} diff --git a/shared/contracts/plugins/v1/fixtures/build-systems/build-plans.json b/shared/contracts/plugins/v1/fixtures/build-systems/build-plans.json deleted file mode 100644 index c66169dd6e..0000000000 --- a/shared/contracts/plugins/v1/fixtures/build-systems/build-plans.json +++ /dev/null @@ -1,1981 +0,0 @@ -{ - "schemaVersion": 1, - "description": "Golden outcomes of the build.* commands for the build-system fixtures. Each case sends `request` with the named fixture manifest and build system, and expects the whole outcome envelope. `${workspace}` stands for an absolute, existing workspace root the test creates; it is substituted in requests and expectations alike.", - "cases": [ - { - "name": "cargo invocation is the cargo command", - "plugin": "build-static-file.plugin.json", - "buildSystemID": "cargo", - "operation": "invocationPlan", - "request": { - "root": "crates/app", - "platform": "macos" - }, - "expected": { - "status": "ok", - "invocation": { - "buildSystemID": "cargo", - "root": "crates/app", - "executables": [ - { - "kind": "command", - "command": "cargo" - } - ], - "environmentInputs": [], - "runtimeDependencies": [], - "version": { - "arguments": [ - "--version" - ] - }, - "minimumVersion": "1.70" - } - } - }, - { - "name": "cargo version meets the minimum", - "plugin": "build-static-file.plugin.json", - "buildSystemID": "cargo", - "operation": "checkToolVersion", - "request": { - "output": "cargo 1.82.0 (8f40fc59f 2024-08-21)\n" - }, - "expected": { - "status": "ok", - "version": { - "satisfied": true, - "version": "1.82.0" - } - } - }, - { - "name": "cargo version below the minimum", - "plugin": "build-static-file.plugin.json", - "buildSystemID": "cargo", - "operation": "checkToolVersion", - "request": { - "output": "cargo 1.65.0 (4bc8f24d3 2022-10-20)\n" - }, - "expected": { - "status": "ok", - "version": { - "satisfied": false, - "version": "1.65.0" - } - } - }, - { - "name": "cargo build puts options after the subcommand", - "plugin": "build-static-file.plugin.json", - "buildSystemID": "cargo", - "operation": "taskPlan", - "request": { - "root": "crates/app", - "task": "build", - "project": { - "path": "crates/app", - "name": "app" - }, - "options": { - "release": true, - "features": [ - "serde", - "cli", - "serde" - ] - } - }, - "expected": { - "status": "ok", - "plan": { - "buildSystemID": "cargo", - "root": "crates/app", - "arguments": [ - "build", - "--message-format=short", - "--release", - "--features", - "cli,serde" - ], - "environment": {}, - "workingDirectory": "crates/app", - "execution": "task", - "optionFingerprint": "2c2b95fc66b1b63663b3ed598ca82767b0241fafe752edecfa94724c5fbcb55f" - } - } - }, - { - "name": "cargo example needs its target", - "plugin": "build-static-file.plugin.json", - "buildSystemID": "cargo", - "operation": "taskPlan", - "request": { - "root": ".", - "task": "example", - "project": { - "path": ".", - "name": "app" - }, - "target": { - "name": "demo", - "tags": [ - "example" - ] - } - }, - "expected": { - "status": "ok", - "plan": { - "buildSystemID": "cargo", - "root": ".", - "arguments": [ - "run", - "--example", - "demo" - ], - "environment": {}, - "workingDirectory": ".", - "execution": "application", - "optionFingerprint": "88f2074b94ba42d86684c879132be55f137f292c4d312d11da9a64c46f400e28" - } - } - }, - { - "name": "cargo example refuses a binary target", - "plugin": "build-static-file.plugin.json", - "buildSystemID": "cargo", - "operation": "taskPlan", - "request": { - "root": ".", - "task": "example", - "project": { - "path": ".", - "name": "app" - }, - "target": { - "name": "app", - "tags": [ - "application" - ] - } - }, - "expected": { - "status": "rejected", - "error": { - "code": "plugin.build.invalidSelection", - "message": "The task example does not apply to this target." - } - } - }, - { - "name": "cargo example refuses the project scope", - "plugin": "build-static-file.plugin.json", - "buildSystemID": "cargo", - "operation": "taskPlan", - "request": { - "root": ".", - "task": "example", - "project": { - "path": ".", - "name": "app" - } - }, - "expected": { - "status": "rejected", - "error": { - "code": "plugin.build.invalidSelection", - "message": "The task example does not run on a project." - } - } - }, - { - "name": "cargo test selects one exact case", - "plugin": "build-static-file.plugin.json", - "buildSystemID": "cargo", - "operation": "testPlan", - "request": { - "root": ".", - "project": { - "path": ".", - "name": "app" - }, - "case": "parser::parses_empty" - }, - "expected": { - "status": "ok", - "plan": { - "buildSystemID": "cargo", - "root": ".", - "arguments": [ - "test", - "--", - "parser::parses_empty", - "--exact" - ], - "environment": {}, - "workingDirectory": ".", - "execution": "task", - "optionFingerprint": "88f2074b94ba42d86684c879132be55f137f292c4d312d11da9a64c46f400e28", - "results": null - } - } - }, - { - "name": "cargo test selects an integration target", - "plugin": "build-static-file.plugin.json", - "buildSystemID": "cargo", - "operation": "testPlan", - "request": { - "root": ".", - "project": { - "path": ".", - "name": "app" - }, - "target": { - "name": "cli", - "tags": [ - "test" - ] - }, - "case": "runs" - }, - "expected": { - "status": "ok", - "plan": { - "buildSystemID": "cargo", - "root": ".", - "arguments": [ - "test", - "--test", - "cli", - "--", - "runs", - "--exact" - ], - "environment": {}, - "workingDirectory": ".", - "execution": "task", - "optionFingerprint": "88f2074b94ba42d86684c879132be55f137f292c4d312d11da9a64c46f400e28", - "results": null - } - } - }, - { - "name": "cargo test refuses a binary target", - "plugin": "build-static-file.plugin.json", - "buildSystemID": "cargo", - "operation": "testPlan", - "request": { - "root": ".", - "project": { - "path": ".", - "name": "app" - }, - "target": { - "name": "app", - "tags": [ - "application" - ] - } - }, - "expected": { - "status": "rejected", - "error": { - "code": "plugin.build.invalidSelection", - "message": "Cargo does not run tests on this target." - } - } - }, - { - "name": "cargo test cannot select a suite", - "plugin": "build-static-file.plugin.json", - "buildSystemID": "cargo", - "operation": "testPlan", - "request": { - "root": ".", - "project": { - "path": ".", - "name": "app" - }, - "suite": "parser" - }, - "expected": { - "status": "rejected", - "error": { - "code": "plugin.build.invalidSelection", - "message": "Cargo cannot select a single test Suite." - } - } - }, - { - "name": "cargo options keep known values and drop the rest", - "plugin": "build-static-file.plugin.json", - "buildSystemID": "cargo", - "operation": "resolveOptions", - "request": { - "options": { - "release": true, - "features": [ - "serde", - "bogus" - ], - "removed": "x" - }, - "modelValues": { - "features": [ - "cli", - "serde" - ] - } - }, - "expected": { - "status": "ok", - "options": { - "options": [ - { - "id": "release", - "displayName": "Release Profile", - "kind": "boolean", - "value": true, - "source": "user", - "choices": [], - "allowCustom": false - }, - { - "id": "features", - "displayName": "Features", - "kind": "multiSelect", - "value": [ - "serde" - ], - "source": "user", - "choices": [ - { - "value": "cli", - "fromModel": true - }, - { - "value": "serde", - "fromModel": true - } - ], - "allowCustom": false - }, - { - "id": "offline", - "displayName": "Offline", - "kind": "boolean", - "value": false, - "source": "unset", - "choices": [], - "allowCustom": false - } - ], - "dropped": [ - "features", - "removed" - ], - "fingerprint": "0ad75178ebc24b24a4af56a3e9338d74255ab3d0d3c3627f9744967b8b0b9685" - } - } - }, - { - "name": "cargo options accept model values before a model exists", - "plugin": "build-static-file.plugin.json", - "buildSystemID": "cargo", - "operation": "resolveOptions", - "request": { - "options": { - "features": [ - "serde" - ] - } - }, - "expected": { - "status": "ok", - "options": { - "options": [ - { - "id": "release", - "displayName": "Release Profile", - "kind": "boolean", - "value": false, - "source": "unset", - "choices": [], - "allowCustom": false - }, - { - "id": "features", - "displayName": "Features", - "kind": "multiSelect", - "value": [ - "serde" - ], - "source": "user", - "choices": [], - "allowCustom": false - }, - { - "id": "offline", - "displayName": "Offline", - "kind": "boolean", - "value": false, - "source": "unset", - "choices": [], - "allowCustom": false - } - ], - "dropped": [], - "fingerprint": "11a1daf676a5920abec57f23aeb43fb82c65ac00efbe64eec02965c9ca3a1c4b" - } - } - }, - { - "name": "cargo short diagnostics", - "plugin": "build-static-file.plugin.json", - "buildSystemID": "cargo", - "operation": "decodeDiagnostics", - "request": { - "workspaceRoot": "${workspace}", - "root": "crates/app", - "output": " Compiling app v0.1.0\nsrc/main.rs:4:9: error[E0425]: cannot find value `x` in this scope\nsrc/lib.rs:10:1: warning: unused import: `std::fs`\nsrc/main.rs:4:9: error[E0425]: cannot find value `x` in this scope\nerror: could not compile `app`\n" - }, - "expected": { - "status": "ok", - "diagnostics": [ - { - "path": "crates/app/src/main.rs", - "line": 4, - "column": 9, - "severity": "error", - "message": "cannot find value `x` in this scope" - }, - { - "path": "crates/app/src/lib.rs", - "line": 10, - "column": 1, - "severity": "warning", - "message": "unused import: `std::fs`" - } - ] - } - }, - { - "name": "go runs through the host-managed runtime", - "plugin": "build-command-stdout.plugin.json", - "buildSystemID": "go", - "operation": "invocationPlan", - "request": { - "root": ".", - "platform": "windows" - }, - "expected": { - "status": "ok", - "invocation": { - "buildSystemID": "go", - "root": ".", - "executables": [ - { - "kind": "runtime", - "runtime": "go" - } - ], - "environmentInputs": [], - "runtimeDependencies": [ - { - "id": "go", - "displayName": null, - "hostManaged": true, - "minimumVersion": "1.21", - "executables": [], - "version": { - "arguments": [ - "version" - ] - } - } - ], - "version": null, - "minimumVersion": null - } - } - }, - { - "name": "go runtime version", - "plugin": "build-command-stdout.plugin.json", - "buildSystemID": "go", - "operation": "checkToolVersion", - "request": { - "runtime": "go", - "output": "go version go1.22.3 darwin/arm64\n" - }, - "expected": { - "status": "ok", - "version": { - "satisfied": true, - "version": "1.22.3" - } - } - }, - { - "name": "go runtime below the minimum", - "plugin": "build-command-stdout.plugin.json", - "buildSystemID": "go", - "operation": "checkToolVersion", - "request": { - "runtime": "go", - "output": "go version go1.20.14 linux/amd64\n" - }, - "expected": { - "status": "ok", - "version": { - "satisfied": false, - "version": "1.20.14" - } - } - }, - { - "name": "go model is a json stream on stdout", - "plugin": "build-command-stdout.plugin.json", - "buildSystemID": "go", - "operation": "modelPlan", - "request": { - "root": "." - }, - "expected": { - "status": "ok", - "plan": { - "buildSystemID": "go", - "root": ".", - "arguments": [ - "list", - "-json", - "./..." - ], - "environment": {}, - "workingDirectory": ".", - "execution": "task", - "optionFingerprint": "07c24ec6a45d7776fbcd5c22e3bbc7737d76d907d936bc9b851b36f2c57c4eea", - "output": "stdout", - "decoder": "jsonStream", - "executesProjectCode": false, - "mayUseNetwork": true - } - } - }, - { - "name": "go list output becomes projects, targets, and run entries", - "plugin": "build-command-stdout.plugin.json", - "buildSystemID": "go", - "operation": "decodeModel", - "request": { - "workspaceRoot": "${workspace}", - "root": "shop", - "output": "{\n \"Dir\": \"${workspace}/shop\",\n \"ImportPath\": \"example.com/shop\",\n \"Name\": \"shop\",\n \"GoFiles\": [\n \"shop.go\"\n ],\n \"TestGoFiles\": [\n \"shop_test.go\"\n ],\n \"Module\": {\n \"Path\": \"example.com/shop\",\n \"Dir\": \"${workspace}/shop\",\n \"GoVersion\": \"1.22\"\n }\n}\n{\n \"Dir\": \"${workspace}/shop/cmd/api\",\n \"ImportPath\": \"example.com/shop/cmd/api\",\n \"Name\": \"main\",\n \"GoFiles\": [\n \"main.go\"\n ],\n \"Module\": {\n \"Path\": \"example.com/shop\",\n \"Dir\": \"${workspace}/shop\",\n \"GoVersion\": \"1.22\"\n }\n}\n{\n \"Dir\": \"${workspace}/shop/cmd/worker\",\n \"ImportPath\": \"example.com/shop/cmd/worker\",\n \"Name\": \"main\",\n \"GoFiles\": [\n \"main.go\"\n ],\n \"Module\": {\n \"Path\": \"example.com/shop\",\n \"Dir\": \"${workspace}/shop\",\n \"GoVersion\": \"1.22\"\n }\n}", - "options": { - "race": true - } - }, - "expected": { - "status": "ok", - "model": { - "projects": [ - { - "id": "go:shop/example.com/shop", - "path": "shop", - "name": "example.com/shop", - "properties": { - "goVersion": "1.22" - } - } - ], - "targets": [ - { - "id": "go.test:shop/example.com/shop", - "projectID": "go:shop/example.com/shop", - "name": "example.com/shop", - "path": "shop", - "tags": [ - "test" - ], - "properties": {} - }, - { - "id": "go.application:shop/cmd/api/example.com/shop/cmd/api", - "projectID": "go:shop/example.com/shop", - "name": "example.com/shop/cmd/api", - "path": "shop/cmd/api", - "tags": [ - "application" - ], - "properties": { - "short": "api" - } - }, - { - "id": "go.application:shop/cmd/worker/example.com/shop/cmd/worker", - "projectID": "go:shop/example.com/shop", - "name": "example.com/shop/cmd/worker", - "path": "shop/cmd/worker", - "tags": [ - "application" - ], - "properties": { - "short": "worker" - } - } - ], - "tasks": [], - "contentRoots": [], - "optionValues": {}, - "run": [ - { - "id": "go.main:shop/api", - "name": "api", - "provider": "go.main", - "execution": "application", - "command": null, - "args": [ - "run", - "-race", - "example.com/shop/cmd/api" - ], - "cwd": "shop", - "env": {}, - "source": null, - "buildSystem": { - "id": "go", - "root": "shop", - "projectID": "go:shop/example.com/shop", - "targetID": "go.application:shop/cmd/api/example.com/shop/cmd/api", - "optionFingerprint": "2812b34f5d8bc2a5bf8988fc84f16180a18353d6b31f886d9b2729eb41d27994" - } - }, - { - "id": "go.main:shop/worker", - "name": "worker", - "provider": "go.main", - "execution": "application", - "command": null, - "args": [ - "run", - "-race", - "example.com/shop/cmd/worker" - ], - "cwd": "shop", - "env": {}, - "source": null, - "buildSystem": { - "id": "go", - "root": "shop", - "projectID": "go:shop/example.com/shop", - "targetID": "go.application:shop/cmd/worker/example.com/shop/cmd/worker", - "optionFingerprint": "2812b34f5d8bc2a5bf8988fc84f16180a18353d6b31f886d9b2729eb41d27994" - } - } - ] - } - } - }, - { - "name": "go dependencies of a module", - "plugin": "build-command-stdout.plugin.json", - "buildSystemID": "go", - "operation": "dependencyPlan", - "request": { - "root": "shop", - "project": { - "path": "shop", - "name": "example.com/shop" - } - }, - "expected": { - "status": "ok", - "plan": { - "buildSystemID": "go", - "root": "shop", - "arguments": [ - "list", - "-m", - "-json", - "all" - ], - "environment": {}, - "workingDirectory": "shop", - "execution": "task", - "optionFingerprint": "07c24ec6a45d7776fbcd5c22e3bbc7737d76d907d936bc9b851b36f2c57c4eea", - "output": "stdout", - "decoder": "jsonStream", - "executesProjectCode": false, - "mayUseNetwork": true - } - } - }, - { - "name": "go module list skips the main module", - "plugin": "build-command-stdout.plugin.json", - "buildSystemID": "go", - "operation": "decodeDependencies", - "request": { - "workspaceRoot": "${workspace}", - "root": "shop", - "project": "shop", - "output": "{\"Path\": \"example.com/shop\", \"Main\": true, \"Dir\": \"${workspace}/shop\", \"GoVersion\": \"1.22\"}\n{\"Path\": \"github.com/google/uuid\", \"Version\": \"v1.6.0\"}\n{\"Path\": \"golang.org/x/text\", \"Version\": \"v0.14.0\", \"Indirect\": true}" - }, - "expected": { - "status": "ok", - "dependencies": { - "project": "shop", - "dependencies": [ - { - "name": "github.com/google/uuid", - "version": "v1.6.0", - "children": [] - }, - { - "name": "golang.org/x/text", - "version": "v0.14.0", - "properties": { - "indirect": "true" - }, - "children": [] - } - ], - "truncated": false - } - } - }, - { - "name": "go test escapes the case name", - "plugin": "build-command-stdout.plugin.json", - "buildSystemID": "go", - "operation": "testPlan", - "request": { - "root": "shop", - "project": { - "path": "shop", - "name": "example.com/shop" - }, - "target": { - "name": "example.com/shop", - "tags": [ - "test" - ] - }, - "case": "TestOrder/refund.full" - }, - "expected": { - "status": "ok", - "plan": { - "buildSystemID": "go", - "root": "shop", - "arguments": [ - "test", - "example.com/shop", - "-run", - "^TestOrder/refund\\.full$" - ], - "environment": {}, - "workingDirectory": "shop", - "execution": "task", - "optionFingerprint": "07c24ec6a45d7776fbcd5c22e3bbc7737d76d907d936bc9b851b36f2c57c4eea", - "results": null - } - } - }, - { - "name": "go diagnostics relative to the module", - "plugin": "build-command-stdout.plugin.json", - "buildSystemID": "go", - "operation": "decodeDiagnostics", - "request": { - "workspaceRoot": "${workspace}", - "root": "shop", - "output": "# example.com/shop/cmd/api\ncmd/api/main.go:5:2: undefined: handler\n./shop.go:12: missing return\n" - }, - "expected": { - "status": "ok", - "diagnostics": [ - { - "path": "shop/cmd/api/main.go", - "line": 5, - "column": 2, - "severity": "error", - "message": "undefined: handler" - }, - { - "path": "shop/shop.go", - "line": 12, - "severity": "error", - "message": "missing return" - } - ] - } - }, - { - "name": "gradle prefers the unix wrapper", - "plugin": "build-command-output-file.plugin.json", - "buildSystemID": "gradle", - "operation": "invocationPlan", - "request": { - "root": "build-logic", - "platform": "linux" - }, - "expected": { - "status": "ok", - "invocation": { - "buildSystemID": "gradle", - "root": "build-logic", - "executables": [ - { - "kind": "projectFile", - "path": "build-logic/gradlew", - "requires": [ - "build-logic/gradle/wrapper/gradle-wrapper.properties" - ], - "executesProjectCode": true - }, - { - "kind": "environment", - "variable": "GRADLE_HOME", - "path": "bin/gradle" - }, - { - "kind": "command", - "command": "gradle" - } - ], - "environmentInputs": [ - "GRADLE_HOME" - ], - "runtimeDependencies": [ - { - "id": "java", - "displayName": null, - "hostManaged": false, - "minimumVersion": "17", - "executables": [ - { - "kind": "toolchain", - "toolchainID": "java", - "root": "build-logic" - } - ], - "version": null - } - ], - "version": { - "arguments": [ - "--version" - ] - }, - "minimumVersion": "7.6" - } - } - }, - { - "name": "gradle prefers the batch wrapper on windows", - "plugin": "build-command-output-file.plugin.json", - "buildSystemID": "gradle", - "operation": "invocationPlan", - "request": { - "root": ".", - "platform": "windows" - }, - "expected": { - "status": "ok", - "invocation": { - "buildSystemID": "gradle", - "root": ".", - "executables": [ - { - "kind": "projectFile", - "path": "gradlew.bat", - "requires": [ - "gradle/wrapper/gradle-wrapper.properties" - ], - "executesProjectCode": true - }, - { - "kind": "environment", - "variable": "GRADLE_HOME", - "path": "bin/gradle.bat" - }, - { - "kind": "command", - "command": "gradle" - } - ], - "environmentInputs": [ - "GRADLE_HOME" - ], - "runtimeDependencies": [ - { - "id": "java", - "displayName": null, - "hostManaged": false, - "minimumVersion": "17", - "executables": [ - { - "kind": "toolchain", - "toolchainID": "java", - "root": "." - } - ], - "version": null - } - ], - "version": { - "arguments": [ - "--version" - ] - }, - "minimumVersion": "7.6" - } - } - }, - { - "name": "gradle two-part version", - "plugin": "build-command-output-file.plugin.json", - "buildSystemID": "gradle", - "operation": "checkToolVersion", - "request": { - "output": "\n------------------------------------------------------------\nGradle 8.10\n------------------------------------------------------------\n" - }, - "expected": { - "status": "ok", - "version": { - "satisfied": true, - "version": "8.10" - } - } - }, - { - "name": "gradle model runs the init script into the output file", - "plugin": "build-command-output-file.plugin.json", - "buildSystemID": "gradle", - "operation": "modelPlan", - "request": { - "root": ".", - "pluginDirectory": "${workspace}/plugins/gradle", - "outputFile": "${workspace}/state/model.json", - "options": { - "offline": true - } - }, - "expected": { - "status": "ok", - "plan": { - "buildSystemID": "gradle", - "root": ".", - "arguments": [ - "--console=plain", - "--offline", - "-q", - "--init-script", - "${workspace}/plugins/gradle/lithe-model.init.gradle", - "litheModel", - "-PlitheModelOutput=${workspace}/state/model.json" - ], - "environment": {}, - "workingDirectory": ".", - "execution": "task", - "optionFingerprint": "352a3ccd7eb04a8babcfabaa3b76304c71e0f28d6de841e417266aadd183ab39", - "output": "outputFile", - "decoder": "litheBuildModel", - "executesProjectCode": true, - "mayUseNetwork": true - } - } - }, - { - "name": "gradle model needs an output file", - "plugin": "build-command-output-file.plugin.json", - "buildSystemID": "gradle", - "operation": "modelPlan", - "request": { - "root": ".", - "pluginDirectory": "${workspace}/plugins/gradle" - }, - "expected": { - "status": "rejected", - "error": { - "code": "plugin.build.invalidSelection", - "message": "This command writes to a file; pass outputFile." - } - } - }, - { - "name": "gradle build of one project", - "plugin": "build-command-output-file.plugin.json", - "buildSystemID": "gradle", - "operation": "taskPlan", - "request": { - "root": ".", - "task": "build", - "project": { - "path": "app", - "name": "app", - "properties": { - "taskPrefix": ":app:" - } - }, - "options": { - "offline": true, - "buildCache": false - } - }, - "expected": { - "status": "ok", - "plan": { - "buildSystemID": "gradle", - "root": ".", - "arguments": [ - "--console=plain", - "--offline", - ":app:build" - ], - "environment": {}, - "workingDirectory": ".", - "execution": "task", - "optionFingerprint": "352a3ccd7eb04a8babcfabaa3b76304c71e0f28d6de841e417266aadd183ab39" - } - } - }, - { - "name": "gradle build of the whole build", - "plugin": "build-command-output-file.plugin.json", - "buildSystemID": "gradle", - "operation": "taskPlan", - "request": { - "root": ".", - "task": "build" - }, - "expected": { - "status": "ok", - "plan": { - "buildSystemID": "gradle", - "root": ".", - "arguments": [ - "--console=plain", - "build" - ], - "environment": {}, - "workingDirectory": ".", - "execution": "task", - "optionFingerprint": "412601eb5af95d4cd3c162065322aaec6b3d65fda1f35257942f5d8b8a0f5a9e" - } - } - }, - { - "name": "gradle model task runs by its path", - "plugin": "build-command-output-file.plugin.json", - "buildSystemID": "gradle", - "operation": "taskPlan", - "request": { - "root": ".", - "task": "gradle-task", - "project": { - "path": "app", - "name": "app" - }, - "modelTask": { - "name": "bootRun", - "execution": "service", - "properties": { - "path": ":app:bootRun" - } - }, - "userArguments": [ - "--args=--debug" - ] - }, - "expected": { - "status": "ok", - "plan": { - "buildSystemID": "gradle", - "root": ".", - "arguments": [ - "--console=plain", - ":app:bootRun", - "--args=--debug" - ], - "environment": {}, - "workingDirectory": ".", - "execution": "service", - "optionFingerprint": "412601eb5af95d4cd3c162065322aaec6b3d65fda1f35257942f5d8b8a0f5a9e" - } - } - }, - { - "name": "gradle arbitrary tasks need arguments", - "plugin": "build-command-output-file.plugin.json", - "buildSystemID": "gradle", - "operation": "taskPlan", - "request": { - "root": ".", - "task": "tasks", - "userArguments": [ - "dependencies", - "--configuration", - "runtimeClasspath" - ] - }, - "expected": { - "status": "ok", - "plan": { - "buildSystemID": "gradle", - "root": ".", - "arguments": [ - "--console=plain", - "dependencies", - "--configuration", - "runtimeClasspath" - ], - "environment": {}, - "workingDirectory": ".", - "execution": "task", - "optionFingerprint": "412601eb5af95d4cd3c162065322aaec6b3d65fda1f35257942f5d8b8a0f5a9e" - } - } - }, - { - "name": "gradle build takes no user arguments", - "plugin": "build-command-output-file.plugin.json", - "buildSystemID": "gradle", - "operation": "taskPlan", - "request": { - "root": ".", - "task": "build", - "userArguments": [ - "--scan" - ] - }, - "expected": { - "status": "rejected", - "error": { - "code": "plugin.build.invalidSelection", - "message": "This command takes no extra arguments." - } - } - }, - { - "name": "gradle test of one method", - "plugin": "build-command-output-file.plugin.json", - "buildSystemID": "gradle", - "operation": "testPlan", - "request": { - "root": ".", - "project": { - "path": "app", - "name": "app", - "properties": { - "taskPrefix": ":app:" - } - }, - "suite": "com.example.OrderTest", - "case": "refunds" - }, - "expected": { - "status": "ok", - "plan": { - "buildSystemID": "gradle", - "root": ".", - "arguments": [ - "--console=plain", - ":app:test", - "--tests", - "com.example.OrderTest.refunds" - ], - "environment": {}, - "workingDirectory": ".", - "execution": "task", - "optionFingerprint": "412601eb5af95d4cd3c162065322aaec6b3d65fda1f35257942f5d8b8a0f5a9e", - "results": { - "decoder": "junitXml", - "reports": [ - "app/build/test-results/test/*.xml" - ] - } - } - } - }, - { - "name": "gradle test refuses a case without its suite", - "plugin": "build-command-output-file.plugin.json", - "buildSystemID": "gradle", - "operation": "testPlan", - "request": { - "root": ".", - "project": { - "path": "app", - "name": "app", - "properties": { - "taskPrefix": ":app:" - } - }, - "case": "refunds" - }, - "expected": { - "status": "rejected", - "error": { - "code": "plugin.build.invalidSelection", - "message": "Gradle cannot select this test case without its suite." - } - } - }, - { - "name": "gradle workspace test collects every model project's reports", - "plugin": "build-command-output-file.plugin.json", - "buildSystemID": "gradle", - "operation": "testPlan", - "request": { - "root": ".", - "projects": [ - "app", - "lib" - ] - }, - "expected": { - "status": "ok", - "plan": { - "buildSystemID": "gradle", - "root": ".", - "arguments": [ - "--console=plain", - "test" - ], - "environment": {}, - "workingDirectory": ".", - "execution": "task", - "optionFingerprint": "412601eb5af95d4cd3c162065322aaec6b3d65fda1f35257942f5d8b8a0f5a9e", - "results": { - "decoder": "junitXml", - "reports": [ - "build/test-results/test/*.xml", - "app/build/test-results/test/*.xml", - "lib/build/test-results/test/*.xml" - ] - } - } - } - }, - { - "name": "gradle dependencies of the root project", - "plugin": "build-command-output-file.plugin.json", - "buildSystemID": "gradle", - "operation": "dependencyPlan", - "request": { - "root": ".", - "pluginDirectory": "${workspace}/plugins/gradle", - "outputFile": "${workspace}/state/deps.json" - }, - "expected": { - "status": "ok", - "plan": { - "buildSystemID": "gradle", - "root": ".", - "arguments": [ - "--console=plain", - "-q", - "--init-script", - "${workspace}/plugins/gradle/lithe-model.init.gradle", - "litheDependencies", - "-PlitheDependenciesOutput=${workspace}/state/deps.json" - ], - "environment": {}, - "workingDirectory": ".", - "execution": "task", - "optionFingerprint": "412601eb5af95d4cd3c162065322aaec6b3d65fda1f35257942f5d8b8a0f5a9e", - "output": "outputFile", - "decoder": "litheDependencies", - "executesProjectCode": true, - "mayUseNetwork": true - } - } - }, - { - "name": "gradle javac and kotlin diagnostics", - "plugin": "build-command-output-file.plugin.json", - "buildSystemID": "gradle", - "operation": "decodeDiagnostics", - "request": { - "workspaceRoot": "${workspace}", - "root": ".", - "output": "> Task :app:compileJava\n${workspace}/app/src/main/java/demo/App.java:7: error: ';' expected\n${workspace}/app/src/main/java/demo/App.java:9: warning: [deprecation] old() in Util has been deprecated\nw: file://${workspace}/lib/src/main/kotlin/Lib.kt:3:5 Parameter 'x' is never used\n/elsewhere/Other.java:1: error: outside the workspace\n" - }, - "expected": { - "status": "ok", - "diagnostics": [ - { - "path": "app/src/main/java/demo/App.java", - "line": 7, - "severity": "error", - "message": "';' expected" - }, - { - "path": "app/src/main/java/demo/App.java", - "line": 9, - "severity": "warning", - "message": "[deprecation] old() in Util has been deprecated" - }, - { - "path": "lib/src/main/kotlin/Lib.kt", - "line": 3, - "column": 5, - "severity": "warning", - "message": "Parameter 'x' is never used" - } - ] - } - }, - { - "name": "gradle provider model is a request for the provider with the option values", - "plugin": "build-provider.plugin.json", - "buildSystemID": "gradle", - "operation": "modelPlan", - "request": { - "root": ".", - "options": { - "offline": true - } - }, - "expected": { - "status": "ok", - "plan": { - "buildSystemID": "gradle", - "root": ".", - "provider": { - "method": "lithe/build/model", - "params": { - "buildSystemID": "gradle", - "root": ".", - "options": { - "offline": true - }, - "optionArguments": [ - "--offline" - ], - "environment": {} - } - }, - "decoder": "litheBuildModel", - "executesProjectCode": true, - "mayUseNetwork": true, - "optionFingerprint": "352a3ccd7eb04a8babcfabaa3b76304c71e0f28d6de841e417266aadd183ab39" - } - } - }, - { - "name": "gradle provider model covers the whole instance", - "plugin": "build-provider.plugin.json", - "buildSystemID": "gradle", - "operation": "modelPlan", - "request": { - "root": ".", - "project": { - "path": "app", - "name": "app" - } - }, - "expected": { - "status": "rejected", - "error": { - "code": "plugin.build.invalidSelection", - "message": "The model request covers the whole instance." - } - } - }, - { - "name": "gradle provider dependencies of a project name the project", - "plugin": "build-provider.plugin.json", - "buildSystemID": "gradle", - "operation": "dependencyPlan", - "request": { - "root": ".", - "project": { - "path": "app", - "name": "app", - "properties": { - "taskPrefix": ":app:" - } - } - }, - "expected": { - "status": "ok", - "plan": { - "buildSystemID": "gradle", - "root": ".", - "provider": { - "method": "lithe/build/dependencies", - "params": { - "project": { - "name": "app", - "path": "app" - }, - "buildSystemID": "gradle", - "root": ".", - "options": {}, - "optionArguments": [], - "environment": {} - } - }, - "decoder": "litheDependencies", - "executesProjectCode": true, - "mayUseNetwork": true, - "optionFingerprint": "412601eb5af95d4cd3c162065322aaec6b3d65fda1f35257942f5d8b8a0f5a9e" - } - } - }, - { - "name": "gradle provider model reload carries refresh and the resolved tool", - "plugin": "build-provider.plugin.json", - "buildSystemID": "gradle", - "operation": "modelPlan", - "request": { - "root": ".", - "options": { - "offline": true - }, - "refresh": true, - "tool": { - "executable": "${workspace}/tools/gradle/bin/gradle" - } - }, - "expected": { - "status": "ok", - "plan": { - "buildSystemID": "gradle", - "root": ".", - "provider": { - "method": "lithe/build/model", - "params": { - "refresh": true, - "tool": { - "executable": "${workspace}/tools/gradle/bin/gradle" - }, - "buildSystemID": "gradle", - "root": ".", - "options": { - "offline": true - }, - "optionArguments": [ - "--offline" - ], - "environment": {} - } - }, - "decoder": "litheBuildModel", - "executesProjectCode": true, - "mayUseNetwork": true, - "optionFingerprint": "352a3ccd7eb04a8babcfabaa3b76304c71e0f28d6de841e417266aadd183ab39" - } - } - }, - { - "name": "gradle provider model without a reload leaves refresh out", - "plugin": "build-provider.plugin.json", - "buildSystemID": "gradle", - "operation": "modelPlan", - "request": { - "root": ".", - "options": { - "offline": true - }, - "refresh": false - }, - "expected": { - "status": "ok", - "plan": { - "buildSystemID": "gradle", - "root": ".", - "provider": { - "method": "lithe/build/model", - "params": { - "buildSystemID": "gradle", - "root": ".", - "options": { - "offline": true - }, - "optionArguments": [ - "--offline" - ], - "environment": {} - } - }, - "decoder": "litheBuildModel", - "executesProjectCode": true, - "mayUseNetwork": true, - "optionFingerprint": "352a3ccd7eb04a8babcfabaa3b76304c71e0f28d6de841e417266aadd183ab39" - } - } - }, - { - "name": "gradle provider dependency reload carries refresh and the resolved tool", - "plugin": "build-provider.plugin.json", - "buildSystemID": "gradle", - "operation": "dependencyPlan", - "request": { - "root": ".", - "project": { - "path": "app", - "name": "app", - "properties": { - "taskPrefix": ":app:" - } - }, - "refresh": true, - "tool": { - "executable": "${workspace}/tools/gradle/bin/gradle" - } - }, - "expected": { - "status": "ok", - "plan": { - "buildSystemID": "gradle", - "root": ".", - "provider": { - "method": "lithe/build/dependencies", - "params": { - "refresh": true, - "tool": { - "executable": "${workspace}/tools/gradle/bin/gradle" - }, - "project": { - "name": "app", - "path": "app" - }, - "buildSystemID": "gradle", - "root": ".", - "options": {}, - "optionArguments": [], - "environment": {} - } - }, - "decoder": "litheDependencies", - "executesProjectCode": true, - "mayUseNetwork": true, - "optionFingerprint": "412601eb5af95d4cd3c162065322aaec6b3d65fda1f35257942f5d8b8a0f5a9e" - } - } - }, - { - "name": "gradle provider tool must be an absolute path", - "plugin": "build-provider.plugin.json", - "buildSystemID": "gradle", - "operation": "modelPlan", - "request": { - "root": ".", - "options": { - "offline": true - }, - "tool": { - "executable": "tools/gradle/bin/gradle" - } - }, - "expected": { - "status": "rejected", - "error": { - "code": "plugin.build.invalidSelection", - "message": "tool.executable must be an absolute path." - } - } - }, - { - "name": "gradle model command ignores the provider refresh and tool", - "plugin": "build-command-output-file.plugin.json", - "buildSystemID": "gradle", - "operation": "modelPlan", - "request": { - "root": ".", - "pluginDirectory": "${workspace}/plugins/gradle", - "outputFile": "${workspace}/state/model.json", - "options": { - "offline": true - }, - "refresh": true, - "tool": { - "executable": "${workspace}/tools/gradle/bin/gradle" - } - }, - "expected": { - "status": "ok", - "plan": { - "buildSystemID": "gradle", - "root": ".", - "arguments": [ - "--console=plain", - "--offline", - "-q", - "--init-script", - "${workspace}/plugins/gradle/lithe-model.init.gradle", - "litheModel", - "-PlitheModelOutput=${workspace}/state/model.json" - ], - "environment": {}, - "workingDirectory": ".", - "execution": "task", - "optionFingerprint": "352a3ccd7eb04a8babcfabaa3b76304c71e0f28d6de841e417266aadd183ab39", - "output": "outputFile", - "decoder": "litheBuildModel", - "executesProjectCode": true, - "mayUseNetwork": true - } - } - }, - { - "name": "gradle provider model result becomes projects, tasks, and run entries", - "plugin": "build-provider.plugin.json", - "buildSystemID": "gradle", - "operation": "decodeModel", - "request": { - "workspaceRoot": "${workspace}", - "root": ".", - "result": { - "format": "litheBuildModel", - "version": 1, - "projects": [ - { - "path": ".", - "name": "shop", - "properties": { - "taskPrefix": ":" - } - }, - { - "path": "app", - "name": "app", - "properties": { - "taskPrefix": ":app:" - } - } - ], - "tasks": [ - { - "project": "app", - "name": "bootRun", - "template": "gradle-task", - "execution": "service", - "properties": { - "path": ":app:bootRun" - } - }, - { - "project": "app", - "name": "jar", - "template": "gradle-task", - "properties": { - "path": ":app:jar" - } - } - ] - } - }, - "expected": { - "status": "ok", - "model": { - "projects": [ - { - "id": "gradle:shop", - "path": ".", - "name": "shop", - "properties": { - "taskPrefix": ":" - } - }, - { - "id": "gradle:app/app", - "path": "app", - "name": "app", - "parentID": "gradle:shop", - "properties": { - "taskPrefix": ":app:" - } - } - ], - "targets": [], - "tasks": [ - { - "id": "gradle.gradle-task:app/bootRun", - "projectID": "gradle:app/app", - "name": "bootRun", - "path": "app", - "template": "gradle-task", - "group": "other", - "execution": "service", - "properties": { - "path": ":app:bootRun" - } - }, - { - "id": "gradle.gradle-task:app/jar", - "projectID": "gradle:app/app", - "name": "jar", - "path": "app", - "template": "gradle-task", - "group": "other", - "execution": "task", - "properties": { - "path": ":app:jar" - } - } - ], - "contentRoots": [ - { - "projectID": "gradle:app/app", - "path": "app/.gradle", - "kind": "excluded" - }, - { - "projectID": "gradle:app/app", - "path": "app/build", - "kind": "excluded" - }, - { - "projectID": "gradle:shop", - "path": ".gradle", - "kind": "excluded" - }, - { - "projectID": "gradle:shop", - "path": "build", - "kind": "excluded" - } - ], - "optionValues": {}, - "run": [ - { - "id": "gradle.task:bootRun", - "name": "bootRun", - "provider": "gradle.task", - "execution": "service", - "command": null, - "args": [ - "--console=plain", - ":app:bootRun" - ], - "cwd": ".", - "env": {}, - "source": null, - "buildSystem": { - "id": "gradle", - "root": ".", - "projectID": "gradle:app/app", - "taskID": "gradle.gradle-task:app/bootRun", - "optionFingerprint": "412601eb5af95d4cd3c162065322aaec6b3d65fda1f35257942f5d8b8a0f5a9e" - } - } - ] - } - } - }, - { - "name": "gradle provider model needs the provider's result", - "plugin": "build-provider.plugin.json", - "buildSystemID": "gradle", - "operation": "decodeModel", - "request": { - "workspaceRoot": "${workspace}", - "root": "." - }, - "expected": { - "status": "rejected", - "error": { - "code": "plugin.build.invalidSelection", - "message": "Pass the provider's result." - } - } - }, - { - "name": "gradle provider dependency result is a litheDependencies tree", - "plugin": "build-provider.plugin.json", - "buildSystemID": "gradle", - "operation": "decodeDependencies", - "request": { - "workspaceRoot": "${workspace}", - "root": ".", - "project": "app", - "result": { - "format": "litheDependencies", - "version": 1, - "dependencies": [ - { - "name": "spring-web", - "group": "org.springframework", - "version": "6.1.0", - "scope": "runtimeClasspath", - "children": [ - { - "name": "spring-core", - "group": "org.springframework", - "version": "6.1.0" - } - ] - } - ] - } - }, - "expected": { - "status": "ok", - "dependencies": { - "project": "app", - "dependencies": [ - { - "name": "spring-web", - "group": "org.springframework", - "version": "6.1.0", - "scope": "runtimeClasspath", - "children": [ - { - "name": "spring-core", - "group": "org.springframework", - "version": "6.1.0", - "children": [] - } - ] - } - ], - "truncated": false - } - } - }, - { - "name": "gradle provider dependency result of another format is refused", - "plugin": "build-provider.plugin.json", - "buildSystemID": "gradle", - "operation": "decodeDependencies", - "request": { - "workspaceRoot": "${workspace}", - "root": ".", - "result": { - "format": "litheBuildModel", - "version": 1, - "projects": [ - { - "path": ".", - "name": "shop", - "properties": { - "taskPrefix": ":" - } - }, - { - "path": "app", - "name": "app", - "properties": { - "taskPrefix": ":app:" - } - } - ], - "tasks": [ - { - "project": "app", - "name": "bootRun", - "template": "gradle-task", - "execution": "service", - "properties": { - "path": ":app:bootRun" - } - }, - { - "project": "app", - "name": "jar", - "template": "gradle-task", - "properties": { - "path": ":app:jar" - } - } - ] - } - }, - "expected": { - "status": "rejected", - "error": { - "code": "plugin.build.invalidOutput", - "message": "Expected litheDependencies version 1." - } - } - }, - { - "name": "mix model goes to the shared language server", - "plugin": "build-provider-language-server.plugin.json", - "buildSystemID": "mix", - "operation": "modelPlan", - "request": { - "root": "." - }, - "expected": { - "status": "ok", - "plan": { - "buildSystemID": "mix", - "root": ".", - "provider": { - "method": "lithe/build/model", - "params": { - "buildSystemID": "mix", - "root": ".", - "options": {}, - "optionArguments": [], - "environment": {} - } - }, - "decoder": "litheBuildModel", - "executesProjectCode": true, - "mayUseNetwork": false, - "optionFingerprint": "76fb003af18a13133b3836c6d0870963ebe7baab6b4cd6bbd4ec61e30334492f" - } - } - }, - { - "name": "mix provider lists dependencies of the workspace only", - "plugin": "build-provider-language-server.plugin.json", - "buildSystemID": "mix", - "operation": "dependencyPlan", - "request": { - "root": ".", - "project": { - "path": "apps/web", - "name": "web" - } - }, - "expected": { - "status": "rejected", - "error": { - "code": "plugin.build.invalidSelection", - "message": "Mix does not list dependencies of a project." - } - } - }, - { - "name": "mix dependencies of the workspace", - "plugin": "build-provider-language-server.plugin.json", - "buildSystemID": "mix", - "operation": "dependencyPlan", - "request": { - "root": "." - }, - "expected": { - "status": "ok", - "plan": { - "buildSystemID": "mix", - "root": ".", - "provider": { - "method": "lithe/build/dependencies", - "params": { - "project": null, - "buildSystemID": "mix", - "root": ".", - "options": {}, - "optionArguments": [], - "environment": {} - } - }, - "decoder": "litheDependencies", - "executesProjectCode": true, - "mayUseNetwork": false, - "optionFingerprint": "76fb003af18a13133b3836c6d0870963ebe7baab6b4cd6bbd4ec61e30334492f" - } - } - } - ] -} diff --git a/shared/contracts/plugins/v1/fixtures/build-systems/build-static-file.plugin.json b/shared/contracts/plugins/v1/fixtures/build-systems/build-static-file.plugin.json deleted file mode 100644 index 7844177174..0000000000 --- a/shared/contracts/plugins/v1/fixtures/build-systems/build-static-file.plugin.json +++ /dev/null @@ -1,143 +0,0 @@ -{ - "schemaVersion": 2, - "id": "dev.lithe.fixture.build-static-file", - "displayName": "Static File Build Fixture", - "version": "0.1.0", - "pluginAPIVersion": 3, - "requires": { "buildSystems": 1 }, - "vendor": { - "id": "org.example", - "displayName": "Example", - "signatureRequirement": "publisherPackage" - }, - "permissions": [ - "process.build" - ], - "activationEvents": [ - "onBuildSystem:cargo" - ], - "languages": [], - "buildSystems": [ - { - "id": "cargo", - "displayName": "Cargo", - "detection": { - "markers": ["Cargo.toml"] - }, - "invocation": { - "executables": [ - { "kind": "command", "command": "cargo" } - ], - "version": { "arguments": ["--version"], "pattern": "cargo (\\d+\\.\\d+\\.\\d+)" }, - "minimumVersion": "1.70" - }, - "options": [ - { "id": "release", "displayName": "Release Profile", "kind": "boolean", "arguments": ["--release"] }, - { - "id": "features", - "displayName": "Features", - "kind": "multiSelect", - "choicesFromModel": true, - "arguments": ["--features", "${value}"] - }, - { "id": "offline", "displayName": "Offline", "kind": "boolean", "arguments": ["--offline"] } - ], - "model": { - "source": "static", - "file": "Cargo.toml", - "decoder": "toml", - "map": { - "projects": [ - { - "each": "/package", - "name": "/name", - "properties": { "version": "/version", "edition": "/edition" }, - "targets": [ - { "each": "$/bin/*", "name": "/name", "tags": ["application"] }, - { "fallback": true, "whenFile": "src/main.rs", "name": "/name", "tags": ["application"] }, - { "each": "$/test/*", "name": "/name", "tags": ["test"] }, - { "each": "$/example/*", "name": "/name", "tags": ["example"] } - ], - "contentRoots": [ - { "path": { "value": "src" }, "kind": "source" }, - { "path": { "value": "tests" }, "kind": "testSource" } - ] - } - ], - "optionValues": { - "features": { "each": "/features/*", "value": "@key" } - } - } - }, - "tasks": [ - { - "id": "build", - "displayName": "Build", - "group": "build", - "scopes": ["project"], - "arguments": ["build", "--message-format=short", "${optionArguments}"] - }, - { - "id": "check", - "displayName": "Check", - "group": "verification", - "scopes": ["project"], - "arguments": ["check", "--message-format=short", "${optionArguments}"] - }, - { - "id": "clean", - "displayName": "Clean", - "group": "build", - "scopes": ["project"], - "arguments": ["clean"] - }, - { - "id": "example", - "displayName": "Run Example", - "group": "run", - "execution": "application", - "scopes": ["target"], - "targetTags": ["example"], - "arguments": ["run", "--example", "${target.name}", "${optionArguments}"] - } - ], - "run": [ - { - "id": "binary", - "fromTargets": { "tags": ["application"] }, - "arguments": ["run", "--bin", "${target.name}", "${optionArguments}"], - "extension": { "bin": "${target.name}" } - } - ], - "test": { - "scopes": ["project", "target"], - "targetTags": ["test"], - "filters": ["case"], - "arguments": [ - "test", - "${optionArguments}", - { "value": "--test", "when": "targetSelected" }, - { "value": "${target.name}", "when": "targetSelected" }, - { "value": "--", "when": "caseSelected" }, - { "value": "${test.case}", "when": "caseSelected" }, - { "value": "--exact", "when": "caseSelected" } - ] - }, - "diagnostics": { - "decoder": "lineMatcher", - "patterns": [ - { - "regex": "^([^\\s:][^:]*\\.rs):(\\d+):(\\d+): (error|warning)(?:\\[\\w+\\])?: (.+)$", - "file": 1, - "line": 2, - "column": 3, - "severity": 4, - "message": 5 - } - ] - }, - "sync": { "watch": ["Cargo.toml", "Cargo.lock"] }, - "layout": { "excluded": ["target"] } - } - ] -} diff --git a/shared/contracts/plugins/v1/fixtures/build-systems/build-tool-path.plugin.json b/shared/contracts/plugins/v1/fixtures/build-systems/build-tool-path.plugin.json deleted file mode 100644 index 3115aac8a5..0000000000 --- a/shared/contracts/plugins/v1/fixtures/build-systems/build-tool-path.plugin.json +++ /dev/null @@ -1,74 +0,0 @@ -{ - "schemaVersion": 2, - "id": "dev.lithe.fixture.build-tool-path", - "displayName": "Build path fixture", - "version": "0.1.0", - "pluginAPIVersion": 3, - "requires": { - "buildSystems": 1, - "settings": 2, - "executableResolution": 1 - }, - "vendor": { - "id": "org.example", - "displayName": "Example", - "signatureRequirement": "publisherPackage" - }, - "permissions": [ - "process.build" - ], - "activationEvents": [ - "onBuildSystem:fixture" - ], - "languages": [], - "settings": [ - { - "id": "toolPath", - "type": "file", - "title": "Build tool", - "default": "", - "scope": "global", - "effect": "reload", - "page": { - "buildSystemID": "fixture" - } - } - ], - "buildSystems": [ - { - "id": "fixture", - "displayName": "Fixture", - "detection": { - "markers": [ - "build.fixture" - ] - }, - "invocation": { - "executables": [ - { - "id": "selected", - "kind": "setting", - "settingID": "toolPath" - }, - { - "kind": "command", - "command": "fixture-build" - } - ] - }, - "tasks": [ - { - "id": "build", - "displayName": "Build", - "group": "build", - "scopes": [ - "workspace" - ], - "arguments": [ - "build" - ] - } - ] - } - ] -} diff --git a/shared/contracts/plugins/v1/fixtures/build-systems/build-toolchains.plugin.json b/shared/contracts/plugins/v1/fixtures/build-systems/build-toolchains.plugin.json deleted file mode 100644 index 386c84a11b..0000000000 --- a/shared/contracts/plugins/v1/fixtures/build-systems/build-toolchains.plugin.json +++ /dev/null @@ -1,329 +0,0 @@ -{ - "schemaVersion": 2, - "id": "dev.lithe.fixture.build-toolchains", - "displayName": "Canonical Toolchain Build Fixture", - "version": "0.1.0", - "pluginAPIVersion": 3, - "requires": { - "buildSystems": 3, - "executableResolution": 2 - }, - "vendor": { - "id": "org.example", - "displayName": "Example", - "signatureRequirement": "publisherPackage" - }, - "permissions": [ - "process.build" - ], - "activationEvents": [ - "onBuildSystem:cargo" - ], - "languages": [], - "buildSystems": [ - { - "id": "cargo", - "displayName": "Cargo", - "detection": { - "markers": [ - "Cargo.toml" - ] - }, - "invocation": { - "executables": [ - { - "kind": "toolchain", - "toolchainID": "dev.lithe.fixture.build-toolchains:compiler" - } - ], - "runtimeDependencies": [ - { - "id": "vm", - "minimumVersion": "8", - "version": { - "arguments": ["--version"], - "pattern": "VM (\\d+(?:\\.\\d+)*)" - }, - "executables": [ - { - "kind": "toolchain", - "toolchainID": "dev.lithe.fixture.build-toolchains:vm" - } - ] - } - ], - "version": { - "arguments": [ - "--version" - ], - "pattern": "Fixture (\\d+\\.\\d+)" - }, - "minimumVersion": "1.0" - }, - "options": [ - { - "id": "release", - "displayName": "Release Profile", - "kind": "boolean", - "arguments": [ - "--release" - ], - "scope": "instance" - }, - { - "id": "features", - "displayName": "Features", - "kind": "multiSelect", - "choicesFromModel": true, - "arguments": [ - "--features", - "${value}" - ], - "scope": "instance" - }, - { - "id": "offline", - "displayName": "Offline", - "kind": "boolean", - "arguments": [ - "--offline" - ] - }, - { - "id": "settingsFile", - "displayName": "Settings File", - "kind": "file", - "scope": "instance", - "arguments": [ - "--config", - "${value}" - ] - }, - { - "id": "cacheDirectory", - "displayName": "Cache Directory", - "kind": "directory", - "scope": "instance", - "arguments": [ - "--cache", - "${value}" - ] - }, - { - "id": "label", - "displayName": "Label", - "kind": "text", - "scope": "instance", - "arguments": [ - "--label", - "${value}" - ] - } - ], - "model": { - "source": "static", - "file": "Cargo.toml", - "decoder": "toml", - "map": { - "projects": [ - { - "each": "/package", - "name": "/name", - "properties": { - "version": "/version", - "edition": "/edition" - }, - "targets": [ - { - "each": "$/bin/*", - "name": "/name", - "tags": [ - "application" - ] - }, - { - "fallback": true, - "whenFile": "src/main.rs", - "name": "/name", - "tags": [ - "application" - ] - }, - { - "each": "$/test/*", - "name": "/name", - "tags": [ - "test" - ] - }, - { - "each": "$/example/*", - "name": "/name", - "tags": [ - "example" - ] - } - ], - "contentRoots": [ - { - "path": { - "value": "src" - }, - "kind": "source" - }, - { - "path": { - "value": "tests" - }, - "kind": "testSource" - } - ] - } - ], - "optionValues": { - "features": { - "each": "/features/*", - "value": "@key" - } - } - } - }, - "tasks": [ - { - "id": "build", - "displayName": "Build", - "group": "build", - "scopes": [ - "project" - ], - "arguments": [ - "build", - "--message-format=short", - "${optionArguments}" - ] - }, - { - "id": "check", - "displayName": "Check", - "group": "verification", - "scopes": [ - "project" - ], - "arguments": [ - "check", - "--message-format=short", - "${optionArguments}" - ] - }, - { - "id": "clean", - "displayName": "Clean", - "group": "build", - "scopes": [ - "project" - ], - "arguments": [ - "clean" - ] - }, - { - "id": "example", - "displayName": "Run Example", - "group": "run", - "execution": "application", - "scopes": [ - "target" - ], - "targetTags": [ - "example" - ], - "arguments": [ - "run", - "--example", - "${target.name}", - "${optionArguments}" - ] - } - ], - "run": [ - { - "id": "binary", - "fromTargets": { - "tags": [ - "application" - ] - }, - "arguments": [ - "run", - "--bin", - "${target.name}", - "${optionArguments}" - ], - "extension": { - "bin": "${target.name}" - } - } - ], - "test": { - "scopes": [ - "project", - "target" - ], - "targetTags": [ - "test" - ], - "filters": [ - "case" - ], - "arguments": [ - "test", - "${optionArguments}", - { - "value": "--test", - "when": "targetSelected" - }, - { - "value": "${target.name}", - "when": "targetSelected" - }, - { - "value": "--", - "when": "caseSelected" - }, - { - "value": "${test.case}", - "when": "caseSelected" - }, - { - "value": "--exact", - "when": "caseSelected" - } - ] - }, - "diagnostics": { - "decoder": "lineMatcher", - "patterns": [ - { - "regex": "^([^\\s:][^:]*\\.rs):(\\d+):(\\d+): (error|warning)(?:\\[\\w+\\])?: (.+)$", - "file": 1, - "line": 2, - "column": 3, - "severity": 4, - "message": 5 - } - ] - }, - "sync": { - "watch": [ - "Cargo.toml", - "Cargo.lock" - ] - }, - "layout": { - "excluded": [ - "target" - ] - } - } - ] -} diff --git a/shared/contracts/plugins/v1/fixtures/debug-adapters/debug-adapter-features.plugin.json b/shared/contracts/plugins/v1/fixtures/debug-adapters/debug-adapter-features.plugin.json deleted file mode 100644 index 0c8b0449ad..0000000000 --- a/shared/contracts/plugins/v1/fixtures/debug-adapters/debug-adapter-features.plugin.json +++ /dev/null @@ -1,68 +0,0 @@ -{ - "schemaVersion": 2, - "id": "dev.lithe.fixture.debug-adapter-features", - "displayName": "Debug Adapter Features Fixture", - "version": "0.1.0", - "pluginAPIVersion": 4, - "requires": { "backend": 2, "debugAdapters": 3, "serverProcess": 1 }, - "vendor": { - "id": "org.example", - "displayName": "Example", - "signatureRequirement": "publisherPackage" - }, - "permissions": [ - "backend.launch", - "debug.launch", - "debug.start" - ], - "activationEvents": [ - "onDebug:script", - "onWorkspaceOpen" - ], - "languages": [], - "backend": { - "launch": { "kind": "packaged", "path": "bin/backend" }, - "arguments": ["--state", "${stateDir}"] - }, - "debugAdapters": [ - { - "id": "script", - "displayName": "Script Debugger", - "adapterID": "script-dap", - "requests": ["launch"], - "selectors": [{ "targetKinds": ["file"], "languageIDs": ["script"] }], - "configurationTypes": ["script"], - "configurations": { - "launch": { - "arguments": { "stopOnEntry": false }, - "targetBindings": { "program": "target.path", "cwd": "target.workingDirectory" } - } - }, - "features": { - "hotCodeReplace": { - "request": "script.reload", - "event": "script.reloaded", - "changedField": "modules", - "errorField": "error" - }, - "stepFilters": { "argument": "stepFilters" } - }, - "defaults": { - "stepFilters": { - "classNameFilters": ["_vendor.*"], - "skipSynthetics": true, - "skipStaticInitializers": false, - "skipConstructors": false, - "hideFilteredStackFrames": false - } - }, - "launch": { - "process": { - "launch": { "kind": "packaged", "path": "bin/script-dap" }, - "arguments": ["--stdio"] - }, - "transport": "stdio" - } - } - ] -} diff --git a/shared/contracts/plugins/v1/fixtures/debug-adapters/debug-adapter-language-server.plugin.json b/shared/contracts/plugins/v1/fixtures/debug-adapters/debug-adapter-language-server.plugin.json deleted file mode 100644 index aa5a9c3a1f..0000000000 --- a/shared/contracts/plugins/v1/fixtures/debug-adapters/debug-adapter-language-server.plugin.json +++ /dev/null @@ -1,51 +0,0 @@ -{ - "schemaVersion": 2, - "id": "dev.lithe.fixture.debug-adapter-language-server", - "displayName": "Debug Adapter In Language Server Fixture", - "version": "0.1.0", - "pluginAPIVersion": 4, - "requires": { "debugAdapters": 1, "languageServers": 1, "languages": 1, "serverProcess": 1 }, - "vendor": { - "id": "org.example", - "displayName": "Example", - "signatureRequirement": "publisherPackage" - }, - "permissions": [ - "debug.launch", - "languageServer.launch" - ], - "activationEvents": [ - "onDebug:example", - "onLanguage:example" - ], - "languages": [ - { - "id": "example", - "displayName": "Example", - "fileExtensions": ["ex"], - "projectFileNames": ["example.toml"] - } - ], - "languageServers": [ - { - "languageID": "example", - "launch": { "kind": "systemCommand", "commands": ["example-ls"] }, - "arguments": ["--stdio"] - } - ], - "debugAdapters": [ - { - "id": "example", - "displayName": "Example Debugger", - "adapterID": "example-dap", - "selectors": [{ "targetKinds": ["file"], "languageIDs": ["example"] }], - "launch": { - "transport": "tcpLanguageServer", - "endpoint": { - "languageID": "example", - "command": "example.startDebugSession" - } - } - } - ] -} diff --git a/shared/contracts/plugins/v1/fixtures/debug-adapters/debug-adapter-rejections.json b/shared/contracts/plugins/v1/fixtures/debug-adapters/debug-adapter-rejections.json deleted file mode 100644 index 19f09f99d9..0000000000 --- a/shared/contracts/plugins/v1/fixtures/debug-adapters/debug-adapter-rejections.json +++ /dev/null @@ -1,517 +0,0 @@ -{ - "description": "Rejection cases for plugin.json debugAdapters, run by the Core tests; each case names the validation layer that must reject it. Synthetic rejection specifications; edits use the same JSON Pointer fixture convention as invalid-manifests.json. Paths only build test data and are not plugin syntax.", - "baseline": { - "block": { - "debugAdapters": [ - { - "id": "synthetic", - "displayName": "Synthetic contract input", - "launch": { - "process": { - "launch": { - "kind": "packaged", - "path": "bin/synthetic" - } - }, - "transport": "stdio" - } - } - ] - }, - "context": { - "manifestMetadata": { - "pluginAPIVersion": 4, - "requires": { - "debugAdapters": 1, - "serverProcess": 1 - }, - "permissions": [ - "debug.launch" - ] - }, - "hostCapabilities": { - "debugAdapters": [ - 1 - ], - "serverProcess": [ - 1, - 2 - ], - "settings": [ - 1, - 2 - ] - }, - "registration": { - "generation": 1, - "currentGeneration": 1 - }, - "runtimeSelection": { - "generation": 1, - "currentGeneration": 1 - }, - "target": { - "kind": "file" - }, - "packageResources": [{"path": "bin/synthetic", "kind": "file"}] - } - }, - "cases": [ - { - "id": "removed-platform-fields", - "layer": "schema", - "edits": [{"op": "set", "path": "/block/pluginDependencies", "value": {"missing": {"pluginID": "dev.lithe.fixture.absent"}}}], - "expected": {"code": "plugin.manifest.invalid", "field": "pluginDependencies"} - }, - { - "id": "removed-resolver", - "layer": "schema", - "edits": [{"op": "set", "path": "/block/debugAdapters/0/resolver", "value": {"backendRef": "absent", "functionID": "debug.resolve"}}], - "expected": {"code": "plugin.manifest.invalid", "field": "debugAdapters[0].resolver"} - }, - { - "id": "removed-host-integration", - "layer": "schema", - "edits": [{"op": "set", "path": "/block/debugAdapters/0/hostIntegration", "value": {"integrationID": "jdt"}}], - "expected": {"code": "plugin.manifest.invalid", "field": "debugAdapters[0].hostIntegration"} - }, - { - "id": "removed-workflow", - "layer": "schema", - "edits": [{"op": "set", "path": "/block/debugAdapters/0/launch/steps", "value": [{"id": "same"}, {"id": "same"}]}], - "expected": {"code": "plugin.manifest.invalid", "field": "debugAdapters[0].launch.steps"} - }, - { - "id": "program-from-process-id", - "layer": "schema", - "edits": [{"op": "set", "path": "/block/debugAdapters/0/configurations", "value": {"launch": {"targetBindings": {"program": "target.processID"}}}}], - "expected": {"code": "plugin.manifest.invalid", "field": "debugAdapters[0].configurations.launch.targetBindings.program"} - }, - { - "id": "function-for-step-back", - "layer": "schema", - "edits": [{"op": "set", "path": "/block/debugAdapters/0/capabilities", "value": {"stepBack": {"source": "function", "functionID": "synthetic.stepBack"}}}], - "expected": {"code": "plugin.manifest.invalid", "field": "debugAdapters[0].capabilities.stepBack"} - }, - { - "id": "old-api-debug", - "layer": "coreManifest", - "edits": [{"op": "set", "path": "/context/manifestMetadata/pluginAPIVersion", "value": 3}], - "expected": {"code": "plugin.api.unsupported", "field": "requires.debugAdapters"} - }, - { - "id": "missing-host-capability", - "layer": "coreManifest", - "edits": [{"op": "remove", "path": "/context/hostCapabilities/debugAdapters"}], - "expected": {"code": "plugin.api.unsupported", "field": "requires.debugAdapters"} - }, - { - "id": "missing-debug-requirement", - "layer": "coreManifest", - "edits": [{"op": "remove", "path": "/context/manifestMetadata/requires/debugAdapters"}], - "expected": {"code": "plugin.manifest.invalid", "field": "requires"} - }, - { - "id": "missing-process-requirement", - "layer": "coreManifest", - "edits": [{"op": "remove", "path": "/context/manifestMetadata/requires/serverProcess"}], - "expected": {"code": "plugin.manifest.invalid", "field": "requires"} - }, - { - "id": "unused-process-v2", - "layer": "coreManifest", - "edits": [{"op": "set", "path": "/context/manifestMetadata/requires/serverProcess", "value": 2}], - "expected": {"code": "plugin.manifest.invalid", "field": "requires.serverProcess"} - }, - { - "id": "duplicate-adapter-id", - "layer": "coreManifest", - "edits": [{"op": "set", "path": "/block/debugAdapters", "value": [{"id": "synthetic", "displayName": "Synthetic contract input", "launch": {"process": {"launch": {"kind": "packaged", "path": "bin/synthetic"}}, "transport": "stdio"}}, {"id": "synthetic", "displayName": "Different title, same identity", "launch": {"process": {"launch": {"kind": "packaged", "path": "bin/synthetic"}}, "transport": "stdio"}}]}], - "expected": {"code": "plugin.manifest.invalid", "field": "debugAdapters[1].id"} - }, - { - "id": "missing-launch-permission", - "layer": "coreManifest", - "edits": [{"op": "set", "path": "/context/manifestMetadata/permissions", "value": []}], - "expected": {"code": "plugin.permission.undeclared", "field": "permissions"} - }, - { - "id": "attach-without-permission", - "layer": "coreManifest", - "edits": [{"op": "set", "path": "/block/debugAdapters/0/requests", "value": ["launch", "attach"]}], - "expected": {"code": "plugin.permission.undeclared", "field": "permissions"} - }, - { - "id": "unsupported-request-config", - "layer": "coreManifest", - "edits": [{"op": "set", "path": "/block/debugAdapters/0/configurations", "value": {"attach": {"arguments": {"port": 30000}}}}], - "expected": {"code": "plugin.manifest.invalid", "field": "debugAdapters[0].configurations.attach"} - }, - { - "id": "selected-runtime-v1", - "layer": "coreManifest", - "edits": [{"op": "set", "path": "/block/debugAdapters/0/launch/process", "value": {"launch": {"kind": "runSelectedRuntime", "tool": "python"}}}], - "expected": {"code": "plugin.manifest.invalid", "field": "requires.serverProcess"} - }, - { - "id": "stale-selected-runtime", - "layer": "corePlan", - "edits": [{"op": "set", "path": "/block/debugAdapters/0/launch/process", "value": {"launch": {"kind": "runSelectedRuntime", "tool": "python"}}}, {"op": "set", "path": "/context/manifestMetadata/requires/serverProcess", "value": 2}, {"op": "set", "path": "/context/runtimeSelection/currentGeneration", "value": 2}], - "expected": {"code": "debug.runtime.stale", "field": "runtimeSelection"} - }, - { - "id": "unknown-dap-capability", - "layer": "coreManifest", - "edits": [{"op": "set", "path": "/block/debugAdapters/0/capabilities", "value": {"disabled": ["supportsSyntheticUnknownRequest"]}}], - "expected": {"code": "plugin.manifest.invalid", "field": "debugAdapters[0].capabilities.disabled[0]"} - }, - { - "id": "empty-console", - "layer": "coreManifest", - "edits": [{"op": "set", "path": "/block/debugAdapters/0/console", "value": {}}], - "expected": {"code": "plugin.manifest.invalid", "field": "debugAdapters[0].console.commands"} - }, - { - "id": "empty-console-commands", - "layer": "coreManifest", - "edits": [{"op": "set", "path": "/block/debugAdapters/0/console", "value": {"commands": []}}], - "expected": {"code": "plugin.manifest.invalid", "field": "debugAdapters[0].console.commands"} - }, - { - "id": "padded-console-command-name", - "layer": "coreManifest", - "edits": [{"op": "set", "path": "/block/debugAdapters/0/console", "value": {"commands": [{"name": " frame"}]}}], - "expected": {"code": "plugin.manifest.invalid", "field": "debugAdapters[0].console.commands[0].name"} - }, - { - "id": "multiline-console-command-description", - "layer": "coreManifest", - "edits": [{"op": "set", "path": "/block/debugAdapters/0/console", "value": {"commands": [{"name": "frame", "description": "one\ntwo"}]}}], - "expected": {"code": "plugin.manifest.invalid", "field": "debugAdapters[0].console.commands[0].description"} - }, - { - "id": "duplicate-console-command", - "layer": "coreManifest", - "edits": [{"op": "set", "path": "/block/debugAdapters/0/console", "value": {"commands": [{"name": "frame"}, {"name": "frame", "description": "again"}]}}], - "expected": {"code": "plugin.manifest.invalid", "field": "debugAdapters[0].console.commands"} - }, - { - "id": "spaced-console-command-prefix", - "layer": "coreManifest", - "edits": [{"op": "set", "path": "/block/debugAdapters/0/console", "value": {"commandPrefix": "` "}}], - "expected": {"code": "plugin.manifest.invalid", "field": "debugAdapters[0].console.commandPrefix"} - }, - { - "id": "unknown-console-field", - "layer": "schema", - "edits": [{"op": "set", "path": "/block/debugAdapters/0/console", "value": {"commands": [{"name": "frame"}], "script": "complete.js"}}], - "expected": {"code": "plugin.manifest.invalid", "field": "debugAdapters[0].console.script"} - }, - { - "id": "missing-target-path", - "layer": "corePlan", - "edits": [{"op": "set", "path": "/block/debugAdapters/0/configurations", "value": {"launch": {"targetBindings": {"program": "target.path"}}}}], - "expected": {"code": "debug.target.invalid", "field": "target.path"} - }, - { - "id": "executable-without-binding", - "layer": "coreManifest", - "edits": [{"op": "set", "path": "/block/settings", "value": [{"id": "program", "type": "file", "title": "Program", "default": "", "scope": "project", "effect": "nextRun"}]}, {"op": "set", "path": "/context/manifestMetadata/requires/settings", "value": 2}, {"op": "set", "path": "/block/debugAdapters/0/configurations", "value": {"launch": {"executable": {"setting": "program", "candidates": ["${workspaceFolder}/build/app"]}}}}], - "expected": {"code": "plugin.manifest.invalid", "field": "debugAdapters[0].configurations.launch.executable"} - }, - { - "id": "executable-binding-without-lookup", - "layer": "coreManifest", - "edits": [{"op": "set", "path": "/block/settings", "value": [{"id": "program", "type": "file", "title": "Program", "default": "", "scope": "project", "effect": "nextRun"}]}, {"op": "set", "path": "/context/manifestMetadata/requires/settings", "value": 2}, {"op": "set", "path": "/block/debugAdapters/0/configurations", "value": {"launch": {"targetBindings": {"program": "target.executable"}}}}], - "expected": {"code": "plugin.manifest.invalid", "field": "debugAdapters[0].configurations.launch.executable"} - }, - { - "id": "executable-undeclared-setting", - "layer": "coreManifest", - "edits": [{"op": "set", "path": "/block/debugAdapters/0/configurations", "value": {"launch": {"targetBindings": {"program": "target.executable"}, "executable": {"setting": "missing", "candidates": []}}}}], - "expected": {"code": "plugin.manifest.invalid", "field": "debugAdapters[0].configurations.launch.executable.setting"} - }, - { - "id": "executable-setting-not-file", - "layer": "coreManifest", - "edits": [{"op": "set", "path": "/block/settings", "value": [{"id": "program", "type": "boolean", "title": "Program", "default": false}]}, {"op": "set", "path": "/context/manifestMetadata/requires/settings", "value": 1}, {"op": "set", "path": "/block/debugAdapters/0/configurations", "value": {"launch": {"targetBindings": {"program": "target.executable"}, "executable": {"setting": "program", "candidates": ["${workspaceFolder}/build/app"]}}}}], - "expected": {"code": "plugin.manifest.invalid", "field": "debugAdapters[0].configurations.launch.executable.setting"} - }, - { - "id": "executable-candidate-outside-roots", - "layer": "coreManifest", - "edits": [{"op": "set", "path": "/block/settings", "value": [{"id": "program", "type": "file", "title": "Program", "default": "", "scope": "project", "effect": "nextRun"}]}, {"op": "set", "path": "/context/manifestMetadata/requires/settings", "value": 2}, {"op": "set", "path": "/block/debugAdapters/0/configurations", "value": {"launch": {"targetBindings": {"program": "target.executable"}, "executable": {"setting": "program", "candidates": ["/usr/local/bin/app"]}}}}], - "expected": {"code": "plugin.manifest.invalid", "field": "debugAdapters[0].configurations.launch.executable.candidates[0]"} - }, - { - "id": "executable-candidate-parent-directory", - "layer": "coreManifest", - "edits": [{"op": "set", "path": "/block/settings", "value": [{"id": "program", "type": "file", "title": "Program", "default": "", "scope": "project", "effect": "nextRun"}]}, {"op": "set", "path": "/context/manifestMetadata/requires/settings", "value": 2}, {"op": "set", "path": "/block/debugAdapters/0/configurations", "value": {"launch": {"targetBindings": {"program": "target.executable"}, "executable": {"setting": "program", "candidates": ["${workspaceFolder}/../app"]}}}}], - "expected": {"code": "plugin.manifest.invalid", "field": "debugAdapters[0].configurations.launch.executable.candidates[0]"} - }, - { - "id": "executable-candidate-unknown-variable", - "layer": "coreManifest", - "edits": [{"op": "set", "path": "/block/settings", "value": [{"id": "program", "type": "file", "title": "Program", "default": "", "scope": "project", "effect": "nextRun"}]}, {"op": "set", "path": "/context/manifestMetadata/requires/settings", "value": 2}, {"op": "set", "path": "/block/debugAdapters/0/configurations", "value": {"launch": {"targetBindings": {"program": "target.executable"}, "executable": {"setting": "program", "candidates": ["${workspaceFolder}/${env:HOME}"]}}}}], - "expected": {"code": "plugin.manifest.invalid", "field": "debugAdapters[0].configurations.launch.executable.candidates[0]"} - }, - { - "id": "executable-duplicate-candidates", - "layer": "coreManifest", - "edits": [{"op": "set", "path": "/block/settings", "value": [{"id": "program", "type": "file", "title": "Program", "default": "", "scope": "project", "effect": "nextRun"}]}, {"op": "set", "path": "/context/manifestMetadata/requires/settings", "value": 2}, {"op": "set", "path": "/block/debugAdapters/0/configurations", "value": {"launch": {"targetBindings": {"program": "target.executable"}, "executable": {"setting": "program", "candidates": ["${workspaceFolder}/app", "${workspaceFolder}/app"]}}}}], - "expected": {"code": "plugin.manifest.invalid", "field": "debugAdapters[0].configurations.launch.executable.candidates"} - }, - { - "id": "executable-too-many-candidates", - "layer": "coreManifest", - "edits": [{"op": "set", "path": "/block/settings", "value": [{"id": "program", "type": "file", "title": "Program", "default": "", "scope": "project", "effect": "nextRun"}]}, {"op": "set", "path": "/context/manifestMetadata/requires/settings", "value": 2}, {"op": "set", "path": "/block/debugAdapters/0/configurations", "value": {"launch": {"targetBindings": {"program": "target.executable"}, "executable": {"setting": "program", "candidates": ["${workspaceFolder}/c0", "${workspaceFolder}/c1", "${workspaceFolder}/c2", "${workspaceFolder}/c3", "${workspaceFolder}/c4", "${workspaceFolder}/c5", "${workspaceFolder}/c6", "${workspaceFolder}/c7", "${workspaceFolder}/c8"]}}}}], - "expected": {"code": "plugin.manifest.invalid", "field": "debugAdapters[0].configurations.launch.executable.candidates"} - }, - { - "id": "executable-on-attach", - "layer": "coreManifest", - "edits": [{"op": "set", "path": "/block/settings", "value": [{"id": "program", "type": "file", "title": "Program", "default": "", "scope": "project", "effect": "nextRun"}]}, {"op": "set", "path": "/context/manifestMetadata/requires/settings", "value": 2}, {"op": "set", "path": "/block/debugAdapters/0/requests", "value": ["launch", "attach"]}, {"op": "set", "path": "/context/manifestMetadata/permissions", "value": ["debug.attach", "debug.launch"]}, {"op": "set", "path": "/block/debugAdapters/0/configurations", "value": {"attach": {"targetBindings": {"program": "target.executable"}, "executable": {"setting": "program", "candidates": ["${workspaceFolder}/build/app"]}}}}], - "expected": {"code": "plugin.manifest.invalid", "field": "debugAdapters[0].configurations.attach.executable"} - }, - { - "id": "missing-target-executable", - "layer": "corePlan", - "edits": [{"op": "set", "path": "/block/settings", "value": [{"id": "program", "type": "file", "title": "Program", "default": "", "scope": "project", "effect": "nextRun"}]}, {"op": "set", "path": "/context/manifestMetadata/requires/settings", "value": 2}, {"op": "set", "path": "/block/debugAdapters/0/configurations", "value": {"launch": {"targetBindings": {"program": "target.executable"}, "executable": {"setting": "program", "candidates": ["${workspaceFolder}/build/app"]}}}}], - "expected": {"code": "debug.target.invalid", "field": "target.executable"} - }, - { - "id": "escaping-parameters-schema", - "layer": "coreInstall", - "edits": [{"op": "set", "path": "/block/debugAdapters/0/configurations", "value": {"launch": {"parametersSchema": "schemas/parameters.json"}}}, {"op": "set", "path": "/context/packageResources", "value": [{"path": "bin/synthetic", "kind": "file"}, {"path": "schemas/parameters.json", "kind": "symlink", "target": "../../../outside/parameters.json"}]}], - "expected": {"code": "plugin.manifest.invalid", "field": "debugAdapters[0].configurations.launch.parametersSchema"} - }, - { - "id": "api-level-below-4", - "layer": "coreManifest", - "edits": [{"op": "set", "path": "/context/manifestMetadata/pluginAPIVersion", "value": 2}, {"op": "remove", "path": "/context/manifestMetadata/requires"}], - "expected": {"code": "plugin.manifest.invalid", "field": "debugAdapters"} - }, - { - "id": "missing-adapter-executable", - "layer": "coreInstall", - "edits": [{"op": "set", "path": "/context/packageResources", "value": []}], - "expected": {"code": "plugin.manifest.invalid", "field": "debugAdapters[0].launch.process.launch.path"} - }, - { - "id": "adapter-executable-is-directory", - "layer": "coreInstall", - "edits": [{"op": "set", "path": "/context/packageResources", "value": [{"path": "bin/synthetic", "kind": "directory"}]}], - "expected": {"code": "plugin.manifest.invalid", "field": "debugAdapters[0].launch.process.launch.path"} - }, - { - "id": "escaping-adapter-executable", - "layer": "coreInstall", - "edits": [{"op": "set", "path": "/context/packageResources", "value": [{"path": "bin/synthetic", "kind": "symlink", "target": "../../outside/adapter"}]}], - "expected": {"code": "plugin.manifest.invalid", "field": "debugAdapters[0].launch.process.launch.path"} - }, - { - "id": "adapter-executable-link-is-dangling", - "layer": "coreInstall", - "edits": [{"op": "set", "path": "/context/packageResources", "value": [{"path": "bin/synthetic", "kind": "symlink", "target": "real/missing"}]}], - "expected": {"code": "plugin.manifest.invalid", "field": "debugAdapters[0].launch.process.launch.path"} - }, - { - "id": "adapter-executable-link-targets-directory", - "layer": "coreInstall", - "edits": [{"op": "set", "path": "/context/packageResources", "value": [{"path": "bin/synthetic", "kind": "symlink", "target": "real"}, {"path": "bin/real", "kind": "directory"}]}], - "expected": {"code": "plugin.manifest.invalid", "field": "debugAdapters[0].launch.process.launch.path"} - }, - { - "id": "adapter-executable-link-loop", - "layer": "coreInstall", - "edits": [{"op": "set", "path": "/context/packageResources", "value": [{"path": "bin/synthetic", "kind": "symlink", "target": "again"}, {"path": "bin/again", "kind": "symlink", "target": "synthetic"}]}], - "expected": {"code": "plugin.manifest.invalid", "field": "debugAdapters[0].launch.process.launch.path"} - }, - { - "id": "runtime-adapter-entry-missing", - "layer": "coreInstall", - "edits": [{"op": "set", "path": "/block/debugAdapters/0/launch/process/launch", "value": {"kind": "runtime", "tool": "java", "entry": "lib/adapter.jar"}}, {"op": "set", "path": "/context/packageResources", "value": []}], - "expected": {"code": "plugin.manifest.invalid", "field": "debugAdapters[0].launch.process.launch.entry"} - }, - { - "id": "non-canonical-path-is-still-found", - "layer": "coreInstall", - "edits": [{"op": "set", "path": "/block/debugAdapters/0/launch/process/launch/path", "value": "./bin//synthetic"}, {"op": "set", "path": "/context/packageResources", "value": [{"path": "bin/synthetic", "kind": "directory"}]}], - "expected": {"code": "plugin.manifest.invalid", "field": "debugAdapters[0].launch.process.launch.path"} - }, - { - "id": "stale-registration", - "layer": "corePlan", - "edits": [{"op": "set", "path": "/context/registration/currentGeneration", "value": 2}], - "expected": {"code": "debug.provider.stale", "field": "registration"} - }, - { - "id": "connection-binding-on-launch", - "layer": "coreManifest", - "edits": [{"op": "set", "path": "/block/debugAdapters/0/configurations", "value": {"launch": {"targetBindings": {"connection": {"host": "hostName", "port": "port"}}}}}], - "expected": {"code": "plugin.manifest.invalid", "field": "debugAdapters[0].configurations.launch.targetBindings"} - }, - { - "id": "connection-host-without-port", - "layer": "coreManifest", - "edits": [{"op": "set", "path": "/block/debugAdapters/0/requests", "value": ["attach"]}, {"op": "set", "path": "/context/manifestMetadata/permissions", "value": ["debug.attach", "debug.launch"]}, {"op": "set", "path": "/block/debugAdapters/0/configurations", "value": {"attach": {"targetBindings": {"connection": {"host": "hostName"}}}}}], - "expected": {"code": "plugin.manifest.invalid", "field": "debugAdapters[0].configurations.attach.targetBindings.connection.host"} - }, - { - "id": "connection-without-destination", - "layer": "coreManifest", - "edits": [{"op": "set", "path": "/block/debugAdapters/0/requests", "value": ["attach"]}, {"op": "set", "path": "/context/manifestMetadata/permissions", "value": ["debug.attach", "debug.launch"]}, {"op": "set", "path": "/block/debugAdapters/0/configurations", "value": {"attach": {"targetBindings": {"connection": {}}}}}], - "expected": {"code": "plugin.manifest.invalid", "field": "debugAdapters[0].configurations.attach.targetBindings.connection"} - }, - { - "id": "connection-malformed-argument-path", - "layer": "coreManifest", - "edits": [{"op": "set", "path": "/block/debugAdapters/0/requests", "value": ["attach"]}, {"op": "set", "path": "/context/manifestMetadata/permissions", "value": ["debug.attach", "debug.launch"]}, {"op": "set", "path": "/block/debugAdapters/0/configurations", "value": {"attach": {"targetBindings": {"connection": {"host": "connect..host", "port": "port"}}}}}], - "expected": {"code": "plugin.manifest.invalid", "field": "debugAdapters[0].configurations.attach.targetBindings.connection.host"} - }, - { - "id": "connection-argument-path-too-deep", - "layer": "coreManifest", - "edits": [{"op": "set", "path": "/block/debugAdapters/0/requests", "value": ["attach"]}, {"op": "set", "path": "/context/manifestMetadata/permissions", "value": ["debug.attach", "debug.launch"]}, {"op": "set", "path": "/block/debugAdapters/0/configurations", "value": {"attach": {"targetBindings": {"connection": {"host": "a.b.c.d.e", "port": "port"}}}}}], - "expected": {"code": "plugin.manifest.invalid", "field": "debugAdapters[0].configurations.attach.targetBindings.connection.host"} - }, - { - "id": "connection-destinations-overlap", - "layer": "coreManifest", - "edits": [{"op": "set", "path": "/block/debugAdapters/0/requests", "value": ["attach"]}, {"op": "set", "path": "/context/manifestMetadata/permissions", "value": ["debug.attach", "debug.launch"]}, {"op": "set", "path": "/block/debugAdapters/0/configurations", "value": {"attach": {"targetBindings": {"connection": {"host": "connect", "port": "connect.port"}}}}}], - "expected": {"code": "plugin.manifest.invalid", "field": "debugAdapters[0].configurations.attach.targetBindings.connection.port"} - }, - { - "id": "connection-overlaps-process-binding", - "layer": "coreManifest", - "edits": [{"op": "set", "path": "/block/debugAdapters/0/requests", "value": ["attach"]}, {"op": "set", "path": "/context/manifestMetadata/permissions", "value": ["debug.attach", "debug.launch"]}, {"op": "set", "path": "/block/debugAdapters/0/configurations", "value": {"attach": {"targetBindings": {"processId": "target.processID", "connection": {"host": "processId", "port": "port"}}}}}], - "expected": {"code": "plugin.manifest.invalid", "field": "debugAdapters[0].configurations.attach.targetBindings.connection.host"} - }, - { - "id": "connection-collides-with-default-argument", - "layer": "coreManifest", - "edits": [{"op": "set", "path": "/block/debugAdapters/0/requests", "value": ["attach"]}, {"op": "set", "path": "/context/manifestMetadata/permissions", "value": ["debug.attach", "debug.launch"]}, {"op": "set", "path": "/block/debugAdapters/0/configurations", "value": {"attach": {"targetBindings": {"connection": {"host": "hostName", "port": "port"}}, "arguments": {"hostName": "localhost"}}}}], - "expected": {"code": "plugin.manifest.invalid", "field": "debugAdapters[0].configurations.attach.targetBindings.connection.host"} - }, - { - "id": "connection-collides-with-default-object", - "layer": "coreManifest", - "edits": [{"op": "set", "path": "/block/debugAdapters/0/requests", "value": ["attach"]}, {"op": "set", "path": "/context/manifestMetadata/permissions", "value": ["debug.attach", "debug.launch"]}, {"op": "set", "path": "/block/debugAdapters/0/configurations", "value": {"attach": {"targetBindings": {"connection": {"host": "connect.host", "port": "connect.port"}}, "arguments": {"connect": "tcp"}}}}], - "expected": {"code": "plugin.manifest.invalid", "field": "debugAdapters[0].configurations.attach.targetBindings.connection.host"} - }, - { - "id": "connection-path-mapping-keys-equal", - "layer": "coreManifest", - "edits": [{"op": "set", "path": "/block/debugAdapters/0/requests", "value": ["attach"]}, {"op": "set", "path": "/context/manifestMetadata/permissions", "value": ["debug.attach", "debug.launch"]}, {"op": "set", "path": "/block/debugAdapters/0/configurations", "value": {"attach": {"targetBindings": {"connection": {"host": "connect.host", "port": "connect.port", "pathMappings": {"shape": "objects", "argument": "pathMappings", "localKey": "root", "remoteKey": "root"}}}}}}], - "expected": {"code": "plugin.manifest.invalid", "field": "debugAdapters[0].configurations.attach.targetBindings.connection.pathMappings.remoteKey"} - }, - { - "id": "connection-path-mapping-malformed-key", - "layer": "coreManifest", - "edits": [{"op": "set", "path": "/block/debugAdapters/0/requests", "value": ["attach"]}, {"op": "set", "path": "/context/manifestMetadata/permissions", "value": ["debug.attach", "debug.launch"]}, {"op": "set", "path": "/block/debugAdapters/0/configurations", "value": {"attach": {"targetBindings": {"connection": {"host": "connect.host", "port": "connect.port", "pathMappings": {"shape": "objects", "argument": "pathMappings", "localKey": "local root", "remoteKey": "remoteRoot"}}}}}}], - "expected": {"code": "plugin.manifest.invalid", "field": "debugAdapters[0].configurations.attach.targetBindings.connection.pathMappings.localKey"} - }, - { - "id": "connection-path-mapping-overlaps-endpoint", - "layer": "coreManifest", - "edits": [{"op": "set", "path": "/block/debugAdapters/0/requests", "value": ["attach"]}, {"op": "set", "path": "/context/manifestMetadata/permissions", "value": ["debug.attach", "debug.launch"]}, {"op": "set", "path": "/block/debugAdapters/0/configurations", "value": {"attach": {"targetBindings": {"connection": {"host": "connect.host", "port": "connect.port", "pathMappings": {"shape": "first", "local": "connect.host", "remote": "remoteRoot"}}}}}}], - "expected": {"code": "plugin.manifest.invalid", "field": "debugAdapters[0].configurations.attach.targetBindings.connection.pathMappings.local"} - }, - { - "id": "connection-path-mapping-unknown-shape", - "layer": "schema", - "edits": [{"op": "set", "path": "/block/debugAdapters/0/requests", "value": ["attach"]}, {"op": "set", "path": "/context/manifestMetadata/permissions", "value": ["debug.attach", "debug.launch"]}, {"op": "set", "path": "/block/debugAdapters/0/configurations", "value": {"attach": {"targetBindings": {"connection": {"host": "connect.host", "port": "connect.port", "pathMappings": {"shape": "triples", "argument": "sourceMap"}}}}}}], - "expected": {"code": "plugin.manifest.invalid", "field": "debugAdapters[0].configurations.attach.targetBindings.connection.pathMappings"} - }, - { - "id": "connection-unknown-field", - "layer": "schema", - "edits": [{"op": "set", "path": "/block/debugAdapters/0/requests", "value": ["attach"]}, {"op": "set", "path": "/context/manifestMetadata/permissions", "value": ["debug.attach", "debug.launch"]}, {"op": "set", "path": "/block/debugAdapters/0/configurations", "value": {"attach": {"targetBindings": {"connection": {"host": "hostName", "port": "port", "scheme": "https"}}}}}], - "expected": {"code": "plugin.manifest.invalid", "field": "debugAdapters[0].configurations.attach.targetBindings.connection.scheme"} - }, - { - "id": "connection-selector-without-binding", - "layer": "coreManifest", - "edits": [{"op": "set", "path": "/block/debugAdapters/0/requests", "value": ["attach"]}, {"op": "set", "path": "/context/manifestMetadata/permissions", "value": ["debug.attach", "debug.launch"]}, {"op": "set", "path": "/block/debugAdapters/0/configurations", "value": {"attach": {"targetBindings": {"processId": "target.processID"}}}}, {"op": "set", "path": "/block/debugAdapters/0/selectors", "value": [{"targetKinds": ["connection"]}]}], - "expected": {"code": "plugin.manifest.invalid", "field": "debugAdapters[0].selectors"} - }, - { - "id": "remote-target-missing-host", - "layer": "corePlan", - "edits": [{"op": "set", "path": "/block/debugAdapters/0/requests", "value": ["attach"]}, {"op": "set", "path": "/context/manifestMetadata/permissions", "value": ["debug.attach", "debug.launch"]}, {"op": "set", "path": "/block/debugAdapters/0/configurations", "value": {"attach": {"targetBindings": {"connection": {"host": "hostName", "port": "port"}}}}}, {"op": "set", "path": "/context/request", "value": "attach"}, {"op": "set", "path": "/context/target", "value": {"kind": "connection", "port": 5005}}], - "expected": {"code": "debug.target.invalid", "field": "target.host"} - }, - { - "id": "remote-target-host-with-scheme", - "layer": "corePlan", - "edits": [{"op": "set", "path": "/block/debugAdapters/0/requests", "value": ["attach"]}, {"op": "set", "path": "/context/manifestMetadata/permissions", "value": ["debug.attach", "debug.launch"]}, {"op": "set", "path": "/block/debugAdapters/0/configurations", "value": {"attach": {"targetBindings": {"connection": {"host": "hostName", "port": "port"}}}}}, {"op": "set", "path": "/context/request", "value": "attach"}, {"op": "set", "path": "/context/target", "value": {"kind": "connection", "host": "http://build.example.org", "port": 5005}}], - "expected": {"code": "debug.target.invalid", "field": "target.host"} - }, - { - "id": "remote-target-missing-port", - "layer": "corePlan", - "edits": [{"op": "set", "path": "/block/debugAdapters/0/requests", "value": ["attach"]}, {"op": "set", "path": "/context/manifestMetadata/permissions", "value": ["debug.attach", "debug.launch"]}, {"op": "set", "path": "/block/debugAdapters/0/configurations", "value": {"attach": {"targetBindings": {"connection": {"host": "hostName", "port": "port"}}}}}, {"op": "set", "path": "/context/request", "value": "attach"}, {"op": "set", "path": "/context/target", "value": {"kind": "connection", "host": "build.example.org"}}], - "expected": {"code": "debug.target.invalid", "field": "target.port"} - }, - { - "id": "remote-target-port-out-of-range", - "layer": "corePlan", - "edits": [{"op": "set", "path": "/block/debugAdapters/0/requests", "value": ["attach"]}, {"op": "set", "path": "/context/manifestMetadata/permissions", "value": ["debug.attach", "debug.launch"]}, {"op": "set", "path": "/block/debugAdapters/0/configurations", "value": {"attach": {"targetBindings": {"connection": {"host": "hostName", "port": "port"}}}}}, {"op": "set", "path": "/context/request", "value": "attach"}, {"op": "set", "path": "/context/target", "value": {"kind": "connection", "host": "build.example.org", "port": 70000}}], - "expected": {"code": "debug.target.invalid", "field": "target.port"} - }, - { - "id": "remote-target-relative-local-root", - "layer": "corePlan", - "edits": [{"op": "set", "path": "/block/debugAdapters/0/requests", "value": ["attach"]}, {"op": "set", "path": "/context/manifestMetadata/permissions", "value": ["debug.attach", "debug.launch"]}, {"op": "set", "path": "/block/debugAdapters/0/configurations", "value": {"attach": {"targetBindings": {"connection": {"host": "connect.host", "port": "connect.port", "pathMappings": {"shape": "objects", "argument": "pathMappings", "localKey": "localRoot", "remoteKey": "remoteRoot"}}}}}}, {"op": "set", "path": "/context/request", "value": "attach"}, {"op": "set", "path": "/context/target", "value": {"kind": "connection", "host": "build.example.org", "port": 5005, "pathMappings": [{"local": "src", "remote": "/srv/app"}]}}], - "expected": {"code": "debug.target.invalid", "field": "target.pathMappings"} - }, - { - "id": "remote-target-mappings-without-binding", - "layer": "corePlan", - "edits": [{"op": "set", "path": "/block/debugAdapters/0/requests", "value": ["attach"]}, {"op": "set", "path": "/context/manifestMetadata/permissions", "value": ["debug.attach", "debug.launch"]}, {"op": "set", "path": "/block/debugAdapters/0/configurations", "value": {"attach": {"targetBindings": {"connection": {"host": "hostName", "port": "port"}}}}}, {"op": "set", "path": "/context/request", "value": "attach"}, {"op": "set", "path": "/context/target", "value": {"kind": "connection", "host": "build.example.org", "port": 5005, "pathMappings": [{"local": "/work/src", "remote": "/srv/app"}]}}], - "expected": {"code": "debug.target.invalid", "field": "target.pathMappings"} - }, - { - "id": "remote-target-for-launch", - "layer": "corePlan", - "edits": [{"op": "set", "path": "/block/debugAdapters/0/requests", "value": ["attach"]}, {"op": "set", "path": "/context/manifestMetadata/permissions", "value": ["debug.attach", "debug.launch"]}, {"op": "set", "path": "/block/debugAdapters/0/configurations", "value": {"attach": {"targetBindings": {"connection": {"host": "hostName", "port": "port"}}}}}, {"op": "set", "path": "/block/debugAdapters/0/requests", "value": ["launch", "attach"]}, {"op": "set", "path": "/context/target", "value": {"kind": "connection", "host": "build.example.org", "port": 5005}}], - "expected": {"code": "debug.target.invalid", "field": "target.kind"} - }, - { - "id": "connection-path-mapping-dictionary-unknown-side", - "layer": "schema", - "edits": [{"op": "set", "path": "/block/debugAdapters/0/requests", "value": ["attach"]}, {"op": "set", "path": "/context/manifestMetadata/permissions", "value": ["debug.attach", "debug.launch"]}, {"op": "set", "path": "/block/debugAdapters/0/configurations", "value": {"attach": {"targetBindings": {"connection": {"host": "connect.host", "port": "connect.port", "pathMappings": {"shape": "dictionary", "argument": "sourceMap", "keyedBy": "both"}}}}}}], - "expected": {"code": "plugin.manifest.invalid", "field": "debugAdapters[0].configurations.attach.targetBindings.connection.pathMappings"} - }, - { - "id": "connection-path-mapping-pairs-unknown-order", - "layer": "schema", - "edits": [{"op": "set", "path": "/block/debugAdapters/0/requests", "value": ["attach"]}, {"op": "set", "path": "/context/manifestMetadata/permissions", "value": ["debug.attach", "debug.launch"]}, {"op": "set", "path": "/block/debugAdapters/0/configurations", "value": {"attach": {"targetBindings": {"connection": {"host": "connect.host", "port": "connect.port", "pathMappings": {"shape": "pairs", "argument": "sourceMap", "order": "sideBySide"}}}}}}], - "expected": {"code": "plugin.manifest.invalid", "field": "debugAdapters[0].configurations.attach.targetBindings.connection.pathMappings"} - }, - { - "id": "connection-path-mapping-dictionary-overlaps-endpoint", - "layer": "coreManifest", - "edits": [{"op": "set", "path": "/block/debugAdapters/0/requests", "value": ["attach"]}, {"op": "set", "path": "/context/manifestMetadata/permissions", "value": ["debug.attach", "debug.launch"]}, {"op": "set", "path": "/block/debugAdapters/0/configurations", "value": {"attach": {"targetBindings": {"connection": {"host": "connect.host", "port": "connect.port", "pathMappings": {"shape": "dictionary", "argument": "connect.host", "keyedBy": "remote"}}}}}}], - "expected": {"code": "plugin.manifest.invalid", "field": "debugAdapters[0].configurations.attach.targetBindings.connection.pathMappings.argument"} - }, - { - "id": "connection-path-mapping-pairs-overlaps-endpoint", - "layer": "coreManifest", - "edits": [{"op": "set", "path": "/block/debugAdapters/0/requests", "value": ["attach"]}, {"op": "set", "path": "/context/manifestMetadata/permissions", "value": ["debug.attach", "debug.launch"]}, {"op": "set", "path": "/block/debugAdapters/0/configurations", "value": {"attach": {"targetBindings": {"connection": {"host": "connect.host", "port": "connect.port", "pathMappings": {"shape": "pairs", "argument": "connect", "order": "localRemote"}}}}}}], - "expected": {"code": "plugin.manifest.invalid", "field": "debugAdapters[0].configurations.attach.targetBindings.connection.pathMappings.argument"} - }, - { - "id": "remote-target-mappings-share-a-keyed-root", - "layer": "corePlan", - "edits": [{"op": "set", "path": "/block/debugAdapters/0/requests", "value": ["attach"]}, {"op": "set", "path": "/context/manifestMetadata/permissions", "value": ["debug.attach", "debug.launch"]}, {"op": "set", "path": "/block/debugAdapters/0/configurations", "value": {"attach": {"targetBindings": {"connection": {"host": "connect.host", "port": "connect.port", "pathMappings": {"shape": "dictionary", "argument": "sourceMap", "keyedBy": "remote"}}}}}}, {"op": "set", "path": "/context/request", "value": "attach"}, {"op": "set", "path": "/context/target", "value": {"kind": "connection", "host": "build.example.org", "port": 5005, "pathMappings": [{"local": "/work/src", "remote": "/srv/app"}, {"local": "/work/lib", "remote": "/srv/app"}]}}], - "expected": {"code": "debug.target.invalid", "field": "target.pathMappings"} - }, - { - "id": "remote-target-more-mappings-than-a-single-root-takes", - "layer": "corePlan", - "edits": [{"op": "set", "path": "/block/debugAdapters/0/requests", "value": ["attach"]}, {"op": "set", "path": "/context/manifestMetadata/permissions", "value": ["debug.attach", "debug.launch"]}, {"op": "set", "path": "/block/debugAdapters/0/configurations", "value": {"attach": {"targetBindings": {"connection": {"host": "connect.host", "port": "connect.port", "pathMappings": {"shape": "first", "local": "localRoot", "remote": "remoteRoot"}}}}}}, {"op": "set", "path": "/context/request", "value": "attach"}, {"op": "set", "path": "/context/target", "value": {"kind": "connection", "host": "build.example.org", "port": 5005, "pathMappings": [{"local": "/work/src", "remote": "/srv/app"}, {"local": "/work/lib", "remote": "/srv/lib"}]}}], - "expected": {"code": "debug.target.invalid", "field": "target.pathMappings"} - } - ] -} diff --git a/shared/contracts/plugins/v1/fixtures/debug-adapters/debug-adapter-remote-attach.plugin.json b/shared/contracts/plugins/v1/fixtures/debug-adapters/debug-adapter-remote-attach.plugin.json deleted file mode 100644 index fa9f8689e5..0000000000 --- a/shared/contracts/plugins/v1/fixtures/debug-adapters/debug-adapter-remote-attach.plugin.json +++ /dev/null @@ -1,184 +0,0 @@ -{ - "schemaVersion": 2, - "id": "dev.lithe.fixture.debug-adapter-remote-attach", - "displayName": "Debug Adapter Remote Attach Fixture", - "version": "0.1.0", - "pluginAPIVersion": 4, - "requires": { "debugAdapters": 1, "serverProcess": 1 }, - "vendor": { - "id": "org.example", - "displayName": "Example", - "signatureRequirement": "publisherPackage" - }, - "permissions": [ - "debug.attach", - "debug.launch" - ], - "activationEvents": [ - "onDebug:flat", - "onDebug:nested", - "onDebug:scalar", - "onDebug:joined", - "onDebug:keyed", - "onDebug:paired" - ], - "languages": [], - "debugAdapters": [ - { - "id": "flat", - "displayName": "Flat Remote Debugger", - "adapterID": "flat-dap", - "requests": ["attach"], - "selectors": [{ "targetKinds": ["connection"] }], - "configurations": { - "attach": { - "arguments": { "timeout": 5000 }, - "targetBindings": { - "connection": { "host": "hostName", "port": "port" } - } - } - }, - "launch": { - "process": { - "launch": { "kind": "packaged", "path": "bin/flat-dap" } - }, - "transport": "stdio" - } - }, - { - "id": "nested", - "displayName": "Nested Remote Debugger", - "adapterID": "nested-dap", - "requests": ["attach"], - "selectors": [{ "targetKinds": ["connection"] }], - "configurations": { - "attach": { - "arguments": { "justMyCode": false }, - "targetBindings": { - "connection": { - "host": "connect.host", - "port": "connect.port", - "pathMappings": { - "shape": "objects", - "argument": "pathMappings", - "localKey": "localRoot", - "remoteKey": "remoteRoot" - } - } - } - } - }, - "launch": { - "process": { - "launch": { "kind": "packaged", "path": "bin/nested-dap" } - }, - "transport": "stdio" - } - }, - { - "id": "scalar", - "displayName": "Single Root Remote Debugger", - "adapterID": "scalar-dap", - "requests": ["attach"], - "selectors": [{ "targetKinds": ["connection"] }], - "configurations": { - "attach": { - "targetBindings": { - "connection": { - "host": "address", - "port": "port", - "pathMappings": { - "shape": "first", - "local": "localRoot", - "remote": "remoteRoot" - } - } - } - } - }, - "launch": { - "process": { - "launch": { "kind": "packaged", "path": "bin/scalar-dap" } - }, - "transport": "stdio" - } - }, - { - "id": "joined", - "displayName": "Address Remote Debugger", - "adapterID": "joined-dap", - "requests": ["attach"], - "selectors": [{ "targetKinds": ["connection"] }], - "configurations": { - "attach": { - "arguments": { "request": "attach" }, - "targetBindings": { - "connection": { "address": "target" } - } - } - }, - "launch": { - "process": { - "launch": { "kind": "packaged", "path": "bin/joined-dap" } - }, - "transport": "stdio" - } - }, - { - "id": "keyed", - "displayName": "Keyed Source Map Remote Debugger", - "adapterID": "keyed-dap", - "requests": ["attach"], - "selectors": [{ "targetKinds": ["connection"] }], - "configurations": { - "attach": { - "targetBindings": { - "connection": { - "host": "connect.host", - "port": "connect.port", - "pathMappings": { - "shape": "dictionary", - "argument": "sourceMap", - "keyedBy": "remote" - } - } - } - } - }, - "launch": { - "process": { - "launch": { "kind": "packaged", "path": "bin/keyed-dap" } - }, - "transport": "stdio" - } - }, - { - "id": "paired", - "displayName": "Paired Source Map Remote Debugger", - "adapterID": "paired-dap", - "requests": ["attach"], - "selectors": [{ "targetKinds": ["connection"] }], - "configurations": { - "attach": { - "targetBindings": { - "connection": { - "host": "hostName", - "port": "port", - "pathMappings": { - "shape": "pairs", - "argument": "sourceMap", - "order": "remoteLocal" - } - } - } - } - }, - "launch": { - "process": { - "launch": { "kind": "packaged", "path": "bin/paired-dap" } - }, - "transport": "stdio" - } - } - ] -} diff --git a/shared/contracts/plugins/v1/fixtures/debug-adapters/debug-adapter.plugin.json b/shared/contracts/plugins/v1/fixtures/debug-adapters/debug-adapter.plugin.json deleted file mode 100644 index 568cfa890d..0000000000 --- a/shared/contracts/plugins/v1/fixtures/debug-adapters/debug-adapter.plugin.json +++ /dev/null @@ -1,96 +0,0 @@ -{ - "schemaVersion": 2, - "id": "dev.lithe.fixture.debug-adapter", - "displayName": "Debug Adapter Fixture", - "version": "0.1.0", - "pluginAPIVersion": 4, - "requires": { "debugAdapters": 1, "serverProcess": 1, "settings": 2 }, - "vendor": { - "id": "org.example", - "displayName": "Example", - "signatureRequirement": "publisherPackage" - }, - "permissions": [ - "debug.attach", - "debug.launch" - ], - "activationEvents": [ - "onDebug:example", - "onDebug:native" - ], - "languages": [], - "settings": [ - { - "id": "program", - "type": "file", - "title": "Program", - "description": "The program to debug. Build it with debug information first, for example cc -g main.c -o main.", - "default": "", - "placeholder": "Found next to the open file", - "scope": "project", - "effect": "nextRun" - } - ], - "debugAdapters": [ - { - "id": "example", - "displayName": "Example Debugger", - "adapterID": "example-dap", - "requests": ["launch", "attach"], - "selectors": [{ "targetKinds": ["file"], "languageIDs": ["example"] }], - "configurationTypes": ["example"], - "configurations": { - "launch": { - "arguments": { "stopOnEntry": false }, - "parametersSchema": "schemas/launch.json", - "targetBindings": { "program": "target.path", "cwd": "target.workingDirectory" } - }, - "attach": { - "targetBindings": { "processId": "target.processID" } - } - }, - "capabilities": { "disabled": ["supportsStepBack"] }, - "console": { - "commandPrefix": "`", - "commands": [ - { "name": "breakpoint set", "description": "Set a breakpoint" }, - { "name": "frame variable" } - ] - }, - "launch": { - "process": { - "launch": { "kind": "packaged", "path": "bin/example-dap" }, - "arguments": ["--stdio"] - }, - "transport": "stdio" - } - }, - { - "id": "native", - "displayName": "Native Debugger", - "adapterID": "native-dap", - "requests": ["launch"], - "selectors": [{ "targetKinds": ["file"], "languageIDs": ["example"] }], - "configurationTypes": ["native"], - "configurations": { - "launch": { - "arguments": { "stopOnEntry": false }, - "targetBindings": { "program": "target.executable", "cwd": "target.workingDirectory" }, - "executable": { - "setting": "program", - "candidates": [ - "${fileDirectory}/${fileBasenameNoExtension}", - "${workspaceFolder}/build/${fileBasenameNoExtension}" - ] - } - } - }, - "launch": { - "process": { - "launch": { "kind": "systemCommand", "commands": ["native-dap"] } - }, - "transport": "stdio" - } - } - ] -} diff --git a/shared/contracts/plugins/v1/fixtures/debug-adapters/debug-start.json b/shared/contracts/plugins/v1/fixtures/debug-adapters/debug-start.json deleted file mode 100644 index d2cd2ad466..0000000000 --- a/shared/contracts/plugins/v1/fixtures/debug-adapters/debug-start.json +++ /dev/null @@ -1,117 +0,0 @@ -{ - "description": "Parameters of lithe/host/debug/start and what debug.decodeBackendConfiguration returns. The host passes the plugin's manifest (`manifest`, a file in this directory) and the request's `params`. `start` is the normalized start; `error` is the rejection every host reports. The 256 KiB size limit is covered by Core's own tests.", - "manifest": "debug-adapter-features.plugin.json", - "cases": [ - { - "name": "the plugin's own adapter by its local ID", - "params": { - "context": { "contextID": "w-run", "generation": 1 }, - "label": "Debug main.script", - "adapter": "script", - "request": "launch", - "configuration": { "program": "main.script", "args": ["--fast"] } - }, - "start": { - "adapterID": "dev.lithe.fixture.debug-adapter-features/script", - "request": "launch", - "label": "Debug main.script", - "configuration": { "program": "main.script", "args": ["--fast"] } - } - }, - { - "name": "the plugin's own adapter by its qualified ID", - "params": { - "label": "Debug main.script", - "adapter": "dev.lithe.fixture.debug-adapter-features/script", - "request": "launch", - "configuration": {} - }, - "start": { - "adapterID": "dev.lithe.fixture.debug-adapter-features/script", - "request": "launch", - "label": "Debug main.script", - "configuration": {} - } - }, - { - "name": "an adapter of another plugin", - "params": { - "label": "Debug", - "adapter": "org.example.other/script", - "request": "launch", - "configuration": {} - }, - "error": { "code": "plugin.debug.foreignAdapter", "field": "adapter" } - }, - { - "name": "an adapter the plugin does not declare", - "params": { - "label": "Debug", - "adapter": "missing", - "request": "launch", - "configuration": {} - }, - "error": { "code": "plugin.debug.unknownAdapter", "field": "adapter" } - }, - { - "name": "a malformed adapter ID", - "params": { - "label": "Debug", - "adapter": "Not An ID", - "request": "launch", - "configuration": {} - }, - "error": { "code": "plugin.debug.invalidStart", "field": "adapter" } - }, - { - "name": "a request the adapter does not serve", - "params": { - "label": "Attach", - "adapter": "script", - "request": "attach", - "configuration": {} - }, - "error": { "code": "plugin.debug.invalidStart", "field": "request" } - }, - { - "name": "the session mode belongs to the host", - "params": { - "label": "Debug", - "adapter": "script", - "request": "launch", - "configuration": { "noDebug": true } - }, - "error": { "code": "plugin.debug.invalidStart", "field": "configuration.noDebug" } - }, - { - "name": "host bookkeeping keys belong to the host", - "params": { - "label": "Debug", - "adapter": "script", - "request": "launch", - "configuration": { "__sessionId": "x" } - }, - "error": { "code": "plugin.debug.invalidStart", "field": "configuration.__sessionId" } - }, - { - "name": "an empty label", - "params": { - "label": " ", - "adapter": "script", - "request": "launch", - "configuration": {} - }, - "error": { "code": "plugin.debug.invalidStart", "field": "label" } - }, - { - "name": "a configuration that is not an object", - "params": { - "label": "Debug", - "adapter": "script", - "request": "launch", - "configuration": ["main.script"] - }, - "error": { "code": "plugin.debug.invalidStart", "field": "params" } - } - ] -} diff --git a/shared/contracts/plugins/v1/fixtures/editor/editor-actions-v2.json b/shared/contracts/plugins/v1/fixtures/editor/editor-actions-v2.json deleted file mode 100644 index f008386927..0000000000 --- a/shared/contracts/plugins/v1/fixtures/editor/editor-actions-v2.json +++ /dev/null @@ -1,118 +0,0 @@ -{ - "schemaVersion": 1, - "description": "Version 2 editor action validation. `host` is what the host declared in getCapabilities (`services.editor.options.actionIcons` and `limits.editorActionSourceBytes`); `kind` is `actions` for a collector result (one-based UTF-16 positions in `text`) or `invokeResult` for the result of a clicked action or alternative. Accepted cases list the normalized value; rejected cases reject the whole result.", - "host": { - "actionIcons": ["run", "run-all", "debug", "test", "test-passed", "test-failed", "test-skipped", "navigate-super", "navigate-implementations"], - "actionSourceBytes": 1048576 - }, - "cases": [ - { - "name": "a Go main marker offers debug and test alternatives", - "kind": "actions", - "text": "package main\n\nfunc main() {}\n", - "value": { - "actions": [ - { - "id": "main", - "range": { "start": { "line": 3, "column": 1 }, "end": { "line": 3, "column": 10 } }, - "title": "Run main", - "icon": "run", - "invoke": { "functionID": "go.markers.invoke", "params": { "entry": "main" } }, - "alternatives": [ - { "id": "debug", "title": "Debug main", "icon": "debug", "invoke": { "functionID": "go.markers.invoke", "params": { "entry": "main", "debug": true } } }, - { "id": "test", "title": "Test package", "icon": "test", "invoke": { "functionID": "go.markers.invoke" } } - ] - } - ] - }, - "expected": { - "status": "accepted", - "value": [ - { - "id": "main", - "range": { "start": { "line": 3, "column": 1 }, "end": { "line": 3, "column": 10 } }, - "title": "Run main", - "icon": "run", - "invoke": { "functionID": "go.markers.invoke", "params": { "entry": "main" } }, - "alternatives": [ - { "id": "debug", "title": "Debug main", "icon": "debug", "invoke": { "functionID": "go.markers.invoke", "params": { "entry": "main", "debug": true } } }, - { "id": "test", "title": "Test package", "icon": "test", "invoke": { "functionID": "go.markers.invoke", "params": {} } } - ] - } - ] - } - }, - { - "name": "a Go test function shows its last outcome", - "kind": "actions", - "text": "func TestParse(t *testing.T) {}\n", - "value": { - "actions": [ - { "id": "TestParse", "range": { "start": { "line": 1, "column": 1 }, "end": { "line": 1, "column": 15 } }, "title": "Run TestParse", "icon": "test-failed", "invoke": { "functionID": "go.markers.invoke", "params": { "test": "TestParse" } } } - ] - }, - "expected": { - "status": "accepted", - "value": [ - { "id": "TestParse", "range": { "start": { "line": 1, "column": 1 }, "end": { "line": 1, "column": 15 } }, "title": "Run TestParse", "icon": "test-failed", "invoke": { "functionID": "go.markers.invoke", "params": { "test": "TestParse" } } } - ] - } - }, - { - "name": "an icon the host did not declare", - "kind": "actions", - "text": "x", - "value": { "actions": [ { "id": "a", "range": { "start": { "line": 1, "column": 1 }, "end": { "line": 1, "column": 1 } }, "title": "Run", "icon": "rocket", "invoke": { "functionID": "go.markers.invoke" } } ] }, - "expected": { "status": "rejected" } - }, - { - "name": "at most four alternatives", - "kind": "actions", - "text": "x", - "value": { "actions": [ { "id": "a", "range": { "start": { "line": 1, "column": 1 }, "end": { "line": 1, "column": 1 } }, "title": "Run", "icon": "run", "invoke": { "functionID": "go.markers.invoke" }, - "alternatives": [ - { "id": "1", "title": "One", "icon": "debug", "invoke": { "functionID": "go.markers.invoke" } }, - { "id": "2", "title": "Two", "icon": "debug", "invoke": { "functionID": "go.markers.invoke" } }, - { "id": "3", "title": "Three", "icon": "debug", "invoke": { "functionID": "go.markers.invoke" } }, - { "id": "4", "title": "Four", "icon": "debug", "invoke": { "functionID": "go.markers.invoke" } }, - { "id": "5", "title": "Five", "icon": "debug", "invoke": { "functionID": "go.markers.invoke" } } - ] } ] }, - "expected": { "status": "rejected" } - }, - { - "name": "alternative IDs are unique within their action", - "kind": "actions", - "text": "x", - "value": { "actions": [ { "id": "a", "range": { "start": { "line": 1, "column": 1 }, "end": { "line": 1, "column": 1 } }, "title": "Run", "icon": "run", "invoke": { "functionID": "go.markers.invoke" }, - "alternatives": [ - { "id": "same", "title": "Debug", "icon": "debug", "invoke": { "functionID": "go.markers.invoke" } }, - { "id": "same", "title": "Test", "icon": "test", "invoke": { "functionID": "go.markers.invoke" } } - ] } ] }, - "expected": { "status": "rejected" } - }, - { - "name": "a click reveals resource-key definitions", - "kind": "invokeResult", - "value": { "reveal": { "locations": [ - { "uri": "file:///workspace/messages.properties", "range": { "start": { "line": 4, "character": 0 }, "end": { "line": 4, "character": 9 } } }, - { "uri": "file:///workspace/messages_zh.properties", "range": { "start": { "line": 2, "character": 0 }, "end": { "line": 2, "character": 9 } } } - ] }, "started": true }, - "expected": { "status": "accepted", "value": { "reveal": { "locations": [ - { "uri": "file:///workspace/messages.properties", "range": { "start": { "line": 4, "character": 0 }, "end": { "line": 4, "character": 9 } } }, - { "uri": "file:///workspace/messages_zh.properties", "range": { "start": { "line": 2, "character": 0 }, "end": { "line": 2, "character": 9 } } } - ] } } } - }, - { - "name": "other result members stay the plugin's own", - "kind": "invokeResult", - "value": { "runID": "r1" }, - "expected": { "status": "accepted", "value": {} } - }, - { - "name": "a reveal location needs an absolute URI", - "kind": "invokeResult", - "value": { "reveal": { "locations": [ { "uri": "messages.properties", "range": { "start": { "line": 0, "character": 0 }, "end": { "line": 0, "character": 0 } } } ] } }, - "expected": { "status": "rejected" } - } - ] -} diff --git a/shared/contracts/plugins/v1/fixtures/editor/editor-actions.plugin.json b/shared/contracts/plugins/v1/fixtures/editor/editor-actions.plugin.json deleted file mode 100644 index 2c499d2f7c..0000000000 --- a/shared/contracts/plugins/v1/fixtures/editor/editor-actions.plugin.json +++ /dev/null @@ -1,36 +0,0 @@ -{ - "schemaVersion": 2, - "id": "dev.lithe.fixture.editoractions", - "displayName": "Editor Actions", - "version": "1.0.0", - "pluginAPIVersion": 3, - "requires": { - "backend": 2, - "serverProcess": 1 - }, - "vendor": { - "id": "org.example", - "displayName": "Example", - "signatureRequirement": "publisherPackage" - }, - "permissions": [ - "backend.launch", - "documents.read", - "editor.actions", - "workspace.metadata" - ], - "activationEvents": [ - "onWorkspaceOpen" - ], - "languages": [], - "backend": { - "launch": { - "kind": "packaged", - "path": "bin/backend" - }, - "arguments": [ - "--state", - "${stateDir}" - ] - } -} diff --git a/shared/contracts/plugins/v1/fixtures/editor/editor-providers.json b/shared/contracts/plugins/v1/fixtures/editor/editor-providers.json deleted file mode 100644 index 671aaea004..0000000000 --- a/shared/contracts/plugins/v1/fixtures/editor/editor-providers.json +++ /dev/null @@ -1,132 +0,0 @@ -{ - "schemaVersion": 1, - "description": "lithe/host/editor/registerProviders validation. `host.providerTypes` is what the host declared in getCapabilities (`services.editor.options.providerTypes`). Registration cases carry the method params without `context`; result cases carry one provider function's LSP 3.17 shaped result and the normalized value the host merges after the language server's own answer. Positions are zero-based LSP positions. A rejected registration names the host failure code; a rejected result is dropped whole.", - "host": { - "providerTypes": ["definition", "hover", "completion", "codeLens", "foldingRange", "semanticTokens", "documentLink"] - }, - "registrations": [ - { - "name": "resource keys navigate from templates to message bundles", - "params": { - "id": "message-keys", - "selector": { "languages": ["html"], "fileExtensions": [".Properties"], "fileNames": ["Messages"] }, - "providers": { - "definition": { "function": "keys.definition" }, - "hover": { "function": "keys.hover" }, - "completion": { "function": "keys.complete", "triggerCharacters": ["."] }, - "codeLens": { "function": "keys.usages" }, - "semanticTokens": { "function": "keys.tokens", "legend": { "tokenTypes": ["property", "string"], "tokenModifiers": ["declaration"] } } - } - }, - "expected": { - "status": "accepted", - "registration": { - "id": "message-keys", - "selector": { "languages": ["html"], "fileExtensions": ["properties"], "fileNames": ["messages"] }, - "providers": { - "codeLens": { "function": "keys.usages", "budgetMs": 2000 }, - "completion": { "function": "keys.complete", "triggerCharacters": ["."], "budgetMs": 400 }, - "definition": { "function": "keys.definition", "budgetMs": 1500 }, - "hover": { "function": "keys.hover", "budgetMs": 400 }, - "semanticTokens": { "function": "keys.tokens", "legend": { "tokenTypes": ["property", "string"], "tokenModifiers": ["declaration"] }, "budgetMs": 2000 } - } - } - } - }, - { - "name": "a provider type the host does not route", - "params": { "id": "message-keys", "selector": { "fileExtensions": ["properties"] }, "providers": { "signatureHelp": { "function": "keys.signature" } } }, - "expected": { "status": "rejected", "code": "plugin.host.unsupportedOption", "details": { "option": "providers.signatureHelp" } } - }, - { - "name": "diagnostics are not a provider", - "params": { "id": "message-keys", "selector": { "fileExtensions": ["properties"] }, "providers": { "diagnostics": { "function": "keys.check" } } }, - "expected": { "status": "rejected", "code": "plugin.host.unsupportedOption", "details": { "option": "providers.diagnostics" } } - }, - { - "name": "a selector names at least one language, extension or file", - "params": { "id": "message-keys", "selector": {}, "providers": { "hover": { "function": "keys.hover" } } }, - "expected": { "status": "rejected", "code": "plugin.host.invalidParams" } - }, - { - "name": "semantic tokens declare their legend", - "params": { "id": "message-keys", "selector": { "fileExtensions": ["properties"] }, "providers": { "semanticTokens": { "function": "keys.tokens" } } }, - "expected": { "status": "rejected", "code": "plugin.host.invalidParams" } - }, - { - "name": "budgets are the host's", - "params": { "id": "message-keys", "selector": { "fileExtensions": ["properties"] }, "providers": { "hover": { "function": "keys.hover", "budgetMs": 5000 } } }, - "expected": { "status": "rejected", "code": "plugin.host.invalidParams" } - } - ], - "results": [ - { - "name": "a definition link becomes its target selection", - "type": "definition", - "value": [ { "targetUri": "file:///workspace/messages.properties", "targetRange": { "start": { "line": 3, "character": 0 }, "end": { "line": 3, "character": 30 } }, "targetSelectionRange": { "start": { "line": 3, "character": 0 }, "end": { "line": 3, "character": 9 } } } ], - "expected": { "status": "accepted", "value": { "locations": [ { "uri": "file:///workspace/messages.properties", "range": { "start": { "line": 3, "character": 0 }, "end": { "line": 3, "character": 9 } } } ] } } - }, - { - "name": "no definition", - "type": "definition", - "value": null, - "expected": { "status": "accepted", "value": { "locations": [] } } - }, - { - "name": "a hover with a code block", - "type": "hover", - "value": { "contents": [ { "language": "properties", "value": "app.title=Lithe" }, "Defined in messages.properties" ], "range": { "start": { "line": 0, "character": 7 }, "end": { "line": 0, "character": 16 } } }, - "expected": { "status": "accepted", "value": { "contents": [ { "kind": "markdown", "value": "```properties\napp.title=Lithe\n```" }, { "kind": "markdown", "value": "Defined in messages.properties" } ], "range": { "start": { "line": 0, "character": 7 }, "end": { "line": 0, "character": 16 } } } } - }, - { - "name": "completion keeps presentation and edits only", - "type": "completion", - "value": { "isIncomplete": false, "items": [ { "label": "app.title", "kind": 10, "detail": "Lithe", "data": { "cursor": 1 }, "command": { "title": "Resolve", "command": "keys.resolve" } } ] }, - "expected": { "status": "accepted", "value": { "isIncomplete": false, "items": [ { "label": "app.title", "kind": 10, "detail": "Lithe" } ] } } - }, - { - "name": "a code lens calls a function of its plugin", - "type": "codeLens", - "value": [ { "range": { "start": { "line": 3, "character": 0 }, "end": { "line": 3, "character": 9 } }, "command": { "title": "2 usages", "command": "keys.usages.reveal", "arguments": [ { "key": "app.title" } ] } } ], - "expected": { "status": "accepted", "value": { "lenses": [ { "range": { "start": { "line": 3, "character": 0 }, "end": { "line": 3, "character": 9 } }, "command": { "title": "2 usages", "command": "keys.usages.reveal", "arguments": [ { "key": "app.title" } ] } } ] } } - }, - { - "name": "a code lens without a command", - "type": "codeLens", - "value": [ { "range": { "start": { "line": 0, "character": 0 }, "end": { "line": 0, "character": 0 } } } ], - "expected": { "status": "rejected" } - }, - { - "name": "folding ranges keep their kind", - "type": "foldingRange", - "value": [ { "startLine": 0, "endLine": 4, "kind": "region", "collapsedText": "..." } ], - "expected": { "status": "accepted", "value": { "ranges": [ { "startLine": 0, "endLine": 4, "kind": "region" } ] } } - }, - { - "name": "semantic tokens index the registered legend", - "type": "semanticTokens", - "legend": { "tokenTypes": ["property", "string"], "tokenModifiers": ["declaration"] }, - "value": { "resultId": "1", "data": [0, 0, 9, 0, 1, 0, 10, 5, 1, 0] }, - "expected": { "status": "accepted", "value": { "data": [0, 0, 9, 0, 1, 0, 10, 5, 1, 0] } } - }, - { - "name": "a semantic token type outside the legend", - "type": "semanticTokens", - "legend": { "tokenTypes": ["property"], "tokenModifiers": [] }, - "value": { "data": [0, 0, 9, 1, 0] }, - "expected": { "status": "rejected" } - }, - { - "name": "a document link needs an absolute target", - "type": "documentLink", - "value": [ { "range": { "start": { "line": 0, "character": 0 }, "end": { "line": 0, "character": 4 } }, "target": "messages.properties" } ], - "expected": { "status": "rejected" } - }, - { - "name": "a document link to a bundle", - "type": "documentLink", - "value": [ { "range": { "start": { "line": 0, "character": 0 }, "end": { "line": 0, "character": 4 } }, "target": "file:///workspace/messages.properties", "tooltip": "Open bundle" } ], - "expected": { "status": "accepted", "value": { "links": [ { "range": { "start": { "line": 0, "character": 0 }, "end": { "line": 0, "character": 4 } }, "target": "file:///workspace/messages.properties", "tooltip": "Open bundle" } ] } } - } - ] -} diff --git a/shared/contracts/plugins/v1/fixtures/editor/editor-providers.plugin.json b/shared/contracts/plugins/v1/fixtures/editor/editor-providers.plugin.json deleted file mode 100644 index 0a3dd906bb..0000000000 --- a/shared/contracts/plugins/v1/fixtures/editor/editor-providers.plugin.json +++ /dev/null @@ -1,36 +0,0 @@ -{ - "schemaVersion": 2, - "id": "dev.lithe.fixture.editorproviders", - "displayName": "Editor Providers", - "version": "1.0.0", - "pluginAPIVersion": 3, - "requires": { - "backend": 2, - "serverProcess": 1 - }, - "vendor": { - "id": "org.example", - "displayName": "Example", - "signatureRequirement": "publisherPackage" - }, - "permissions": [ - "backend.launch", - "documents.read", - "editor.providers", - "workspace.metadata" - ], - "activationEvents": [ - "onWorkspaceOpen" - ], - "languages": [], - "backend": { - "launch": { - "kind": "packaged", - "path": "bin/backend" - }, - "arguments": [ - "--state", - "${stateDir}" - ] - } -} diff --git a/shared/contracts/plugins/v1/fixtures/keymap-import/keymap-import-provider.plugin.json b/shared/contracts/plugins/v1/fixtures/keymap-import/keymap-import-provider.plugin.json deleted file mode 100644 index 0cafa02bf5..0000000000 --- a/shared/contracts/plugins/v1/fixtures/keymap-import/keymap-import-provider.plugin.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "schemaVersion": 2, - "id": "dev.lithe.fixture.import", - "displayName": "Shortcut import fixture", - "version": "1.0.0", - "pluginAPIVersion": 3, - "requires": {"keymapImportProviders": 1, "backend": 2, "serverProcess": 1}, - "vendor": {"id": "org.example", "displayName": "Fixture publisher", "signatureRequirement": "publisherPackage"}, - "permissions": ["backend.launch", "keymaps.provide", "keymaps.readSelectedSources"], - "keymapImportProviders": [ - {"id": "first", "displayName": "First editor", "recognition": [{"kind": "file", "path": "bindings.json"}, {"kind": "root", "base": "userConfig", "components": ["FirstEditor", "User"]}, {"kind": "root", "base": "userConfig", "components": ["FirstEditor", "User", "profiles", "*"]}], "inputs": [{"kind": "file", "path": "bindings.json"}]}, - {"id": "second", "displayName": "Second editor", "recognition": [{"kind": "directory", "path": "keymaps"}], "inputs": [ - {"kind": "file", "path": "options/map.xml"}, - {"kind": "directory", "path": "keymaps", "extension": "xml"} - ]} - ], - "backend": {"launch": {"kind": "packaged", "path": "bin/import-provider"}, "arguments": ["--stdio"]} -} diff --git a/shared/contracts/plugins/v1/fixtures/languages/command-plans.json b/shared/contracts/plugins/v1/fixtures/languages/command-plans.json deleted file mode 100644 index 9200afed0f..0000000000 --- a/shared/contracts/plugins/v1/fixtures/languages/command-plans.json +++ /dev/null @@ -1,709 +0,0 @@ -{ - "schemaVersion": 1, - "description": "Golden expansions of declarative run/test templates and language-server launch plans. `request` is the payload's request object for the named operation; `expected` is the command's data object.", - "cases": [ - { - "name": "php run passes user arguments after the file", - "plugin": "language-packaged-server.plugin.json", - "languageID": "php", - "operation": "runPlan", - "request": { "relativeFilePath": "public/index.php", "arguments": ["--verbose", "two words"] }, - "expected": { - "status": "ok", - "plan": { "executable": { "command": "php" }, "arguments": ["public/index.php", "--verbose", "two words"], "workingDirectory": "." } - } - }, - { - "name": "php run protects a file name that looks like an option", - "plugin": "language-packaged-server.plugin.json", - "languageID": "php", - "operation": "runPlan", - "request": { "relativeFilePath": "-weird.php" }, - "expected": { - "status": "ok", - "plan": { "executable": { "command": "php" }, "arguments": ["./-weird.php"], "workingDirectory": "." } - } - }, - { - "name": "php run keeps surrounding spaces in a file name", - "plugin": "language-packaged-server.plugin.json", - "languageID": "php", - "operation": "runPlan", - "request": { "relativeFilePath": " spaced.php" }, - "expected": { - "status": "ok", - "plan": { "executable": { "command": "php" }, "arguments": [" spaced.php"], "workingDirectory": "." } - } - }, - { - "name": "php run refuses a path outside the workspace", - "plugin": "language-packaged-server.plugin.json", - "languageID": "php", - "operation": "runPlan", - "request": { "relativeFilePath": "../outside.php" }, - "expected": { "status": "rejected", "code": "plugin.path.invalid" } - }, - { - "name": "php discovery lists the workspace then sorted test files", - "plugin": "language-packaged-server.plugin.json", - "languageID": "php", - "operation": "discoverTests", - "request": { "relativeProjectFilePaths": ["tests/StoreTest.php", "composer.json", "src/Store.php", "tests/Helpers.php", "tests/LegacyTEST.php"] }, - "expected": { - "status": "ok", - "items": [ - { "id": "php:workspace", "label": "All PHP Tests", "kind": "workspace" }, - { "id": "php:file:tests/LegacyTEST.php", "label": "tests/LegacyTEST.php", "kind": "file", "relativeFilePath": "tests/LegacyTEST.php" }, - { "id": "php:file:tests/StoreTest.php", "label": "tests/StoreTest.php", "kind": "file", "relativeFilePath": "tests/StoreTest.php" } - ] - } - }, - { - "name": "php discovery returns nothing outside a PHP project", - "plugin": "language-packaged-server.plugin.json", - "languageID": "php", - "operation": "discoverTests", - "request": { "relativeProjectFilePaths": ["README.md", "index.php", "tests/IndexTest.php"] }, - "expected": { "status": "ok", "items": [] } - }, - { - "name": "php workspace test", - "plugin": "language-packaged-server.plugin.json", - "languageID": "php", - "operation": "testPlan", - "request": { "scope": { "kind": "workspace" }, "relativeProjectFilePaths": ["phpunit.xml.dist"] }, - "expected": { - "status": "ok", - "plan": { "label": "All PHP Tests", "frameworkID": "phpunit", "executable": { "command": "php" }, "arguments": ["vendor/bin/phpunit"], "workingDirectory": "." } - } - }, - { - "name": "php file test", - "plugin": "language-packaged-server.plugin.json", - "languageID": "php", - "operation": "testPlan", - "request": { "scope": { "kind": "file", "relativeFilePath": "tests/StoreTest.php" }, "relativeProjectFilePaths": ["composer.json"] }, - "expected": { - "status": "ok", - "plan": { "label": "StoreTest.php", "frameworkID": "phpunit", "executable": { "command": "php" }, "arguments": ["vendor/bin/phpunit", "tests/StoreTest.php"], "workingDirectory": "." } - } - }, - { - "name": "php single test case with its file", - "plugin": "language-packaged-server.plugin.json", - "languageID": "php", - "operation": "testPlan", - "request": { "scope": { "kind": "testCase", "identifier": " testKeepsInsertionOrder ", "relativeFilePath": "tests/StoreTest.php" }, "relativeProjectFilePaths": ["composer.json"] }, - "expected": { - "status": "ok", - "plan": { "label": "testKeepsInsertionOrder", "frameworkID": "phpunit", "executable": { "command": "php" }, "arguments": ["vendor/bin/phpunit", "--filter", "\\btestKeepsInsertionOrder\\b", "tests/StoreTest.php"], "workingDirectory": "." } - } - }, - { - "name": "php single test case escapes regex characters and omits the missing file", - "plugin": "language-packaged-server.plugin.json", - "languageID": "php", - "operation": "testPlan", - "request": { "scope": { "kind": "testCase", "identifier": "testA.b/c" }, "relativeProjectFilePaths": ["composer.json"] }, - "expected": { - "status": "ok", - "plan": { "label": "testA.b/c", "frameworkID": "phpunit", "executable": { "command": "php" }, "arguments": ["vendor/bin/phpunit", "--filter", "\\btestA\\.b/c\\b"], "workingDirectory": "." } - } - }, - { - "name": "php blank test identifier", - "plugin": "language-packaged-server.plugin.json", - "languageID": "php", - "operation": "testPlan", - "request": { "scope": { "kind": "testCase", "identifier": " " }, "relativeProjectFilePaths": ["composer.json"] }, - "expected": { "status": "rejected", "code": "plugin.test.invalidIdentifier" } - }, - { - "name": "php test outside a PHP project", - "plugin": "language-packaged-server.plugin.json", - "languageID": "php", - "operation": "testPlan", - "request": { "scope": { "kind": "workspace" }, "relativeProjectFilePaths": ["index.php"] }, - "expected": { "status": "rejected", "code": "plugin.test.unsupportedProject" } - }, - { - "name": "language without an execution provider", - "plugin": "language-packaged-server.plugin.json", - "languageID": "python", - "operation": "runPlan", - "request": { "relativeFilePath": "main.py" }, - "expected": { "status": "rejected", "code": "plugin.execution.unavailable" } - }, - { - "name": "go run uses the project toolchain", - "plugin": "language-system-command.plugin.json", - "languageID": "go", - "operation": "runPlan", - "request": { "relativeFilePath": "cmd/app/main.go", "arguments": ["-port", "8080"] }, - "expected": { - "status": "ok", - "plan": { "executable": { "toolchain": "project-go" }, "arguments": ["run", "cmd/app/main.go", "-port", "8080"], "workingDirectory": "." } - } - }, - { - "name": "go discovery", - "plugin": "language-system-command.plugin.json", - "languageID": "go", - "operation": "discoverTests", - "request": { "relativeProjectFilePaths": ["go.mod", "main.go", "pkg/store/store_test.go", "main_test.go"] }, - "expected": { - "status": "ok", - "items": [ - { "id": "go:workspace", "label": "All Go Tests", "kind": "workspace" }, - { "id": "go:file:main_test.go", "label": "main_test.go", "kind": "file", "relativeFilePath": "main_test.go" }, - { "id": "go:file:pkg/store/store_test.go", "label": "pkg/store/store_test.go", "kind": "file", "relativeFilePath": "pkg/store/store_test.go" } - ] - } - }, - { - "name": "go file test runs the file's package", - "plugin": "language-system-command.plugin.json", - "languageID": "go", - "operation": "testPlan", - "request": { "scope": { "kind": "file", "relativeFilePath": "pkg/store/store_test.go" }, "relativeProjectFilePaths": ["go.mod"] }, - "expected": { - "status": "ok", - "plan": { "label": "store_test.go", "frameworkID": "go", "executable": { "toolchain": "project-go" }, "arguments": ["test", "./pkg/store"], "workingDirectory": "." } - } - }, - { - "name": "go test case in a root file targets the root package", - "plugin": "language-system-command.plugin.json", - "languageID": "go", - "operation": "testPlan", - "request": { "scope": { "kind": "testCase", "identifier": "TestMain", "relativeFilePath": "main_test.go" }, "relativeProjectFilePaths": ["go.work"] }, - "expected": { - "status": "ok", - "plan": { "label": "TestMain", "frameworkID": "go", "executable": { "toolchain": "project-go" }, "arguments": ["test", ".", "-run", "^TestMain$"], "workingDirectory": "." } - } - }, - { - "name": "go test case without a file searches every package", - "plugin": "language-system-command.plugin.json", - "languageID": "go", - "operation": "testPlan", - "request": { "scope": { "kind": "testCase", "identifier": "TestStore/sub(case)" }, "relativeProjectFilePaths": ["go.mod"] }, - "expected": { - "status": "ok", - "plan": { "label": "TestStore/sub(case)", "frameworkID": "go", "executable": { "toolchain": "project-go" }, "arguments": ["test", "./...", "-run", "^TestStore/sub\\(case\\)$"], "workingDirectory": "." } - } - }, - { - "name": "node launch discovers the runtime, carries its version probe, and expands host directories", - "plugin": "node-runtime.plugin.json", - "languageID": "fixture", - "operation": "languageServerLaunchPlan", - "request": { - "pluginDirectory": "/plugins/node/versions/1.0.0", - "stateDirectory": "/state/node", - "workspaceStateDirectory": "/state/node/workspaces/abc", - "architecture": "x86_64" - }, - "expected": { - "status": "ok", - "plan": { - "owner": { "pluginID": "dev.lithe.fixture.node-runtime", "version": "1.0.0" }, - "launch": { - "kind": "runtime", - "tool": "node", - "entry": "language-server/lib/server.js", - "minimumVersion": "18.17", - "versionArguments": [ - "--version" - ] - }, - "arguments": [ - "--max-old-space-size=2048", - "--require=/plugins/node/versions/1.0.0/language-server/lib/preload.js", - "/plugins/node/versions/1.0.0/language-server/lib/server.js", - "--stdio", - "--log-level=info", - "--storage", - "/state/node/storage", - "--workspace-cache", - "/state/node/workspaces/abc" - ], - "validationArguments": [], - "runtimeRequirements": [ - { - "tool": "node", - "minimumVersion": "18.17" - } - ], - "initializationOptions": { - "stubs": [ - "/plugins/node/versions/1.0.0/language-server/stubs/x86_64" - ], - "telemetry": false - }, - "requiredDirectories": [ - "state", - "workspaceState" - ], - "requiredPackagePaths": [ - "language-server/lib/preload.js", - "language-server/lib/server.js", - "language-server/stubs/x86_64" - ], - "settings": { - "heapMB": 2048, - "logLevel": "info", - "telemetry": false - } - } - } - }, - { - "name": "node launch substitutes stored settings, keeping a boolean setting a boolean", - "plugin": "node-runtime.plugin.json", - "languageID": "fixture", - "operation": "languageServerLaunchPlan", - "request": { - "pluginDirectory": "/plugins/node/versions/1.0.0", - "stateDirectory": "/state/node", - "workspaceStateDirectory": "/state/node/workspaces/abc", - "architecture": "x86_64", - "settings": { - "heapMB": 4096, - "logLevel": "debug", - "telemetry": true - } - }, - "expected": { - "status": "ok", - "plan": { - "owner": { "pluginID": "dev.lithe.fixture.node-runtime", "version": "1.0.0" }, - "launch": { - "kind": "runtime", - "tool": "node", - "entry": "language-server/lib/server.js", - "minimumVersion": "18.17", - "versionArguments": [ - "--version" - ] - }, - "arguments": [ - "--max-old-space-size=4096", - "--require=/plugins/node/versions/1.0.0/language-server/lib/preload.js", - "/plugins/node/versions/1.0.0/language-server/lib/server.js", - "--stdio", - "--log-level=debug", - "--storage", - "/state/node/storage", - "--workspace-cache", - "/state/node/workspaces/abc" - ], - "validationArguments": [], - "runtimeRequirements": [ - { - "tool": "node", - "minimumVersion": "18.17" - } - ], - "initializationOptions": { - "stubs": [ - "/plugins/node/versions/1.0.0/language-server/stubs/x86_64" - ], - "telemetry": true - }, - "requiredDirectories": [ - "state", - "workspaceState" - ], - "requiredPackagePaths": [ - "language-server/lib/preload.js", - "language-server/lib/server.js", - "language-server/stubs/x86_64" - ], - "settings": { - "heapMB": 4096, - "logLevel": "debug", - "telemetry": true - } - } - } - }, - { - "name": "node launch falls back to defaults for stored values the declaration no longer accepts", - "plugin": "node-runtime.plugin.json", - "languageID": "fixture", - "operation": "languageServerLaunchPlan", - "request": { - "pluginDirectory": "/plugins/node/versions/1.0.0", - "stateDirectory": "/state/node", - "workspaceStateDirectory": "/state/node/workspaces/abc", - "architecture": "x86_64", - "settings": { - "heapMB": 99999, - "logLevel": "verbose", - "telemetry": "yes", - "unknown": 1 - } - }, - "expected": { - "status": "ok", - "plan": { - "owner": { "pluginID": "dev.lithe.fixture.node-runtime", "version": "1.0.0" }, - "launch": { - "kind": "runtime", - "tool": "node", - "entry": "language-server/lib/server.js", - "minimumVersion": "18.17", - "versionArguments": [ - "--version" - ] - }, - "arguments": [ - "--max-old-space-size=2048", - "--require=/plugins/node/versions/1.0.0/language-server/lib/preload.js", - "/plugins/node/versions/1.0.0/language-server/lib/server.js", - "--stdio", - "--log-level=info", - "--storage", - "/state/node/storage", - "--workspace-cache", - "/state/node/workspaces/abc" - ], - "validationArguments": [], - "runtimeRequirements": [ - { - "tool": "node", - "minimumVersion": "18.17" - } - ], - "initializationOptions": { - "stubs": [ - "/plugins/node/versions/1.0.0/language-server/stubs/x86_64" - ], - "telemetry": false - }, - "requiredDirectories": [ - "state", - "workspaceState" - ], - "requiredPackagePaths": [ - "language-server/lib/preload.js", - "language-server/lib/server.js", - "language-server/stubs/x86_64" - ], - "settings": { - "heapMB": 2048, - "logLevel": "info", - "telemetry": false - } - } - } - }, - { - "name": "node launch keeps a stored value for one setting and defaults the others", - "plugin": "node-runtime.plugin.json", - "languageID": "fixture", - "operation": "languageServerLaunchPlan", - "request": { - "pluginDirectory": "/plugins/node/versions/1.0.0", - "stateDirectory": "/state/node", - "workspaceStateDirectory": "/state/node/workspaces/abc", - "architecture": "x86_64", - "settings": { - "heapMB": 1024 - } - }, - "expected": { - "status": "ok", - "plan": { - "owner": { "pluginID": "dev.lithe.fixture.node-runtime", "version": "1.0.0" }, - "launch": { - "kind": "runtime", - "tool": "node", - "entry": "language-server/lib/server.js", - "minimumVersion": "18.17", - "versionArguments": [ - "--version" - ] - }, - "arguments": [ - "--max-old-space-size=1024", - "--require=/plugins/node/versions/1.0.0/language-server/lib/preload.js", - "/plugins/node/versions/1.0.0/language-server/lib/server.js", - "--stdio", - "--log-level=info", - "--storage", - "/state/node/storage", - "--workspace-cache", - "/state/node/workspaces/abc" - ], - "validationArguments": [], - "runtimeRequirements": [ - { - "tool": "node", - "minimumVersion": "18.17" - } - ], - "initializationOptions": { - "stubs": [ - "/plugins/node/versions/1.0.0/language-server/stubs/x86_64" - ], - "telemetry": false - }, - "requiredDirectories": [ - "state", - "workspaceState" - ], - "requiredPackagePaths": [ - "language-server/lib/preload.js", - "language-server/lib/server.js", - "language-server/stubs/x86_64" - ], - "settings": { - "heapMB": 1024, - "logLevel": "info", - "telemetry": false - } - } - } - }, - { - "name": "php launch keeps API 1 arguments literal and names the packaged executable", - "plugin": "language-packaged-server.plugin.json", - "languageID": "php", - "operation": "languageServerLaunchPlan", - "request": { - "pluginDirectory": "/plugins/java/versions/1.0.0", - "stateDirectory": "/state/java", - "workspaceStateDirectory": "/state/java/workspaces/abc", - "architecture": "arm64" - }, - "expected": { - "status": "ok", - "plan": { - "owner": { "pluginID": "dev.lithe.fixture.language-packaged-server", "version": "0.1.0" }, - "launch": { - "kind": "packaged", - "path": "language-server/bin/intelephense" - }, - "arguments": [ - "--stdio" - ], - "validationArguments": [], - "runtimeRequirements": [ - { - "tool": "node" - } - ], - "requiredDirectories": [], - "requiredPackagePaths": [ - "language-server/bin/intelephense" - ] - } - } - }, - { - "name": "go launch resolves a system command and needs nothing from the package", - "plugin": "language-system-command.plugin.json", - "languageID": "go", - "operation": "languageServerLaunchPlan", - "request": { - "pluginDirectory": "/plugins/java/versions/1.0.0", - "stateDirectory": "/state/java", - "workspaceStateDirectory": "/state/java/workspaces/abc", - "architecture": "arm64" - }, - "expected": { - "status": "ok", - "plan": { - "owner": { "pluginID": "dev.lithe.fixture.language-system-command", "version": "0.1.0" }, - "launch": { - "kind": "systemCommand", - "commands": [ - "gopls" - ] - }, - "arguments": [], - "validationArguments": [ - "version" - ], - "runtimeRequirements": [ - { - "tool": "go" - } - ], - "requiredDirectories": [], - "requiredPackagePaths": [] - } - } - }, - { - "name": "mix provider launch is the elixir language server plan and names that server", - "plugin": "build-provider-language-server.plugin.json", - "buildSystemID": "mix", - "operation": "languageServerLaunchPlan", - "request": { - "pluginDirectory": "/plugins/mix/versions/0.1.0", - "stateDirectory": "/state/mix", - "workspaceStateDirectory": "/state/mix/workspaces/abc", - "architecture": "x86_64" - }, - "expected": { - "status": "ok", - "plan": { - "owner": { "pluginID": "dev.lithe.fixture.build-provider-language-server", "version": "0.1.0" }, - "launch": { - "kind": "systemCommand", - "commands": [ - "elixir-ls" - ] - }, - "arguments": [ - "--stdio" - ], - "validationArguments": [], - "runtimeRequirements": [], - "requiredDirectories": [], - "requiredPackagePaths": [], - "buildProvider": { - "buildSystemID": "mix", - "executesProjectCode": true, - "mayUseNetwork": false, - "languageServer": "elixir" - } - } - } - }, - { - "name": "elixir language server launch carries no build provider", - "plugin": "build-provider-language-server.plugin.json", - "languageID": "elixir", - "operation": "languageServerLaunchPlan", - "request": { - "pluginDirectory": "/plugins/mix/versions/0.1.0", - "stateDirectory": "/state/mix", - "workspaceStateDirectory": "/state/mix/workspaces/abc", - "architecture": "x86_64" - }, - "expected": { - "status": "ok", - "plan": { - "owner": { "pluginID": "dev.lithe.fixture.build-provider-language-server", "version": "0.1.0" }, - "launch": { - "kind": "systemCommand", - "commands": [ - "elixir-ls" - ] - }, - "arguments": [ - "--stdio" - ], - "validationArguments": [], - "runtimeRequirements": [], - "requiredDirectories": [], - "requiredPackagePaths": [] - } - } - }, - { - "name": "launch plan refuses a build system without a provider", - "plugin": "build-static-file.plugin.json", - "buildSystemID": "cargo", - "operation": "languageServerLaunchPlan", - "request": { - "pluginDirectory": "/plugins/cargo/versions/0.1.0", - "stateDirectory": "/state/cargo", - "workspaceStateDirectory": "/state/cargo/workspaces/abc", - "architecture": "x86_64" - }, - "expected": { - "status": "rejected", - "code": "plugin.launch.unavailable" - } - }, - { - "name": "launch plan refuses an undeclared build system", - "plugin": "build-provider.plugin.json", - "buildSystemID": "maven", - "operation": "languageServerLaunchPlan", - "request": { - "pluginDirectory": "/plugins/gradle/versions/0.1.0", - "stateDirectory": "/state/gradle", - "workspaceStateDirectory": "/state/gradle/workspaces/abc", - "architecture": "arm64", - "settings": { - "providerHeapMB": 2048 - } - }, - "expected": { - "status": "rejected", - "code": "plugin.launch.unavailable" - } - }, - { - "name": "node runtime receives an explicit session plugin log directory", - "plugin": "node-runtime.plugin.json", - "languageID": "fixture", - "operation": "languageServerLaunchPlan", - "request": { - "pluginDirectory": "/plugins/node/versions/1.0.0", - "stateDirectory": "/state/node", - "workspaceStateDirectory": "/state/node/workspaces/abc", - "architecture": "x86_64", - "logDirectory": "/logs/sessions/current/plugins/io.example/files" - }, - "expected": { - "status": "ok", - "plan": { - "owner": { "pluginID": "dev.lithe.fixture.node-runtime", "version": "1.0.0" }, - "launch": { - "kind": "runtime", - "tool": "node", - "entry": "language-server/lib/server.js", - "minimumVersion": "18.17", - "versionArguments": [ - "--version" - ] - }, - "arguments": [ - "--max-old-space-size=2048", - "--require=/plugins/node/versions/1.0.0/language-server/lib/preload.js", - "/plugins/node/versions/1.0.0/language-server/lib/server.js", - "--stdio", - "--log=/logs/sessions/current/plugins/io.example/files/server.log" - ], - "validationArguments": [], - "runtimeRequirements": [ - { - "tool": "node", - "minimumVersion": "18.17" - } - ], - "initializationOptions": { - "stubs": [ - "/plugins/node/versions/1.0.0/language-server/stubs/x86_64" - ], - "telemetry": false - }, - "requiredDirectories": [ - "log" - ], - "requiredPackagePaths": [ - "language-server/lib/preload.js", - "language-server/lib/server.js", - "language-server/stubs/x86_64" - ], - "settings": { - "heapMB": 2048, - "logLevel": "info", - "telemetry": false - } - } - }, - "manifestArguments": [ - "--stdio", - "--log=${logDir}/server.log" - ] - } - ] -} diff --git a/shared/contracts/plugins/v1/fixtures/languages/grammars/http.tmLanguage.json b/shared/contracts/plugins/v1/fixtures/languages/grammars/http.tmLanguage.json deleted file mode 100644 index 3b228898a0..0000000000 --- a/shared/contracts/plugins/v1/fixtures/languages/grammars/http.tmLanguage.json +++ /dev/null @@ -1,61 +0,0 @@ -{ - "name": "HTTP Request", - "scopeName": "source.http", - "patterns": [ - { "include": "#separator" }, - { "include": "#comment" }, - { "include": "#variable-definition" }, - { "include": "#request-line" }, - { "include": "#header" }, - { "include": "#body" } - ], - "repository": { - "separator": { - "match": "^###.*$", - "name": "comment.line.separator.http" - }, - "comment": { - "match": "^\\s*(?:#|//).*$", - "name": "comment.line.http" - }, - "variable-definition": { - "match": "^(@[A-Za-z_][\\w.-]*)\\s*(=)\\s*(.*)$", - "captures": { - "1": { "name": "variable.other.definition.http" }, - "2": { "name": "keyword.operator.assignment.http" }, - "3": { "name": "string.unquoted.http", "patterns": [{ "include": "#variables" }] } - } - }, - "request-line": { - "match": "^(GET|HEAD|POST|PUT|PATCH|DELETE|OPTIONS|TRACE|CONNECT)\\s+(\\S+)(?:\\s+(HTTP/[\\d.]+))?\\s*$", - "captures": { - "1": { "name": "keyword.other.method.http" }, - "2": { "name": "string.unquoted.uri.http", "patterns": [{ "include": "#variables" }] }, - "3": { "name": "keyword.other.version.http" } - } - }, - "header": { - "begin": "^([A-Za-z][\\w-]*)\\s*(:)\\s*", - "beginCaptures": { - "1": { "name": "entity.name.tag.header.http" }, - "2": { "name": "punctuation.separator.key-value.http" } - }, - "end": "$", - "contentName": "string.unquoted.header-value.http", - "patterns": [{ "include": "#variables" }] - }, - "body": { - "patterns": [ - { "include": "#variables" }, - { "match": "\"(?:[^\"\\\\]|\\\\.)*\"", "name": "string.quoted.double.http" }, - { "match": "-?\\d+(?:\\.\\d+)?(?:[eE][-+]?\\d+)?", "name": "constant.numeric.http" }, - { "match": "\\b(?:true|false|null)\\b", "name": "constant.language.http" }, - { "match": "[{}\\[\\]]", "name": "punctuation.section.brackets.http" } - ] - }, - "variables": { - "match": "\\{\\{[^}]*\\}\\}", - "name": "variable.other.template.http" - } - } -} diff --git a/shared/contracts/plugins/v1/fixtures/languages/language-grammar.plugin.json b/shared/contracts/plugins/v1/fixtures/languages/language-grammar.plugin.json deleted file mode 100644 index cc92d19fd6..0000000000 --- a/shared/contracts/plugins/v1/fixtures/languages/language-grammar.plugin.json +++ /dev/null @@ -1,43 +0,0 @@ -{ - "schemaVersion": 2, - "id": "dev.lithe.fixture.httpgrammar", - "displayName": "HTTP Request Syntax", - "version": "1.0.0", - "pluginAPIVersion": 3, - "requires": { - "languages": 3 - }, - "vendor": { - "id": "org.example", - "displayName": "Example", - "signatureRequirement": "publisherPackage" - }, - "permissions": [], - "activationEvents": [], - "languages": [ - { - "id": "http", - "displayName": "HTTP Request", - "fileExtensions": [ - "http", - "rest" - ], - "grammar": { - "kind": "textmate", - "path": "grammars/http.tmLanguage.json" - }, - "configuration": { - "lineComment": "#", - "brackets": [ - ["{", "}"], - ["[", "]"] - ], - "autoClosingPairs": [ - ["{", "}"], - ["[", "]"], - ["\"", "\""] - ] - } - } - ] -} diff --git a/shared/contracts/plugins/v1/fixtures/languages/language-packaged-server.plugin.json b/shared/contracts/plugins/v1/fixtures/languages/language-packaged-server.plugin.json deleted file mode 100644 index 30aacbd2e3..0000000000 --- a/shared/contracts/plugins/v1/fixtures/languages/language-packaged-server.plugin.json +++ /dev/null @@ -1,99 +0,0 @@ -{ - "schemaVersion": 2, - "id": "dev.lithe.fixture.language-packaged-server", - "displayName": "Packaged Language Server Fixture", - "version": "0.1.0", - "pluginAPIVersion": 1, - "vendor": { - "id": "dev.lithe", - "displayName": "Lithe", - "signatureRequirement": "publisherPackage" - }, - "permissions": [ - "languageServer.launch", - "process.run", - "process.test" - ], - "activationEvents": [ - "onLanguage:php", - "onRun:php", - "onTest:php" - ], - "languages": [ - { - "id": "php", - "displayName": "PHP", - "fileExtensions": [ - "php", - "phtml" - ], - "projectFileNames": [ - "composer.json" - ] - } - ], - "languageServers": [ - { - "languageID": "php", - "languageIdentifier": "php", - "launch": { - "kind": "packaged", - "path": "language-server/bin/intelephense" - }, - "arguments": [ - "--stdio" - ], - "validationArguments": [], - "runtimeDependencies": [ - { - "tool": "node" - } - ] - } - ], - "executionProviders": [ - { - "languageID": "php", - "run": { - "executable": { - "command": "php" - }, - "arguments": [ - "${file}", - "${userArguments}" - ] - }, - "test": { - "frameworkID": "phpunit", - "workspaceLabel": "All PHP Tests", - "projectMarkers": [ - "composer.json", - "phpunit.xml", - "phpunit.xml.dist" - ], - "testFilePatterns": [ - "*test.php" - ], - "executable": { - "command": "php" - }, - "workspaceArguments": [ - "vendor/bin/phpunit" - ], - "fileArguments": [ - "vendor/bin/phpunit", - "${file}" - ], - "testCaseArguments": [ - "vendor/bin/phpunit", - "--filter", - "\\b${testName:regex}\\b", - { - "value": "${file}", - "when": "fileSelected" - } - ] - } - } - ] -} diff --git a/shared/contracts/plugins/v1/fixtures/languages/language-server-backend-launch.plugin.json b/shared/contracts/plugins/v1/fixtures/languages/language-server-backend-launch.plugin.json deleted file mode 100644 index 2bc42b5d54..0000000000 --- a/shared/contracts/plugins/v1/fixtures/languages/language-server-backend-launch.plugin.json +++ /dev/null @@ -1,116 +0,0 @@ -{ - "schemaVersion": 2, - "id": "dev.lithe.fixture.language-server-backend-launch", - "displayName": "Backend Launched Language Server Fixture", - "version": "0.1.0", - "pluginAPIVersion": 4, - "requires": { - "backend": 2, - "executableResolution": 2, - "languageServers": 3, - "languages": 1, - "serverProcess": 3, - "toolDefinitions": 1 - }, - "vendor": { - "id": "org.example", - "displayName": "Example", - "signatureRequirement": "publisherPackage" - }, - "permissions": [ - "backend.launch", - "languageServer.launch", - "languageServer.request" - ], - "activationEvents": [ - "onLanguage:scala" - ], - "languages": [ - { - "id": "scala", - "displayName": "Scala", - "fileExtensions": [ - "scala", - "sc" - ], - "projectFileNames": [ - "build.sbt" - ] - } - ], - "toolDefinitions": [ - { - "id": "coursier", - "displayName": "Coursier", - "executableLayouts": [ - { - "path": "bin/cs" - } - ], - "executables": [ - { - "id": "shell", - "kind": "command", - "command": "cs" - } - ], - "version": { - "arguments": [ - "--version" - ], - "pattern": "(\\d+(?:\\.\\d+)*)" - }, - "commands": [ - "cs" - ], - "launch": [ - "${executable}", - "${arguments}" - ] - } - ], - "languageServers": [ - { - "languageID": "scala", - "launch": { - "kind": "backend", - "function": "metals.resolveLaunch", - "timeoutMilliseconds": 30000 - }, - "requestMethods": [ - "textDocument/definition", - "workspace/executeCommand" - ], - "commands": [ - "build-connect", - "build-import", - "doctor-run" - ], - "serializedCommands": [ - "build-import" - ], - "forwardNotifications": [ - "metals/executeClientCommand", - "metals/status" - ], - "state": { - "scope": "workspace", - "retention": { - "maxEntries": 8, - "maxAgeDays": 30 - } - }, - "remote": "unsupported" - } - ], - "backend": { - "launch": { - "kind": "packaged", - "path": "bin/backend" - }, - "arguments": [ - "--state", - "${stateDir}" - ] - } -} diff --git a/shared/contracts/plugins/v1/fixtures/languages/language-server-launch-resolution.json b/shared/contracts/plugins/v1/fixtures/languages/language-server-launch-resolution.json deleted file mode 100644 index 14a5889843..0000000000 --- a/shared/contracts/plugins/v1/fixtures/languages/language-server-launch-resolution.json +++ /dev/null @@ -1,491 +0,0 @@ -{ - "schemaVersion": 1, - "description": "Golden launch of a language server whose backend resolves the command line (serverProcess 3). `languageServerLaunchPlan` is the first step: Core names the function to call and its params. `decodeLaunch` is the second step: Core bounds the function's `result` and returns the plan the host starts. A case runs against `plugin` and `languageID` unless it names its own, with `request` changed by `requestEdits` (JSON Pointer `set` or `remove`). `expected` is the command's data object, or `{status: \"rejected\", code}` for the stable rejection code. `resolveParams.platform.os` is the host's operating system and is not compared.", - "plugin": "language-server-backend-launch.plugin.json", - "languageID": "scala", - "request": { - "pluginDirectory": "/plugins/metals", - "stateDirectory": "/state/metals", - "workspaceStateDirectory": "/state/metals/workspaces/abc", - "logDirectory": "/logs/metals", - "temporaryDirectory": "/tmp/metals", - "architecture": "arm64" - }, - "cases": [ - { - "name": "the first step asks the backend to resolve the launch", - "operation": "languageServerLaunchPlan", - "expected": { - "status": "ok", - "plan": { - "owner": { "pluginID": "dev.lithe.fixture.language-server-backend-launch", "version": "0.1.0" }, - "launch": { - "kind": "backend", - "function": "metals.resolveLaunch", - "timeoutMilliseconds": 30000 - }, - "resolveParams": { - "serverID": "scala", - "platform": { - "arch": "arm64" - }, - "stateDirectory": "/state/metals", - "workspaceStateDirectory": "/state/metals/workspaces/abc", - "logDirectory": "/logs/metals", - "temporaryDirectory": "/tmp/metals", - "settings": {} - }, - "arguments": [], - "validationArguments": [], - "runtimeRequirements": [], - "requiredDirectories": [ - "state", - "workspaceState", - "log", - "temporary" - ], - "requiredPackagePaths": [], - "sessionPolicy": { - "serverID": "scala", - "requestMethods": [ - "textDocument/definition", - "workspace/executeCommand" - ], - "commands": [ - "build-connect", - "build-import", - "doctor-run" - ], - "serializedCommands": [ - "build-import" - ], - "forwardNotifications": [ - "metals/executeClientCommand", - "metals/status" - ], - "remote": "unsupported", - "gates": [], - "state": { - "scope": "workspace", - "retention": { - "maxEntries": 8, - "maxAgeDays": 30 - } - } - } - } - } - }, - { - "name": "the first step needs the temporary directory", - "operation": "languageServerLaunchPlan", - "requestEdits": [ - { - "op": "remove", - "path": "/temporaryDirectory" - } - ], - "expected": { - "status": "rejected", - "code": "plugin.launch.invalidRequest" - } - }, - { - "name": "the first step refuses an unknown architecture", - "operation": "languageServerLaunchPlan", - "requestEdits": [ - { - "op": "set", - "path": "/architecture", - "value": "sparc" - } - ], - "expected": { - "status": "rejected", - "code": "plugin.launch.invalidRequest" - } - }, - { - "name": "a packaged answer becomes a start plan with its gates", - "operation": "decodeLaunch", - "result": { - "executable": { - "kind": "packaged", - "path": "server/bin/metals" - }, - "arguments": [ - "-Dmetals.client=lithe" - ], - "environment": { - "COURSIER_CACHE": "/tmp/metals/coursier" - }, - "initializationOptions": { - "isHttpEnabled": false - }, - "workspaceConfiguration": { - "metals": { - "showInferredType": true - } - }, - "gates": [ - { - "id": "build-imported", - "until": "notification", - "method": "metals/status", - "match": { - "text": "Indexing complete" - } - } - ], - "writablePaths": [ - "/tmp/metals/coursier", - "/state/metals/workspaces/abc/.bloop" - ] - }, - "expected": { - "status": "ok", - "plan": { - "launch": { - "kind": "packaged", - "path": "server/bin/metals" - }, - "arguments": [ - "-Dmetals.client=lithe" - ], - "validationArguments": [], - "runtimeRequirements": [], - "environment": { - "COURSIER_CACHE": "/tmp/metals/coursier" - }, - "writablePaths": [ - "/state/metals/workspaces/abc/.bloop", - "/tmp/metals/coursier" - ], - "requiredDirectories": [], - "requiredPackagePaths": [ - "server/bin/metals" - ], - "initializationOptions": { - "isHttpEnabled": false - }, - "workspaceConfiguration": { - "metals": { - "showInferredType": true - } - }, - "sessionPolicy": { - "serverID": "scala", - "requestMethods": [ - "textDocument/definition", - "workspace/executeCommand" - ], - "commands": [ - "build-connect", - "build-import", - "doctor-run" - ], - "serializedCommands": [ - "build-import" - ], - "forwardNotifications": [ - "metals/executeClientCommand", - "metals/status" - ], - "remote": "unsupported", - "gates": [ - { - "id": "build-imported", - "until": "notification", - "method": "metals/status", - "match": { - "text": "Indexing complete" - } - } - ], - "state": { - "scope": "workspace", - "retention": { - "maxEntries": 8, - "maxAgeDays": 30 - } - } - } - } - } - }, - { - "name": "a tool answer names a declared tool definition", - "operation": "decodeLaunch", - "result": { - "executable": { - "kind": "tool", - "tool": "coursier" - }, - "arguments": [ - "launch", - "metals" - ] - }, - "expected": { - "status": "ok", - "plan": { - "launch": { - "kind": "tool", - "tool": "coursier" - }, - "arguments": [ - "launch", - "metals" - ], - "validationArguments": [], - "runtimeRequirements": [], - "environment": {}, - "writablePaths": [], - "requiredDirectories": [], - "requiredPackagePaths": [], - "sessionPolicy": { - "serverID": "scala", - "requestMethods": [ - "textDocument/definition", - "workspace/executeCommand" - ], - "commands": [ - "build-connect", - "build-import", - "doctor-run" - ], - "serializedCommands": [ - "build-import" - ], - "forwardNotifications": [ - "metals/executeClientCommand", - "metals/status" - ], - "remote": "unsupported", - "gates": [], - "state": { - "scope": "workspace", - "retention": { - "maxEntries": 8, - "maxAgeDays": 30 - } - } - } - } - } - }, - { - "name": "an executable outside the package is refused", - "operation": "decodeLaunch", - "result": { - "executable": { - "kind": "packaged", - "path": "../bin/metals" - } - }, - "expected": { - "status": "rejected", - "code": "plugin.launch.outsidePackage" - } - }, - { - "name": "a tool the plugin does not define is refused", - "operation": "decodeLaunch", - "result": { - "executable": { - "kind": "tool", - "tool": "sbt" - } - }, - "expected": { - "status": "rejected", - "code": "plugin.launch.undeclaredTool" - } - }, - { - "name": "a writable path outside the host directories is refused", - "operation": "decodeLaunch", - "result": { - "executable": { - "kind": "packaged", - "path": "server/bin/metals" - }, - "writablePaths": [ - "/home/user/.metals" - ] - }, - "expected": { - "status": "rejected", - "code": "plugin.launch.unwritablePath" - } - }, - { - "name": "a writable path cannot climb out of a host directory", - "operation": "decodeLaunch", - "result": { - "executable": { - "kind": "packaged", - "path": "server/bin/metals" - }, - "writablePaths": [ - "/state/metals/../other" - ] - }, - "expected": { - "status": "rejected", - "code": "plugin.launch.unwritablePath" - } - }, - { - "name": "an unknown member of the answer is refused", - "operation": "decodeLaunch", - "result": { - "executable": { - "kind": "packaged", - "path": "server/bin/metals" - }, - "directories": {} - }, - "expected": { - "status": "rejected", - "code": "plugin.launch.invalidResult" - } - }, - { - "name": "initialization options are an object", - "operation": "decodeLaunch", - "result": { - "executable": { - "kind": "packaged", - "path": "server/bin/metals" - }, - "initializationOptions": [ - "not", - "an", - "object" - ] - }, - "expected": { - "status": "rejected", - "code": "plugin.launch.invalidResult" - } - }, - { - "name": "an argument cannot contain NUL", - "operation": "decodeLaunch", - "result": { - "executable": { - "kind": "packaged", - "path": "server/bin/metals" - }, - "arguments": [ - "a\u0000b" - ] - }, - "expected": { - "status": "rejected", - "code": "plugin.launch.invalidResult" - } - }, - { - "name": "an environment name cannot contain an equals sign", - "operation": "decodeLaunch", - "result": { - "executable": { - "kind": "packaged", - "path": "server/bin/metals" - }, - "environment": { - "A=B": "x" - } - }, - "expected": { - "status": "rejected", - "code": "plugin.launch.invalidResult" - } - }, - { - "name": "gate IDs are unique", - "operation": "decodeLaunch", - "result": { - "executable": { - "kind": "packaged", - "path": "server/bin/metals" - }, - "gates": [ - { - "id": "build-imported", - "until": "notification", - "method": "metals/status", - "match": { - "text": "Indexing complete" - } - }, - { - "id": "build-imported", - "until": "notification", - "method": "metals/status", - "match": { - "text": "Indexing complete" - } - } - ] - }, - "expected": { - "status": "rejected", - "code": "plugin.launch.invalidResult" - } - }, - { - "name": "a server the backend does not launch has no answer to decode", - "operation": "decodeLaunch", - "plugin": "language-packaged-server.plugin.json", - "languageID": "php", - "result": { - "executable": { - "kind": "packaged", - "path": "server/bin/metals" - } - }, - "expected": { - "status": "rejected", - "code": "plugin.launch.notBackend" - } - }, - { - "name": "a language without a server has no answer to decode", - "operation": "decodeLaunch", - "languageID": "hack", - "result": { - "executable": { - "kind": "packaged", - "path": "server/bin/metals" - } - }, - "expected": { - "status": "rejected", - "code": "plugin.launch.unavailable" - } - }, - { - "name": "decoding needs the same directories the first step did", - "operation": "decodeLaunch", - "requestEdits": [ - { - "op": "remove", - "path": "/logDirectory" - } - ], - "result": { - "executable": { - "kind": "packaged", - "path": "server/bin/metals" - } - }, - "expected": { - "status": "rejected", - "code": "plugin.launch.invalidRequest" - } - } - ] -} diff --git a/shared/contracts/plugins/v1/fixtures/languages/language-system-command.plugin.json b/shared/contracts/plugins/v1/fixtures/languages/language-system-command.plugin.json deleted file mode 100644 index 299f341b1e..0000000000 --- a/shared/contracts/plugins/v1/fixtures/languages/language-system-command.plugin.json +++ /dev/null @@ -1,114 +0,0 @@ -{ - "schemaVersion": 2, - "id": "dev.lithe.fixture.language-system-command", - "displayName": "System Command Language Server Fixture", - "version": "0.1.0", - "pluginAPIVersion": 1, - "vendor": { - "id": "dev.lithe", - "displayName": "Lithe", - "signatureRequirement": "publisherPackage" - }, - "permissions": [ - "languageServer.launch", - "process.run", - "process.test" - ], - "activationEvents": [ - "onLanguage:go", - "onRun:go", - "onTest:go" - ], - "languages": [ - { - "id": "go", - "displayName": "Go", - "fileExtensions": [ - "go" - ], - "projectFileNames": [ - "go.mod", - "go.work" - ], - "dependencies": { - "managementFileNames": [ - "go.mod", - "go.sum", - "go.work", - "go.work.sum", - "vendor/modules.txt" - ], - "projectDependencyPaths": [ - "vendor" - ] - } - } - ], - "languageServers": [ - { - "languageID": "go", - "languageIdentifier": "go", - "launch": { - "kind": "systemCommand", - "commands": [ - "gopls" - ] - }, - "arguments": [], - "validationArguments": [ - "version" - ], - "runtimeDependencies": [{ "tool": "go" }] - } - ], - "executionProviders": [ - { - "languageID": "go", - "run": { - "executable": { - "toolchain": "project-go" - }, - "arguments": [ - "run", - "${file}", - "${userArguments}" - ] - }, - "test": { - "frameworkID": "go", - "workspaceLabel": "All Go Tests", - "projectMarkers": [ - "go.mod", - "go.work" - ], - "testFilePatterns": [ - "*_test.go" - ], - "executable": { - "toolchain": "project-go" - }, - "workspaceArguments": [ - "test", - "./..." - ], - "fileArguments": [ - "test", - "${fileDirectory}" - ], - "testCaseArguments": [ - "test", - { - "value": "${fileDirectory}", - "when": "fileSelected" - }, - { - "value": "./...", - "when": "noFileSelected" - }, - "-run", - "^${testName:regex}$" - ] - } - } - ] -} diff --git a/shared/contracts/plugins/v1/fixtures/languages/node-runtime.plugin.json b/shared/contracts/plugins/v1/fixtures/languages/node-runtime.plugin.json deleted file mode 100644 index 7914e4b919..0000000000 --- a/shared/contracts/plugins/v1/fixtures/languages/node-runtime.plugin.json +++ /dev/null @@ -1,94 +0,0 @@ -{ - "schemaVersion": 2, - "id": "dev.lithe.fixture.node-runtime", - "displayName": "Node Runtime Fixture", - "version": "1.0.0", - "pluginAPIVersion": 2, - "vendor": { - "id": "dev.lithe", - "displayName": "Lithe", - "signatureRequirement": "publisherPackage" - }, - "permissions": [ - "languageServer.launch" - ], - "activationEvents": [ - "onLanguage:fixture" - ], - "languages": [ - { - "id": "fixture", - "displayName": "Fixture", - "fileExtensions": [ - "fixture" - ] - } - ], - "languageServers": [ - { - "languageID": "fixture", - "launch": { - "kind": "runtime", - "tool": "node", - "minimumVersion": "18.17", - "runtimeArguments": [ - "--max-old-space-size=${setting:heapMB}", - "--require=${pluginDir}/language-server/lib/preload.js" - ], - "entry": "language-server/lib/server.js" - }, - "arguments": [ - "--stdio", - "--log-level=${setting:logLevel}", - "--storage", - "${stateDir}/storage", - "--workspace-cache", - "${workspaceStateDir}" - ], - "initializationOptions": { - "stubs": [ - "${pluginDir}/language-server/stubs/${arch}" - ], - "telemetry": "${setting:telemetry}" - } - } - ], - "settings": [ - { - "id": "heapMB", - "type": "integer", - "title": "Maximum memory", - "description": "Upper bound of the server's heap.", - "default": 2048, - "minimum": 512, - "maximum": 8192, - "unit": "MB" - }, - { - "id": "logLevel", - "type": "enum", - "title": "Log level", - "default": "info", - "options": [ - { - "value": "error", - "title": "Errors only" - }, - { - "value": "info", - "title": "Information" - }, - { - "value": "debug", - "title": "Debug" - } - ] - }, - { - "id": "telemetry", - "type": "boolean", - "title": "Send usage data", - "default": false - } - ] -} diff --git a/shared/contracts/plugins/v1/fixtures/languages/runtime-versions.json b/shared/contracts/plugins/v1/fixtures/languages/runtime-versions.json deleted file mode 100644 index 327882e717..0000000000 --- a/shared/contracts/plugins/v1/fixtures/languages/runtime-versions.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "schemaVersion": 1, - "description": "Golden outcomes of plugins.declarative.checkRuntimeVersion. `request` is the command payload; `expected` is the returned `check` object, or a rejection code.", - "cases": [ - { "name": "node version with a leading v", "request": { "tool": "node", "minimumVersion": "18.17", "output": "v20.11.0" }, "expected": { "satisfied": true, "version": "20.11.0" } }, - { "name": "node minor below the requirement", "request": { "tool": "node", "minimumVersion": "18.17", "output": "v18.16.1" }, "expected": { "satisfied": false, "version": "18.16.1" } }, - { "name": "node meets a major-only requirement", "request": { "tool": "node", "minimumVersion": "20", "output": "v20.0.0" }, "expected": { "satisfied": true, "version": "20.0.0" } }, - { "name": "a newer node major satisfies the requirement", "request": { "tool": "node", "minimumVersion": "18", "output": "v22.3.0" }, "expected": { "satisfied": true, "version": "22.3.0" } }, - { "name": "the first line with a digit carries the version", "request": { "tool": "node", "minimumVersion": "20", "output": "warning: using a custom runtime\nv18.20.4\nv22.0.0" }, "expected": { "satisfied": false, "version": "18.20.4" } }, - { "name": "requirement names more components than the runtime reports", "request": { "tool": "node", "minimumVersion": "21.0.1", "output": "v21" }, "expected": { "satisfied": false, "version": "21" } }, - { "name": "output without a version", "request": { "tool": "node", "minimumVersion": "18", "output": "node: command not found" }, "expected": { "satisfied": false } }, - { "name": "a tool that cannot start an entry file", "request": { "tool": "go", "minimumVersion": "1.22", "output": "go version go1.22.3 darwin/arm64" }, "expectedCode": "plugin.runtime.unsupported" }, - { "name": "a tool definition checks its own version", "request": { "tool": "fixture-sdk", "minimumVersion": "21", "output": "fixture-sdk 21.0.4" }, "expectedCode": "plugin.runtime.unsupported" }, - { "name": "malformed requirement", "request": { "tool": "node", "minimumVersion": "21+", "output": "v21.0.0" }, "expectedCode": "plugin.manifest.invalid" } - ] -} diff --git a/shared/contracts/plugins/v1/fixtures/manifest/hello-lithe.plugin.json b/shared/contracts/plugins/v1/fixtures/manifest/hello-lithe.plugin.json deleted file mode 100644 index e31ca05f15..0000000000 --- a/shared/contracts/plugins/v1/fixtures/manifest/hello-lithe.plugin.json +++ /dev/null @@ -1,50 +0,0 @@ -{ - "schemaVersion": 2, - "id": "dev.lithe.fixture.hello", - "displayName": "Hello Lithe", - "version": "1.0.0", - "pluginAPIVersion": 2, - "vendor": { - "id": "org.example", - "displayName": "Example", - "signatureRequirement": "publisherPackage" - }, - "permissions": [ - "ui.contribute" - ], - "activationEvents": [ - "onView:dev.lithe.fixture.hello.window", - "onCommand:dev.lithe.fixture.hello.open" - ], - "languages": [], - "ui": { - "toolWindows": [ - { - "id": "dev.lithe.fixture.hello.window", - "title": "Hello Lithe", - "placement": "right", - "order": 250, - "text": "Hello Lithe!\nThis window is registered by the plugin and rendered by the host.", - "icon": { - "host": "plugin" - } - } - ], - "commands": [ - { - "id": "dev.lithe.fixture.hello.open", - "title": "Open Hello Lithe", - "toolWindowID": "dev.lithe.fixture.hello.window", - "placements": [ - "commandPalette", - "toolbar", - "menu" - ], - "order": 100, - "icon": { - "host": "run" - } - } - ] - } -} diff --git a/shared/contracts/plugins/v1/fixtures/manifest/invalid-manifests.json b/shared/contracts/plugins/v1/fixtures/manifest/invalid-manifests.json deleted file mode 100644 index 6188e22791..0000000000 --- a/shared/contracts/plugins/v1/fixtures/manifest/invalid-manifests.json +++ /dev/null @@ -1,1005 +0,0 @@ -{ - "schemaVersion": 1, - "description": "Each case edits a valid fixture manifest and states the stable rejection code every host must report. Edits use JSON Pointer paths; `set` replaces or adds a value and `remove` deletes it.", - "cases": [ - { - "name": "legacy native manifest schema", - "base": "language-packaged-server.plugin.json", - "edits": [{ "op": "set", "path": "/schemaVersion", "value": 1 }], - "expectedCode": "plugin.schema.unsupported" - }, - { - "name": "future plugin API", - "base": "language-packaged-server.plugin.json", - "edits": [{ "op": "set", "path": "/pluginAPIVersion", "value": 99 }], - "expectedCode": "plugin.api.unsupported" - }, - { - "name": "unknown top-level field", - "base": "language-packaged-server.plugin.json", - "edits": [{ "op": "set", "path": "/entrypoint", "value": { "kind": "nativeBundle" } }], - "expectedCode": "plugin.manifest.invalid" - }, - { - "name": "uppercase plugin id", - "base": "language-packaged-server.plugin.json", - "edits": [{ "op": "set", "path": "/id", "value": "Dev.Lithe.Fixture" }], - "expectedCode": "plugin.manifest.invalid" - }, - { - "name": "packaged language server escapes the package", - "base": "language-packaged-server.plugin.json", - "edits": [{ "op": "set", "path": "/languageServers/0/launch/path", "value": "../bin/intelephense" }], - "expectedCode": "plugin.manifest.invalid" - }, - { - "name": "system command is a path", - "base": "language-system-command.plugin.json", - "edits": [{ "op": "set", "path": "/languageServers/0/launch/commands", "value": ["/usr/local/bin/gopls"] }], - "expectedCode": "plugin.manifest.invalid" - }, - { - "name": "language server for an undeclared language", - "base": "language-packaged-server.plugin.json", - "edits": [{ "op": "set", "path": "/languageServers/0/languageID", "value": "hack" }], - "expectedCode": "plugin.manifest.invalid" - }, - { - "name": "unsupported runtime dependency", - "base": "language-packaged-server.plugin.json", - "edits": [{ "op": "set", "path": "/languageServers/0/runtimeDependencies", "value": [{ "tool": "Python 3" }] }], - "expectedCode": "plugin.runtime.unsupported" - }, - { - "name": "unknown permission", - "base": "language-packaged-server.plugin.json", - "edits": [{ "op": "set", "path": "/permissions/0", "value": "network.fetch" }], - "expectedCode": "plugin.permission.unknown" - }, - { - "name": "language server without its permission", - "base": "language-packaged-server.plugin.json", - "edits": [{ "op": "set", "path": "/permissions", "value": ["process.run", "process.test"] }], - "expectedCode": "plugin.permission.undeclared" - }, - { - "name": "missing activation event", - "base": "language-packaged-server.plugin.json", - "edits": [{ "op": "set", "path": "/activationEvents", "value": ["onLanguage:php", "onRun:php"] }], - "expectedCode": "plugin.activation.invalid" - }, - { - "name": "activation event without a provider", - "base": "language-packaged-server.plugin.json", - "edits": [{ "op": "remove", "path": "/executionProviders/0/run" }], - "expectedCode": "plugin.activation.invalid" - }, - { - "name": "unknown template variable", - "base": "language-packaged-server.plugin.json", - "edits": [{ "op": "set", "path": "/executionProviders/0/run/arguments", "value": ["${workspaceRoot}/${file}"] }], - "expectedCode": "plugin.template.invalid" - }, - { - "name": "user arguments embedded in an element", - "base": "language-packaged-server.plugin.json", - "edits": [{ "op": "set", "path": "/executionProviders/0/run/arguments", "value": ["${file}", "--args=${userArguments}"] }], - "expectedCode": "plugin.template.invalid" - }, - { - "name": "test case uses the file without a guard", - "base": "language-packaged-server.plugin.json", - "edits": [{ "op": "set", "path": "/executionProviders/0/test/testCaseArguments", "value": ["vendor/bin/phpunit", "--filter", "${testName:regex}", "${file}"] }], - "expectedCode": "plugin.template.invalid" - }, - { - "name": "test case never names the test", - "base": "language-packaged-server.plugin.json", - "edits": [{ "op": "set", "path": "/executionProviders/0/test/testCaseArguments", "value": ["vendor/bin/phpunit"] }], - "expectedCode": "plugin.template.invalid" - }, - { - "name": "executable is an absolute path", - "base": "language-packaged-server.plugin.json", - "edits": [{ "op": "set", "path": "/executionProviders/0/run/executable", "value": { "command": "/usr/bin/php" } }], - "expectedCode": "plugin.manifest.invalid" - }, - { - "name": "runtime launch in an API 1 manifest", - "base": "language-packaged-server.plugin.json", - "edits": [{ "op": "set", "path": "/languageServers/0/launch", "value": { "kind": "runtime", "tool": "node", "entry": "language-server/lib/intelephense.js" } }, { "op": "set", "path": "/languageServers/0/runtimeDependencies", "value": [] }], - "expectedCode": "plugin.manifest.invalid" - }, - { - "name": "initialization options in an API 1 manifest", - "base": "language-packaged-server.plugin.json", - "edits": [{ "op": "set", "path": "/languageServers/0/initializationOptions", "value": { "storagePath": "cache" } }], - "expectedCode": "plugin.manifest.invalid" - }, - { - "name": "host integration in an API 1 manifest", - "base": "language-packaged-server.plugin.json", - "edits": [{ "op": "set", "path": "/languageServers/0/hostIntegration", "value": { "id": "jdt" } }], - "expectedCode": "plugin.manifest.invalid" - }, - { - "name": "runtime dependency states a minimum version", - "base": "language-packaged-server.plugin.json", - "edits": [{ "op": "set", "path": "/languageServers/0/runtimeDependencies", "value": [{ "tool": "node", "minimumVersion": "18" }] }], - "expectedCode": "plugin.manifest.invalid" - }, - { - "name": "runtime launch with a tool that cannot start an entry", - "base": "node-runtime.plugin.json", - "edits": [{ "op": "set", "path": "/languageServers/0/launch/tool", "value": "go" }], - "expectedCode": "plugin.runtime.unsupported" - }, - { - "name": "runtime entry escapes the package", - "base": "node-runtime.plugin.json", - "edits": [{ "op": "set", "path": "/languageServers/0/launch/entry", "value": "../server.js" }], - "expectedCode": "plugin.manifest.invalid" - }, - { - "name": "malformed minimum runtime version", - "base": "node-runtime.plugin.json", - "edits": [{ "op": "set", "path": "/languageServers/0/launch/minimumVersion", "value": "18+" }], - "expectedCode": "plugin.manifest.invalid" - }, - { - "name": "launch runtime repeated as a dependency", - "base": "node-runtime.plugin.json", - "edits": [{ "op": "set", "path": "/languageServers/0/runtimeDependencies", "value": [{ "tool": "node" }] }], - "expectedCode": "plugin.manifest.invalid" - }, - { - "name": "runtime launch with a validation probe", - "base": "node-runtime.plugin.json", - "edits": [{ "op": "set", "path": "/languageServers/0/validationArguments", "value": ["--version"] }], - "expectedCode": "plugin.manifest.invalid" - }, - { - "name": "packaged runtime also states a minimum version", - "base": "publisher-bundled.plugin.json", - "edits": [{ "op": "set", "path": "/languageServers/0/launch/minimumVersion", "value": "21" }], - "expectedCode": "plugin.manifest.invalid" - }, - { - "name": "unknown launch template variable", - "base": "node-runtime.plugin.json", - "edits": [{ "op": "set", "path": "/languageServers/0/arguments/2", "value": "${homeDir}/storage" }], - "expectedCode": "plugin.template.invalid" - }, - { - "name": "package path leaves the package", - "base": "node-runtime.plugin.json", - "edits": [{ "op": "set", "path": "/languageServers/0/launch/runtimeArguments/1", "value": "--require=${pluginDir}/../preload.js" }], - "expectedCode": "plugin.template.invalid" - }, - { - "name": "plugin directory without a package path", - "base": "node-runtime.plugin.json", - "edits": [{ "op": "set", "path": "/languageServers/0/arguments/2", "value": "${pluginDir}" }], - "expectedCode": "plugin.template.invalid" - }, - { - "name": "package path varies by a state directory", - "base": "node-runtime.plugin.json", - "edits": [{ "op": "set", "path": "/languageServers/0/arguments/2", "value": "${pluginDir}/storage/${stateDir}" }], - "expectedCode": "plugin.template.invalid" - }, - { - "name": "validation probe uses a state directory", - "base": "node-runtime.plugin.json", - "edits": [{ "op": "set", "path": "/languageServers/0/launch", "value": { "kind": "packaged", "path": "language-server/bin/server" } }, { "op": "set", "path": "/languageServers/0/validationArguments", "value": ["--check", "${workspaceStateDir}"] }], - "expectedCode": "plugin.template.invalid" - }, - { - "name": "initialization options are not an object", - "base": "node-runtime.plugin.json", - "edits": [{ "op": "set", "path": "/languageServers/0/initializationOptions", "value": ["stubs"] }], - "expectedCode": "plugin.manifest.invalid" - }, - { - "name": "unknown template variable inside initialization options", - "base": "node-runtime.plugin.json", - "edits": [{ "op": "set", "path": "/languageServers/0/initializationOptions/stubs/0", "value": "${stubDir}/php" }], - "expectedCode": "plugin.template.invalid" - }, - { - "name": "unknown host integration", - "base": "node-runtime.plugin.json", - "edits": [{ "op": "set", "path": "/languageServers/0/hostIntegration", "value": { "id": "roslyn" } }], - "expectedCode": "plugin.integration.unsupported" - }, - {"name": "settings on API level 1", "base": "language-packaged-server.plugin.json", "edits": [{"op": "set", "path": "/settings", "value": [{"id": "x", "type": "boolean", "title": "X", "default": true}]}], "expectedCode": "plugin.manifest.invalid"}, - {"name": "launch template names an undeclared setting", "base": "node-runtime.plugin.json", "edits": [{"op": "set", "path": "/languageServers/0/arguments/1", "value": "--log-level=${setting:verbosity}"}], "expectedCode": "plugin.template.invalid"}, - {"name": "setting shapes a package path", "base": "node-runtime.plugin.json", "edits": [{"op": "set", "path": "/languageServers/0/launch/runtimeArguments/1", "value": "--require=${pluginDir}/language-server/${setting:logLevel}.js"}], "expectedCode": "plugin.template.invalid"}, - {"name": "setting identifier with a separator", "base": "node-runtime.plugin.json", "edits": [{"op": "set", "path": "/settings/0/id", "value": "heap-mb"}], "expectedCode": "plugin.manifest.invalid"}, - {"name": "duplicate setting identifier", "base": "node-runtime.plugin.json", "edits": [{"op": "set", "path": "/settings/1/id", "value": "heapMB"}], "expectedCode": "plugin.manifest.invalid"}, - {"name": "unknown setting type", "base": "node-runtime.plugin.json", "edits": [{"op": "set", "path": "/settings/0/type", "value": "string"}], "expectedCode": "plugin.manifest.invalid"}, - {"name": "integer setting without a range", "base": "node-runtime.plugin.json", "edits": [{"op": "remove", "path": "/settings/0/maximum"}], "expectedCode": "plugin.manifest.invalid"}, - {"name": "integer default outside its range", "base": "node-runtime.plugin.json", "edits": [{"op": "set", "path": "/settings/0/default", "value": 100}], "expectedCode": "plugin.manifest.invalid"}, - {"name": "integer default is not a whole number", "base": "node-runtime.plugin.json", "edits": [{"op": "set", "path": "/settings/0/default", "value": 2048.5}], "expectedCode": "plugin.manifest.invalid"}, - {"name": "enum default is not an option", "base": "node-runtime.plugin.json", "edits": [{"op": "set", "path": "/settings/1/default", "value": "trace"}], "expectedCode": "plugin.manifest.invalid"}, - {"name": "enum option value could inject an argument", "base": "node-runtime.plugin.json", "edits": [{"op": "set", "path": "/settings/1/options/0/value", "value": "error --inspect"}], "expectedCode": "plugin.manifest.invalid"}, - {"name": "boolean default is text", "base": "node-runtime.plugin.json", "edits": [{"op": "set", "path": "/settings/2/default", "value": "false"}], "expectedCode": "plugin.manifest.invalid"}, - {"name": "setting with an unknown field", "base": "node-runtime.plugin.json", "edits": [{"op": "set", "path": "/settings/2/scope", "value": "workspace"}], "expectedCode": "plugin.manifest.invalid"}, - { - "name": "UI requires API level 2", - "base": "hello-lithe.plugin.json", - "edits": [ - { - "op": "set", - "path": "/pluginAPIVersion", - "value": 1 - } - ], - "expectedCode": "plugin.manifest.invalid" - }, - { - "name": "UI permission is required", - "base": "hello-lithe.plugin.json", - "edits": [ - { - "op": "set", - "path": "/permissions", - "value": [] - } - ], - "expectedCode": "plugin.permission.undeclared" - }, - { - "name": "UI activation is required", - "base": "hello-lithe.plugin.json", - "edits": [ - { - "op": "set", - "path": "/activationEvents", - "value": [] - } - ], - "expectedCode": "plugin.activation.invalid" - }, - { - "name": "UI rejects foreign tool identity", - "base": "hello-lithe.plugin.json", - "edits": [ - { - "op": "set", - "path": "/ui/toolWindows/0/id", - "value": "database.workspace" - } - ], - "expectedCode": "plugin.manifest.invalid" - }, - { - "name": "UI rejects foreign command identity", - "base": "hello-lithe.plugin.json", - "edits": [ - { - "op": "set", - "path": "/ui/commands/0/id", - "value": "database.toggle" - } - ], - "expectedCode": "plugin.manifest.invalid" - }, - { - "name": "UI rejects foreign command target", - "base": "hello-lithe.plugin.json", - "edits": [ - { - "op": "set", - "path": "/ui/commands/0/toolWindowID", - "value": "database.workspace" - } - ], - "expectedCode": "plugin.manifest.invalid" - }, - { - "name": "UI rejects executable content", - "base": "hello-lithe.plugin.json", - "edits": [ - { - "op": "set", - "path": "/ui/toolWindows/0/html", - "value": "