mirror of
https://github.com/lobehub/lobehub.git
synced 2026-03-26 13:19:34 +07:00
* 🗃️ chore: add agent task system database schema Add 6 new tables for the Agent Task System: - tasks: core task with tree structure, heartbeat, scheduling - task_dependencies: inter-task dependency graph (blocks/relates) - task_documents: MVP workspace document pinning - task_topics: topic tracking with handoff (jsonb) and review results - task_comments: user/agent comments with author tracking (text id: cmt_) - briefs: unresolved notification system (text id: brf_) All sub-tables include userId FK for row-level user isolation. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * 🗃️ chore: add self-referential FK on tasks.parentTaskId (ON DELETE SET NULL) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * 🐛 fix: use foreignKey() for self-referential parentTaskId to avoid TS circular inference Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * 🗃️ chore: add FK on task_topics.topic_id → topics.id (ON DELETE SET NULL) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * 🐛 fix: resolve pre-existing TS type-check errors - Fix i18next defaultValue type (string | null → string) - Fix i18next options type mismatches - Fix fieldTags.webhook possibly undefined Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * 🗃️ chore: add FK on tasks.currentTopicId → topics.id (ON DELETE SET NULL) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * 🗃️ chore: add FK constraints for assignee, author, topic, and parent fields - tasks.assigneeUserId → users.id (ON DELETE SET NULL) - tasks.assigneeAgentId → agents.id (ON DELETE SET NULL) - tasks.parentTaskId → tasks.id (ON DELETE SET NULL) - tasks.currentTopicId → topics.id (ON DELETE SET NULL) - task_comments.authorUserId → users.id (ON DELETE SET NULL) - task_comments.authorAgentId → agents.id (ON DELETE SET NULL) - task_topics.topicId → topics.id (ON DELETE SET NULL) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * 🗃️ chore: change task_topics.topicId FK to ON DELETE CASCADE Topic deleted → task_topic mapping row removed (not just nulled). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * ♻️ refactor: use inline .references() for currentTopicId FK No circular inference issue — only parentTaskId (self-ref) needs foreignKey(). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * 🗃️ chore: add FK on task_comments.briefId and topicId (ON DELETE SET NULL) - task_comments.briefId → briefs.id (SET NULL) - task_comments.topicId → topics.id (SET NULL) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * ♻️ refactor: merge briefs table into task.ts to fix circular dependency brief.ts imported task.ts (briefs.taskId FK) and task.ts imported brief.ts (taskComments.briefId FK), causing circular dependency error. Merged briefs into task.ts since briefs are part of the task system. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * 🗃️ chore: add FK on tasks.createdByAgentId → agents.id (ON DELETE SET NULL) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>