Skip to content

About

NCF(NeuCharFramework)底层支持库官方 Nuget 包源码

Resources

Stars

52 stars

Watchers

3 watching

Forks

Repository files navigation

NeuCharFramework

NcfPackageSources

Build Status

目录 / Table of Contents

项目介绍 / Introduction

本项目为 NCF(NeuCharFramework) 模板官方包的核心基础库源码。

当您使用 NCF 模板开发项目时,核心基础库将为您提供一系列基础能力的支撑,通常情况下您无需关心这些库的具体实现,只需要引用即可。

当您需要了解、修改或调试相关基础库时,您可以通过本项目获取源码。

NCF 文档地址:https://doc.ncf.pub/。

开发环境 / Development Environment

  • Visual Studio 2019+ 或 VS Code 最新版本
  • .NET 8.0
  • 支持的数据库:
    • SQLite
    • MySQL
    • SQL Server (2012+)
    • PostgreSQL
    • Oracle
    • DM(达梦)

快速开始 / Quick Start

  1. 克隆仓库
git clone https://github.com/NeuCharFramework/NcfPackageSources.git
  1. 打开解决方案
cd NcfPackageSources
start NcfPackageSources.sln  # Windows
open NcfPackageSources.sln   # macOS
  1. 还原包
dotnet restore
  1. 还原工作负载(可选)
dotnet workload restore
  1. 编译运行
dotnet build
dotnet run

项目结构 / Project Structure

文件夹 / Folder 说明 / Description
src/Basic 必须安装的基础官方库,以 Separc.Ncf. 开头
Required basic official libraries, prefixed with Separc.Ncf.
src/Extensions 可选的扩展包,以 Senparc.Xncf. 开头
Optional extension packages, prefixed with Senparc.Xncf.
src/Extensions/System 系统模块
System modules

Workspace Agent 构建与部署 / Build and Deployment

工作区运行时项目统一命名为 Senparc.Xncf.WorkspaceAgent(仅在 Xncf 两侧保留两个点),目录、程序集、命名空间和 Docker 入口使用同一名称。

The Workspace runtime project is named Senparc.Xncf.WorkspaceAgent, with exactly two dots around Xncf; its directory, assembly, namespace and Docker entry point use the same name.

Workspace 通过项目引用获取 Agent 的实际输出路径,并将 .dll、.deps.json 和 .runtimeconfig.json 传递至管理端及宿主的 build/publish 输出。不要根据宿主的 $(Configuration) 拼接 Agent 路径;解决方案中的依赖项目可能采用不同配置。自定义 SenparcXncfWorkspace:AgentPath 时需同步更新文件名。

Workspace resolves the Agent's actual output paths through its project reference and propagates the .dll, .deps.json and .runtimeconfig.json to Admin and host build/publish outputs. Do not construct Agent paths from the host's $(Configuration): solution dependencies may use a different configuration. Update the filename in any custom SenparcXncfWorkspace:AgentPath setting.

NuGet 打包与发布 / Packaging and Publishing

ADO 流水线 使用 Release 构建,由各项目的 GeneratePackageOnBuild 配置生成 .nupkg,随后自动发现并推送包。新增需要发布的库(包括 Abstractions 契约项目)时,必须启用 Release 自动打包;仅添加项目引用不会生成依赖项目的 NuGet 包。

The ADO pipeline builds in Release and relies on each project's GeneratePackageOnBuild setting to create .nupkg files before discovery and push. Enable Release packaging for every new published library, including abstraction contracts; a project reference alone does not generate its dependency's NuGet package.

需要发布的契约项目还必须加入 CI 使用的 src/NcfPackageSources.sln,并启用 Release 构建映射。未登记在解决方案中的依赖可能被 MSBuild 移除父级配置,回退到 Debug,从而不生成仅在 Release 时打包的 .nupkg。

Published contract projects must also belong to the CI solution, src/NcfPackageSources.sln, with Release build mappings enabled. MSBuild may remove the parent configuration from dependencies missing from the solution, causing a fallback to Debug and skipping Release-only package generation.

推送前会按 MSBuild 求值后的包 ID、版本和输出目录检查 Senparc.Ncf.Shared.Abstractions、Senparc.Xncf.FileManager.Abstractions、Senparc.Xncf.MCP.Abstractions 与 Senparc.Xncf.Workspace.Abstractions 的包文件。构建或检查失败时不执行推送。修复漏发包后重新运行流水线即可补发缺失版本,已存在版本仍通过 --skip-duplicate 跳过。

