feat: 引擎重构 Phase 1+2 — 轻量化内核 + 插件系统#1
Open
ricky-theseus wants to merge 3 commits into
Open
Conversation
创建 src/engine/ 目录,包含 9 个核心模块: - types.ts — 基础共享类型 (Message/ToolCall/AgentEvent 等) - tool.ts — Tool 接口 + ToolRegistry - permission.ts — PermissionSystem (Rule + 通配符匹配 + 多层合并) - provider.ts — ModelAdapter 接口 + ProviderRegistry - agent.ts — AgentInfo 定义 + 7 个内置 Agent + AgentService - session.ts — Session 管理 + SessionManager - plugin.ts — Plugin 引擎 (API/Hooks/Load/Trigger) - skill.ts — Skills 系统 (被动加载 + SkillService) - index.ts — 统一导出 src/types.ts 改为从 engine/ re-export,保持向后兼容
新增功能 vs 旧 agent-loop.ts: - Skill 列表自动注入 system prompt - Plugin Hook 调用点 (chat:before/after, tool:before/after, system:prompt, agent:done) - 基于 AgentInfo 的步骤限制 (agent.steps) - 改进的消息截断算法 - 工具执行结果触发 tool:after/tool:error hook - 完整的 system prompt 构建管道 (agent.system + skills + plugin custom)
创建 5 个内置插件,全部基于 Plugin API: - src/plugins/tools/ — 内置工具插件 (read/edit/write/glob/grep/bash) - src/plugins/providers/ — LLM Provider 插件 (deepseek/openai) - src/plugins/orchestrator.ts — 子 Agent 编排插件 (task tool) - src/plugins/mcp.ts — MCP 协议插件 - src/plugins/memory.ts — 跨会话记忆插件 引擎修复: - PluginAPI 新增 registerService - ToolRegistry 兼容旧 API (unregister/unregisterByPrefix 别名)
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.
概述
将 DaisyCode 重构为轻量化内核 + 可无限扩展插件的 Agent 架构。
新增文件
引擎内核 (src/engine/) — 10 个文件,零新依赖
内置插件 (src/plugins/) — 5 个
架构
\
src/engine/ ← 内核 (Agent Loop + Plugin引擎 + 权限 + Agent + 会话 + Skills)
src/plugins/ ← 扩展 (工具/Provider/MCP/Orchestrator/Memory 全插件化)
src/types.ts ← 向后兼容 (re-export from engine)
\\
验证