XiHan.Framework.Plugins.OutOfProcess 5.0.0-rc.8

Prefix Reserved
This is a prerelease version of XiHan.Framework.Plugins.OutOfProcess.
dotnet add package XiHan.Framework.Plugins.OutOfProcess --version 5.0.0-rc.8
                    
NuGet\Install-Package XiHan.Framework.Plugins.OutOfProcess -Version 5.0.0-rc.8
                    
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="XiHan.Framework.Plugins.OutOfProcess" Version="5.0.0-rc.8" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="XiHan.Framework.Plugins.OutOfProcess" Version="5.0.0-rc.8" />
                    
Directory.Packages.props
<PackageReference Include="XiHan.Framework.Plugins.OutOfProcess" />
                    
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 XiHan.Framework.Plugins.OutOfProcess --version 5.0.0-rc.8
                    
#r "nuget: XiHan.Framework.Plugins.OutOfProcess, 5.0.0-rc.8"
                    
#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 XiHan.Framework.Plugins.OutOfProcess@5.0.0-rc.8
                    
#: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=XiHan.Framework.Plugins.OutOfProcess&version=5.0.0-rc.8&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=XiHan.Framework.Plugins.OutOfProcess&version=5.0.0-rc.8&prerelease
                    
Install as a Cake Tool

XiHan.Framework.Plugins.OutOfProcess

关于

XiHan.Framework.Plugins.OutOfProcess 进程外插件宿主:插件是任意语言写的子进程,只需 protobuf、gRPC 与 JSON,经 xihan.plugin.v1 协议与宿主通信。插件声明的操作登记为代理操作,与本地操作一样经完整管道。

主要特性

  • 任意语言写插件,独立进程与独立依赖
  • 崩溃按退避自动重启,每个插件是一个健康条目
  • 插件交回的操作应答(payload)不为空时先过 JSON 文本的共同检查(语法、64 层、合法的 UTF-8 与 Unicode、重复成员),没过时这次调用是 PLUGINS_UNEXPECTED_001,载荷不交给调用方;不按崩溃处理、进程不重启。空的载荷表示没有响应体,不做这道检查,开了幂等的调用照常记录、回放出同样的空载荷
  • 清单声明的配置节写成 JSON 下发;键或值里有孤立的代理项时不发 Configure,插件配置失败,按退避重试。下发的绑定的主值或属性值有孤立的代理项时同样不发(ADR-0321)
  • 宿主写给插件的元数据不经宽松编码:已登记 Baggage 的值有孤立的代理项(只有幂等键可能带着,没有 Idempotency 阶段的宿主不核对它)时这次调用或投递不交给插件,以 PLUGINS_UNEXPECTED_001 结束、不启动进程,reason 写明是哪个键(ADR-0334)
  • 宿主写给插件的错误(回调与发布的结果)带的细节严格写出:细节里的字符串有孤立的代理项,或写出的文本没过 JSON 文本的共同检查,这个错误不带细节、其余照写,与读插件写来的不合法细节当作没有相同(ADR-0320);文案(text,含内部错误的)里的孤立代理项各换成一个 U+FFFD 写出(ADR-0339)
  • 插件可回调宿主的操作调用与消息发布,需在清单声明并授予权限;发布在按元数据建的回调上下文里进行,信封缺的租户、主体与关联 ID 由发布器补齐;信封的 time 是空串或合 RFC 3339 的那一条文法(与截止时间相同,读成 UTC),不合的那一项以 MESSAGING_VALIDATION_002 不发布,其余照常;data_schema 是信封的 dataschema,两个方向都原样传递,空串表示没有
  • 回调端点有两个:Windows 上是只允许当前用户的命名管道加回环 TCP,其他系统是私有目录里的 Unix 域套接字加回环 TCP,各语言的 gRPC 库至少能连上回环 TCP
  • 回调带的会话令牌按它的 SHA-256 找会话、再与签发的令牌做常数时间比较,令牌本身不作字典的键;进程结束即作废(ADR-0325)
  • 清单声明并授予(binding:<绑定名>)的资源绑定随 Configure 下发,与内核按同一套来源解析:先读 Service Binding 目录(SERVICE_BINDING_ROOT,或应用经 UseServiceBindingRoot 指定的目录)、再读 XiHan:Bindings,同名时配置整体覆盖目录;每次配置插件时解析一遍,重启或运行期加载的插件拿到的是那一刻的值。绑定连同它的属性一起下发(Binding.properties):属性名区分大小写、原样下发,只有属性、没有主值的绑定照常下发、主值为空。下发之前按清单的顺序逐个核对:清单标为必需(required 缺省为 true)的绑定解析不出(两种来源都没给,或只给了类型)、来源声明的类型与清单不同(必需与可选都核对),这个插件配置失败;可选的绑定解析不出不下发,只给了类型的另记警告。下发时属性名须是 1 到 253 个 ASCII 字母、数字、.、_、- 且不以 . 开头,一个绑定最多 64 个属性、属性名与属性值合计不超过 262144 个 UTF-8 字节,整个 Configure 请求按 protobuf 编码不超过 2097152 字节,不合时这个插件配置失败、不少发也不截断;绑定目录里的文件超过内核的大小上限、一个绑定目录的文件多于 128 个同样配置失败。属性不单独授权,属性值不进日志与错误
  • 每次调用插件的操作、向插件投递事件各记一条 xihan.plugin.invoke Span:它是内核 xihan.invoke 的子 Span,带 xihan.plugin.id,操作调用另带 xihan.operation;写给插件的 trace_parent 以它为父级。没有监听器时不开 Span

如何使用

安装

dotnet add package XiHan.Framework.Plugins.OutOfProcess --prerelease

使用

注册特性,在配置里列出插件目录与授予的权限。

builder.AddXiHan(x => x
    .UseStandardProfile()
    .UseFeature<OutOfProcessPluginsFeature>());
{
  "XiHan": { "Plugins": { "OutOfProcess": {
    "Directories": ["plugins/echo"],
    "Grants": { "xihan.samples.echo": ["capability:kernel.pipeline"] }
  } } }
}

主要类型

此库提供的主要类型:

  • OutOfProcessPluginsFeature:特性入口
  • OutOfProcessPluginHost:实现 IPluginHost,FindStatus 查找诊断快照(未加载时无值),HostEndpoints 是按偏好排序的回调端点
  • OutOfProcessPluginOptions:目录、授予、超时、重启策略

更多文档

相关包

反馈与贡献

XiHan.Framework.Plugins.OutOfProcess 以 MIT 许可证 开源。欢迎到 GitHub 仓库 提交问题和贡献。

Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on XiHan.Framework.Plugins.OutOfProcess:

Package Downloads
XiHan.Framework.Plugins.Conformance

曦寒框架插件协议一致性测试套件

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
5.0.0-rc.8 74 11/28/2026
5.0.0-rc.7 135 11/23/2026
5.0.0-rc.6 96 11/21/2026
5.0.0-rc.5 62 11/20/2026
5.0.0-rc.4 71 11/19/2026
5.0.0-rc.3 63 11/19/2026
5.0.0-rc.2 63 11/15/2026
5.0.0-rc.1 72 11/13/2026
5.0.0-preview.3 63 11/11/2026
5.0.0-preview.2 71 11/6/2026
5.0.0-preview.1 67 11/4/2026