Before pushing, the pipeline checks the Senparc.Ncf.Shared.Abstractions, Senparc.Xncf.FileManager.Abstractions, Senparc.Xncf.MCP.Abstractions, and Senparc.Xncf.Workspace.Abstractions package files using their evaluated MSBuild package IDs, versions and output directories. Build or validation failures prevent pushing. Rerun the pipeline to publish missing versions after fixing packaging; existing versions are skipped with --skip-duplicate.

模块加载顺序 / Module Loading Order

使用 [XncfOrder(x)] 特性指定模块的加载顺序,为降序排列,数字越大越在前:

The [XncfOrder(x)] attribute specifies the loading order of modules in descending order, larger numbers load first:

  • 0:默认值,可以不用设置 / Default value, no need to set
  • 1 ~ 5000:需要预加载的重要模块 / Important modules that need preloading
  • 5000+:系统及基础模块 / System and basic modules
  • 58xx:AI 相关基础模块 / AI-related basic modules
  • 59xx:系统底层基础模块 / System underlying basic modules

可用的 Nuget 包 / Available NuGet Packages

基础库 / Basic Libraries

包名 / Package Name 描述 / Description 版本 / Version
Senparc.Ncf.XncfBase XNCF 模块基础库 Senparc.Ncf.XncfBase
Senparc.Ncf.Core 核心基础库 Senparc.Ncf.Core
Senparc.Ncf.DatabasePlant 数据库组装厂 Senparc.Ncf.DatabasePlant
Senparc.Ncf.Log 日志模块 Senparc.Ncf.Log
Senparc.Ncf.AreaBase Area 基础模块 Senparc.Ncf.AreaBase
Senparc.Ncf.UnitTestExtension 单元测试扩展 Senparc.Ncf.UnitTestExtension
Senparc.Ncf.Mvc.UI MVC UI 组件 Senparc.Ncf.Mvc.UI
Senparc.Ncf.Database 数据库基础库 Senparc.Ncf.Database
Senparc.Ncf.Database.MySql.Backup MySQL 数据库备份 Senparc.Ncf.Database.MySql.Backup
Senparc.Ncf.Database.MySql MySQL 数据库支持 Senparc.Ncf.Database.MySql
Senparc.Ncf.Database.Oracle Oracle 数据库支持 Senparc.Ncf.Database.Oracle
Senparc.Ncf.Database.PostgreSQL PostgreSQL 数据库支持 Senparc.Ncf.Database.PostgreSQL
Senparc.Ncf.Database.Sqlite SQLite 数据库支持 Senparc.Ncf.Database.Sqlite
Senparc.Ncf.Database.SqlServer SQL Server 数据库支持 Senparc.Ncf.Database.SqlServer
Senparc.Ncf.Database.Dm 达梦(DM)数据库支持 Senparc.Ncf.Database.Dm
Senparc.Ncf.Database.InMemory 内存数据库支持 Senparc.Ncf.Database.InMemory
Senparc.Ncf.Repository 仓储层 Senparc.Ncf.Repository
Senparc.Ncf.Service 服务层 Senparc.Ncf.Service
Senparc.Ncf.SMS 短信服务 Senparc.Ncf.SMS
Senparc.Ncf.Utility 工具类库 Senparc.Ncf.Utility
Senparc.Ncf.IsolatedRuntime 共享隔离运行时 Senparc.Ncf.IsolatedRuntime

扩展 XNCF 模块 / Extension XNCF Modules

