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

@@ -33,6 +33,7 @@ class Execution(Base):
)
depth = Column(Integer, default=0, nullable=False, comment="执行深度根为0")
pause_state = Column(JSON, nullable=True, comment="挂起快照(审批节点 HITL恢复时消费")
goal_id = Column(CHAR(36), ForeignKey("goals.id"), nullable=True, comment="关联目标ID")
created_at = Column(DateTime, default=func.now(), comment="创建时间")
# 关系