Conversation
…ds (#20) ## Summary 实现模块化 Agent 运行时架构,支持可插拔的执行后端: - 定义标准化的运行时接口(BaseSubAgentRuntime) - 内置 InternalSubAgentRuntime(进程内执行)和 HTTPSubAgentRuntime(远程 RPC) - 运行时注册表机制,支持动态扩展 - 集成 dispatch_sub_agent,支持通过 runtime_type 选择后端 ## Backend Changes - **agentpal/runtimes/**: 新增运行时核心模块 - `base.py`: RuntimeConfig、ExecutionResult、BaseSubAgentRuntime 基类 - `internal.py`: 进程内运行时,复用现有 SubAgent 逻辑 - `http.py`: HTTP RPC 运行时,支持分布式部署 - `registry.py`: 运行时注册表和工厂函数 - **agentpal/services/task_event_bus.py**: 任务事件总线原型 - **agentpal/models/session.py**: 新增 TaskStatus 枚举和 SubAgentTask.meta 字段 - **agentpal/tools/builtin.py**: 重构 dispatch_sub_agent 使用新运行时架构 - **agentpal/api/v1/endpoints/tasks.py**: 新增任务管理 API 端点 - Tests: 添加单元测试和集成测试 ## Frontend Changes - **src/api/index.ts**: 新增任务相关 API 客户端方法 - **src/pages/TasksPage.tsx**: 增强任务页面功能 - **src/pages/SessionsPage.tsx**: 优化会话展示 - **src/components/TaskArtifactViewer.tsx**: 新增任务产物查看组件 - **src/hooks/useTaskArtifacts.ts**: 新增任务产物拉取钩子 ## Testing - 26 个单元测试全部通过 ✓ - 2 个集成测试验证运行时与数据库集成 ✓ - 代码可正确编译导入 ✓ Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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.
Summary
实现模块化 Agent 运行时架构,支持可插拔的执行后端。这是 Phase 6 & 7 的核心成果。
Key Features
BaseSubAgentRuntime定义了初始化、执行、清理的标准生命周期dispatch_sub_agent通过runtime_type参数选择后端Architecture
Backend Changes
runtimes/base.pyruntimes/internal.pyruntimes/http.pyruntimes/registry.pyservices/task_event_bus.pyapi/v1/endpoints/tasks.pytools/builtin.pyFrontend Changes
pages/TasksPage.tsxcomponents/TaskArtifactViewer.tsxhooks/useTaskArtifacts.tsTesting
Related Issues
Checklist
🤖 Generated with Claude Code