包名 / Package Name 描述 / Description 版本 / Version
Senparc.Xncf.AgentsManager 智能体管理器 Senparc.Xncf.AgentsManager
Senparc.Xncf.AIAgentsHub AI 智能体中心 Senparc.Xncf.AIAgentsHub
Senparc.Xncf.AIKernel AI 内核 Senparc.Xncf.AIKernel
Senparc.Xncf.ChangeNamespace 命名空间修改工具 Senparc.Xncf.ChangeNamespace
Senparc.Xncf.Dapr Dapr 分布式运行时支持 Senparc.Xncf.Dapr
Senparc.Xncf.DatabaseToolkit 数据库工具包模块 Senparc.Xncf.DatabaseToolkit
Senparc.Xncf.DesktopBridge 桌面状态桥接 Senparc.Xncf.DesktopBridge
Senparc.Xncf.DynamicData 动态数据基础模块 Senparc.Xncf.DynamicData
Senparc.Xncf.FileManager 文件管理模块 Senparc.Xncf.FileManager
Senparc.Xncf.FirmwareUpdate 固件与安装包镜像更新 Senparc.Xncf.FirmwareUpdate
Senparc.Xncf.KnowledgeBase AI 知识库 Senparc.Xncf.KnowledgeBase
Senparc.Xncf.MCP MCP 端点管理 Senparc.Xncf.MCP
Senparc.Xncf.NeuCharWorkflow 服务端工作流编排 Senparc.Xncf.NeuCharWorkflow
Senparc.Xncf.PromptRange AI 提示词靶场 Senparc.Xncf.PromptRange
Senparc.Xncf.Sandbox 沙箱环境编排 Senparc.Xncf.Sandbox
Senparc.Xncf.SenMapic SenMapic 爬虫模块 Senparc.Xncf.SenMapic
Senparc.Xncf.Swagger Swagger 接口文档 Senparc.Xncf.Swagger
Senparc.Xncf.Terminal 终端命令模块 Senparc.Xncf.Terminal
Senparc.Xncf.WeixinManager 微信管理后台 Senparc.Xncf.WeixinManager
Senparc.Xncf.Workspace 工作区存储与远程编辑 Senparc.Xncf.Workspace
Senparc.Xncf.XncfBuilder XNCF 模块生成器 Senparc.Xncf.XncfBuilder
Senparc.Xncf.XncfBuilder.Template XNCF 模块项目模板 Senparc.Xncf.XncfBuilder.Template
Senparc.Xncf.AreasBase 系统区域基础模块 Senparc.Xncf.AreasBase
Senparc.Xncf.Menu 菜单管理模块 Senparc.Xncf.Menu
Senparc.Xncf.SystemCore 系统核心模块 Senparc.Xncf.SystemCore
Senparc.Xncf.SystemManager 系统管理模块 Senparc.Xncf.SystemManager
Senparc.Xncf.SystemPermission 系统权限模块 Senparc.Xncf.SystemPermission
Senparc.Xncf.Tenant 多租户管理模块 Senparc.Xncf.Tenant
Senparc.Xncf.Tenant.Interface 多租户接口模块 Senparc.Xncf.Tenant.Interface
Senparc.Xncf.XncfModuleManager XNCF 模块管理器 Senparc.Xncf.XncfModuleManager

契约包 / Abstraction Packages

契约包只暴露跨模块接口,可单独引用,不必依赖对应模块的实现程序集。

Abstraction packages expose cross-module contracts and can be referenced without the corresponding module implementation.

包名 / Package Name 描述 / Description 版本 / Version
Senparc.Ncf.Shared.Abstractions EventBus、隔离运行时与桌面桥接公共契约 Senparc.Ncf.Shared.Abstractions
Senparc.Xncf.AgentsManager.Abstractions 智能体与工作流引用校验契约 Senparc.Xncf.AgentsManager.Abstractions
Senparc.Xncf.AIKernel.Abstractions AI 内核跨模块契约 Senparc.Xncf.AIKernel.Abstractions
Senparc.Xncf.FileManager.Abstractions 文件管理跨模块契约 Senparc.Xncf.FileManager.Abstractions
Senparc.Xncf.MCP.Abstractions MCP 端点查询契约 Senparc.Xncf.MCP.Abstractions
Senparc.Xncf.NeuCharWorkflow.Abstractions 工作流对象与通知契约 Senparc.Xncf.NeuCharWorkflow.Abstractions
Senparc.Xncf.PromptRange.Abstractions 提示词靶场 Skill 与评分契约 Senparc.Xncf.PromptRange.Abstractions
Senparc.Xncf.Sandbox.Abstractions 沙箱集成契约 Senparc.Xncf.Sandbox.Abstractions
Senparc.Xncf.Workspace.Abstractions 工作区访问与 Agent 协议契约 Senparc.Xncf.Workspace.Abstractions
Senparc.Xncf.XncfBuilder.Abstractions 模块生成器跨模块契约 Senparc.Xncf.XncfBuilder.Abstractions

贡献指南 / Contributing

我们欢迎开发者为 NCF 贡献代码。如果您想要贡献,请:

We welcome developers to contribute to NCF. If you want to contribute, please:

  1. Fork 本仓库 / Fork this repository
  2. 创建您的特性分支 / Create your feature branch
  3. 提交您的改动 / Commit your changes
  4. 推送到分支 / Push to the branch
  5. 创建 Pull Request / Create a Pull Request

许可证 / License

Apache License Version 2.0

详细请参考 / For details, please refer to: LICENSE


About

NCF(NeuCharFramework)底层支持库官方 Nuget 包源码

Resources

Stars

52 stars

Watchers

3 watching

Forks

Releases

Packages

Contributors

Languages