Draft
[WIP] Create architecture framework and development guide for GroundPA-Toolkit#1
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
docs/v2-reference/architecture reference documents (bilingual, with design intent and Cherry Studio code paths)src/with required interfaces and initial implementationsDEVELOPMENT.md,DEPRECATION_POLICY.md) and updateCONTRIBUTING.mdminimallyOriginal prompt
为 GroundPA-Toolkit 创建基于 Cherry Studio v2 的完整架构框架和开发指南
背景
基于对 Cherry Studio v2 重构的深度研究,为 GroundPA-Toolkit 项目创建一套完整的架构参考、代码框架和开发指南。
GroundPA-Toolkit 是 .NET 智能体项目,采用"自研核心 + MCP 扩展"架构。从 Cherry Studio v2 的设计中提取最佳实践,包括:
需要创建的主要内容
1. 架构参考文档(docs/v2-reference/)
CHERRY_STUDIO_V2_LESSONS.md- v2 核心设计决策提取ARCHITECTURE.md- GroundPA v2 整体架构设计DATA_LAYER_DESIGN.md- 数据层分工(自研核心 + MCP)AGENT_RUNTIME_DESIGN.md- Agent 运行时和知识库原生化MIGRATION_STRATEGY.md- v1 → v2 迁移框架LIFECYCLE_DESIGN.md- 服务生命周期管理BEST_PRACTICES.md- 从 Cherry Studio 学到的最佳实践2. 代码结构框架
完整的项目目录结构和关键文件创建:
3. 关键接口和基类
IAgent.cs/IAgentRuntime.cs- Agent 接口定义IKnowledgeBase.cs/IKnowledgeAccessor.cs- 知识库接口IDataStore.cs- 统一数据存储接口IService.cs/IServiceRegistry.cs- 生命周期管理IMigrator.cs/MigrationEngine.cs- 数据迁移框架IMCPProvider.cs- MCP 扩展点4. 初始实现
ServiceRegistry.cs- 服务注册和依赖管理AgentRuntime.cs- Agent 运行时核心DataStoreFactory.cs- 数据存储工厂MigrationEngine.cs- 迁移引擎框架MCPRuntimeAdapter.cs- MCP 适配器5. 开发规范
DEVELOPMENT.md- 开发约定(参考 CLAUDE.md)CONTRIBUTING.md- 贡献指南DEPRECATION_POLICY.md- 弃用政策具体要求
Cherry Studio 关键参考
src/main/data/migration/v2/src/main/data/migration/v2/migrators/README-AssistantMigrator.mdv2-refactor-temp/docs/knowledge/docs/references/lifecycle/packages/ui/CLAUDE.mdThe following is the prior conversation context from the user's chat exploration (may be truncated):
User: 只看这两个v2 refactor
Agent / Knowledge Base
Assistant: 我已经帮你筛到 “v2 refactor / Agent / Knowledge Base” 这个方向了,但这一步工具返回的是可渲染的 issue 列表引用,不是直接文本结果。
你接下来最省事的方式
如果你愿意,我可以继续做下面任意一种:
把这两组里对应的 issue 逐条整理成“人话版”
把这些 issue 直接归纳成开发路线图
继续往下拉 PR
如果你要,我下一条就直接帮你做 “这两个方向的 issue 清单 + 每个 issue 的一句话解释”。
User: 把这两组里对应的 issue 逐条整理,最后要一份“人话版”的报告,给我开发路线图,看这些 issue 最终是怎么落到代码里的,括号里写上源码位置
Assistant: 下面这份我按你要的方式整理:只看 v2 refactor 里跟 Agent / Knowledge Base 相关的 issue 主题,然后把它们落到代码位置,给你一份能直接用来跟进开发的“人话版报告”。
先说一句实话:
我这次拿到的是 issue 主题集合 + 代码落点,不是每个 issue 的完整正文,所以我会按仓库里已经能确认的实现线索来帮你归类,不乱猜。
Cherry Studio v2:Agent / Knowledge Base 方向“人话版”报告
你可以先记住一句话
这条线不是在“加一个 Agent 功能”,而是在把 Agent 和知识库从老系统里拆出来,变成一套能迁移、能运行、能扩展的新底座。
换成人话就是:
一、这两组 issue 其实在做什么
我把它们拆成 4 条主线:
1)Agent 不再是一个“附属功能”,而是独立业务域
你可以理解为:
以前的 Agent 更像聊天页面里的一种模式;
v2 想把它变成单独的数据域 + 单独的运行域 + 单独的迁移域。
代码落点
src/main/data/migration/v2/migrators/AgentsMigrator.tssrc/main/data/migration/v2/migrators/remapAgentPrefixIds.tssrc/main/data/migration/v2/migrators/mappings/AssistantMappings.tssrc/renderer/services/db/AgentMessageDataSource.tssrc/renderer/services/db/DbService.ts人话解释
这说明团队在做三件事:
也就是说,Agent 不是 UI 上多了个按钮,而是从底层开始独立了。
2)Knowledge Base 不是外挂,而是 V2 里要“原生生长”的对象
你可以理解为:
以前知识库像一个“额外挂载件”;
现在知识库要变成Agent 运行时天然能用的数据资产。
代码落点
src/main/data/migration/v2/migrators/KnowledgeMigrator.tssrc/main/data/migration/v2/migrators/__tests__/KnowledgeMigrator.test.tsv2-refactor-temp/docs/knowledge/knowledge-schema.mdsrc/renderer/store/knowledge.ts人话解释
这里最关键的不是“把知识库搬过去”,而是:
这说明他们对知识库不是“兼容一下就完事”,而是把它当成新架构里必须严肃处理的核心资产。
3)迁移不是简单搬表,而是“数据语义重建”
你可以理解为:
不是把数据复制过去就行,
而是要重新判断:这个数据在 V2 里应该长什么样。
代码落点
src/main/data/migration/v2/migrators/ChatMigrator.tssrc/main/data/migration/v2/migrators/README-AssistantMigrator.mdsrc/main/data/migration/v2/migrators/mappings/AgentsDbMappings.tssrc/main/data/migration/v2/migrators/mappings/__tests__/AgentsDbMappings.test.ts...This pull request was created from Copilot chat.