VelaShell.PluginSdk 2.0.1

There is a newer version of this package available.
See the version list below for details.
dotnet add package VelaShell.PluginSdk --version 2.0.1
                    
NuGet\Install-Package VelaShell.PluginSdk -Version 2.0.1
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="VelaShell.PluginSdk" Version="2.0.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="VelaShell.PluginSdk" Version="2.0.1" />
                    
Directory.Packages.props
<PackageReference Include="VelaShell.PluginSdk" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add VelaShell.PluginSdk --version 2.0.1
                    
#r "nuget: VelaShell.PluginSdk, 2.0.1"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package VelaShell.PluginSdk@2.0.1
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=VelaShell.PluginSdk&version=2.0.1
                    
Install as a Cake Addin
#tool nuget:?package=VelaShell.PluginSdk&version=2.0.1
                    
Install as a Cake Tool

VelaShell.PluginSdk

隔离边界上的「细腰」—— 宿主与插件世界唯一共享的契约程序集。仅依赖 BCL。

插件入口契约(IVelaPlugin / IPluginContext)、全部能力接口、plugin.json 清单模型与 RPC 线协议都在这里。宿主引用它来提供能力,插件引用它来消费能力,双方不共享任何其他类型。

🗂️ 结构

路径 内容
IVelaPlugin.cs IPluginContext.cs VelaPluginAttribute.cs 插件入口契约与激活/停用生命周期。
VelaPluginApi.cs apiLevel 版本常量(当前 = 2)。
Sessions/ RemoteFs/ RemoteExec/ Terminal/ 远程侧能力:会话枚举与打开已保存的会话、远程文件读写、远程命令执行、终端读写。
Commands/ Ui/ Clipboard/ 宿主侧能力:命令注册、面板/对话框、剪贴板。
Storage/ Secrets/ TimeSeries/ 持久化能力:KV 存储、加密机密、时序数据(含 TimeSeriesModel 与写入校验)。
Logging/ Events/ 插件日志与宿主事件订阅。
Manifest/ plugin.json 的模型、读取器与错误类型(PluginManifest/PluginManifestReader/PluginManifestException)。
Hosting/ 装载侧工具:PluginAssemblyLoadContext(可收集 ALC,Avalonia* 前缀回落到装载方以保证类型同一)、PluginEntryLocatorJsonFilePluginStorage
Rpc/ 隔离模式的线协议:PluginRpc(方法名常量与载荷记录)、RpcConnectionRpcMessage
PluginPermissionDeniedException.cs PluginSessionNotFoundException.cs PluginSessionOpenException.cs 跨边界的异常类型。

🔑 纪律

  • 零重量级依赖:切勿引入 Avalonia / Tmds.Ssh / ReactiveUI。一旦这个程序集变胖,隔离进程和插件包都会跟着变胖,「细腰」就不成立了。
  • 传输无关:能力接口不假设调用方式。同一份插件源码既能被进程内装载(宿主直调),也能跑在 VelaShell.PluginHost 里(RPC 代理)—— 由 plugin.jsonisolated 决定,插件代码一行不改。
  • 同 apiLevel 内只增不改不删:破坏性变更必须提升 VelaPluginApi.Level 并回写设计文档。

🔗 依赖关系

  • 引用:无(仅 BCL)。
  • 被引用:主仓库的 VelaShell.Infrastructure(能力实现与插件运行时)、VelaShell.Presentation(命令桥接)、VelaShell.PluginHost(隔离进程),以及全部插件项目。

开发文档见 开发指南;能力清单与权限模型见 07-capability-apis.md06-permission-system.md。测试替身见 VelaShell.PluginSdk.Testing

发版

发一次 SDK 的完整步骤:

  • 破坏性变更才需要:手工把 VelaPluginApi.Level +1(脚本会核对"SDK 主版本 == apiLevel", 但刻意不代改 —— 契约破没破是人的判断)
  • 合进 main
  • 在 GitHub 上发布 Release,标签 v<版本>(2026-08-21 起不再用 sdk-v* 标签)

版本号在合进 main 之前用脚本落好:跑一次 scripts/Set-Version.ps1,把它写进 Directory.Build.props、 两个模板的 template.json、本目录的 VelaPluginApi.SdkVersion 以及四份文档。 流水线在构建之前也会按标签跑一遍同样的脚本,所以产物版本号永远等于标签;但它只改 runner 的 工作区、不回写仓库,忘了落版本号的话由 CI 的版本同步体检兜底。 想先验一遍不推送,用 workflow_dispatch 勾 dryRun。

完整流程与 nuget.org 可信发布的配置见 发版流程

Product Compatible and additional computed target framework versions.
.NET net11.0 is compatible. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net11.0

    • No dependencies.

NuGet packages (2)

Showing the top 2 NuGet packages that depend on VelaShell.PluginSdk:

Package Downloads
VelaShell.PluginSdk.Testing

VelaShell 插件单元测试替身:TestPluginContext 与全部能力接口的内存实现,插件项目无需宿主即可测试业务逻辑。

VelaShell.PluginSdk.Build

VelaShell 插件工程的构建支持包:一次引用即得到契约程序集、与宿主版本一致的 Avalonia、共享程序集不落地的处理、清单编译期校验,以及 `dotnet build -t:PackVpx` 一步出 .vpx 包。插件工程只需引用本包。

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
2.0.2 522 9/2/2026
2.0.1 81 9/2/2026
2.0.0 167 8/31/2026
1.5.1 125 8/29/2026
1.5.0 152 8/26/2026
1.4.0 175 8/21/2026
1.3.1 109 8/21/2026
1.3.0 108 8/21/2026
1.2.0 102 8/21/2026
1.1.0 104 8/21/2026
1.0.1 113 8/20/2026
1.0.0 112 8/18/2026
1.0.0-preview.1 67 8/18/2026