@@ -102,6 +102,19 @@ enum AgentStatus {
|
||||
TERMINATED
|
||||
}
|
||||
|
||||
enum AgentTaskStatus {
|
||||
PENDING
|
||||
RUNNING
|
||||
COMPLETED
|
||||
FAILED
|
||||
}
|
||||
|
||||
enum AgentTaskPriority {
|
||||
LOW
|
||||
MEDIUM
|
||||
HIGH
|
||||
}
|
||||
|
||||
enum EntryStatus {
|
||||
DRAFT
|
||||
PUBLISHED
|
||||
@@ -145,6 +158,7 @@ model User {
|
||||
agentSessions AgentSession[]
|
||||
userLayouts UserLayout[]
|
||||
userPreference UserPreference?
|
||||
createdAgentTasks AgentTask[] @relation("AgentTaskCreator")
|
||||
|
||||
@@map("users")
|
||||
}
|
||||
@@ -188,6 +202,7 @@ model Workspace {
|
||||
knowledgeEntries KnowledgeEntry[]
|
||||
knowledgeTags KnowledgeTag[]
|
||||
cronSchedules CronSchedule[]
|
||||
agentTasks AgentTask[]
|
||||
|
||||
@@index([ownerId])
|
||||
@@map("workspaces")
|
||||
@@ -573,6 +588,45 @@ model AgentSession {
|
||||
@@map("agent_sessions")
|
||||
}
|
||||
|
||||
model AgentTask {
|
||||
id String @id @default(uuid()) @db.Uuid
|
||||
workspaceId String @map("workspace_id") @db.Uuid
|
||||
|
||||
// Core fields
|
||||
title String
|
||||
description String? @db.Text
|
||||
|
||||
// Status and priority
|
||||
status AgentTaskStatus @default(PENDING)
|
||||
priority AgentTaskPriority @default(MEDIUM)
|
||||
|
||||
// Agent configuration
|
||||
agentType String @map("agent_type")
|
||||
agentConfig Json @default("{}") @map("agent_config")
|
||||
|
||||
// Results
|
||||
result Json?
|
||||
error String? @db.Text
|
||||
|
||||
// Audit
|
||||
createdById String @map("created_by_id") @db.Uuid
|
||||
createdAt DateTime @default(now()) @map("created_at") @db.Timestamptz
|
||||
updatedAt DateTime @updatedAt @map("updated_at") @db.Timestamptz
|
||||
startedAt DateTime? @map("started_at") @db.Timestamptz
|
||||
completedAt DateTime? @map("completed_at") @db.Timestamptz
|
||||
|
||||
// Relations
|
||||
workspace Workspace @relation(fields: [workspaceId], references: [id], onDelete: Cascade)
|
||||
createdBy User @relation("AgentTaskCreator", fields: [createdById], references: [id], onDelete: Cascade)
|
||||
|
||||
@@unique([id, workspaceId])
|
||||
@@index([workspaceId])
|
||||
@@index([workspaceId, status])
|
||||
@@index([workspaceId, priority])
|
||||
@@index([createdById])
|
||||
@@map("agent_tasks")
|
||||
}
|
||||
|
||||
model WidgetDefinition {
|
||||
id String @id @default(uuid()) @db.Uuid
|
||||
|
||||
|
||||
Reference in New Issue
Block a user