feat: add Goal/Task data models, service layer, and API routes (Phase 1)

Main Agent 数字员工工厂基础设施:
- 新增 Goal 和 Task SQLAlchemy 数据模型
- Agent 模型新增 agent_type / input_schema / output_schema
- Execution 模型新增 goal_id 关联
- 新增 Goal/Task CRUD 服务层(含依赖检查、任务树、进度计算)
- 新增 /api/v1/goals (9端点) + /api/v1/tasks (8端点)
- 数据库迁移 013_add_goals_tasks

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
renjianbo
2026-05-08 19:50:16 +08:00
parent 10ee7ee625
commit 02d7cf8f62
11 changed files with 1017 additions and 2 deletions

View File

@@ -16,11 +16,14 @@ class Agent(Base):
name = Column(String(100), nullable=False, comment="智能体名称")
description = Column(Text, comment="描述")
workflow_config = Column(JSON, nullable=False, comment="工作流配置")
agent_type = Column(String(20), default="specialist", comment="Agent类型: main/specialist")
budget_config = Column(
JSON,
nullable=True,
comment="执行预算max_steps/max_llm_invocations/max_tool_calls可选覆盖全局默认",
)
input_schema = Column(JSON, nullable=True, comment="输入数据类型约束JSON Schema")
output_schema = Column(JSON, nullable=True, comment="输出数据类型约束JSON Schema")
version = Column(Integer, default=1, comment="版本号")
status = Column(String(20), default="draft", comment="状态: draft/published/running/stopped")
user_id = Column(CHAR(36), ForeignKey("users.id"), comment="创建者ID")