From f11a005538030753534b08a1f4200c46dcf1a704 Mon Sep 17 00:00:00 2001 From: Jason Woltje Date: Wed, 4 Mar 2026 18:49:25 -0600 Subject: [PATCH] feat(ms22-p2): add AgentTemplate and UserAgent prisma schema --- apps/api/prisma/schema.prisma | 36 +++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/apps/api/prisma/schema.prisma b/apps/api/prisma/schema.prisma index 97312c1..33ed985 100644 --- a/apps/api/prisma/schema.prisma +++ b/apps/api/prisma/schema.prisma @@ -1703,3 +1703,39 @@ model UserAgentConfig { createdAt DateTime @default(now()) updatedAt DateTime @updatedAt } + +model AgentTemplate { + id String @id @default(cuid()) + name String @unique // "jarvis", "builder", "medic" + displayName String // "Jarvis", "Builder", "Medic" + role String // "orchestrator" | "coding" | "monitoring" + personality String // SOUL.md content (markdown) + primaryModel String // "opus", "codex", "haiku" + fallbackModels Json @default("[]") // ["sonnet", "haiku"] + toolPermissions Json @default("[]") // ["exec", "read", "write", ...] + discordChannel String? // "jarvis", "builder", "medic-alerts" + isActive Boolean @default(true) + isDefault Boolean @default(false) // Include in new user provisioning + createdAt DateTime @default(now()) + updatedAt DateTime @updatedAt +} + +model UserAgent { + id String @id @default(cuid()) + userId String + templateId String? // null = custom agent + name String // "jarvis", "builder", "medic" or custom + displayName String + role String + personality String // User can customize + primaryModel String? + fallbackModels Json @default("[]") + toolPermissions Json @default("[]") + discordChannel String? + isActive Boolean @default(true) + createdAt DateTime @default(now()) + updatedAt DateTime @updatedAt + + @@unique([userId, name]) + @@index([userId]) +}